diff --git a/.pick_status.json b/.pick_status.json index cf683fec6d9..168032fa74a 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -1867,7 +1867,7 @@ "description": "egl/dri2: only take a dri2_dpy reference when binding a new context/surfaces", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "master_sha": null, "because_sha": "4e8f95f64d004aa1278609c5bbac9a53c0c6e4c9" }, diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c index a3c800b04aa..00d11b292e4 100644 --- a/src/egl/drivers/dri2/egl_dri2.c +++ b/src/egl/drivers/dri2/egl_dri2.c @@ -1851,6 +1851,13 @@ dri2_make_current(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *dsurf, tmp_rsurf == old_rsurf); _eglLog(_EGL_WARNING, "DRI2: failed to rebind the previous context"); + } else { + /* dri2_dpy->core->bindContext succeeded, so take a reference on the + * dri2_dpy. This prevents dri2_dpy from being reinitialized when a + * EGLDisplay is terminated and then initialized again while a + * context is still bound. See dri2_intitialize() for a more in depth + * explanation. */ + dri2_dpy->ref_count++; } } @@ -1865,8 +1872,6 @@ dri2_make_current(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *dsurf, if (egl_error != EGL_SUCCESS) return _eglError(egl_error, "eglMakeCurrent"); - dri2_dpy->ref_count++; - if (dsurf && _eglSurfaceHasMutableRenderBuffer(dsurf) && dri2_dpy->vtbl->set_shared_buffer_mode) { /* Always update the shared buffer mode. This is obviously needed when