wayland/dma-buf: Handle zero modifiers from eglQueryDmaBufModifiersEXT

Some drivers expose EGL_EXT_image_dma_buf_import_modifiers so you can
query supported formats, but don't support any modifiers. Handle this by
treating it like DRM_FORMAT_MOD_INVALID.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/782
This commit is contained in:
Adam Jackson 2019-09-06 14:45:55 -04:00 committed by Jonas Ådahl
parent b69d2aa6a0
commit 031003a5dc

View File

@ -461,9 +461,17 @@ send_modifiers (struct wl_resource *resource,
* then fill the array. */ * then fill the array. */
ret = meta_egl_query_dma_buf_modifiers (egl, egl_display, format, 0, NULL, ret = meta_egl_query_dma_buf_modifiers (egl, egl_display, format, 0, NULL,
NULL, &num_modifiers, NULL); NULL, &num_modifiers, NULL);
if (!ret || num_modifiers == 0) if (!ret)
return; return;
if (num_modifiers == 0)
{
zwp_linux_dmabuf_v1_send_modifier (resource, format,
DRM_FORMAT_MOD_INVALID >> 32,
DRM_FORMAT_MOD_INVALID & 0xffffffff);
return;
}
modifiers = g_new0 (uint64_t, num_modifiers); modifiers = g_new0 (uint64_t, num_modifiers);
ret = meta_egl_query_dma_buf_modifiers (egl, egl_display, format, ret = meta_egl_query_dma_buf_modifiers (egl, egl_display, format,
num_modifiers, modifiers, NULL, num_modifiers, modifiers, NULL,