eglimage: Fail exportation if a modififer is used

We don't support modififers and that would result in bad image being
displayed. Note that this was fixes recently in Mesa MR 1138, prior to
that, the reported modifier is always 0, which makes this change a
no-op.

Fixes #441
Related to https://gitlab.freedesktop.org/mesa/mesa/merge_requests/1338
This commit is contained in:
Nicolas Dufresne 2018-04-25 13:09:05 -04:00
parent 747ae7d769
commit 976e7e4e3d

View file

@ -995,6 +995,8 @@ gst_egl_image_export_dmabuf (GstEGLImage * image, int *fd, gint * stride,
int egl_fd = 0;
EGLint egl_stride = 0;
EGLint egl_offset = 0;
int fourcc;
EGLuint64KHR modifier;
gst_eglExportDMABUFImageQueryMESA =
gst_gl_context_get_proc_address (image->context,
@ -1020,13 +1022,21 @@ gst_egl_image_export_dmabuf (GstEGLImage * image, int *fd, gint * stride,
gst_object_unref (display_egl);
if (!gst_eglExportDMABUFImageQueryMESA (egl_display, image->image,
NULL, &num_planes, NULL))
&fourcc, &num_planes, &modifier))
return FALSE;
/* Don't allow multi-plane dmabufs */
if (num_planes > 1)
return FALSE;
GST_DEBUG_OBJECT (image->context, "Export DMABuf with fourcc %"
GST_FOURCC_FORMAT " and modififers %" G_GUINT64_FORMAT,
GST_FOURCC_ARGS (fourcc), modifier);
/* FIXME We don't support modifiers */
if (modifier != DRM_FORMAT_MOD_LINEAR)
return FALSE;
if (!gst_eglExportDMABUFImageMESA (egl_display, image->image, &egl_fd,
&egl_stride, &egl_offset))
return FALSE;