glcontext: fix get_current_gl_api on x11/nvidia drivers

They require to get_proc_address some functions through the
platform specific {glX,egl}GetProcAddress rather than the default
GL library symbol lookup.
This commit is contained in:
Matthew Waters 2015-07-18 17:19:18 +10:00
parent 74711c214d
commit d5996de5d7
6 changed files with 19 additions and 12 deletions

View file

@ -477,7 +477,7 @@ _get_gl_context (GtkGstGLWidget * gst_widget)
#if GST_GL_HAVE_WINDOW_X11 && defined (GDK_WINDOWING_X11) #if GST_GL_HAVE_WINDOW_X11 && defined (GDK_WINDOWING_X11)
if (GST_IS_GL_DISPLAY_X11 (priv->display)) { if (GST_IS_GL_DISPLAY_X11 (priv->display)) {
platform = GST_GL_PLATFORM_GLX; platform = GST_GL_PLATFORM_GLX;
gl_api = gst_gl_context_get_current_gl_api (NULL, NULL); gl_api = gst_gl_context_get_current_gl_api (platform, NULL, NULL);
gl_handle = gst_gl_context_get_current_gl_context (platform); gl_handle = gst_gl_context_get_current_gl_context (platform);
if (gl_handle) if (gl_handle)
priv->other_context = priv->other_context =
@ -488,7 +488,7 @@ _get_gl_context (GtkGstGLWidget * gst_widget)
#if GST_GL_HAVE_WINDOW_WAYLAND && defined (GDK_WINDOWING_WAYLAND) #if GST_GL_HAVE_WINDOW_WAYLAND && defined (GDK_WINDOWING_WAYLAND)
if (GST_IS_GL_DISPLAY_WAYLAND (priv->display)) { if (GST_IS_GL_DISPLAY_WAYLAND (priv->display)) {
platform = GST_GL_PLATFORM_EGL; platform = GST_GL_PLATFORM_EGL;
gl_api = gst_gl_context_get_current_gl_api (NULL, NULL); gl_api = gst_gl_context_get_current_gl_api (platform, NULL, NULL);
gl_handle = gst_gl_context_get_current_gl_context (platform); gl_handle = gst_gl_context_get_current_gl_context (platform);
if (gl_handle) if (gl_handle)
priv->other_context = priv->other_context =

View file

@ -262,7 +262,7 @@ QtGLVideoItem::onSceneGraphInitialized ()
#if GST_GL_HAVE_WINDOW_X11 && defined (HAVE_QT_X11) #if GST_GL_HAVE_WINDOW_X11 && defined (HAVE_QT_X11)
if (GST_IS_GL_DISPLAY_X11 (this->priv->display)) { if (GST_IS_GL_DISPLAY_X11 (this->priv->display)) {
platform = GST_GL_PLATFORM_GLX; platform = GST_GL_PLATFORM_GLX;
gl_api = gst_gl_context_get_current_gl_api (NULL, NULL); gl_api = gst_gl_context_get_current_gl_api (platform, NULL, NULL);
gl_handle = gst_gl_context_get_current_gl_context (platform); gl_handle = gst_gl_context_get_current_gl_context (platform);
if (gl_handle) if (gl_handle)
this->priv->other_context = this->priv->other_context =
@ -273,7 +273,7 @@ QtGLVideoItem::onSceneGraphInitialized ()
#if GST_GL_HAVE_WINDOW_WAYLAND #if GST_GL_HAVE_WINDOW_WAYLAND
if (GST_IS_GL_DISPLAY_WAYLAND (this->priv->display)) { if (GST_IS_GL_DISPLAY_WAYLAND (this->priv->display)) {
platform = GST_GL_PLATFORM_EGL; platform = GST_GL_PLATFORM_EGL;
gl_api = gst_gl_context_get_current_gl_api (NULL, NULL); gl_api = gst_gl_context_get_current_gl_api (platform, NULL, NULL);
gl_handle = gst_gl_context_get_current_gl_context (platform); gl_handle = gst_gl_context_get_current_gl_context (platform);
if (gl_handle) if (gl_handle)
this->priv->other_context = this->priv->other_context =

View file

@ -117,7 +117,7 @@ _context_ready (gpointer data)
display = gst_gl_context_get_display (GST_GL_CONTEXT (self->gst_gl_context)); display = gst_gl_context_get_display (GST_GL_CONTEXT (self->gst_gl_context));
self->draw_context = gst_gl_context_new_wrapped (display, self->draw_context = gst_gl_context_new_wrapped (display,
(guintptr) self->gl_context, GST_GL_PLATFORM_CGL, (guintptr) self->gl_context, GST_GL_PLATFORM_CGL,
gst_gl_context_get_current_gl_api (NULL, NULL)); gst_gl_context_get_current_gl_api (GST_GL_PLATFORM_CGL, NULL, NULL));
gst_object_unref (display); gst_object_unref (display);
if (!self->draw_context) { if (!self->draw_context) {

View file

@ -411,7 +411,7 @@ gst_gl_context_new_wrapped (GstGLDisplay * display, guintptr handle,
if (context_type == GST_GL_PLATFORM_CGL) { if (context_type == GST_GL_PLATFORM_CGL) {
context_class->get_current_context = context_class->get_current_context =
gst_gl_context_cocoa_get_current_context; gst_gl_context_cocoa_get_current_context;
context_class->get_proc_address = _default_get_proc_address; context_class->get_proc_address = gst_gl_context_default_get_proc_address;
} }
#endif #endif
#if GST_GL_HAVE_PLATFORM_WGL #if GST_GL_HAVE_PLATFORM_WGL
@ -424,7 +424,7 @@ gst_gl_context_new_wrapped (GstGLDisplay * display, guintptr handle,
if (context_type == GST_GL_PLATFORM_EAGL) { if (context_type == GST_GL_PLATFORM_EAGL) {
context_class->get_current_context = context_class->get_current_context =
gst_gl_context_eagl_get_current_context; gst_gl_context_eagl_get_current_context;
context_class->get_proc_address = _default_get_proc_address; context_class->get_proc_address = gst_gl_context_default_get_proc_address;
} }
#endif #endif
@ -507,6 +507,7 @@ gst_gl_context_get_proc_address_with_platform (GstGLPlatform context_type,
/** /**
* gst_gl_context_get_current_gl_api: * gst_gl_context_get_current_gl_api:
* @platform: the #GstGLPlatform to retreive the API for
* @major: (out): (allow-none): the major version * @major: (out): (allow-none): the major version
* @minor: (out): (allow-none): the minor version * @minor: (out): (allow-none): the minor version
* *
@ -519,7 +520,8 @@ gst_gl_context_get_proc_address_with_platform (GstGLPlatform context_type,
* Since: 1.6 * Since: 1.6
*/ */
GstGLAPI GstGLAPI
gst_gl_context_get_current_gl_api (guint * major, guint * minor) gst_gl_context_get_current_gl_api (GstGLPlatform platform, guint * major,
guint * minor)
{ {
const GLubyte *(*GetString) (GLenum name); const GLubyte *(*GetString) (GLenum name);
#if GST_GL_HAVE_OPENGL #if GST_GL_HAVE_OPENGL
@ -533,10 +535,13 @@ gst_gl_context_get_current_gl_api (guint * major, guint * minor)
while (ret != GST_GL_API_NONE) { while (ret != GST_GL_API_NONE) {
/* FIXME: attempt to delve into the platform specific GetProcAddress */ /* FIXME: attempt to delve into the platform specific GetProcAddress */
GetString = gst_gl_context_default_get_proc_address (ret, "glGetString"); GetString =
gst_gl_context_get_proc_address_with_platform (platform, ret,
"glGetString");
#if GST_GL_HAVE_OPENGL #if GST_GL_HAVE_OPENGL
GetIntegerv = GetIntegerv =
gst_gl_context_default_get_proc_address (ret, "glGetIntegerv"); gst_gl_context_get_proc_address_with_platform (platform, ret,
"glGetIntegerv");
#endif #endif
if (!GetString) { if (!GetString) {
goto next; goto next;

View file

@ -146,7 +146,7 @@ gboolean gst_gl_context_check_gl_version (GstGLContext * context, GstGLAPI
gboolean gst_gl_context_check_feature (GstGLContext *context, const gchar *feature); gboolean gst_gl_context_check_feature (GstGLContext *context, const gchar *feature);
guintptr gst_gl_context_get_current_gl_context (GstGLPlatform platform); guintptr gst_gl_context_get_current_gl_context (GstGLPlatform platform);
GstGLAPI gst_gl_context_get_current_gl_api (guint *major, guint *minor); GstGLAPI gst_gl_context_get_current_gl_api (GstGLPlatform platform, guint *major, guint *minor);
gboolean gst_gl_context_fill_info (GstGLContext * context, GError ** error); gboolean gst_gl_context_fill_info (GstGLContext * context, GError ** error);

View file

@ -401,7 +401,9 @@ static void
_fill_context_info (GstGLContext * context, struct context_info *info) _fill_context_info (GstGLContext * context, struct context_info *info)
{ {
info->handle = gst_gl_context_get_current_gl_context (info->platform); info->handle = gst_gl_context_get_current_gl_context (info->platform);
info->api = gst_gl_context_get_current_gl_api (&info->major, &info->minor); info->api =
gst_gl_context_get_current_gl_api (info->platform, &info->major,
&info->minor);
} }
GST_START_TEST (test_current_context) GST_START_TEST (test_current_context)