egl: Let the caller of dri2_create_drawable decide about loaderPrivate.
authorMathias Fröhlich <mathias.froehlich@web.de>
Fri, 7 Jun 2019 05:12:42 +0000 (07:12 +0200)
committerMathias Fröhlich <mathias.froehlich@web.de>
Mon, 10 Jun 2019 09:06:48 +0000 (11:06 +0200)
In the call arguments to dri2_create_drawable decouple loaderPrivate
from dri2_surf. For all callers of dri2_create_drawable the two
pointers are the same with the exception of the gbm backed platform.
Let the calling code of dri2_create_drawable decide what
loaderPrivate shall be.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
src/egl/drivers/dri2/egl_dri2.c
src/egl/drivers/dri2/egl_dri2.h
src/egl/drivers/dri2/platform_android.c
src/egl/drivers/dri2/platform_device.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

index cdbc16940b1bf3d01fc6e6327b065e2e4601229a..ee4faaab34f4bf95318d1264ddd0826e8297ad4c 100644 (file)
@@ -1431,10 +1431,10 @@ dri2_surf_update_fence_fd(_EGLContext *ctx,
 EGLBoolean
 dri2_create_drawable(struct dri2_egl_display *dri2_dpy,
                      const __DRIconfig *config,
-                     struct dri2_egl_surface *dri2_surf)
+                     struct dri2_egl_surface *dri2_surf,
+                     void *loaderPrivate)
 {
    __DRIcreateNewDrawableFunc createNewDrawable;
-   void *loaderPrivate = dri2_surf;
 
    if (dri2_dpy->image_driver)
       createNewDrawable = dri2_dpy->image_driver->createNewDrawable;
@@ -1445,12 +1445,6 @@ dri2_create_drawable(struct dri2_egl_display *dri2_dpy,
    else
       return _eglError(EGL_BAD_ALLOC, "no createNewDrawable");
 
-   /* As always gbm is a bit special.. */
-#ifdef HAVE_DRM_PLATFORM
-   if (dri2_surf->gbm_surf)
-      loaderPrivate = dri2_surf->gbm_surf;
-#endif
-
    dri2_surf->dri_drawable = (*createNewDrawable)(dri2_dpy->dri_screen,
                                                   config, loaderPrivate);
    if (dri2_surf->dri_drawable == NULL)
index e122f31a5391e9f78606ae8ddbf016ba1bea03a0..943ff1808619adde5daba2fa58768a6eac8cb0d9 100644 (file)
@@ -549,7 +549,8 @@ dri2_fini_surface(_EGLSurface *surf);
 EGLBoolean
 dri2_create_drawable(struct dri2_egl_display *dri2_dpy,
                      const __DRIconfig *config,
-                     struct dri2_egl_surface *dri2_surf);
+                     struct dri2_egl_surface *dri2_surf,
+                     void *loaderPrivate);
 
 static inline uint64_t
 combine_u32_into_u64(uint32_t hi, uint32_t lo)
index e44447c7df76622b48fa725d5cc18d839843cc61..db6ba4a4b4d63a5acafec93e4d9aafb6b0937066 100644 (file)
@@ -385,7 +385,7 @@ droid_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
       goto cleanup_surface;
    }
 
-   if (!dri2_create_drawable(dri2_dpy, config, dri2_surf))
+   if (!dri2_create_drawable(dri2_dpy, config, dri2_surf, dri2_surf))
       goto cleanup_surface;
 
    if (window) {
index 81725ae7de91642b58d21383d12a377f5289a059..6b80a3869b3ca2b4617a29de351c2d47428a4dc3 100644 (file)
@@ -142,7 +142,7 @@ dri2_device_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
       goto cleanup_surface;
    }
 
-   if (!dri2_create_drawable(dri2_dpy, config, dri2_surf))
+   if (!dri2_create_drawable(dri2_dpy, config, dri2_surf, dri2_surf))
       goto cleanup_surface;
 
    if (conf->RedSize == 5)
index c59b9341d87c1b62fea88f5aea8efa54c5e9ae87..42d79da7b02bee640e5dd72292d53f3bea391c4a 100644 (file)
@@ -171,7 +171,7 @@ dri2_drm_create_window_surface(_EGLDriver *drv, _EGLDisplay *disp,
    dri2_surf->base.Height = surf->base.height;
    surf->dri_private = dri2_surf;
 
-   if (!dri2_create_drawable(dri2_dpy, config, dri2_surf))
+   if (!dri2_create_drawable(dri2_dpy, config, dri2_surf, dri2_surf->gbm_surf))
       goto cleanup_surf;
 
    return &dri2_surf->base;
index ce9f7d0f980ce279a60d88611b5c8a101ceaa0ad..fd6ec6e602d3ebede8a49e32e0bad6006944737d 100644 (file)
@@ -136,7 +136,7 @@ dri2_surfaceless_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
       goto cleanup_surface;
    }
 
-   if (!dri2_create_drawable(dri2_dpy, config, dri2_surf))
+   if (!dri2_create_drawable(dri2_dpy, config, dri2_surf, dri2_surf))
       goto cleanup_surface;
 
    if (conf->RedSize == 5)
index fb5ecdab2c53e1c90a8f06cac612b36f6a0e4479..d7e7eaa2c95d3c4ac2120bfbd5bc2fbba2feaf53 100644 (file)
@@ -348,7 +348,7 @@ dri2_wl_create_window_surface(_EGLDriver *drv, _EGLDisplay *disp,
    if (dri2_dpy->flush)
       dri2_surf->wl_win->resize_callback = resize_callback;
 
-   if (!dri2_create_drawable(dri2_dpy, config, dri2_surf))
+   if (!dri2_create_drawable(dri2_dpy, config, dri2_surf, dri2_surf))
        goto cleanup_surf_wrapper;
 
    dri2_surf->base.SwapInterval = dri2_dpy->default_swap_interval;
index a66d68ef60e7e5de7d545403d12ab2aa61ff541c..0d62f83b4116364e6d3398795c66ee88165e5288 100644 (file)
@@ -290,7 +290,7 @@ dri2_x11_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
       goto cleanup_pixmap;
    }
 
-   if (!dri2_create_drawable(dri2_dpy, config, dri2_surf))
+   if (!dri2_create_drawable(dri2_dpy, config, dri2_surf, dri2_surf))
       goto cleanup_pixmap;
 
    if (type != EGL_PBUFFER_BIT) {