aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2024-08-04 00:21:44 +0200
committerdec05eba <dec05eba@protonmail.com>2024-08-04 00:21:44 +0200
commitfbbeadfeb07a40060532834ca5dc440e61ec0b38 (patch)
treed7b9e509419b096ee5346b515a9359145c4f8f56 /src/main.cpp
parent9560c47cfd941522fe1ecbc6597c2ff4c730e62e (diff)
Enable prime-run on wayland
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp25
1 files changed, 20 insertions, 5 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 7877b00..1067ccd 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1757,6 +1757,16 @@ static void info_command() {
if(!wayland)
wayland = is_xwayland(dpy);
+ if(!wayland) {
+ // Disable prime-run and similar options as it doesn't work, the monitor to capture has to be run on the same device.
+ // This is fine on wayland since nvidia uses drm interface there and the monitor query checks the monitors connected
+ // to the drm device.
+ unsetenv("__NV_PRIME_RENDER_OFFLOAD");
+ unsetenv("__NV_PRIME_RENDER_OFFLOAD_PROVIDER");
+ unsetenv("__GLX_VENDOR_LIBRARY_NAME");
+ unsetenv("__VK_LAYER_NV_optimus");
+ }
+
gsr_egl egl;
if(!gsr_egl_load(&egl, dpy, wayland, false)) {
fprintf(stderr, "gsr error: failed to load opengl\n");
@@ -2102,11 +2112,6 @@ int main(int argc, char **argv) {
unsetenv("__GL_SYNC_TO_VBLANK");
// Same as above, but for amd/intel
unsetenv("vblank_mode");
- // Disable prime-run and similar options as it doesn't work, the monitor to capture has to be run on the same device
- unsetenv("__NV_PRIME_RENDER_OFFLOAD");
- unsetenv("__NV_PRIME_RENDER_OFFLOAD_PROVIDER");
- unsetenv("__GLX_VENDOR_LIBRARY_NAME");
- unsetenv("__VK_LAYER_NV_optimus");
if(argc <= 1)
usage_full();
@@ -2433,6 +2438,16 @@ int main(int argc, char **argv) {
if(!wayland)
wayland = is_xwayland(dpy);
+ if(!wayland) {
+ // Disable prime-run and similar options as it doesn't work, the monitor to capture has to be run on the same device.
+ // This is fine on wayland since nvidia uses drm interface there and the monitor query checks the monitors connected
+ // to the drm device.
+ unsetenv("__NV_PRIME_RENDER_OFFLOAD");
+ unsetenv("__NV_PRIME_RENDER_OFFLOAD_PROVIDER");
+ unsetenv("__GLX_VENDOR_LIBRARY_NAME");
+ unsetenv("__VK_LAYER_NV_optimus");
+ }
+
if(video_codec_is_hdr(video_codec) && !wayland) {
fprintf(stderr, "Error: hdr video codec option %s is not available on X11\n", video_codec_to_use);
_exit(1);