summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLongChair <longchair@hotmail.com>2018-03-20 07:42:44 +0100
committerJan Ekström <jeebjp@gmail.com>2018-03-23 00:44:47 +0200
commitb4c6fb0f5258493dfd1dbb10bef1c6daca529ddf (patch)
tree0d03cefa63f6d28b3d681d221e08592314808ec0
parenta04ac8204faabf73a696a5e1191063ff67722850 (diff)
downloadmpv-b4c6fb0f5258493dfd1dbb10bef1c6daca529ddf.tar.bz2
mpv-b4c6fb0f5258493dfd1dbb10bef1c6daca529ddf.tar.xz
drm/atomic: ensure request is available until uninit
Right now the atomic request is alive during the renderloop. We want it to be alive until the drm egl context is destroyed because some properties might still be set upon interop close This patch make the request to be kept created even outside the renderloop. The context uninit will commit the last request.
-rw-r--r--video/out/opengl/context_drm_egl.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/video/out/opengl/context_drm_egl.c b/video/out/opengl/context_drm_egl.c
index 1973092739..c2585049fc 100644
--- a/video/out/opengl/context_drm_egl.c
+++ b/video/out/opengl/context_drm_egl.c
@@ -323,8 +323,10 @@ static bool drm_atomic_egl_start_frame(struct ra_swapchain *sw, struct ra_fbo *o
{
struct priv *p = sw->ctx->priv;
if (p->kms->atomic_context) {
- p->kms->atomic_context->request = drmModeAtomicAlloc();
- p->drm_params.atomic_request = p->kms->atomic_context->request;
+ if (!p->kms->atomic_context->request) {
+ p->kms->atomic_context->request = drmModeAtomicAlloc();
+ p->drm_params.atomic_request = p->kms->atomic_context->request;
+ }
return ra_gl_ctx_start_frame(sw, out_fbo);
}
return false;
@@ -381,7 +383,7 @@ static void drm_egl_swap_buffers(struct ra_ctx *ctx)
if (atomic_ctx) {
drmModeAtomicFree(atomic_ctx->request);
- p->drm_params.atomic_request = atomic_ctx->request = NULL;
+ p->drm_params.atomic_request = atomic_ctx->request = drmModeAtomicAlloc();
}
gbm_surface_release_buffer(p->gbm.surface, p->gbm.bo);
@@ -391,6 +393,15 @@ static void drm_egl_swap_buffers(struct ra_ctx *ctx)
static void drm_egl_uninit(struct ra_ctx *ctx)
{
struct priv *p = ctx->priv;
+ struct drm_atomic_context *atomic_ctx = p->kms->atomic_context;
+
+ if (atomic_ctx) {
+ int ret = drmModeAtomicCommit(p->kms->fd, atomic_ctx->request, 0, NULL);
+ if (ret)
+ MP_ERR(ctx->vo, "Failed to commit atomic request (%d)\n", ret);
+ drmModeAtomicFree(atomic_ctx->request);
+ }
+
ra_gl_ctx_uninit(ctx);
crtc_release(ctx);