summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <slomo@circular-chaos.org>2013-07-24 13:34:20 +0200
committerSebastian Dröge <slomo@circular-chaos.org>2013-07-24 13:36:21 +0200
commita8d0991b8714f4a198a1548a14b7c4637dcf774b (patch)
tree342fc933bd27ad6e09af67fed68ec009971df0f1
parente0c85e17a56a64a2396e6e12ee2505ccc96bcabe (diff)
egl: Use EGL_KHR_surfaceless_context instead of creating a useless surface if available
-rw-r--r--gst-libs/gst/gl/gstglegl.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/gst-libs/gst/gl/gstglegl.c b/gst-libs/gst/gl/gstglegl.c
index 71441bc..6eb4ad9 100644
--- a/gst-libs/gst/gl/gstglegl.c
+++ b/gst-libs/gst/gl/gstglegl.c
@@ -108,6 +108,8 @@ gst_gl_egl_create_context (EGLDisplay display, EGLNativeWindowType window,
EGLint context_attrib[3];
EGLint majorVersion;
EGLint minorVersion;
+ const gchar *egl_exts;
+ gboolean need_surface = TRUE;
egl = g_slice_new0 (GstGLEGL);
@@ -196,12 +198,13 @@ gst_gl_egl_create_context (EGLDisplay display, EGLNativeWindowType window,
goto failure;
}
+ egl_exts = eglQueryString (egl->egl_display, EGL_EXTENSIONS);
- if (window) {
+ if (window && FALSE) {
egl->egl_surface =
eglCreateWindowSurface (egl->egl_display, egl->egl_config, window,
NULL);
- } else {
+ } else if (!gst_gl_check_extension ("EGL_KHR_surfaceless_context", egl_exts)) {
EGLint surface_attrib[7];
gint j = 0;
@@ -218,14 +221,20 @@ gst_gl_egl_create_context (EGLDisplay display, EGLNativeWindowType window,
egl->egl_surface =
eglCreatePbufferSurface (egl->egl_display, egl->egl_config,
surface_attrib);
+ } else {
+ egl->egl_surface = EGL_NO_SURFACE;
+ need_surface = FALSE;
}
- if (egl->egl_surface != EGL_NO_SURFACE) {
- GST_INFO ("surface created");
- } else {
- g_set_error (error, GST_GL_WINDOW_ERROR, GST_GL_WINDOW_ERROR_FAILED,
- "Failed to create window surface: %s", gst_gl_egl_get_error_string ());
- goto failure;
+ if (need_surface) {
+ if (egl->egl_surface != EGL_NO_SURFACE) {
+ GST_INFO ("surface created");
+ } else {
+ g_set_error (error, GST_GL_WINDOW_ERROR, GST_GL_WINDOW_ERROR_FAILED,
+ "Failed to create window surface: %s",
+ gst_gl_egl_get_error_string ());
+ goto failure;
+ }
}
gst_gl_egl_activate (egl, TRUE);