[mutter] egl: Add EGL_WL_wayland_eglstream helpers



commit 0a826da33084953ea6e981af9a4eb36b36cb4efb
Author: Jonas Ådahl <jadahl gmail com>
Date:   Fri Dec 9 11:12:11 2016 +0800

    egl: Add EGL_WL_wayland_eglstream helpers
    
    These are to replace the file descriptor hack currently in use.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=773629

 src/backends/meta-egl-ext.h |    5 +++++
 src/backends/meta-egl.c     |   25 +++++++++++++++++++++++++
 src/backends/meta-egl.h     |    5 +++++
 3 files changed, 35 insertions(+), 0 deletions(-)
---
diff --git a/src/backends/meta-egl-ext.h b/src/backends/meta-egl-ext.h
index 29e13e3..d93d757 100644
--- a/src/backends/meta-egl-ext.h
+++ b/src/backends/meta-egl-ext.h
@@ -93,4 +93,9 @@ typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERACQUIREATTRIBNVPROC) (EGLDi
 typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERRELEASEATTRIBNVPROC) (EGLDisplay dpy, EGLStreamKHR 
stream, const EGLAttrib *attrib_list);
 #endif /* EGL_NV_stream_attrib */
 
+#ifndef EGL_WL_wayland_eglstream
+#define EGL_WL_wayland_eglstream 1
+#define EGL_WAYLAND_EGLSTREAM_WL              0x334B
+#endif /* EGL_WL_wayland_eglstream */
+
 #endif /* META_EGL_EXT_H */
diff --git a/src/backends/meta-egl.c b/src/backends/meta-egl.c
index ffd13df..77ca4a8 100644
--- a/src/backends/meta-egl.c
+++ b/src/backends/meta-egl.c
@@ -56,6 +56,8 @@ struct _MetaEgl
   PFNEGLDESTROYSTREAMKHRPROC eglDestroyStreamKHR;
   PFNEGLQUERYSTREAMKHRPROC eglQueryStreamKHR;
 
+  PFNEGLCREATESTREAMATTRIBNVPROC eglCreateStreamAttribNV;
+
   PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC eglCreateStreamProducerSurfaceKHR;
 
   PFNEGLSTREAMCONSUMEROUTPUTEXTPROC eglStreamConsumerOutputEXT;
@@ -576,6 +578,27 @@ meta_egl_query_stream (MetaEgl     *egl,
   return TRUE;
 }
 
+EGLStreamKHR
+meta_egl_create_stream_attrib (MetaEgl         *egl,
+                               EGLDisplay       display,
+                               const EGLAttrib *attrib_list,
+                               GError         **error)
+{
+  EGLStreamKHR stream;
+
+  if (!is_egl_proc_valid (egl->eglCreateStreamAttribNV, error))
+    return FALSE;
+
+  stream = egl->eglCreateStreamAttribNV (display, attrib_list);
+  if (stream == EGL_NO_STREAM_KHR)
+    {
+      set_egl_error (error);
+      return EGL_NO_STREAM_KHR;
+    }
+
+  return stream;
+}
+
 EGLSurface
 meta_egl_create_stream_producer_surface (MetaEgl     *egl,
                                          EGLDisplay   display,
@@ -729,6 +752,8 @@ meta_egl_constructed (GObject *object)
   GET_EGL_PROC_ADDR (eglDestroyStreamKHR);
   GET_EGL_PROC_ADDR (eglQueryStreamKHR);
 
+  GET_EGL_PROC_ADDR (eglCreateStreamAttribNV);
+
   GET_EGL_PROC_ADDR (eglCreateStreamProducerSurfaceKHR);
 
   GET_EGL_PROC_ADDR (eglStreamConsumerOutputEXT);
diff --git a/src/backends/meta-egl.h b/src/backends/meta-egl.h
index b7bdf32..367555b 100644
--- a/src/backends/meta-egl.h
+++ b/src/backends/meta-egl.h
@@ -129,6 +129,11 @@ gboolean meta_egl_query_stream (MetaEgl     *egl,
                                 EGLint      *value,
                                 GError     **error);
 
+EGLStreamKHR meta_egl_create_stream_attrib (MetaEgl         *egl,
+                                            EGLDisplay       display,
+                                            const EGLAttrib *attrib_list,
+                                            GError         **error);
+
 EGLSurface meta_egl_create_stream_producer_surface (MetaEgl     *egl,
                                                     EGLDisplay   display,
                                                     EGLConfig    config,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]