mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 04:48:08 +02:00
egl/dri2: dri2_make_current: Release previous context's display
eglMakeCurrent can also be used to change the active display. In that
case, we need to decrement ref_count of the previous display (possibly
destroying it), and increment it on the next display.
Also, old_dsurf/old_rsurf cannot be non-NULL if old_ctx is NULL, so
we only need to test if old_ctx is non-NULL.
v2: Save the old display before destroying the context.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97214
Fixes: 9ee683f877 (egl/dri2: Add reference count for dri2_egl_display)
Cc: "12.0" <mesa-stable@lists.freedesktop.org>
Reported-by: Alexandr Zelinsky <mexahotabop@w1l.ru>
Tested-by: Alexandr Zelinsky <mexahotabop@w1l.ru>
Reviewed-and-Tested-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
This commit is contained in:
parent
09dff7ae2e
commit
78e3cea419
1 changed files with 5 additions and 4 deletions
|
|
@ -1280,13 +1280,14 @@ dri2_make_current(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *dsurf,
|
|||
drv->API.DestroySurface(drv, disp, old_dsurf);
|
||||
if (old_rsurf)
|
||||
drv->API.DestroySurface(drv, disp, old_rsurf);
|
||||
if (old_ctx)
|
||||
drv->API.DestroyContext(drv, disp, old_ctx);
|
||||
|
||||
if (!unbind)
|
||||
dri2_dpy->ref_count++;
|
||||
if (old_dsurf || old_rsurf || old_ctx)
|
||||
dri2_display_release(disp);
|
||||
if (old_ctx) {
|
||||
EGLDisplay old_disp = _eglGetDisplayHandle(old_ctx->Resource.Display);
|
||||
drv->API.DestroyContext(drv, disp, old_ctx);
|
||||
dri2_display_release(old_disp);
|
||||
}
|
||||
|
||||
return EGL_TRUE;
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue