Revert recent time framing and performance changes as it affects slower devices badly

This commit is contained in:
dec05eba
2024-09-21 15:43:19 +02:00
parent ff6d468713
commit eddb07ac40
6 changed files with 54 additions and 82 deletions

View File

@@ -570,15 +570,6 @@ static int gsr_capture_kms_capture(gsr_capture *cap, AVFrame *frame, gsr_color_c
if(!capture_is_combined_plane)
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. It flickers more when capture fps is lower.
// Remove this when that has been figured out. Same for the below glFlush && glFinish
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();
}
/* Fast opengl free path */
if(self->monitor_rotation == GSR_MONITOR_ROT_0 && video_codec_context_is_vaapi(self->video_codec_context) && self->params.egl->gpu_info.vendor == GSR_GPU_VENDOR_AMD) {
int fds[4];
@@ -599,20 +590,12 @@ static int gsr_capture_kms_capture(gsr_capture *cap, AVFrame *frame, gsr_color_c
self->params.egl->eglDestroyImage(self->params.egl->egl_display, image);
}
self->params.egl->glFlush();
self->params.egl->glFinish();
gsr_color_conversion_draw(color_conversion, self->external_texture_fallback ? self->external_input_texture_id : self->input_texture_id,
target_pos, self->capture_size,
capture_pos, self->capture_size,
texture_rotation, self->external_texture_fallback);
}
for(int i = 0; i < hack_iterations; ++i) {
self->params.egl->glFlush();
self->params.egl->glFinish();
}
if(self->params.record_cursor) {
gsr_kms_response_item *cursor_drm_fd = find_cursor_drm_if_on_monitor(self, drm_fd->connector_id, capture_is_combined_plane);
// The cursor is handled by x11 on x11 instead of using the cursor drm plane because on prime systems with a dedicated nvidia gpu
@@ -625,10 +608,8 @@ static int gsr_capture_kms_capture(gsr_capture *cap, AVFrame *frame, gsr_color_c
}
}
for(int i = 0; i < hack_iterations; ++i) {
self->params.egl->glFlush();
self->params.egl->glFinish();
}
self->params.egl->glFlush();
self->params.egl->glFinish();
gsr_capture_kms_cleanup_kms_fds(self);

View File

@@ -333,9 +333,6 @@ static int gsr_capture_portal_capture(gsr_capture *cap, AVFrame *frame, gsr_colo
} else {
return 0;
}
self->params.egl->glFlush();
self->params.egl->glFinish();
const vec2i target_pos = { max_int(0, frame->width / 2 - self->capture_size.x / 2), max_int(0, frame->height / 2 - self->capture_size.y / 2) };

View File

@@ -258,9 +258,6 @@ static int gsr_capture_xcomposite_capture(gsr_capture *cap, AVFrame *frame, gsr_
const vec2i target_pos = { max_int(0, frame->width / 2 - self->texture_size.x / 2), max_int(0, frame->height / 2 - self->texture_size.y / 2) };
self->params.egl->glFlush();
self->params.egl->glFinish();
/* Fast opengl free path */
if(video_codec_context_is_vaapi(self->video_codec_context) && self->params.egl->gpu_info.vendor == GSR_GPU_VENDOR_AMD) {
vaapi_copy_egl_image_to_video_surface(self->params.egl, self->window_texture.image, (vec2i){0, 0}, self->texture_size, target_pos, self->texture_size, self->video_codec_context, frame);