aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2023-11-30 18:44:45 +0100
committerdec05eba <dec05eba@protonmail.com>2023-11-30 18:44:45 +0100
commit8e66363352eed29b70cab5817810881719d7cd76 (patch)
treeb91e7ccadb863efc4259a72b9541b0621de0b2c4
parent72d75d0f4a43fd460d0df2364890b5fdc1234514 (diff)
flatpak: run gsr kms server on host if the file has root capacity
-rw-r--r--TODO2
-rw-r--r--kms/client/kms_client.c13
2 files changed, 10 insertions, 5 deletions
diff --git a/TODO b/TODO
index e78d62e..e96ef3f 100644
--- a/TODO
+++ b/TODO
@@ -107,4 +107,4 @@ Support I915_FORMAT_MOD_Y_TILED_CCS (and other power saving modifiers, see https
Test if p2 state can be worked around by using pure nvenc api and overwriting cuInit/cuCtxCreate* to not do anything. Cuda might be loaded when using nvenc but it might not be used, with certain record options? (such as h264 p5).
nvenc uses cuda when using b frames and rgb->yuv conversion, so convert the image ourselves instead.-
-Mesa doesn't support global headers (AV_CODEC_FLAG_GLOBAL_HEADER) with h264... which also breaks mkv since mkv requires global header. \ No newline at end of file
+Mesa doesn't support global headers (AV_CODEC_FLAG_GLOBAL_HEADER) with h264... which also breaks mkv since mkv requires global header. Right now gpu screen recorder will forcefully set video codec to hevc when h264 is requested for mkv files.
diff --git a/kms/client/kms_client.c b/kms/client/kms_client.c
index 0ea7cab..bcd6870 100644
--- a/kms/client/kms_client.c
+++ b/kms/client/kms_client.c
@@ -244,12 +244,17 @@ int gsr_kms_client_init(gsr_kms_client *self, const char *card_path) {
fprintf(stderr, "gsr error: gsr_kms_client_init: fork failed, error: %s\n", strerror(errno));
goto err;
} else if(pid == 0) { /* child */
- if(has_perm) {
+ if(inside_flatpak) {
+ if(has_perm) {
+ const char *args[] = { "flatpak-spawn", "--host", "/var/lib/flatpak/app/com.dec05eba.gpu_screen_recorder/current/active/files/bin/gsr-kms-server", self->initial_socket_path, card_path, NULL };
+ execvp(args[0], (char *const*)args);
+ } else {
+ const char *args[] = { "flatpak-spawn", "--host", "pkexec", "flatpak", "run", "--command=gsr-kms-server", "com.dec05eba.gpu_screen_recorder", self->initial_socket_path, card_path, NULL };
+ execvp(args[0], (char *const*)args);
+ }
+ } else if(has_perm) {
const char *args[] = { server_filepath, self->initial_socket_path, card_path, NULL };
execvp(args[0], (char *const*)args);
- } else if(inside_flatpak) {
- const char *args[] = { "flatpak-spawn", "--host", "pkexec", "flatpak", "run", "--command=gsr-kms-server", "com.dec05eba.gpu_screen_recorder", self->initial_socket_path, card_path, NULL };
- execvp(args[0], (char *const*)args);
} else {
const char *args[] = { "pkexec", server_filepath, self->initial_socket_path, card_path, NULL };
execvp(args[0], (char *const*)args);