From: Gurchetan Singh Date: Thu, 15 Aug 2019 01:09:28 +0000 (-0700) Subject: i965: support EXT_EGL_image_storage X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d72f17875334bd9c720ab21fd187328bca00e7dd;p=mesa.git i965: support EXT_EGL_image_storage i965 can support this. Reviewed-by: Tapani Pälli --- diff --git a/src/mesa/drivers/dri/i965/intel_extensions.c b/src/mesa/drivers/dri/i965/intel_extensions.c index 39524925cf1..e7ea8cde52e 100644 --- a/src/mesa/drivers/dri/i965/intel_extensions.c +++ b/src/mesa/drivers/dri/i965/intel_extensions.c @@ -97,6 +97,7 @@ intelInitExtensions(struct gl_context *ctx) ctx->Extensions.EXT_blend_func_separate = true; ctx->Extensions.EXT_blend_minmax = true; ctx->Extensions.EXT_draw_buffers2 = true; + ctx->Extensions.EXT_EGL_image_storage = true; ctx->Extensions.EXT_float_blend = true; ctx->Extensions.EXT_framebuffer_sRGB = true; ctx->Extensions.EXT_gpu_program_parameters = true; diff --git a/src/mesa/drivers/dri/i965/intel_tex_image.c b/src/mesa/drivers/dri/i965/intel_tex_image.c index 34491aa36ef..fba925dee5a 100644 --- a/src/mesa/drivers/dri/i965/intel_tex_image.c +++ b/src/mesa/drivers/dri/i965/intel_tex_image.c @@ -649,6 +649,17 @@ intel_image_target_texture(struct gl_context *ctx, GLenum target, internal_format = GL_RGB10_A2; } + /* Guess sized internal format for dma-bufs, as specified by + * EXT_EGL_image_storage. + */ + if (storage && target == GL_TEXTURE_2D && image->imported_dmabuf) { + internal_format = driGLFormatToSizedInternalGLFormat(image->format); + if (internal_format == GL_NONE) { + _mesa_error(ctx, GL_INVALID_OPERATION, __func__); + return; + } + } + intel_set_texture_image_mt(brw, texImage, internal_format, mt->format, mt); intel_miptree_release(&mt); } @@ -663,6 +674,23 @@ intel_image_target_texture_2d(struct gl_context *ctx, GLenum target, false); } +static void +intel_image_target_tex_storage(struct gl_context *ctx, GLenum target, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage, + GLeglImageOES image_handle) +{ + struct intel_texture_object *intel_texobj = intel_texture_object(texObj); + intel_image_target_texture(ctx, target, texObj, texImage, image_handle, + true); + + /* The miptree is in a validated state, so no need to check later. */ + intel_texobj->needs_validate = false; + intel_texobj->validated_first_level = 0; + intel_texobj->validated_last_level = 0; + intel_texobj->_Format = texImage->TexFormat; +} + static bool intel_gettexsubimage_blorp(struct brw_context *brw, struct gl_texture_image *tex_image, @@ -955,6 +983,7 @@ intelInitTextureImageFuncs(struct dd_function_table *functions) functions->TexSubImage = intelTexSubImage; functions->CompressedTexSubImage = intelCompressedTexSubImage; functions->EGLImageTargetTexture2D = intel_image_target_texture_2d; + functions->EGLImageTargetTexStorage = intel_image_target_tex_storage; functions->BindRenderbufferTexImage = intel_bind_renderbuffer_tex_image; functions->GetTexSubImage = intel_get_tex_sub_image; }