From aef223d844239e2ea66109c20bdd72c0a7d8faee Mon Sep 17 00:00:00 2001 From: dec05eba Date: Fri, 20 Sep 2024 02:20:42 +0200 Subject: Remove damage tracking for now, better frame timing (deal with time error accumulation) --- src/capture/kms.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/capture') diff --git a/src/capture/kms.c b/src/capture/kms.c index 030d609..fcf2058 100644 --- a/src/capture/kms.c +++ b/src/capture/kms.c @@ -232,7 +232,7 @@ static void gsr_capture_kms_on_event(gsr_capture *cap, gsr_egl *egl) { gsr_cursor_on_event(&self->x11_cursor, xev); } -// TODO: This is disabled for now because we want to be able to record at a framerate highe than the monitor framerate +// TODO: This is disabled for now because we want to be able to record at a framerate higher than the monitor framerate // static void gsr_capture_kms_tick(gsr_capture *cap) { // gsr_capture_kms *self = cap->priv; @@ -571,9 +571,10 @@ static int gsr_capture_kms_capture(gsr_capture *cap, AVFrame *frame, gsr_color_c capture_pos = (vec2i){drm_fd->x, drm_fd->y}; // TODO: Hack!! cursor flickers without this when using vaapi copy on wayland. - // There is probably some sync issue between opengl and vaapi. + // There is probably some sync issue between opengl and vaapi. It flickers more when capture fps is lower. // Remove this when that has been figured out. Same for the below glFlush && glFinish - for(int i = 0; i < 3; ++i) { + const int hack_iterations = max_int(1, roundf(1000.0 / (double)self->params.fps)); + for(int i = 0; i < hack_iterations; ++i) { self->params.egl->glFlush(); self->params.egl->glFinish(); } @@ -607,7 +608,7 @@ static int gsr_capture_kms_capture(gsr_capture *cap, AVFrame *frame, gsr_color_c texture_rotation, self->external_texture_fallback); } - for(int i = 0; i < 3; ++i) { + for(int i = 0; i < hack_iterations; ++i) { self->params.egl->glFlush(); self->params.egl->glFinish(); } @@ -624,7 +625,7 @@ static int gsr_capture_kms_capture(gsr_capture *cap, AVFrame *frame, gsr_color_c } } - for(int i = 0; i < 3; ++i) { + for(int i = 0; i < hack_iterations; ++i) { self->params.egl->glFlush(); self->params.egl->glFinish(); } -- cgit v1.2.3