mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-12 18:35:35 +00:00
glupload: dmabuf-direct: query formats before modifiers
The EXT_image_dma_buf_import_modifiers extension [1] states regarding eglQueryDmaBufModifiersEXT: The format must be one of those returned by the eglQueryDmaBufFormatsEXT command. To comply with this requirement eglQueryDmaBufFormatsEXT must be called before eglQueryDmaBufModifiersEXT. [1] https://www.khronos.org/registry/EGL/extensions/EXT/EGL_EXT_image_dma_buf_import_modifiers.txt https://bugzilla.gnome.org/show_bug.cgi?id=783521
This commit is contained in:
parent
c4edd80c8c
commit
eb20293a02
1 changed files with 28 additions and 1 deletions
|
@ -586,20 +586,26 @@ _gst_egl_image_check_dmabuf_direct (GstGLContext * context, int fourcc)
|
||||||
{
|
{
|
||||||
EGLDisplay egl_display = EGL_DEFAULT_DISPLAY;
|
EGLDisplay egl_display = EGL_DEFAULT_DISPLAY;
|
||||||
GstGLDisplayEGL *display_egl;
|
GstGLDisplayEGL *display_egl;
|
||||||
|
EGLint *formats;
|
||||||
|
EGLint num_formats;
|
||||||
EGLuint64KHR *modifiers;
|
EGLuint64KHR *modifiers;
|
||||||
EGLBoolean *external_only;
|
EGLBoolean *external_only;
|
||||||
int num_modifiers;
|
int num_modifiers;
|
||||||
gboolean ret;
|
gboolean ret;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
EGLBoolean (*gst_eglQueryDmaBufFormatsEXT) (EGLDisplay dpy,
|
||||||
|
EGLint max_formats, EGLint * formats, EGLint * num_formats);
|
||||||
EGLBoolean (*gst_eglQueryDmaBufModifiersEXT) (EGLDisplay dpy,
|
EGLBoolean (*gst_eglQueryDmaBufModifiersEXT) (EGLDisplay dpy,
|
||||||
int format, int max_modifiers, EGLuint64KHR * modifiers,
|
int format, int max_modifiers, EGLuint64KHR * modifiers,
|
||||||
EGLBoolean * external_only, int *num_modifiers);
|
EGLBoolean * external_only, int *num_modifiers);
|
||||||
|
|
||||||
|
gst_eglQueryDmaBufFormatsEXT =
|
||||||
|
gst_gl_context_get_proc_address (context, "eglQueryDmaBufFormatsEXT");
|
||||||
gst_eglQueryDmaBufModifiersEXT =
|
gst_eglQueryDmaBufModifiersEXT =
|
||||||
gst_gl_context_get_proc_address (context, "eglQueryDmaBufModifiersEXT");
|
gst_gl_context_get_proc_address (context, "eglQueryDmaBufModifiersEXT");
|
||||||
|
|
||||||
if (!gst_eglQueryDmaBufModifiersEXT)
|
if (!gst_eglQueryDmaBufFormatsEXT || !gst_eglQueryDmaBufModifiersEXT)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
display_egl = gst_gl_display_egl_from_gl_display (context->display);
|
display_egl = gst_gl_display_egl_from_gl_display (context->display);
|
||||||
|
@ -613,6 +619,27 @@ _gst_egl_image_check_dmabuf_direct (GstGLContext * context, int fourcc)
|
||||||
(EGLDisplay) gst_gl_display_get_handle (GST_GL_DISPLAY (display_egl));
|
(EGLDisplay) gst_gl_display_get_handle (GST_GL_DISPLAY (display_egl));
|
||||||
gst_object_unref (display_egl);
|
gst_object_unref (display_egl);
|
||||||
|
|
||||||
|
ret = gst_eglQueryDmaBufFormatsEXT (egl_display, 0, NULL, &num_formats);
|
||||||
|
if (!ret || num_formats == 0)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
formats = g_new (EGLint, num_formats);
|
||||||
|
|
||||||
|
ret = gst_eglQueryDmaBufFormatsEXT (egl_display, num_formats, formats,
|
||||||
|
&num_formats);
|
||||||
|
if (!ret || num_formats == 0) {
|
||||||
|
g_free (formats);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < num_formats; i++) {
|
||||||
|
if (formats[i] == fourcc)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
g_free (formats);
|
||||||
|
if (i == num_formats)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
ret = gst_eglQueryDmaBufModifiersEXT (egl_display, fourcc, 0, NULL, NULL,
|
ret = gst_eglQueryDmaBufModifiersEXT (egl_display, fourcc, 0, NULL, NULL,
|
||||||
&num_modifiers);
|
&num_modifiers);
|
||||||
if (!ret || num_modifiers == 0)
|
if (!ret || num_modifiers == 0)
|
||||||
|
|
Loading…
Reference in a new issue