Skip to content

Instantly share code, notes, and snippets.

@Francesco149
Last active March 22, 2023 10:15
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Francesco149/80ac74999d42bc51adf33f55ee5a0f4b to your computer and use it in GitHub Desktop.
Save Francesco149/80ac74999d42bc51adf33f55ee5a0f4b to your computer and use it in GitHub Desktop.
buttery smooth vte/libvte with the 120fps patches

buttery smooth vte/libvte with the 120fps patches

vte/libvte is extremely choppy because it's hard-capped to 40fps. all terminals based on it suffer from this, so I decided to make these quick n dirty patches for various vte versions that bump the cap up to 120fps

here's a 120fps video demostration https://streamable.com/j8i0n

also a 60fps clip on twitter if your browser can't handle 120 https://twitter.com/roriicon/status/1113186464332951559

pick the one that matches your version more closely. you will find all three patches attached below

0.56.0 would be vte3/vte2.91, also works on latest git version

0.36.5 would be vte290/vte2.90

0.28.2 would be vte

you can apply the desired patch by entering the vte source directory and running patch -p1 < /path/to/patch.diff

note that if you check out the source from git you need to first switch to the correct version tag, for example git checkout 0.56.0

ideally you would modify your distro's package or make a custom package with the patches, but you can also compile manually with

(vte3)

./configure --disable-static --disable-introspection --disable-vala
make -j$(nproc --all)
sudo make install

(vte290)

./configure --disable-static --disable-introspection --disable-vala \
  --with-gtk=3.0 --disable-gnome-pty-helper
make -j$(nproc --all)
sudo make install

(vte)

./configure PYTHON=python2 --disable-static --with-gtk=2.0
make -j$(nproc --all)
sudo make install

keep in mind that manually compiling is not a clean install and you would need to clean up files manually to uninstall it

diff --git a/src/vte-private.h b/src/vte-private.h
index 86d4f8e1..1bc69e04 100644
--- a/src/vte-private.h
+++ b/src/vte-private.h
@@ -80,8 +80,8 @@ G_BEGIN_DECLS
#define VTE_INVALID_BYTE '?'
#define VTE_DISPLAY_TIMEOUT 10
#define VTE_UPDATE_TIMEOUT 15
-#define VTE_UPDATE_REPEAT_TIMEOUT 30
-#define VTE_MAX_PROCESS_TIME 100
+#define VTE_UPDATE_REPEAT_TIMEOUT (1000/120)
+#define VTE_MAX_PROCESS_TIME (1000/120)
#define VTE_CELL_BBOX_SLACK 1
#define VTE_UTF8_BPC (6) /* Maximum number of bytes used per UTF-8 character */
diff --git a/src/vte-private.h b/src/vte-private.h
index ca2a7a6f..9c7c6c05 100644
--- a/src/vte-private.h
+++ b/src/vte-private.h
@@ -103,8 +103,8 @@ G_BEGIN_DECLS
#define VTE_INVALID_BYTE '?'
#define VTE_DISPLAY_TIMEOUT 10
#define VTE_UPDATE_TIMEOUT 15
-#define VTE_UPDATE_REPEAT_TIMEOUT 30
-#define VTE_MAX_PROCESS_TIME 100
+#define VTE_UPDATE_REPEAT_TIMEOUT (1000/120)
+#define VTE_MAX_PROCESS_TIME (1000/120)
#define VTE_CELL_BBOX_SLACK 1
#define VTE_UTF8_BPC (6) /* Maximum number of bytes used per UTF-8 character */
diff --git a/src/vte.c b/src/vte.c
index 508dc00e..92e664bc 100644
--- a/src/vte.c
+++ b/src/vte.c
@@ -14954,19 +14954,12 @@ update_repeat_timeout (gpointer data)
* reinstall a new one because we need to delay by the amount of time
* it took to repaint the screen: bug 730732.
*/
- if (active_terminals == NULL) {
- _vte_debug_print(VTE_DEBUG_TIMEOUT,
- "Stoping update timeout\n");
- update_timeout_tag = 0;
- again = FALSE;
- } else {
update_timeout_tag =
g_timeout_add_full (G_PRIORITY_DEFAULT_IDLE,
VTE_UPDATE_REPEAT_TIMEOUT,
update_repeat_timeout, NULL,
NULL);
again = TRUE;
- }
in_update_timeout = FALSE;
diff --git a/src/vte.cc b/src/vte.cc
index af01264e..794f222e 100644
--- a/src/vte.cc
+++ b/src/vte.cc
@@ -10476,19 +10476,12 @@ update_repeat_timeout (gpointer data)
* reinstall a new one because we need to delay by the amount of time
* it took to repaint the screen: bug 730732.
*/
- if (g_active_terminals == nullptr) {
- _vte_debug_print(VTE_DEBUG_TIMEOUT,
- "Stopping update timeout\n");
- update_timeout_tag = 0;
- again = false;
- } else {
update_timeout_tag =
g_timeout_add_full (G_PRIORITY_DEFAULT_IDLE,
VTE_UPDATE_REPEAT_TIMEOUT,
update_repeat_timeout, NULL,
NULL);
again = true;
- }
in_update_timeout = FALSE;
diff --git a/src/vtedefines.hh b/src/vtedefines.hh
index 71896a76..02f6b299 100644
--- a/src/vtedefines.hh
+++ b/src/vtedefines.hh
@@ -84,8 +84,8 @@
#define VTE_MAX_INPUT_READ 0x1000
#define VTE_DISPLAY_TIMEOUT 10
#define VTE_UPDATE_TIMEOUT 15
-#define VTE_UPDATE_REPEAT_TIMEOUT 30
-#define VTE_MAX_PROCESS_TIME 100
+#define VTE_UPDATE_REPEAT_TIMEOUT (1000/120)
+#define VTE_MAX_PROCESS_TIME (1000/120)
#define VTE_CELL_BBOX_SLACK 1
#define VTE_DEFAULT_UTF8_AMBIGUOUS_WIDTH 1
@clort81
Copy link

clort81 commented Mar 22, 2023

very cool, didn't know about this. can you get them to include this?
i also need libvte to NOT extend the font height +1 to make space for vertically offset bolded fonts
This is breaking all box-drawing.

@Francesco149
Copy link
Author

Francesco149 commented Mar 22, 2023

very cool, didn't know about this. can you get them to include this? i also need libvte to NOT extend the font height +1 to make space for vertically offset bolded fonts This is breaking all box-drawing.

I remember trying to pr this but they said to wait for gpu rendering https://gitlab.gnome.org/GNOME/vte/-/issues/103

@clort81

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment