diff options
author | dec05eba <dec05eba@protonmail.com> | 2024-09-21 22:10:36 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2024-09-21 22:10:36 +0200 |
commit | adddca41d899ce808faf82f9b486016b36dc1d5b (patch) | |
tree | d15e632f109c911d10562834793f2f6161b1931d /src/capture/portal.c | |
parent | 1ee2587a8f800c2f49c49258aec92d3e73980e9e (diff) |
Fallback for vaapi copy to opengl copy
Diffstat (limited to 'src/capture/portal.c')
-rw-r--r-- | src/capture/portal.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/capture/portal.c b/src/capture/portal.c index db5ba4e..da172fb 100644 --- a/src/capture/portal.c +++ b/src/capture/portal.c @@ -26,6 +26,7 @@ typedef struct { int num_dmabuf_data; AVCodecContext *video_codec_context; + bool fast_path_failed; } gsr_capture_portal; static void gsr_capture_portal_cleanup_plane_fds(gsr_capture_portal *self) { @@ -342,7 +343,7 @@ static int gsr_capture_portal_capture(gsr_capture *cap, AVFrame *frame, gsr_colo // TODO: Handle region crop /* Fast opengl free path */ - if(video_codec_context_is_vaapi(self->video_codec_context) && self->params.egl->gpu_info.vendor == GSR_GPU_VENDOR_AMD) { + if(!self->fast_path_failed && video_codec_context_is_vaapi(self->video_codec_context) && self->params.egl->gpu_info.vendor == GSR_GPU_VENDOR_AMD) { int fds[4]; uint32_t offsets[4]; uint32_t pitches[4]; @@ -353,8 +354,15 @@ static int gsr_capture_portal_capture(gsr_capture *cap, AVFrame *frame, gsr_colo pitches[i] = self->dmabuf_data[i].stride; modifiers[i] = pipewire_modifiers; } - vaapi_copy_drm_planes_to_video_surface(self->video_codec_context, frame, (vec2i){region.x, region.y}, self->capture_size, target_pos, self->capture_size, pipewire_fourcc, self->capture_size, fds, offsets, pitches, modifiers, self->num_dmabuf_data); + if(!vaapi_copy_drm_planes_to_video_surface(self->video_codec_context, frame, (vec2i){region.x, region.y}, self->capture_size, target_pos, self->capture_size, pipewire_fourcc, self->capture_size, fds, offsets, pitches, modifiers, self->num_dmabuf_data)) { + fprintf(stderr, "gsr error: gsr_capture_portal_capture: vaapi_copy_drm_planes_to_video_surface failed, falling back to opengl copy. Please report this as an issue at https://github.com/dec05eba/gpu-screen-recorder-issues\n"); + self->fast_path_failed = true; + } } else { + self->fast_path_failed = true; + } + + if(self->fast_path_failed) { gsr_color_conversion_draw(color_conversion, using_external_image ? self->texture_map.external_texture_id : self->texture_map.texture_id, target_pos, self->capture_size, (vec2i){region.x, region.y}, self->capture_size, |