From e2d1aa22034fd46c2c0eba047a9fdf3bb1ebacaf Mon Sep 17 00:00:00 2001 From: dec05eba Date: Thu, 18 Jul 2024 21:37:06 +0200 Subject: Disable desktop portal capture option on x11 since it doesn't seem to be hardware accelerated --- src/dbus.c | 4 ++-- src/main.cpp | 12 +++++++++++- 2 files changed, 13 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/dbus.c b/src/dbus.c index b1c81e0..2172996 100644 --- a/src/dbus.c +++ b/src/dbus.c @@ -590,7 +590,7 @@ bool gsr_dbus_screencast_create_session(gsr_dbus *self, char **session_handle) { DBusMessage *response_msg = NULL; if(!gsr_dbus_call_screencast_method(self, "CreateSession", NULL, NULL, args, 2, NULL, &response_msg)) { - fprintf(stderr, "gsr error: gsr_dbus_screencast_create_session: failed to setup ScreenCast session. Make sure you have a desktop portal running with support for the ScreenCast interface (usually only available on Wayland) and that the desktop portal matches the Wayland compositor you are running.\n"); + fprintf(stderr, "gsr error: gsr_dbus_screencast_create_session: failed to setup ScreenCast session. Make sure you have a desktop portal running with support for the ScreenCast interface and that the desktop portal matches the Wayland compositor you are running.\n"); return false; } @@ -605,7 +605,7 @@ bool gsr_dbus_screencast_create_session(gsr_dbus *self, char **session_handle) { } if(!gsr_dbus_response_status_ok(&resp_args)) { - fprintf(stderr, "gsr error: gsr_dbus_screencast_create_session: failed to setup ScreenCast session. Make sure you have a desktop portal running with support for the ScreenCast interface (usually only available on Wayland) and that the desktop portal matches the Wayland compositor you are running.\n"); + fprintf(stderr, "gsr error: gsr_dbus_screencast_create_session: failed to setup ScreenCast session. Make sure you have a desktop portal running with support for the ScreenCast interface and that the desktop portal matches the Wayland compositor you are running.\n"); dbus_message_unref(response_msg); return false; } diff --git a/src/main.cpp b/src/main.cpp index 74fdaed..5cee51c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1014,7 +1014,7 @@ static void usage_full() { fprintf(stderr, "\n"); fprintf(stderr, "OPTIONS:\n"); fprintf(stderr, " -w Window id to record, a display (monitor name), \"screen\", \"screen-direct-force\", \"focused\" or \"portal\".\n"); - fprintf(stderr, " If this is \"portal\" then xdg desktop screencast portal with pipewire will be used. This is in general only available on Wayland.\n"); + fprintf(stderr, " If this is \"portal\" then xdg desktop screencast portal with pipewire will be used. Portal option is only available on Wayland.\n"); fprintf(stderr, " If you select to save the session (token) in the desktop portal capture popup then the session will be saved for the next time you use \"portal\",\n"); fprintf(stderr, " but the session will be ignored unless you run GPU Screen Recorder with the '-restore-portal-session yes' option.\n"); fprintf(stderr, " If this is \"screen\" or \"screen-direct-force\" then all monitors are recorded on Nvidia X11. On AMD/Intel or wayland \"screen\" will record the first monitor found.\n"); @@ -1667,6 +1667,10 @@ static void list_supported_capture_options(gsr_egl *egl, bool wayland) { } #ifdef GSR_PORTAL + // Desktop portal capture on x11 doesn't seem to be hardware accelerated + if(!wayland) + return; + gsr_dbus dbus; if(!gsr_dbus_init(&dbus, NULL)) return; @@ -1759,6 +1763,12 @@ static gsr_capture* create_capture_impl(const char *window_str, const char *scre follow_focused = true; } else if(strcmp(window_str, "portal") == 0) { #ifdef GSR_PORTAL + // Desktop portal capture on x11 doesn't seem to be hardware accelerated + if(!wayland) { + fprintf(stderr, "Error: desktop portal capture is not supported on X11\n"); + _exit(1); + } + if(video_codec_is_hdr(video_codec)) { fprintf(stderr, "Warning: portal capture option doesn't support hdr yet (pipewire doesn't support hdr)\n"); } -- cgit v1.2.3