diff options
author | dec05eba <dec05eba@protonmail.com> | 2024-09-20 02:20:42 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2024-09-20 02:20:42 +0200 |
commit | aef223d844239e2ea66109c20bdd72c0a7d8faee (patch) | |
tree | 1fb54021831ede4d6a501e42615abfbccef39348 /src/capture/kms.c | |
parent | 6e73e40bb16f3b34f39364314b67f4f41e46b9a8 (diff) |
Remove damage tracking for now, better frame timing (deal with time error accumulation)
Diffstat (limited to 'src/capture/kms.c')
-rw-r--r-- | src/capture/kms.c | 11 |
1 files changed, 6 insertions, 5 deletions
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(); } |