mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-02-14 09:00:28 +01:00
egl: Also query modifiers when exporting DMABuf
This fixes eglExportDMABUFImageQueryMESA() so it will report the
modififers of the underlying image. Without this information,
re-importing will likely be broken as it is rare these days that no
modifiers are used.
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Fixes: 8f7338f284 ("egl: add initial EGL_MESA_image_dma_buf_export v2.4")
This commit is contained in:
parent
4886924262
commit
08f1cefecd
1 changed files with 22 additions and 4 deletions
|
|
@ -2656,21 +2656,39 @@ dri2_export_dma_buf_image_query_mesa(_EGLDriver *drv, _EGLDisplay *disp,
|
|||
{
|
||||
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
|
||||
struct dri2_egl_image *dri2_img = dri2_egl_image(img);
|
||||
int num_planes;
|
||||
|
||||
(void) drv;
|
||||
|
||||
if (!dri2_can_export_dma_buf_image(disp, img))
|
||||
return EGL_FALSE;
|
||||
|
||||
dri2_dpy->image->queryImage(dri2_img->dri_image,
|
||||
__DRI_IMAGE_ATTRIB_NUM_PLANES, &num_planes);
|
||||
if (nplanes)
|
||||
dri2_dpy->image->queryImage(dri2_img->dri_image,
|
||||
__DRI_IMAGE_ATTRIB_NUM_PLANES, nplanes);
|
||||
*nplanes = num_planes;
|
||||
|
||||
if (fourcc)
|
||||
dri2_dpy->image->queryImage(dri2_img->dri_image,
|
||||
__DRI_IMAGE_ATTRIB_FOURCC, fourcc);
|
||||
|
||||
if (modifiers)
|
||||
*modifiers = 0;
|
||||
if (modifiers) {
|
||||
int mod_hi, mod_lo;
|
||||
uint64_t modifier = DRM_FORMAT_MOD_INVALID;
|
||||
bool query;
|
||||
|
||||
query = dri2_dpy->image->queryImage(dri2_img->dri_image,
|
||||
__DRI_IMAGE_ATTRIB_MODIFIER_UPPER,
|
||||
&mod_hi);
|
||||
query &= dri2_dpy->image->queryImage(dri2_img->dri_image,
|
||||
__DRI_IMAGE_ATTRIB_MODIFIER_LOWER,
|
||||
&mod_lo);
|
||||
if (query)
|
||||
modifier = combine_u32_into_u64 (mod_hi, mod_lo);
|
||||
|
||||
for (int i = 0; i < num_planes; i++)
|
||||
modifiers[i] = modifier;
|
||||
}
|
||||
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue