aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2024-08-15 12:08:16 +0200
committerdec05eba <dec05eba@protonmail.com>2024-08-15 12:08:16 +0200
commitc1debaa838795c1d628ad9295f2c1b8498ea4f4a (patch)
tree5a11aaae441d553a516c26aa22dbc8a42ba8f227 /src
parent85d59ea2c8c8e64e55247b967d1469ad92e63e6b (diff)
Disable prime-run + portal for now
Diffstat (limited to 'src')
-rw-r--r--src/main.cpp27
1 files changed, 19 insertions, 8 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 8c09c7b..19a885f 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1654,6 +1654,18 @@ static bool is_xwayland(Display *display) {
return xwayland_found;
}
+static bool is_using_prime_run() {
+ const char *prime_render_offload = getenv("__NV_PRIME_RENDER_OFFLOAD");
+ return prime_render_offload && strcmp(prime_render_offload, "1") == 0;
+}
+
+static void disable_prime_run() {
+ unsetenv("__NV_PRIME_RENDER_OFFLOAD");
+ unsetenv("__NV_PRIME_RENDER_OFFLOAD_PROVIDER");
+ unsetenv("__GLX_VENDOR_LIBRARY_NAME");
+ unsetenv("__VK_LAYER_NV_optimus");
+}
+
static void list_system_info(bool wayland) {
printf("display_server %s\n", wayland ? "wayland" : "x11");
}
@@ -1767,10 +1779,7 @@ static void info_command() {
// 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");
+ disable_prime_run();
}
gsr_egl egl;
@@ -2459,10 +2468,12 @@ int main(int argc, char **argv) {
// 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");
+ disable_prime_run();
+ }
+
+ if(strcmp(window_str, "portal") == 0 && is_using_prime_run()) {
+ fprintf(stderr, "Warning: use of prime-run with -w portal option is currently not supported. Disabling prime-run\n");
+ disable_prime_run();
}
if(video_codec_is_hdr(video_codec) && !wayland) {