mesa: Drop some version checking around ValidateEGLImage

We can just have the screen check if the loader exports it, and take the
path we would otherwise.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30245>
This commit is contained in:
Emma Anholt
2023-10-23 17:03:13 -07:00
committed by Marge Bot
parent 0d8c74bd7c
commit b2777e455b
8 changed files with 11 additions and 25 deletions

View File

@@ -276,7 +276,10 @@ dri2_validate_egl_image(struct dri_screen *screen, void *handle)
{
const __DRIimageLookupExtension *loader = screen->dri2.image;
return loader->validateEGLImage(handle, screen->loaderPrivate);
if (loader)
return loader->validateEGLImage(handle, screen->loaderPrivate);
else
return true;
}
__DRIimage *

View File

@@ -620,17 +620,15 @@ dri_init_screen(struct dri_screen *screen,
screen->base.get_egl_image = dri_get_egl_image;
screen->base.get_param = dri_get_param;
screen->base.set_background_context = dri_set_background_context;
if (screen->validate_egl_image)
screen->base.validate_egl_image = dri_validate_egl_image;
screen->base.validate_egl_image = dri_validate_egl_image;
screen->lookup_egl_image = dri2_lookup_egl_image;
screen->validate_egl_image = dri2_validate_egl_image;
const __DRIimageLookupExtension *image = screen->dri2.image;
if (image &&
image->base.version >= 2 &&
image->validateEGLImage &&
image->lookupEGLImageValidated) {
screen->validate_egl_image = dri2_validate_egl_image;
screen->lookup_egl_image_validated = dri2_lookup_egl_image_validated;
}

View File

@@ -247,8 +247,6 @@ struct dd_function_table {
void (*ShaderCacheSerializeDriverBlob)(struct gl_context *ctx,
struct gl_program *prog);
/*@}*/
GLboolean (*ValidateEGLImage)(struct gl_context *ctx, GLeglImageOES image_handle);
};
#endif /* DD_INCLUDED */

View File

@@ -2934,8 +2934,7 @@ _mesa_EGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image)
return;
}
if (!image || (ctx->Driver.ValidateEGLImage &&
!ctx->Driver.ValidateEGLImage(ctx, image))) {
if (!image || !st_validate_egl_image(ctx, image)) {
_mesa_error(ctx, GL_INVALID_VALUE,
"EGLImageTargetRenderbufferStorageOES");
return;

View File

@@ -3554,8 +3554,7 @@ egl_image_target_texture(struct gl_context *ctx,
if (!texObj)
return;
if (!image || (ctx->Driver.ValidateEGLImage &&
!ctx->Driver.ValidateEGLImage(ctx, image))) {
if (!image || !st_validate_egl_image(ctx, image)) {
_mesa_error(ctx, GL_INVALID_VALUE, "%s(image=%p)", caller, image);
return;
}

View File

@@ -507,7 +507,7 @@ st_bind_egl_image(struct gl_context *ctx,
_mesa_dirty_texobj(ctx, texObj);
}
static GLboolean
bool
st_validate_egl_image(struct gl_context *ctx, GLeglImageOES image_handle)
{
struct st_context *st = st_context(ctx);
@@ -515,11 +515,3 @@ st_validate_egl_image(struct gl_context *ctx, GLeglImageOES image_handle)
return fscreen->validate_egl_image(fscreen, (void *)image_handle);
}
void
st_init_eglimage_functions(struct dd_function_table *functions,
bool has_egl_image_validate)
{
if (has_egl_image_validate)
functions->ValidateEGLImage = st_validate_egl_image;
}

View File

@@ -31,9 +31,8 @@
struct dd_function_table;
extern void
st_init_eglimage_functions(struct dd_function_table *functions,
bool has_egl_image_validate);
bool
st_validate_egl_image(struct gl_context *ctx, GLeglImageOES image_handle);
bool st_get_egl_image(struct gl_context *ctx, GLeglImageOES image_handle,
unsigned usage, bool tex_compression, const char *error,

View File

@@ -806,8 +806,6 @@ st_init_driver_functions(struct pipe_screen *screen,
{
st_init_draw_functions(screen, functions);
st_init_eglimage_functions(functions, has_egl_image_validate);
functions->NewProgram = _mesa_new_program;
st_init_flush_functions(screen, functions);