From 3117f30143c5354cdd9823835fa1daf70a6c7fb7 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Tue, 6 Jan 2026 19:35:15 +0100 Subject: [PATCH] Fix cursor flicker on nvidia when capturing monitor Thanks to David Kleuker for bug testing --- src/capture/v4l2.c | 3 +++ src/color_conversion.c | 1 - src/egl.c | 3 +++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/capture/v4l2.c b/src/capture/v4l2.c index 18c726e..b39adde 100644 --- a/src/capture/v4l2.c +++ b/src/capture/v4l2.c @@ -553,6 +553,9 @@ static int gsr_capture_v4l2_capture(gsr_capture *cap, gsr_capture_metadata *capt const vec2i target_pos = gsr_capture_get_target_position(output_size, capture_metadata); self->params.egl->glFlush(); + // TODO: Use the minimal barrier required + self->params.egl->glMemoryBarrier(GL_ALL_BARRIER_BITS); + // TODO: Remove this? if(self->params.egl->gpu_info.vendor == GSR_GPU_VENDOR_NVIDIA) self->params.egl->glFinish(); diff --git a/src/color_conversion.c b/src/color_conversion.c index 22a1378..8a75e20 100644 --- a/src/color_conversion.c +++ b/src/color_conversion.c @@ -781,7 +781,6 @@ static void gsr_color_conversion_draw_graphics(gsr_color_conversion *self, unsig self->params.egl->glBindBuffer(GL_ARRAY_BUFFER, self->vertex_buffer_object_id); self->params.egl->glBufferSubData(GL_ARRAY_BUFFER, 0, 24 * sizeof(float), vertices); - // TODO: switch(source_color) { case GSR_SOURCE_COLOR_RGB: case GSR_SOURCE_COLOR_BGR: { diff --git a/src/egl.c b/src/egl.c index ce97178..f428b80 100644 --- a/src/egl.c +++ b/src/egl.c @@ -523,4 +523,7 @@ void gsr_egl_swap_buffers(gsr_egl *self) { self->glFlush(); // TODO: Use the minimal barrier required self->glMemoryBarrier(GL_ALL_BARRIER_BITS); // GL_SHADER_IMAGE_ACCESS_BARRIER_BIT + // TODO: This is needed on nvidia because the cursor can flicker otherwise. Find a better solution + if(self->gpu_info.vendor == GSR_GPU_VENDOR_NVIDIA) + self->glFinish(); }