Fix for opensuse: set unix domain socket mod 777

Fixes screen capture on opensuse amd/intel or nvidia wayland
This commit is contained in:
dec05eba
2023-12-31 15:44:37 +01:00
parent 84f9a04272
commit 54b03eabbd
3 changed files with 18 additions and 8 deletions

View File

@@ -1,7 +1,7 @@
![](https://dec05eba.com/images/gpu_screen_recorder_logo_small.png) ![](https://dec05eba.com/images/gpu_screen_recorder_logo_small.png)
# GPU Screen Recorder # GPU Screen Recorder
This is a screen recorder that has minimal impact on system performance by recording a window using the GPU only, This is a screen recorder that has minimal impact on system performance by recording your monitor using the GPU only,
similar to shadowplay on windows. This is the fastest screen recording tool for Linux. similar to shadowplay on windows. This is the fastest screen recording tool for Linux.
This screen recorder can be used for recording your desktop offline, for live streaming and for nvidia shadowplay-like instant replay, This screen recorder can be used for recording your desktop offline, for live streaming and for nvidia shadowplay-like instant replay,
@@ -37,8 +37,6 @@ NVIDIA driver has a "feature" (read: bug) where it will downclock memory transfe
To enable overclocking for optimal performance use the `-oc` option when running GPU Screen Recorder. You also need to have "Coolbits" NVIDIA X setting set to "12" to enable overclocking. You can automatically add this option if you run `sudo nvidia-xconfig --cool-bits=12` and then reboot your computer.\ To enable overclocking for optimal performance use the `-oc` option when running GPU Screen Recorder. You also need to have "Coolbits" NVIDIA X setting set to "12" to enable overclocking. You can automatically add this option if you run `sudo nvidia-xconfig --cool-bits=12` and then reboot your computer.\
Note that this only works when Xorg server is running as root, and using this option will only give you a performance boost if the game you are recording is bottlenecked by your GPU.\ Note that this only works when Xorg server is running as root, and using this option will only give you a performance boost if the game you are recording is bottlenecked by your GPU.\
Note! use at your own risk! Note! use at your own risk!
## Note about optimal performance on AMD/Intel
Performance is the same when recording a single window or the monitor, however in some cases, such as when gpu usage is 100%, the video capture rate might be slower than the games fps when recording a single window instead of a monitor. Recording the monitor instead is recommended in such cases.
# Installation # Installation
If you are running an Arch Linux based distro, then you can find gpu screen recorder on aur under the name gpu-screen-recorder-git (`yay -S gpu-screen-recorder-git`).\ If you are running an Arch Linux based distro, then you can find gpu screen recorder on aur under the name gpu-screen-recorder-git (`yay -S gpu-screen-recorder-git`).\

View File

@@ -10,6 +10,7 @@
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/un.h> #include <sys/un.h>
#include <sys/wait.h> #include <sys/wait.h>
#include <sys/stat.h>
#include <sys/capability.h> #include <sys/capability.h>
#define GSR_SOCKET_PAIR_LOCAL 0 #define GSR_SOCKET_PAIR_LOCAL 0
@@ -229,7 +230,12 @@ int gsr_kms_client_init(gsr_kms_client *self, const char *card_path) {
local_addr.sun_family = AF_UNIX; local_addr.sun_family = AF_UNIX;
strncpy_safe(local_addr.sun_path, self->initial_socket_path, sizeof(local_addr.sun_path)); strncpy_safe(local_addr.sun_path, self->initial_socket_path, sizeof(local_addr.sun_path));
if(bind(self->initial_socket_fd, (struct sockaddr*)&local_addr, sizeof(local_addr.sun_family) + strlen(local_addr.sun_path)) == -1) {
const mode_t prev_mask = umask(0000);
int bind_res = bind(self->initial_socket_fd, (struct sockaddr*)&local_addr, sizeof(local_addr.sun_family) + strlen(local_addr.sun_path));
umask(prev_mask);
if(bind_res == -1) {
fprintf(stderr, "gsr error: gsr_kms_client_init: failed to bind socket, error: %s\n", strerror(errno)); fprintf(stderr, "gsr error: gsr_kms_client_init: failed to bind socket, error: %s\n", strerror(errno));
goto err; goto err;
} }

View File

@@ -1970,6 +1970,10 @@ int main(int argc, char **argv) {
} else { } else {
const AVCodec *h265_codec = find_h265_encoder(gpu_inf.vendor, card_path); const AVCodec *h265_codec = find_h265_encoder(gpu_inf.vendor, card_path);
if(h265_codec && fps > 60) {
fprintf(stderr, "Warning: recording at higher fps than 60 with h265 might result in recording at a very low fps. If this happens, switch to h264\n");
}
// h265 generally allows recording at a higher resolution than h264 on nvidia cards. On a gtx 1080 4k is the max resolution for h264 but for h265 it's 8k. // h265 generally allows recording at a higher resolution than h264 on nvidia cards. On a gtx 1080 4k is the max resolution for h264 but for h265 it's 8k.
// Another important info is that when recording at a higher fps than.. 60? h265 has very bad performance. For example when recording at 144 fps the fps drops to 1 // Another important info is that when recording at a higher fps than.. 60? h265 has very bad performance. For example when recording at 144 fps the fps drops to 1
// while with h264 the fps doesn't drop. // while with h264 the fps doesn't drop.
@@ -2050,10 +2054,12 @@ int main(int argc, char **argv) {
} }
fprintf(stderr, "Error: your gpu does not support '%s' video codec. If you are sure that your gpu does support '%s' video encoding and you are using an AMD/Intel GPU,\n" fprintf(stderr, "Error: your gpu does not support '%s' video codec. If you are sure that your gpu does support '%s' video encoding and you are using an AMD/Intel GPU,\n"
" then it's possible that your distro has disabled hardware accelerated video encoding for '%s' video codec.\n" " then make sure you have installed the GPU specific vaapi packages.\n"
" This may be the case on corporate distros such as Manjaro.\n" " It's also possible that your distro has disabled hardware accelerated video encoding for '%s' video codec.\n"
" You can test this by running 'vainfo | grep VAEntrypointEncSlice' to see if it matches any H264/HEVC/AV1 profile. vainfo is part of libva-utils.\n" " This may be the case on corporate distros such as Manjaro, Fedora or OpenSUSE.\n"
" On such distros, you need to manually install mesa from source to enable H264/HEVC/AV1 hardware acceleration, or use a more user friendly distro.\n", video_codec_name, video_codec_name, video_codec_name); " You can test this by running 'vainfo | grep VAEntrypointEncSlice' to see if it matches any H264/HEVC profile. Also make sure 'ffmpeg -h encoder=h264_vaapi' doesn't return any error.\n"
" vainfo is part of libva-utils.\n"
" On such distros, you need to manually install mesa from source to enable H264/HEVC hardware acceleration, or use a more user friendly distro. Alternatively record with AV1 if supported by your GPU.\n", video_codec_name, video_codec_name, video_codec_name);
_exit(2); _exit(2);
} }