egl/dri2: move surface refcounting out of the platform code
authorEmil Velikov <emil.velikov@collabora.com>
Tue, 16 Aug 2016 12:04:37 +0000 (13:04 +0100)
committerEmil Velikov <emil.l.velikov@gmail.com>
Fri, 14 Oct 2016 11:16:05 +0000 (12:16 +0100)
All the platforms are duplicating what should be a driver/dri2 thing -
refcounting. Just fold it accordingly.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
src/egl/drivers/dri2/egl_dri2.c
src/egl/drivers/dri2/platform_android.c
src/egl/drivers/dri2/platform_drm.c
src/egl/drivers/dri2/platform_surfaceless.c
src/egl/drivers/dri2/platform_wayland.c
src/egl/drivers/dri2/platform_x11.c
src/egl/drivers/dri2/platform_x11_dri3.c

index bedb0bcfcffae68778690f72b2a83f87b1a02064..dacdfbd74f58d7199993b7f88a382222bd43ca2f 100644 (file)
@@ -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);
 }
 
index f86898401c6f00b65e1afa809a75a2ee3441052f..9581c9617d670b572c7b3c2d98cb1ae7b954f647 100644 (file)
@@ -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) {
index 47add1250609cbaf395fa697c9d791da4afc06c8..2668dff66ca162e21b687d4b810d02181d73fe26 100644 (file)
@@ -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++) {
index e0d383ba3836991947b68677e00b4501a01359ab..b4653cc807be78cdcc9907f4f9084063cbcb3641 100644 (file)
@@ -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);
index cbdcd768a228099078ae808228c125dec9261467..8daa2d397cdd389b400cdbdf471a64b58baf3d62 100644 (file)
@@ -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++) {
index 179152f8157889c69f1d029d88d70550dcbf2a41..06b8e1b35b13b4185cd48d69a0b869f7ccf0385e 100644 (file)
@@ -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) {
index d93f5bc73c965144b5da47bf1394338e6dd55ba5..26bb43011507e0c2394caedbdfd7e7cc918dc10b 100644 (file)
@@ -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);