From: Mathias Fröhlich Date: Fri, 7 Jun 2019 05:12:42 +0000 (+0200) Subject: egl: Let the caller of dri2_create_drawable decide about loaderPrivate. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a7ecf78b900c28aafdc1cd1e1a4117feb30a66c9;p=mesa.git egl: Let the caller of dri2_create_drawable decide about loaderPrivate. 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 Signed-off-by: Mathias Fröhlich --- diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c index cdbc16940b1..ee4faaab34f 100644 --- a/src/egl/drivers/dri2/egl_dri2.c +++ b/src/egl/drivers/dri2/egl_dri2.c @@ -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) diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h index e122f31a539..943ff180861 100644 --- a/src/egl/drivers/dri2/egl_dri2.h +++ b/src/egl/drivers/dri2/egl_dri2.h @@ -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) diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c index e44447c7df7..db6ba4a4b4d 100644 --- a/src/egl/drivers/dri2/platform_android.c +++ b/src/egl/drivers/dri2/platform_android.c @@ -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) { diff --git a/src/egl/drivers/dri2/platform_device.c b/src/egl/drivers/dri2/platform_device.c index 81725ae7de9..6b80a3869b3 100644 --- a/src/egl/drivers/dri2/platform_device.c +++ b/src/egl/drivers/dri2/platform_device.c @@ -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) diff --git a/src/egl/drivers/dri2/platform_drm.c b/src/egl/drivers/dri2/platform_drm.c index c59b9341d87..42d79da7b02 100644 --- a/src/egl/drivers/dri2/platform_drm.c +++ b/src/egl/drivers/dri2/platform_drm.c @@ -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; diff --git a/src/egl/drivers/dri2/platform_surfaceless.c b/src/egl/drivers/dri2/platform_surfaceless.c index ce9f7d0f980..fd6ec6e602d 100644 --- a/src/egl/drivers/dri2/platform_surfaceless.c +++ b/src/egl/drivers/dri2/platform_surfaceless.c @@ -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) diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c index fb5ecdab2c5..d7e7eaa2c95 100644 --- a/src/egl/drivers/dri2/platform_wayland.c +++ b/src/egl/drivers/dri2/platform_wayland.c @@ -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; diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c index a66d68ef60e..0d62f83b411 100644 --- a/src/egl/drivers/dri2/platform_x11.c +++ b/src/egl/drivers/dri2/platform_x11.c @@ -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) {