aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2024-03-21 20:17:45 +0100
committerdec05eba <dec05eba@protonmail.com>2024-03-21 20:17:45 +0100
commit2ed4a6ec4a0c7caaad03516f1f06605fa107d5b4 (patch)
tree940092dd26144b6b18ce5609c35de48d281e4bea
parent67a54dbc97c7e7272e77cb270ad3ae6ecfb78c89 (diff)
Force set __GL_THREADED_OPTIMIZATIONS to 0, which fixes window capture/wayland capture for nvidia for users that have set it to 1
-rw-r--r--src/main.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp
index f2dbee9..0977747 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -3393,6 +3393,17 @@ static void activate(GtkApplication *app, gpointer) {
int main(int argc, char **argv) {
setlocale(LC_ALL, "C");
+
+ // Stop nvidia driver from buffering frames
+ setenv("__GL_MaxFramesAllowed", "1", true);
+ // If this is set to 1 then cuGraphicsGLRegisterImage will fail for egl context with error: invalid OpenGL or DirectX context,
+ // so we overwrite it
+ setenv("__GL_THREADED_OPTIMIZATIONS", "0", true);
+ // Some people set this to nvidia (for nvdec) or vdpau (for nvidia vdpau), which breaks gpu screen recorder since
+ // nvidia doesn't support vaapi and nvidia-vaapi-driver doesn't support encoding yet.
+ // Let vaapi find the match vaapi driver instead of forcing a specific one.
+ unsetenv("LIBVA_DRIVER_NAME");
+
GtkApplication *app = gtk_application_new("com.dec05eba.gpu_screen_recorder", G_APPLICATION_NON_UNIQUE);
g_signal_connect(app, "activate", G_CALLBACK(activate), NULL);
int status = g_application_run(G_APPLICATION(app), argc, argv);