st/dri: track if image is created by a dmabuf

Will be used by EXT_EGL_image_storage later.

Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3375>
This commit is contained in:
Gurchetan Singh 2020-01-13 16:07:38 -08:00 committed by Marge Bot
parent 2629cb627c
commit be347863ba
4 changed files with 12 additions and 0 deletions

View File

@ -182,6 +182,8 @@ struct st_egl_image
unsigned level; unsigned level;
unsigned layer; unsigned layer;
/* GL internal format. */
unsigned internalformat;
}; };
/** /**

View File

@ -938,6 +938,7 @@ dri2_create_image_from_fd(__DRIscreen *_screen,
img->dri_components = map->dri_components; img->dri_components = map->dri_components;
img->dri_fourcc = fourcc; img->dri_fourcc = fourcc;
img->dri_format = map->dri_format; img->dri_format = map->dri_format;
img->imported_dmabuf = TRUE;
exit: exit:
if (error) if (error)

View File

@ -473,6 +473,14 @@ dri_get_egl_image(struct st_manager *smapi,
stimg->level = img->level; stimg->level = img->level;
stimg->layer = img->layer; stimg->layer = img->layer;
if (img->imported_dmabuf && map) {
/* Guess sized internal format for dma-bufs. Could be used
* by EXT_EGL_image_storage.
*/
mesa_format mesa_format = driImageFormatToGLFormat(map->dri_format);
stimg->internalformat = driGLFormatToSizedInternalGLFormat(mesa_format);
}
return TRUE; return TRUE;
} }

View File

@ -109,6 +109,7 @@ struct __DRIimageRec {
void *loader_private; void *loader_private;
boolean imported_dmabuf;
/** /**
* Provided by EGL_EXT_image_dma_buf_import. * Provided by EGL_EXT_image_dma_buf_import.
*/ */