[OE-core] [poky][PATCH 2/4] gstreamer1.0-plugins-bad: Fix wrong attribute list type for EGL 1.5

Yuqing Zhu carol.zhu at nxp.com
Tue Oct 11 10:49:10 UTC 2016


For EGL 1.5 spec, the attribute list type should be EGLAttrib.

Signed-off-by: Yuqing Zhu <carol.zhu at nxp.com>
---
 ...Buf-Wrong-attribute-list-type-for-EGL-1.5.patch | 194 +++++++++++++++++++++
 .../gstreamer/gstreamer1.0-plugins-bad_1.8.3.bb    |   1 +
 2 files changed, 195 insertions(+)
 create mode 100755 meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0011-EGL_DMA_Buf-Wrong-attribute-list-type-for-EGL-1.5.patch

diff --git a/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0011-EGL_DMA_Buf-Wrong-attribute-list-type-for-EGL-1.5.patch b/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0011-EGL_DMA_Buf-Wrong-attribute-list-type-for-EGL-1.5.patch
new file mode 100755
index 0000000..8e97cc0
--- /dev/null
+++ b/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0011-EGL_DMA_Buf-Wrong-attribute-list-type-for-EGL-1.5.patch
@@ -0,0 +1,194 @@
+From b390dc7aee52f87a0841740092bca19d6e48881f Mon Sep 17 00:00:00 2001
+From: Song Bing <bing.song at nxp.com>
+Date: Wed, 13 Jul 2016 17:15:44 +0800
+Subject: [PATCH] EGL_DMA_Buf: Wrong attribute list type for EGL 1.5
+
+For EGL 1.5 spec, the attribute list type should be EGLAttrib.
+
+Upstream-Status: Backport [1.9.2]
+https://bugzilla.gnome.org/show_bug.cgi?id=768602
+---
+ gst-libs/gst/gl/egl/gsteglimagememory.c |   78 ++++++++++++++++++++-----------
+ gst-libs/gst/gl/egl/gstglcontext_egl.c  |   20 ++++----
+ gst-libs/gst/gl/egl/gstglcontext_egl.h  |    3 ++
+ 3 files changed, 66 insertions(+), 35 deletions(-)
+
+diff --git a/gst-libs/gst/gl/egl/gsteglimagememory.c b/gst-libs/gst/gl/egl/gsteglimagememory.c
+index 46098b5..6c5ae47 100644
+--- a/gst-libs/gst/gl/egl/gsteglimagememory.c
++++ b/gst-libs/gst/gl/egl/gsteglimagememory.c
+@@ -432,6 +432,9 @@ gst_egl_image_memory_from_dmabuf (GstGLContext * context,
+   gint fourcc;
+   gint atti = 0;
+   EGLint attribs[13];
++#ifdef EGL_VERSION_1_5
++  EGLAttrib attribs_1_5[13];
++#endif
+   EGLImageKHR img = EGL_NO_IMAGE_KHR;
+ 
+   allocator = gst_egl_image_allocator_obtain ();
+@@ -442,32 +445,55 @@ gst_egl_image_memory_from_dmabuf (GstGLContext * context,
+       GST_VIDEO_INFO_COMP_WIDTH (in_info, plane),
+       GST_VIDEO_INFO_COMP_HEIGHT (in_info, plane));
+ 
+-  attribs[atti++] = EGL_WIDTH;
+-  attribs[atti++] = GST_VIDEO_INFO_COMP_WIDTH (in_info, plane);
+-  attribs[atti++] = EGL_HEIGHT;
+-  attribs[atti++] = GST_VIDEO_INFO_COMP_HEIGHT (in_info, plane);
+-
+-  attribs[atti++] = EGL_LINUX_DRM_FOURCC_EXT;
+-  attribs[atti++] = fourcc;
+-
+-  attribs[atti++] = EGL_DMA_BUF_PLANE0_FD_EXT;
+-  attribs[atti++] = dmabuf;
+-
+-  attribs[atti++] = EGL_DMA_BUF_PLANE0_OFFSET_EXT;
+-  attribs[atti++] = offset;
+-  attribs[atti++] = EGL_DMA_BUF_PLANE0_PITCH_EXT;
+-  attribs[atti++] = GST_VIDEO_INFO_PLANE_STRIDE (in_info, plane);
+-
+-  attribs[atti] = EGL_NONE;
+-
+-  for (int i = 0; i < atti; i++)
+-    GST_LOG ("attr %i: %08X", i, attribs[i]);
+-
+-  g_assert (atti == 12);
+-
+-  img = ctx_egl->eglCreateImage (ctx_egl->egl_display, EGL_NO_CONTEXT,
+-      EGL_LINUX_DMA_BUF_EXT, NULL, attribs);
+-
++#ifdef EGL_VERSION_1_5
++  if (GST_GL_CHECK_GL_VERSION (ctx_egl->egl_major, ctx_egl->egl_minor, 1, 5)) {
++    attribs_1_5[atti++] = EGL_WIDTH;
++    attribs_1_5[atti++] = GST_VIDEO_INFO_COMP_WIDTH (in_info, plane);
++    attribs_1_5[atti++] = EGL_HEIGHT;
++    attribs_1_5[atti++] = GST_VIDEO_INFO_COMP_HEIGHT (in_info, plane);
++    attribs_1_5[atti++] = EGL_LINUX_DRM_FOURCC_EXT;
++    attribs_1_5[atti++] = fourcc;
++    attribs_1_5[atti++] = EGL_DMA_BUF_PLANE0_FD_EXT;
++    attribs_1_5[atti++] = dmabuf;
++    attribs_1_5[atti++] = EGL_DMA_BUF_PLANE0_OFFSET_EXT;
++    attribs_1_5[atti++] = offset;
++    attribs_1_5[atti++] = EGL_DMA_BUF_PLANE0_PITCH_EXT;
++    attribs_1_5[atti++] = GST_VIDEO_INFO_PLANE_STRIDE (in_info, plane);
++    attribs_1_5[atti] = EGL_NONE;
++
++    for (int i = 0; i < atti; i++)
++      GST_LOG ("attr %i: %" G_GINTPTR_FORMAT, i, attribs_1_5[i]);
++
++    g_assert (atti == 12);
++
++    img = ctx_egl->eglCreateImage (ctx_egl->egl_display, EGL_NO_CONTEXT,
++        EGL_LINUX_DMA_BUF_EXT, NULL, attribs_1_5);
++
++  } else
++#endif
++  {
++    attribs[atti++] = EGL_WIDTH;
++    attribs[atti++] = GST_VIDEO_INFO_COMP_WIDTH (in_info, plane);
++    attribs[atti++] = EGL_HEIGHT;
++    attribs[atti++] = GST_VIDEO_INFO_COMP_HEIGHT (in_info, plane);
++    attribs[atti++] = EGL_LINUX_DRM_FOURCC_EXT;
++    attribs[atti++] = fourcc;
++    attribs[atti++] = EGL_DMA_BUF_PLANE0_FD_EXT;
++    attribs[atti++] = dmabuf;
++    attribs[atti++] = EGL_DMA_BUF_PLANE0_OFFSET_EXT;
++    attribs[atti++] = offset;
++    attribs[atti++] = EGL_DMA_BUF_PLANE0_PITCH_EXT;
++    attribs[atti++] = GST_VIDEO_INFO_PLANE_STRIDE (in_info, plane);
++    attribs[atti] = EGL_NONE;
++
++    for (int i = 0; i < atti; i++)
++      GST_LOG ("attr %i: %08X", i, attribs[i]);
++
++    g_assert (atti == 12);
++
++    img = ctx_egl->eglCreateImage (ctx_egl->egl_display, EGL_NO_CONTEXT,
++        EGL_LINUX_DMA_BUF_EXT, NULL, attribs);
++  }
+   if (!img) {
+     GST_WARNING_OBJECT (allocator, "eglCreateImage failed: %s",
+         gst_gl_context_egl_get_error_string (eglGetError ()));
+diff --git a/gst-libs/gst/gl/egl/gstglcontext_egl.c b/gst-libs/gst/gl/egl/gstglcontext_egl.c
+index ceafdf3..df6ba3f 100644
+--- a/gst-libs/gst/gl/egl/gstglcontext_egl.c
++++ b/gst-libs/gst/gl/egl/gstglcontext_egl.c
+@@ -309,8 +309,8 @@ gst_gl_context_egl_create_context (GstGLContext * context,
+   GstGLContextEGL *egl;
+   GstGLWindow *window = NULL;
+   EGLNativeWindowType window_handle = (EGLNativeWindowType) 0;
+-  EGLint majorVersion;
+-  EGLint minorVersion;
++  EGLint egl_major;
++  EGLint egl_minor;
+   gboolean need_surface = TRUE;
+   guintptr external_gl_context = 0;
+   GstGLDisplay *display;
+@@ -363,8 +363,8 @@ gst_gl_context_egl_create_context (GstGLContext * context,
+   }
+   gst_object_unref (display);
+ 
+-  if (eglInitialize (egl->egl_display, &majorVersion, &minorVersion)) {
+-    GST_INFO ("egl initialized, version: %d.%d", majorVersion, minorVersion);
++  if (eglInitialize (egl->egl_display, &egl_major, &egl_minor)) {
++    GST_INFO ("egl initialized, version: %d.%d", egl_major, egl_minor);
+   } else {
+     g_set_error (error, GST_GL_CONTEXT_ERROR,
+         GST_GL_CONTEXT_ERROR_RESOURCE_UNAVAILABLE,
+@@ -380,16 +380,16 @@ gst_gl_context_egl_create_context (GstGLContext * context,
+     gint i;
+ 
+     /* egl + opengl only available with EGL 1.4+ */
+-    if (majorVersion == 1 && minorVersion <= 3) {
++    if (egl_major == 1 && egl_minor <= 3) {
+       if ((gl_api & ~GST_GL_API_OPENGL) == GST_GL_API_NONE) {
+         g_set_error (error, GST_GL_CONTEXT_ERROR, GST_GL_CONTEXT_ERROR_OLD_LIBS,
+             "EGL version (%i.%i) too old for OpenGL support, (needed at least 1.4)",
+-            majorVersion, minorVersion);
++            egl_major, egl_minor);
+         goto failure;
+       } else {
+         GST_WARNING
+             ("EGL version (%i.%i) too old for OpenGL support, (needed at least 1.4)",
+-            majorVersion, minorVersion);
++            egl_major, egl_minor);
+         if (gl_api & GST_GL_API_GLES2) {
+           goto try_gles2;
+         } else {
+@@ -599,7 +599,7 @@ gst_gl_context_egl_create_context (GstGLContext * context,
+   }
+ 
+   /* EGLImage functions */
+-  if (GST_GL_CHECK_GL_VERSION (majorVersion, minorVersion, 1, 5)) {
++  if (GST_GL_CHECK_GL_VERSION (egl_major, egl_minor, 1, 5)) {
+     egl->eglCreateImage = gst_gl_context_get_proc_address (context,
+         "eglCreateImage");
+     egl->eglDestroyImage = gst_gl_context_get_proc_address (context,
+@@ -614,7 +614,9 @@ gst_gl_context_egl_create_context (GstGLContext * context,
+     egl->eglCreateImage = NULL;
+     egl->eglDestroyImage = NULL;
+   }
+-
++  egl->egl_major = egl_major;
++  egl->egl_minor = egl_minor;
++ 
+   if (window)
+     gst_object_unref (window);
+ 
+diff --git a/gst-libs/gst/gl/egl/gstglcontext_egl.h b/gst-libs/gst/gl/egl/gstglcontext_egl.h
+index 90abb03..4a72ddf 100644
+--- a/gst-libs/gst/gl/egl/gstglcontext_egl.h
++++ b/gst-libs/gst/gl/egl/gstglcontext_egl.h
+@@ -46,6 +46,9 @@ struct _GstGLContextEGL {
+   EGLSurface egl_surface;
+   EGLConfig  egl_config;
+ 
++  gint egl_major;
++  gint egl_minor;
++
+   GstGLAPI gl_api;
+ 
+   const gchar *egl_exts;
+-- 
+1.7.9.5
+
diff --git a/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.8.3.bb b/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.8.3.bb
index 358c5d1..3b57db9 100644
--- a/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.8.3.bb
+++ b/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.8.3.bb
@@ -20,6 +20,7 @@ SRC_URI = " \
     file://0008-gl-implement-GstGLMemoryEGL.patch \
     file://0009-glimagesink-Downrank-to-marginal.patch \
     file://0010-glplugin-glimagesink-support-video-rotat.patch \
+    file://0011-EGL_DMA_Buf-Wrong-attribute-list-type-for-EGL-1.5.patch \
 "
 SRC_URI[md5sum] = "955281a43e98c5464563fa049e0a0911"
 SRC_URI[sha256sum] = "7899fcb18e6a1af2888b19c90213af018a57d741c6e72ec56b133bc73ec8509b"
-- 
1.9.1




More information about the Openembedded-core mailing list