dri: store internal_format when known

For images created from textures or renderbuffer, the internal
format is known so store it.

This will be used in the next commit to replaces guessing it.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16662>
This commit is contained in:
Pierre-Eric Pelloux-Prayer 2022-05-20 17:30:00 +02:00 committed by Marge Bot
parent f1dd487531
commit 085bdd89c2
4 changed files with 9 additions and 0 deletions

View File

@ -1442,6 +1442,7 @@ dri2_dup_image(__DRIimage *image, void *loaderPrivate)
img->level = image->level;
img->layer = image->layer;
img->dri_format = image->dri_format;
img->internal_format = image->internal_format;
/* This should be 0 for sub images, but dup is also used for base images. */
img->dri_components = image->dri_components;
img->use = image->use;

View File

@ -312,6 +312,7 @@ dri2_create_image_from_renderbuffer2(__DRIcontext *context,
}
img->dri_format = driGLFormatToImageFormat(rb->Format);
img->internal_format = rb->InternalFormat;
img->loader_private = loaderPrivate;
img->sPriv = context->driScreenPriv;
img->in_fence_fd = -1;
@ -416,6 +417,7 @@ dri2_create_from_texture(__DRIcontext *context, int target, unsigned texture,
img->layer = depth;
img->in_fence_fd = -1;
img->dri_format = driGLFormatToImageFormat(obj->Image[face][level]->TexFormat);
img->internal_format = obj->Image[face][level]->InternalFormat;
img->loader_private = loaderPrivate;
img->sPriv = context->driScreenPriv;

View File

@ -745,6 +745,8 @@ dri_get_egl_image(struct st_manager *smapi,
*/
mesa_format mesa_format = driImageFormatToGLFormat(map->dri_format);
stimg->internalformat = driGLFormatToSizedInternalGLFormat(mesa_format);
} else {
stimg->internalformat = img->internal_format;
}
stimg->yuv_color_space = img->yuv_color_space;

View File

@ -117,6 +117,10 @@ struct __DRIimageRec {
uint32_t dri_format;
uint32_t dri_fourcc;
uint32_t dri_components;
/* Provided by eglCreateImageKHR if creating from a
* texture or a renderbuffer. 0 otherwise.
*/
uint32_t internal_format;
unsigned use;
unsigned plane;