diff --git a/video/out/opengl/context.c b/video/out/opengl/context.c index 716f8a14fb..36696a1c91 100644 --- a/video/out/opengl/context.c +++ b/video/out/opengl/context.c @@ -241,6 +241,10 @@ bool ra_gl_ctx_submit_frame(struct ra_swapchain *sw, const struct vo_frame *fram struct priv *p = sw->priv; GL *gl = p->gl; + // Dumb hack for drm_egl and vo_gpu_next. + if (vo_is_gpu_next(sw->ctx->vo)) + return true; + if (p->opts->use_glfinish) gl->Finish(); diff --git a/video/out/opengl/context_drm_egl.c b/video/out/opengl/context_drm_egl.c index fc50e53712..6456604858 100644 --- a/video/out/opengl/context_drm_egl.c +++ b/video/out/opengl/context_drm_egl.c @@ -388,20 +388,6 @@ static void wait_fence(struct ra_ctx *ctx) } } -static bool drm_egl_start_frame(struct ra_swapchain *sw, struct ra_fbo *out_fbo) -{ - struct ra_ctx *ctx = sw->ctx; - struct priv *p = ctx->priv; - struct vo_drm_state *drm = ctx->vo->drm; - - if (!drm->atomic_context->request) { - drm->atomic_context->request = drmModeAtomicAlloc(); - p->drm_params.atomic_request_ptr = &drm->atomic_context->request; - } - - return ra_gl_ctx_start_frame(sw, out_fbo); -} - static bool drm_egl_submit_frame(struct ra_swapchain *sw, const struct vo_frame *frame) { struct ra_ctx *ctx = sw->ctx; @@ -419,6 +405,11 @@ static void drm_egl_swap_buffers(struct ra_swapchain *sw) struct vo_drm_state *drm = ctx->vo->drm; const bool drain = drm->paused || drm->still; // True when we need to drain the swapchain + if (!drm->atomic_context->request) { + drm->atomic_context->request = drmModeAtomicAlloc(); + p->drm_params.atomic_request_ptr = &drm->atomic_context->request; + } + if (!drm->active) return; @@ -452,7 +443,6 @@ static void drm_egl_swap_buffers(struct ra_swapchain *sw) } static const struct ra_swapchain_fns drm_egl_swapchain = { - .start_frame = drm_egl_start_frame, .submit_frame = drm_egl_submit_frame, .swap_buffers = drm_egl_swap_buffers, }; diff --git a/video/out/vo.c b/video/out/vo.c index cf3e50a4d0..f9e4e10726 100644 --- a/video/out/vo.c +++ b/video/out/vo.c @@ -860,6 +860,12 @@ bool vo_is_ready_for_frame(struct vo *vo, int64_t next_pts) return r; } +// Needed by egl_drm +bool vo_is_gpu_next(struct vo *vo) +{ + return vo && vo->driver && vo->driver == &video_out_gpu_next; +} + // Check if the VO reports that the mpv window is visible. bool vo_is_visible(struct vo *vo) { diff --git a/video/out/vo.h b/video/out/vo.h index 15aa3e78b6..bd1dcb07ef 100644 --- a/video/out/vo.h +++ b/video/out/vo.h @@ -532,6 +532,7 @@ int vo_reconfig2(struct vo *vo, struct mp_image *img); int vo_control(struct vo *vo, int request, void *data); void vo_control_async(struct vo *vo, int request, void *data); +bool vo_is_gpu_next(struct vo *vo); bool vo_is_ready_for_frame(struct vo *vo, int64_t next_pts); bool vo_is_visible(struct vo *vo); void vo_queue_frame(struct vo *vo, struct vo_frame *frame); diff --git a/video/out/vo_gpu_next.c b/video/out/vo_gpu_next.c index 5aad0accc0..3692a54c49 100644 --- a/video/out/vo_gpu_next.c +++ b/video/out/vo_gpu_next.c @@ -1170,6 +1170,7 @@ done: if (!valid) // clear with purple to indicate error pl_tex_clear(gpu, swframe.fbo, (float[4]){ 0.5, 0.0, 1.0, 1.0 }); + sw->fns->submit_frame(sw, frame); // for drm_egl pl_gpu_flush(gpu); p->frame_pending = true; return VO_TRUE;