aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2026-07-24 12:13:54 +0200
committerdec05eba <dec05eba@protonmail.com>2026-07-24 12:13:54 +0200
commit0ec2cb0ad576d44e5eeb698f654bdb36f7bde94a (patch)
treed9149e7f1bb2e99bff0ac6de69d53af3a32bf70a
parent7baf5e25f9ea9adc3a685f6512a516b25e61dfeb (diff)
pipewire capture: add fallback for formats without modifier (fix for old amd vega gpus)
-rw-r--r--TODO4
-rw-r--r--include/dbus.h2
-rw-r--r--src/main.cpp1
-rw-r--r--src/pipewire_video.c23
4 files changed, 18 insertions, 12 deletions
diff --git a/TODO b/TODO
index f9ecd92..207f5a3 100644
--- a/TODO
+++ b/TODO
@@ -428,4 +428,6 @@ Region capture works incorrectly on gnome with hidpi, especially with 150% scali
Take color pipeline into consideration in kms hdr capture. Right now kde only uses that on intel.
-Maybe use 3D LUT for hdr tonemapping instead of per fragment math. \ No newline at end of file
+Maybe use 3D LUT for hdr tonemapping instead of per fragment math.
+
+Update cuda to the use the same device as the opengl context (egl device).
diff --git a/include/dbus.h b/include/dbus.h
index 229f7ea..0b779bf 100644
--- a/include/dbus.h
+++ b/include/dbus.h
@@ -34,7 +34,7 @@ typedef struct {
bool gsr_dbus_init(gsr_dbus *self, const char *screencast_restore_token);
void gsr_dbus_deinit(gsr_dbus *self);
-/* The follow functions should be called in order to setup ScreenCast properly */
+/* The following functions should be called in order to setup ScreenCast properly */
/* These functions that return an int return the response status code */
int gsr_dbus_screencast_create_session(gsr_dbus *self, char **session_handle);
/*
diff --git a/src/main.cpp b/src/main.cpp
index ec1941a..cccc4a5 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -3754,7 +3754,6 @@ int main(int argc, char **argv) {
// Linux nvidia driver 580.105.08 added the environment variable CUDA_DISABLE_PERF_BOOST to disable the p2 power level issue,
// where running cuda (which includes nvenc) causes the gpu to be forcefully set to p2 power level which on many nvidia gpus
// decreases gpu performance in games. On my GTX 1080 it decreased game performance by 10% for absolutely no reason.
- // TODO: This only seems to allow the gpu to go to lower power level states, but not higher than p2.
setenv("CUDA_DISABLE_PERF_BOOST", "1", true);
// Stop nvidia driver from buffering frames
setenv("__GL_MaxFramesAllowed", "1", true);
diff --git a/src/pipewire_video.c b/src/pipewire_video.c
index 360c8b5..547b417 100644
--- a/src/pipewire_video.c
+++ b/src/pipewire_video.c
@@ -493,13 +493,18 @@ static const enum spa_video_format video_formats[GSR_PIPEWIRE_VIDEO_MAX_VIDEO_FO
static bool gsr_pipewire_video_build_format_params(gsr_pipewire_video *self, struct spa_pod_builder *pod_builder, struct spa_pod **params, uint32_t *num_params) {
*num_params = 0;
- if(!check_pw_version(&self->server_version, 0, 3, 33))
- return false;
+ if(check_pw_version(&self->server_version, 0, 3, 33)) {
+ for(size_t i = 0; i < GSR_PIPEWIRE_VIDEO_NUM_VIDEO_FORMATS; i++) {
+ if(self->supported_video_formats[i].modifiers_size == 0)
+ continue;
+ params[*num_params] = build_format(pod_builder, &self->video_info, self->supported_video_formats[i].format, self->modifiers + self->supported_video_formats[i].modifiers_index, self->supported_video_formats[i].modifiers_size);
+ ++(*num_params);
+ }
+ }
+ /* Fallback formats without modifiers, needed for negotiation when the compositor doesn't support dma-buf modifier negotiation */
for(size_t i = 0; i < GSR_PIPEWIRE_VIDEO_NUM_VIDEO_FORMATS; i++) {
- if(self->supported_video_formats[i].modifiers_size == 0)
- continue;
- params[*num_params] = build_format(pod_builder, &self->video_info, self->supported_video_formats[i].format, self->modifiers + self->supported_video_formats[i].modifiers_index, self->supported_video_formats[i].modifiers_size);
+ params[*num_params] = build_format(pod_builder, &self->video_info, self->supported_video_formats[i].format, NULL, 0);
++(*num_params);
}
@@ -512,9 +517,9 @@ static void renegotiate_format(void *data, uint64_t expirations) {
pw_thread_loop_lock(self->thread_loop);
- struct spa_pod *params[GSR_PIPEWIRE_VIDEO_NUM_VIDEO_FORMATS];
+ struct spa_pod *params[GSR_PIPEWIRE_VIDEO_NUM_VIDEO_FORMATS * 2];
uint32_t num_video_formats = 0;
- uint8_t params_buffer[4096];
+ uint8_t params_buffer[8192];
struct spa_pod_builder pod_builder = SPA_POD_BUILDER_INIT(params_buffer, sizeof(params_buffer));
if (!gsr_pipewire_video_build_format_params(self, &pod_builder, params, &num_video_formats)) {
fprintf(stderr, "gsr error: renegotiate_format: failed to build formats\n");
@@ -600,9 +605,9 @@ static void gsr_pipewire_video_remove_modifier(gsr_pipewire_video *self, uint64_
}
static bool gsr_pipewire_video_setup_stream(gsr_pipewire_video *self) {
- struct spa_pod *params[GSR_PIPEWIRE_VIDEO_NUM_VIDEO_FORMATS];
+ struct spa_pod *params[GSR_PIPEWIRE_VIDEO_NUM_VIDEO_FORMATS * 2];
uint32_t num_video_formats = 0;
- uint8_t params_buffer[4096];
+ uint8_t params_buffer[8192];
struct spa_pod_builder pod_builder = SPA_POD_BUILDER_INIT(params_buffer, sizeof(params_buffer));
self->thread_loop = pw_thread_loop_new("gsr screen capture", NULL);