mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 14:56:36 +00:00
[711/906] wayland: support choosing Desktop GL as the api
This commit is contained in:
parent
951daee416
commit
380f918802
3 changed files with 51 additions and 9 deletions
|
@ -285,6 +285,7 @@ gst_gl_window_wayland_egl_class_init (GstGLWindowWaylandEGLClass * klass)
|
||||||
static void
|
static void
|
||||||
gst_gl_window_wayland_egl_init (GstGLWindowWaylandEGL * window)
|
gst_gl_window_wayland_egl_init (GstGLWindowWaylandEGL * window)
|
||||||
{
|
{
|
||||||
|
window->gl_api = GST_GL_API_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Must be called in the gl thread */
|
/* Must be called in the gl thread */
|
||||||
|
@ -408,10 +409,45 @@ gst_gl_window_wayland_egl_create_context (GstGLWindow * window,
|
||||||
goto failure;
|
goto failure;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!eglBindAPI (EGL_OPENGL_ES_API)) {
|
if (gl_api & GST_GL_API_OPENGL) {
|
||||||
g_set_error (error, GST_GL_WINDOW_ERROR, GST_GL_WINDOW_ERROR_FAILED,
|
/* egl + opengl only available with EGL 1.4+ */
|
||||||
"Failed to bind OpenGL|ES API: %s", WlEGLErrorString ());
|
if (majorVersion == 1 && minorVersion <= 3) {
|
||||||
goto failure;
|
if ((gl_api & ~GST_GL_API_OPENGL) == GST_GL_API_NONE) {
|
||||||
|
g_set_error (error, GST_GL_WINDOW_ERROR, GST_GL_WINDOW_ERROR_OLD_LIBS,
|
||||||
|
"EGL version (%i.%i) too old for OpenGL support, (needed at least 1.4)",
|
||||||
|
majorVersion, minorVersion);
|
||||||
|
goto failure;
|
||||||
|
} else {
|
||||||
|
GST_WARNING
|
||||||
|
("EGL version (%i.%i) too old for OpenGL support, (needed at least 1.4)",
|
||||||
|
majorVersion, minorVersion);
|
||||||
|
if (gl_api & GST_GL_API_GLES2) {
|
||||||
|
goto try_gles2;
|
||||||
|
} else {
|
||||||
|
g_set_error (error, GST_GL_WINDOW_ERROR,
|
||||||
|
GST_GL_WINDOW_ERROR_WRONG_CONFIG,
|
||||||
|
"Failed to choose a suitable OpenGL API");
|
||||||
|
goto failure;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!eglBindAPI (EGL_OPENGL_API)) {
|
||||||
|
g_set_error (error, GST_GL_WINDOW_ERROR, GST_GL_WINDOW_ERROR_FAILED,
|
||||||
|
"Failed to bind OpenGL|ES API: %s", WlEGLErrorString ());
|
||||||
|
goto failure;
|
||||||
|
}
|
||||||
|
|
||||||
|
window_egl->gl_api = GST_GL_API_OPENGL;
|
||||||
|
} else if (gl_api & GST_GL_API_GLES2) {
|
||||||
|
try_gles2:
|
||||||
|
if (!eglBindAPI (EGL_OPENGL_ES_API)) {
|
||||||
|
g_set_error (error, GST_GL_WINDOW_ERROR, GST_GL_WINDOW_ERROR_FAILED,
|
||||||
|
"Failed to bind OpenGL|ES API: %s", WlEGLErrorString ());
|
||||||
|
goto failure;
|
||||||
|
}
|
||||||
|
|
||||||
|
window_egl->gl_api = GST_GL_API_GLES2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (eglChooseConfig (window_egl->egl_display, config_attrib,
|
if (eglChooseConfig (window_egl->egl_display, config_attrib,
|
||||||
|
@ -503,7 +539,7 @@ gst_gl_window_wayland_egl_get_gl_context (GstGLWindow * window)
|
||||||
static GstGLAPI
|
static GstGLAPI
|
||||||
gst_gl_window_wayland_egl_get_gl_api (GstGLWindow * window)
|
gst_gl_window_wayland_egl_get_gl_api (GstGLWindow * window)
|
||||||
{
|
{
|
||||||
return GST_GL_API_GLES2;
|
return GST_GL_WINDOW_WAYLAND_EGL (window)->gl_api;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -86,6 +86,8 @@ struct _GstGLWindowWaylandEGL {
|
||||||
GMainContext *main_context;
|
GMainContext *main_context;
|
||||||
GMainLoop *loop;
|
GMainLoop *loop;
|
||||||
|
|
||||||
|
GstGLAPI gl_api;
|
||||||
|
|
||||||
gpointer _reserved[GST_PADDING];
|
gpointer _reserved[GST_PADDING];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -186,10 +186,14 @@ gst_gl_window_x11_egl_create_context (GstGLWindowX11 * window_x11,
|
||||||
GST_WARNING
|
GST_WARNING
|
||||||
("EGL version (%i.%i) too old for OpenGL support, (needed at least 1.4)",
|
("EGL version (%i.%i) too old for OpenGL support, (needed at least 1.4)",
|
||||||
majorVersion, minorVersion);
|
majorVersion, minorVersion);
|
||||||
if (gl_api & GST_GL_API_GLES2)
|
if (gl_api & GST_GL_API_GLES2) {
|
||||||
goto try_gles2;
|
goto try_gles2;
|
||||||
else
|
} else {
|
||||||
|
g_set_error (error, GST_GL_WINDOW_ERROR,
|
||||||
|
GST_GL_WINDOW_ERROR_WRONG_CONFIG,
|
||||||
|
"Failed to choose a suitable OpenGL API");
|
||||||
goto failure;
|
goto failure;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -301,8 +305,8 @@ gst_gl_window_x11_egl_get_gl_api (GstGLWindow * window)
|
||||||
{
|
{
|
||||||
GstGLWindowX11EGL *window_egl = GST_GL_WINDOW_X11_EGL (window);
|
GstGLWindowX11EGL *window_egl = GST_GL_WINDOW_X11_EGL (window);
|
||||||
|
|
||||||
return window_egl->
|
return window_egl->gl_api ? window_egl->
|
||||||
gl_api ? window_egl->gl_api : GST_GL_API_GLES2 | GST_GL_API_OPENGL;
|
gl_api : GST_GL_API_GLES2 | GST_GL_API_OPENGL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gpointer
|
static gpointer
|
||||||
|
|
Loading…
Reference in a new issue