mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-28 04:31:06 +00:00
[785/906] egl: Use EGL_KHR_surfaceless_context instead of creating a useless surface if available
This commit is contained in:
parent
2952b923aa
commit
ba1403fdd4
1 changed files with 17 additions and 8 deletions
|
@ -108,6 +108,8 @@ gst_gl_egl_create_context (EGLDisplay display, EGLNativeWindowType window,
|
||||||
EGLint context_attrib[3];
|
EGLint context_attrib[3];
|
||||||
EGLint majorVersion;
|
EGLint majorVersion;
|
||||||
EGLint minorVersion;
|
EGLint minorVersion;
|
||||||
|
const gchar *egl_exts;
|
||||||
|
gboolean need_surface = TRUE;
|
||||||
|
|
||||||
egl = g_slice_new0 (GstGLEGL);
|
egl = g_slice_new0 (GstGLEGL);
|
||||||
|
|
||||||
|
@ -196,12 +198,13 @@ gst_gl_egl_create_context (EGLDisplay display, EGLNativeWindowType window,
|
||||||
goto failure;
|
goto failure;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
egl_exts = eglQueryString (egl->egl_display, EGL_EXTENSIONS);
|
||||||
|
|
||||||
if (window) {
|
if (window && FALSE) {
|
||||||
egl->egl_surface =
|
egl->egl_surface =
|
||||||
eglCreateWindowSurface (egl->egl_display, egl->egl_config, window,
|
eglCreateWindowSurface (egl->egl_display, egl->egl_config, window,
|
||||||
NULL);
|
NULL);
|
||||||
} else {
|
} else if (!gst_gl_check_extension ("EGL_KHR_surfaceless_context", egl_exts)) {
|
||||||
EGLint surface_attrib[7];
|
EGLint surface_attrib[7];
|
||||||
gint j = 0;
|
gint j = 0;
|
||||||
|
|
||||||
|
@ -218,14 +221,20 @@ gst_gl_egl_create_context (EGLDisplay display, EGLNativeWindowType window,
|
||||||
egl->egl_surface =
|
egl->egl_surface =
|
||||||
eglCreatePbufferSurface (egl->egl_display, egl->egl_config,
|
eglCreatePbufferSurface (egl->egl_display, egl->egl_config,
|
||||||
surface_attrib);
|
surface_attrib);
|
||||||
|
} else {
|
||||||
|
egl->egl_surface = EGL_NO_SURFACE;
|
||||||
|
need_surface = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (egl->egl_surface != EGL_NO_SURFACE) {
|
if (need_surface) {
|
||||||
GST_INFO ("surface created");
|
if (egl->egl_surface != EGL_NO_SURFACE) {
|
||||||
} else {
|
GST_INFO ("surface created");
|
||||||
g_set_error (error, GST_GL_WINDOW_ERROR, GST_GL_WINDOW_ERROR_FAILED,
|
} else {
|
||||||
"Failed to create window surface: %s", gst_gl_egl_get_error_string ());
|
g_set_error (error, GST_GL_WINDOW_ERROR, GST_GL_WINDOW_ERROR_FAILED,
|
||||||
goto failure;
|
"Failed to create window surface: %s",
|
||||||
|
gst_gl_egl_get_error_string ());
|
||||||
|
goto failure;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_gl_egl_activate (egl, TRUE);
|
gst_gl_egl_activate (egl, TRUE);
|
||||||
|
|
Loading…
Reference in a new issue