From 0a826da33084953ea6e981af9a4eb36b36cb4efb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Fri, 9 Dec 2016 11:12:11 +0800 Subject: [PATCH] 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(+) diff --git a/src/backends/meta-egl-ext.h b/src/backends/meta-egl-ext.h index 29e13e3d8..d93d757a7 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 ffd13df31..77ca4a894 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 b7bdf3265..367555b76 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,