Revert "egl: Factor some common terminate cleanup up to common code"
authorRob Clark <robdclark@chromium.org>
Tue, 18 Oct 2022 20:36:02 +0000 (13:36 -0700)
committerMarge Bot <emma+marge@anholt.net>
Thu, 20 Oct 2022 22:21:01 +0000 (22:21 +0000)
This reverts commit 04826cd9fc83365e99db3a491254a8d5a6eaac63.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7497
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19145>

src/egl/drivers/dri2/egl_dri2.c
src/egl/drivers/wgl/egl_wgl.c
src/egl/main/eglapi.c
src/egl/main/egldisplay.c

index be3ae39..afe9a9c 100644 (file)
@@ -1230,6 +1230,7 @@ dri2_display_release(_EGLDisplay *disp)
    if (!p_atomic_dec_zero(&dri2_dpy->ref_count))
       return;
 
+   _eglCleanupDisplay(disp);
    dri2_display_destroy(disp);
 }
 
@@ -1331,6 +1332,9 @@ dri2_egl_surface_free_local_buffers(struct dri2_egl_surface *dri2_surf)
 static EGLBoolean
 dri2_terminate(_EGLDisplay *disp)
 {
+   /* Release all non-current Context/Surfaces. */
+   _eglReleaseDisplayResources(disp);
+
    dri2_display_release(disp);
 
    return EGL_TRUE;
index 884309a..3e1fe23 100644 (file)
@@ -358,6 +358,7 @@ wgl_display_release(_EGLDisplay *disp)
    if (!p_atomic_dec_zero(&wgl_dpy->ref_count))
       return;
 
+   _eglCleanupDisplay(disp);
    wgl_display_destroy(disp);
 }
 
@@ -370,6 +371,9 @@ wgl_display_release(_EGLDisplay *disp)
 static EGLBoolean
 wgl_terminate(_EGLDisplay *disp)
 {
+   /* Release all non-current Context/Surfaces. */
+   _eglReleaseDisplayResources(disp);
+
    wgl_display_release(disp);
 
    return EGL_TRUE;
index 804b083..e20c03a 100644 (file)
@@ -779,9 +779,14 @@ eglTerminate(EGLDisplay dpy)
       RETURN_EGL_ERROR(NULL, EGL_BAD_DISPLAY, EGL_FALSE);
 
    if (disp->Initialized) {
-      _eglReleaseDisplayResources(disp);
       disp->Driver->Terminate(disp);
-      _eglCleanupDisplay(disp);
+      /* do not reset disp->Driver */
+      disp->ClientAPIsString[0] = 0;
+      disp->Initialized = EGL_FALSE;
+
+      /* Reset blob cache funcs on terminate. */
+      disp->BlobCacheSet = NULL;
+      disp->BlobCacheGet = NULL;
    }
 
    simple_mtx_unlock(&disp->Mutex);
index 52a9102..39850e3 100644 (file)
@@ -370,13 +370,7 @@ _eglCleanupDisplay(_EGLDisplay *disp)
       disp->Configs = NULL;
    }
 
-   /* do not reset disp->Driver */
-   disp->ClientAPIsString[0] = 0;
-   disp->Initialized = EGL_FALSE;
-
-   /* Reset blob cache funcs on terminate. */
-   disp->BlobCacheSet = NULL;
-   disp->BlobCacheGet = NULL;
+   /* XXX incomplete */
 }