From: Emil Velikov Date: Tue, 16 Aug 2016 12:04:37 +0000 (+0100) Subject: egl/dri2: move surface refcounting out of the platform code X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8fb9ea413de31cc6a95ac4c38215b621de728687;p=mesa.git egl/dri2: move surface refcounting out of the platform code All the platforms are duplicating what should be a driver/dri2 thing - refcounting. Just fold it accordingly. Signed-off-by: Emil Velikov Reviewed-by: Eric Engestrom --- diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c index bedb0bcfcff..dacdfbd74f5 100644 --- a/src/egl/drivers/dri2/egl_dri2.c +++ b/src/egl/drivers/dri2/egl_dri2.c @@ -1366,6 +1366,10 @@ static EGLBoolean dri2_destroy_surface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf) { struct dri2_egl_display *dri2_dpy = dri2_egl_display(dpy); + + if (!_eglPutSurface(surf)) + return EGL_TRUE; + return dri2_dpy->vtbl->destroy_surface(drv, dpy, surf); } diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c index f86898401c6..9581c9617d6 100644 --- a/src/egl/drivers/dri2/platform_android.c +++ b/src/egl/drivers/dri2/platform_android.c @@ -344,9 +344,6 @@ droid_destroy_surface(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf) struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surf); - if (!_eglPutSurface(surf)) - return EGL_TRUE; - droid_free_local_buffers(dri2_surf); if (dri2_surf->base.Type == EGL_WINDOW_BIT) { diff --git a/src/egl/drivers/dri2/platform_drm.c b/src/egl/drivers/dri2/platform_drm.c index 47add125060..2668dff66ca 100644 --- a/src/egl/drivers/dri2/platform_drm.c +++ b/src/egl/drivers/dri2/platform_drm.c @@ -191,9 +191,6 @@ dri2_drm_destroy_surface(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf) struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surf); unsigned i; - if (!_eglPutSurface(surf)) - return EGL_TRUE; - (*dri2_dpy->core->destroyDrawable)(dri2_surf->dri_drawable); for (i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++) { diff --git a/src/egl/drivers/dri2/platform_surfaceless.c b/src/egl/drivers/dri2/platform_surfaceless.c index e0d383ba383..b4653cc807b 100644 --- a/src/egl/drivers/dri2/platform_surfaceless.c +++ b/src/egl/drivers/dri2/platform_surfaceless.c @@ -161,9 +161,6 @@ surfaceless_destroy_surface(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *sur struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surf); - if (!_eglPutSurface(surf)) - return EGL_TRUE; - surfaceless_free_images(dri2_surf); (*dri2_dpy->core->destroyDrawable)(dri2_surf->dri_drawable); diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c index cbdcd768a22..8daa2d397cd 100644 --- a/src/egl/drivers/dri2/platform_wayland.c +++ b/src/egl/drivers/dri2/platform_wayland.c @@ -229,9 +229,6 @@ dri2_wl_destroy_surface(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf) (void) drv; - if (!_eglPutSurface(surf)) - return EGL_TRUE; - (*dri2_dpy->core->destroyDrawable)(dri2_surf->dri_drawable); for (i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++) { diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c index 179152f8157..06b8e1b35b1 100644 --- a/src/egl/drivers/dri2/platform_x11.c +++ b/src/egl/drivers/dri2/platform_x11.c @@ -386,9 +386,6 @@ dri2_x11_destroy_surface(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf) (void) drv; - if (!_eglPutSurface(surf)) - return EGL_TRUE; - (*dri2_dpy->core->destroyDrawable)(dri2_surf->dri_drawable); if (dri2_dpy->dri2) { diff --git a/src/egl/drivers/dri2/platform_x11_dri3.c b/src/egl/drivers/dri2/platform_x11_dri3.c index d93f5bc73c9..26bb4301150 100644 --- a/src/egl/drivers/dri2/platform_x11_dri3.c +++ b/src/egl/drivers/dri2/platform_x11_dri3.c @@ -142,9 +142,6 @@ dri3_destroy_surface(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf) (void) drv; - if (!_eglPutSurface(surf)) - return EGL_TRUE; - loader_dri3_drawable_fini(&dri3_surf->loader_drawable); free(surf);