dri: Drop the old lookupEGLImage wrapper function.

All the loaders implemented the split version.  We don't need to maintain
the old function and struct layout, because we're version locked
between loader and driver.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30245>
This commit is contained in:
Emma Anholt
2023-10-11 12:21:01 -07:00
committed by Marge Bot
parent 733b7002e7
commit 2ef4b6ed54
11 changed files with 10 additions and 70 deletions

View File

@@ -587,21 +587,9 @@ dri2_lookup_egl_image_validated(void *image, void *data)
return dri2_img->dri_image;
}
__DRIimage *
dri2_lookup_egl_image(__DRIscreen *screen, void *image, void *data)
{
(void)screen;
if (!dri2_validate_egl_image(image, data))
return NULL;
return dri2_lookup_egl_image_validated(image, data);
}
const __DRIimageLookupExtension image_lookup_extension = {
.base = {__DRI_IMAGE_LOOKUP, 2},
.lookupEGLImage = dri2_lookup_egl_image,
.validateEGLImage = dri2_validate_egl_image,
.lookupEGLImageValidated = dri2_lookup_egl_image_validated,
};

View File

@@ -503,9 +503,6 @@ dri2_validate_egl_image(void *image, void *data);
__DRIimage *
dri2_lookup_egl_image_validated(void *image, void *data);
__DRIimage *
dri2_lookup_egl_image(__DRIscreen *screen, void *image, void *data);
void
dri2_get_shifts_and_sizes(const __DRIcoreExtension *core,
const __DRIconfig *config, int *shifts,

View File

@@ -634,7 +634,6 @@ dri2_initialize_drm(_EGLDisplay *disp)
dri2_dpy->kopper = dri2_dpy->gbm_dri->kopper;
dri2_dpy->driver_configs = dri2_dpy->gbm_dri->driver_configs;
dri2_dpy->gbm_dri->lookup_image = dri2_lookup_egl_image;
dri2_dpy->gbm_dri->validate_image = dri2_validate_egl_image;
dri2_dpy->gbm_dri->lookup_image_validated = dri2_lookup_egl_image_validated;
dri2_dpy->gbm_dri->lookup_user_data = disp;

View File

@@ -256,21 +256,6 @@ const __DRI2fenceExtension dri2FenceExtension = {
.get_fence_fd = dri2_get_fence_fd,
};
__DRIimage *
dri2_lookup_egl_image(struct dri_screen *screen, void *handle)
{
const __DRIimageLookupExtension *loader = screen->dri2.image;
__DRIimage *img;
if (!loader->lookupEGLImage)
return NULL;
img = loader->lookupEGLImage(opaque_dri_screen(screen),
handle, screen->loaderPrivate);
return img;
}
__DRIimage *
dri2_create_image_from_renderbuffer(__DRIcontext *context,
int renderbuffer, void *loaderPrivate,

View File

@@ -59,9 +59,6 @@ bool
dri2_yuv_dma_buf_supported(struct dri_screen *screen,
const struct dri2_format_mapping *map);
__DRIimage *
dri2_lookup_egl_image(struct dri_screen *screen, void *handle);
bool
dri2_validate_egl_image(struct dri_screen *screen, void *handle);

View File

@@ -623,8 +623,6 @@ dri_init_screen(struct dri_screen *screen,
screen->base.set_background_context = dri_set_background_context;
screen->base.validate_egl_image = dri_validate_egl_image;
screen->lookup_egl_image = dri2_lookup_egl_image;
if (pscreen->get_param(pscreen, PIPE_CAP_NPOT_TEXTURES))
screen->target = PIPE_TEXTURE_2D;
else

View File

@@ -111,9 +111,6 @@ struct dri_screen
bool swrast_no_present;
/* hooks filled in by dri2 & drisw */
__DRIimage * (*lookup_egl_image)(struct dri_screen *ctx, void *handle);
/* DRI exts that vary based on gallium pipe_screen caps. */
__DRIimageExtension image_extension;
__DRI2bufferDamageExtension buffer_damage_extension;

View File

@@ -174,7 +174,9 @@ static struct pipe_resource * st_omx_pipe_texture_from_eglimage(EGLDisplay egldi
struct dri2_egl_display *dri2_egl_dpy = disp->DriverData;
__DRIscreen *_dri_screen = dri2_egl_dpy->dri_screen;
struct dri_screen *st_dri_screen = dri_screen(_dri_screen);
__DRIimage *_dri_image = st_dri_screen->lookup_egl_image(st_dri_screen, eglimage);
if (!st_dri_screen->validate_egl_image(st_dri_screen, eglimage))
return NULL;
__DRIimage *_dri_image = st_dri_screen->lookup_egl_image_validated(st_dri_screen, eglimage);
return _dri_image->texture;
}

View File

@@ -1731,28 +1731,15 @@ typedef struct __DRIimageLookupExtensionRec __DRIimageLookupExtension;
struct __DRIimageLookupExtensionRec {
__DRIextension base;
/**
* Lookup EGLImage without validated. Equivalent to call
* validateEGLImage() then lookupEGLImageValidated().
*
* \since 1
*/
__DRIimage *(*lookupEGLImage)(__DRIscreen *screen, void *image,
void *loaderPrivate);
/**
* Check if EGLImage is associated with the EGL display before lookup with
* lookupEGLImageValidated(). It will hold EGLDisplay.Mutex, so is separated
* out from lookupEGLImage() to avoid deadlock.
*
* \since 2
* out from lookupEGLImageValidated() to avoid deadlock.
*/
unsigned char (*validateEGLImage)(void *image, void *loaderPrivate);
/**
* Lookup EGLImage after validateEGLImage(). No lock in this function.
*
* \since 2
*/
__DRIimage *(*lookupEGLImageValidated)(void *image, void *loaderPrivate);
};

View File

@@ -55,17 +55,6 @@
#include "wayland-drm.h"
#endif
static __DRIimage *
dri_lookup_egl_image(__DRIscreen *screen, void *image, void *data)
{
struct gbm_dri_device *dri = data;
if (dri->lookup_image == NULL)
return NULL;
return dri->lookup_image(screen, image, dri->lookup_user_data);
}
static GLboolean
dri_validate_egl_image(void *image, void *data)
{
@@ -205,7 +194,6 @@ static const __DRIuseInvalidateExtension use_invalidate = {
static const __DRIimageLookupExtension image_lookup_extension = {
.base = { __DRI_IMAGE_LOOKUP, 2 },
.lookupEGLImage = dri_lookup_egl_image,
.validateEGLImage = dri_validate_egl_image,
.lookupEGLImageValidated = dri_lookup_egl_image_validated,
};
@@ -331,7 +319,6 @@ dri_screen_create_for_driver(struct gbm_dri_device *dri, char *driver_name, bool
}
}
dri->lookup_image = NULL;
dri->lookup_user_data = NULL;
return 0;
@@ -755,12 +742,16 @@ gbm_dri_bo_import(struct gbm_device *gbm,
case GBM_BO_IMPORT_EGL_IMAGE:
{
if (dri->lookup_image == NULL) {
if (dri->lookup_image_validated == NULL) {
errno = EINVAL;
return NULL;
}
image = dri->lookup_image(dri->screen, buffer, dri->lookup_user_data);
if (!dri->validate_image(buffer, dri->lookup_user_data)) {
errno = EINVAL;
return NULL;
}
image = dri->lookup_image_validated(buffer, dri->lookup_user_data);
image = dri->image->dupImage(image, NULL);
dri->image->queryImage(image, __DRI_IMAGE_ATTRIB_FOURCC, &gbm_format);
if (gbm_format == DRM_FORMAT_INVALID) {

View File

@@ -69,7 +69,6 @@ struct gbm_dri_device {
const __DRIextension **loader_extensions;
const __DRIextension **driver_extensions;
__DRIimage *(*lookup_image)(__DRIscreen *screen, void *image, void *data);
GLboolean (*validate_image)(void *image, void *data);
__DRIimage *(*lookup_image_validated)(void *image, void *data);
void *lookup_user_data;