aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2025-06-07 00:41:45 +0200
committerdec05eba <dec05eba@protonmail.com>2025-06-07 00:41:45 +0200
commit3b09cb7fd35b080ec42ce23a2cab01b12959f9f9 (patch)
treed774383319d165c47eed627436476948f38598b5
parent1ab2c066b4de87facf89103602387c370211b190 (diff)
Disable cap_sys_nice which causes amd gpu crash for some people. Do glFlush instead of swapBuffers, which allows it to run at high fps anyways. Downside is that some games on kde plasma can start to stutter. Kde plasma issue?
-rw-r--r--README.md2
-rw-r--r--TODO2
-rwxr-xr-xextra/meson_post_install.sh5
-rw-r--r--meson_options.txt2
-rw-r--r--src/egl.c27
5 files changed, 3 insertions, 35 deletions
diff --git a/README.md b/README.md
index c399f82..f788b89 100644
--- a/README.md
+++ b/README.md
@@ -199,5 +199,3 @@ This is a [steam issue](https://github.com/ValveSoftware/steam-for-linux/issues/
If you are using the flatpak version of GPU Screen Recorder then try installing GPU Screen Recorder from a non-flatpak source instead (such as from aur or from source). Flatpak has a limitation that prevents GPU Screen Recorder from running faster when playing very heavy games.
## How do I apply audio effects, such as noise suppression?
You have to use external software for that, such as Easy Effects or NoiseTorch.
-## My AMD GPU freezes when using GPU Screen Recorder
-This is an AMD driver bug that happens to some people: [https://gitlab.freedesktop.org/mesa/mesa/-/issues/13224](https://gitlab.freedesktop.org/mesa/mesa/-/issues/13224). If you are able to provide system information and output of `sudo dmesg` in that bug report then please do so. It will continue to be an issue until AMD fixes it. As a temporary workaround you can run `sudo setcap -r /usr/bin/gpu-screen-recorder` (but this gets overwritten when you update GPU Screen Recorder).
diff --git a/TODO b/TODO
index 49b1d71..7263273 100644
--- a/TODO
+++ b/TODO
@@ -300,3 +300,5 @@ Either support webcam support with raw yuyv, mapping the buffer directly to open
Allow medium, high, very_high and ultra quality for -bm cbr. If that is used then it will automatically estimate the best bitrate for that quality based on resolution and fps.
Maybe do this in the ui instead (or both?), to show estimated file size.
+
+Maybe remove shader compute code. It doesn't seem necessary anymore now that glSwapBuffer/glFinish isn't used. dbus server isn't needed anymore either, the code can be moved back to the gpu screen recorder process.
diff --git a/extra/meson_post_install.sh b/extra/meson_post_install.sh
index 8a01b18..143965c 100755
--- a/extra/meson_post_install.sh
+++ b/extra/meson_post_install.sh
@@ -3,8 +3,3 @@
# Needed to remove password prompt when recording a monitor (without desktop portal option) on amd/intel or nvidia wayland
/usr/sbin/setcap cap_sys_admin+ep ${MESON_INSTALL_DESTDIR_PREFIX}/bin/gsr-kms-server \
|| echo "\n!!! Please re-run install as root\n"
-
-# This is needed (for EGL_CONTEXT_PRIORITY_HIGH_IMG) to allow gpu screen recorder to run faster than the heaviest application on AMD.
-# For example when trying to record a game at 60 fps and the game drops to 45 fps in some place that would also make gpu screen recorder
-# drop to 45 fps unless this setcap is used. Recording would also drop to below 60 fps in some games even though they run above 60 fps.
-/usr/sbin/setcap cap_sys_nice+ep ${MESON_INSTALL_DESTDIR_PREFIX}/bin/gpu-screen-recorder
diff --git a/meson_options.txt b/meson_options.txt
index 4adf715..b1023c2 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,5 +1,5 @@
option('systemd', type : 'boolean', value : true, description : 'Install systemd service file')
-option('capabilities', type : 'boolean', value : true, description : 'Set binary admin capability on gsr-kms-server binary to remove password prompt when recording monitor (without desktop portal option) on amd/intel or nvidia wayland. Also sets nice capability on gpu-screen-recorder to allow it to run as a high priority graphics process for better performance')
+option('capabilities', type : 'boolean', value : true, description : 'Set binary admin capability on gsr-kms-server binary to remove password prompt when recording monitor (without desktop portal option) on amd/intel or nvidia wayland')
option('nvidia_suspend_fix', type : 'boolean', value : true, description : 'Install nvidia modprobe config file to tell nvidia driver to preserve video memory on suspend. This is a workaround for an nvidia driver bug that breaks cuda (and gpu screen recorder) on suspend')
option('portal', type : 'boolean', value : true, description : 'Build with support for xdg desktop portal ScreenCast capture (wayland only) (-w portal option). Requires pipewire')
option('app_audio', type : 'boolean', value : true, description : 'Build with support for recording a single audio source (-a app: option). Requires pipewire')
diff --git a/src/egl.c b/src/egl.c
index 2c7f7be..8d37986 100644
--- a/src/egl.c
+++ b/src/egl.c
@@ -9,7 +9,6 @@
#include <dlfcn.h>
#include <assert.h>
#include <unistd.h>
-#include <sys/capability.h>
// TODO: rename gsr_egl to something else since this includes both egl and glx and in the future maybe vulkan too
@@ -29,29 +28,6 @@
#define GLX_DEPTH_SIZE 12
#define GLX_RGBA_TYPE 0x8014
-#define GLX_CONTEXT_PRIORITY_LEVEL_EXT 0x3100
-#define GLX_CONTEXT_PRIORITY_HIGH_EXT 0x3101
-#define GLX_CONTEXT_PRIORITY_MEDIUM_EXT 0x3102
-#define GLX_CONTEXT_PRIORITY_LOW_EXT 0x3103
-
-static void reset_cap_nice(void) {
- cap_t caps = cap_get_proc();
- if(!caps)
- return;
-
- cap_flag_value_t cap_sys_nice_value = CAP_CLEAR;
- cap_get_flag(caps, CAP_SYS_NICE, CAP_EFFECTIVE, &cap_sys_nice_value);
- if(cap_sys_nice_value == CAP_CLEAR) {
- fprintf(stderr, "gsr warning: cap_sys_nice capability is missing on the gpu-screen-recorder binary, performance might be affected. If you are using the flatpak version of gpu-screen-recorder then the only fix is to use a non-flatpak version of gpu-screen-recorder. Make sure you install gpu-screen-recorder, don't run it from the build directory\n");
- }
-
- const cap_value_t cap_to_remove = CAP_SYS_NICE;
- cap_set_flag(caps, CAP_EFFECTIVE, 1, &cap_to_remove, CAP_CLEAR);
- cap_set_flag(caps, CAP_PERMITTED, 1, &cap_to_remove, CAP_CLEAR);
- cap_set_proc(caps);
- cap_free(caps);
-}
-
// TODO: Create egl context without surface (in other words, x11/wayland agnostic, doesn't require x11/wayland dependency)
static bool gsr_egl_create_window(gsr_egl *self) {
EGLConfig ecfg;
@@ -66,7 +42,6 @@ static bool gsr_egl_create_window(gsr_egl *self) {
const int32_t ctxattr[] = {
EGL_CONTEXT_CLIENT_VERSION, 2,
- EGL_CONTEXT_PRIORITY_LEVEL_IMG, EGL_CONTEXT_PRIORITY_HIGH_IMG, /* requires cap_sys_nice, ignored otherwise */
EGL_NONE, EGL_NONE
};
@@ -106,11 +81,9 @@ static bool gsr_egl_create_window(gsr_egl *self) {
goto fail;
}
- reset_cap_nice();
return true;
fail:
- reset_cap_nice();
gsr_egl_unload(self);
return false;
}