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 <kenneth@whitecape.org>
Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
This commit is contained in:
Mathias Fröhlich 2019-06-07 07:12:42 +02:00
parent 91aa25f462
commit a7ecf78b90
8 changed files with 10 additions and 15 deletions

View 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)

View 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)

View 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) {

View 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)

View 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;

View 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)

View 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;

View 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) {