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.
This commit is contained in:
LongChair 2018-03-20 07:42:44 +01:00 committed by Jan Ekström
parent a04ac8204f
commit b4c6fb0f52
1 changed files with 14 additions and 3 deletions

View File

@ -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);