summaryrefslogtreecommitdiffstats
path: root/src/egl/drivers/dri2
diff options
context:
space:
mode:
authorNicolas Boichat <[email protected]>2016-08-11 16:43:32 +0800
committerMichel Dänzer <[email protected]>2016-08-16 17:30:35 +0900
commit78e3cea4197802253401766fc44362786898e024 (patch)
tree0502f527e137747b4dad52cdf3f2249fdcf8fd3e /src/egl/drivers/dri2
parent09dff7ae2e179d5a3490481762c6bd3d50430c9f (diff)
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" <[email protected]> Reported-by: Alexandr Zelinsky <[email protected]> Tested-by: Alexandr Zelinsky <[email protected]> Reviewed-and-Tested-by: Michel Dänzer <[email protected]> Signed-off-by: Nicolas Boichat <[email protected]>
Diffstat (limited to 'src/egl/drivers/dri2')
-rw-r--r--src/egl/drivers/dri2/egl_dri2.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 3205a360ca1..3e3d1c8d03d 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -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 {