mirror of
https://github.com/mpv-player/mpv
synced 2025-03-18 17:40:30 +00:00
context_drm_egl: more correctness fixes for uninit procedure
- uninit gl before the VO - destroy EGL surface before context: reverse of the creation order. I also checked other code which doesn't even call this and leaves it up to eglTerminate, which frees everything anyway. But this seems more correct since we're destroying the gbm surface afterwards. - check against at EGL_NO_DISPLAY instead of 0: there is probably no EGL implementation where this makes a difference, it is more correct regardless - remove pointless eglDestroyContext call - check render_fd before close
This commit is contained in:
parent
817c281c7c
commit
d15f11a9f7
@ -485,8 +485,8 @@ static void drm_egl_uninit(struct ra_ctx *ctx)
|
||||
drmModeAtomicFree(atomic_ctx->request);
|
||||
}
|
||||
|
||||
vo_drm_uninit(ctx->vo);
|
||||
ra_gl_ctx_uninit(ctx);
|
||||
vo_drm_uninit(ctx->vo);
|
||||
|
||||
if (p) {
|
||||
// According to GBM documentation all BO:s must be released
|
||||
@ -497,18 +497,17 @@ static void drm_egl_uninit(struct ra_ctx *ctx)
|
||||
|
||||
eglMakeCurrent(p->egl.display, EGL_NO_SURFACE, EGL_NO_SURFACE,
|
||||
EGL_NO_CONTEXT);
|
||||
if (p->egl.display) {
|
||||
eglDestroyContext(p->egl.display, p->egl.context);
|
||||
if (p->egl.display != EGL_NO_DISPLAY) {
|
||||
eglDestroySurface(p->egl.display, p->egl.surface);
|
||||
eglDestroyContext(p->egl.display, p->egl.context);
|
||||
}
|
||||
if (p->gbm.surface)
|
||||
gbm_surface_destroy(p->gbm.surface);
|
||||
eglTerminate(p->egl.display);
|
||||
gbm_device_destroy(p->gbm.device);
|
||||
p->egl.context = EGL_NO_CONTEXT;
|
||||
eglDestroyContext(p->egl.display, p->egl.context);
|
||||
|
||||
close(p->drm_params.render_fd);
|
||||
if (p->drm_params.render_fd != -1)
|
||||
close(p->drm_params.render_fd);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user