diff --git a/video/out/opengl/context_drm_egl.c b/video/out/opengl/context_drm_egl.c index da3bfea64c..fc78f13f0e 100644 --- a/video/out/opengl/context_drm_egl.c +++ b/video/out/opengl/context_drm_egl.c @@ -70,9 +70,6 @@ struct priv { struct egl egl; struct gbm gbm; - GLsync *vsync_fences; - unsigned int num_vsync_fences; - uint32_t gbm_format; uint64_t *gbm_modifiers; unsigned int num_gbm_modifiers; @@ -366,32 +363,9 @@ static void swapchain_step(struct ra_ctx *ctx) dequeue_bo(ctx); } -static void new_fence(struct ra_ctx *ctx) +static void drm_egl_swap_buffers(struct ra_ctx *ctx) { struct priv *p = ctx->priv; - - if (p->gl.FenceSync) { - GLsync fence = p->gl.FenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0); - if (fence) - MP_TARRAY_APPEND(p, p->vsync_fences, p->num_vsync_fences, fence); - } -} - -static void wait_fence(struct ra_ctx *ctx) -{ - struct priv *p = ctx->priv; - - while (p->num_vsync_fences && (p->num_vsync_fences >= p->gbm.num_bos)) { - p->gl.ClientWaitSync(p->vsync_fences[0], GL_SYNC_FLUSH_COMMANDS_BIT, 1e9); - p->gl.DeleteSync(p->vsync_fences[0]); - MP_TARRAY_REMOVE_AT(p->vsync_fences, p->num_vsync_fences, 0); - } -} - -static void drm_egl_swap_buffers(struct ra_swapchain *sw) -{ - struct ra_ctx *ctx = sw->ctx; - struct priv *p = ctx->priv; struct vo_drm_state *drm = ctx->vo->drm; if (!drm->atomic_context->request) { @@ -402,8 +376,6 @@ static void drm_egl_swap_buffers(struct ra_swapchain *sw) if (!drm->active) return; - wait_fence(ctx); - eglSwapBuffers(p->egl.display, p->egl.surface); struct gbm_bo *new_bo = gbm_surface_lock_front_buffer(p->gbm.surface); @@ -412,7 +384,6 @@ static void drm_egl_swap_buffers(struct ra_swapchain *sw) return; } enqueue_bo(ctx, new_bo); - new_fence(ctx); while (drm->redraw || p->gbm.num_bos > ctx->vo->opts->swapchain_depth || !gbm_surface_has_free_buffers(p->gbm.surface)) { @@ -432,10 +403,6 @@ static void drm_egl_swap_buffers(struct ra_swapchain *sw) drm->redraw = false; } -static const struct ra_swapchain_fns drm_egl_swapchain = { - .swap_buffers = drm_egl_swap_buffers, -}; - static void drm_egl_uninit(struct ra_ctx *ctx) { struct priv *p = ctx->priv; @@ -662,8 +629,8 @@ static bool drm_egl_init(struct ra_ctx *ctx) } struct ra_ctx_params params = { - .external_swapchain = &drm_egl_swapchain, - .get_vsync = &drm_egl_get_vsync, + .get_vsync = drm_egl_get_vsync, + .swap_buffers = drm_egl_swap_buffers, }; if (!ra_gl_ctx_init(ctx, &p->gl, params)) goto err;