summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian.droege@collabora.co.uk>2012-12-30 10:45:57 +0100
committerSebastian Dröge <sebastian.droege@collabora.co.uk>2013-01-09 12:59:05 +0100
commitb6c8c3561648e7546dec0f8b4665024377192226 (patch)
tree2e6d14086be81993a6ac57259b05b948b9ca9621
parent899fc0ebae17952153ce2312b74c00c4e2aec2cc (diff)
eglglessink: Improve EGL/GL error handling a bit
-rw-r--r--ext/eglgles/gsteglglessink.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/ext/eglgles/gsteglglessink.c b/ext/eglgles/gsteglglessink.c
index fa9fecdb9..960e28812 100644
--- a/ext/eglgles/gsteglglessink.c
+++ b/ext/eglgles/gsteglglessink.c
@@ -400,7 +400,7 @@ static GstFlowReturn gst_eglglessink_render_and_display (GstEglGlesSink * sink,
static GstFlowReturn gst_eglglessink_queue_buffer (GstEglGlesSink * sink,
GstBuffer * buf);
static inline gboolean got_gl_error (const char *wtf);
-static inline void show_egl_error (const char *wtf);
+static inline gboolean got_egl_error (const char *wtf);
static void gst_eglglessink_wipe_fmt (gpointer data);
static inline gboolean egl_init (GstEglGlesSink * eglglessink);
static gboolean gst_eglglessink_context_make_current (GstEglGlesSink *
@@ -826,19 +826,23 @@ got_gl_error (const char *wtf)
GLuint error = GL_NO_ERROR;
if ((error = glGetError ()) != GL_NO_ERROR) {
- GST_CAT_ERROR (GST_CAT_DEFAULT, "GL ERROR: %s returned %x", wtf, error);
+ GST_CAT_ERROR (GST_CAT_DEFAULT, "GL ERROR: %s returned 0x%04x", wtf, error);
return TRUE;
}
return FALSE;
}
-static inline void
-show_egl_error (const char *wtf)
+static inline gboolean
+got_egl_error (const char *wtf)
{
EGLint error;
- if ((error = eglGetError ()) != EGL_SUCCESS)
- GST_CAT_DEBUG (GST_CAT_DEFAULT, "EGL ERROR: %s returned %x", wtf, error);
+ if ((error = eglGetError ()) != EGL_SUCCESS) {
+ GST_CAT_DEBUG (GST_CAT_DEFAULT, "EGL ERROR: %s returned 0x%04x", wtf, error);
+ return TRUE;
+ }
+
+ return FALSE;
}
static EGLNativeWindowType
@@ -1105,7 +1109,7 @@ gst_eglglessink_context_make_current (GstEglGlesSink * eglglessink,
if (!eglMakeCurrent (eglglessink->eglglesctx.display,
eglglessink->eglglesctx.surface, eglglessink->eglglesctx.surface,
eglglessink->eglglesctx.eglcontext)) {
- show_egl_error ("eglMakeCurrent");
+ got_egl_error ("eglMakeCurrent");
GST_ERROR_OBJECT (eglglessink, "Couldn't bind context");
return FALSE;
}
@@ -1114,7 +1118,7 @@ gst_eglglessink_context_make_current (GstEglGlesSink * eglglessink,
g_thread_self ());
if (!eglMakeCurrent (eglglessink->eglglesctx.display, EGL_NO_SURFACE,
EGL_NO_SURFACE, EGL_NO_CONTEXT)) {
- show_egl_error ("eglMakeCurrent");
+ got_egl_error ("eglMakeCurrent");
GST_ERROR_OBJECT (eglglessink, "Couldn't unbind context");
return FALSE;
}
@@ -1142,7 +1146,7 @@ gst_eglglessink_init_egl_surface (GstEglGlesSink * eglglessink)
NULL);
if (eglglessink->eglglesctx.surface == EGL_NO_SURFACE) {
- show_egl_error ("eglCreateWindowSurface");
+ got_egl_error ("eglCreateWindowSurface");
GST_ERROR_OBJECT (eglglessink, "Can't create surface");
goto HANDLE_EGL_ERROR_LOCKED;
}
@@ -1555,7 +1559,7 @@ gst_eglglessink_init_egl_display (GstEglGlesSink * eglglessink)
if (!eglInitialize (eglglessink->eglglesctx.display,
&eglglessink->eglglesctx.egl_major,
&eglglessink->eglglesctx.egl_minor)) {
- show_egl_error ("eglInitialize");
+ got_egl_error ("eglInitialize");
GST_ERROR_OBJECT (eglglessink, "Could not init EGL display connection");
goto HANDLE_EGL_ERROR;
}
@@ -1594,7 +1598,7 @@ gst_eglglessink_choose_config (GstEglGlesSink * eglglessink)
if ((eglChooseConfig (eglglessink->eglglesctx.display,
eglglessink->selected_fmt->attribs,
&eglglessink->eglglesctx.config, 1, &egl_configs)) == EGL_FALSE) {
- show_egl_error ("eglChooseConfig");
+ got_egl_error ("eglChooseConfig");
GST_ERROR_OBJECT (eglglessink, "eglChooseConfig failed");
goto HANDLE_EGL_ERROR;
}
@@ -1985,7 +1989,7 @@ gst_eglglessink_render_and_display (GstEglGlesSink * eglglessink,
if ((eglSwapBuffers (eglglessink->eglglesctx.display,
eglglessink->eglglesctx.surface))
== EGL_FALSE) {
- show_egl_error ("eglSwapBuffers");
+ got_egl_error ("eglSwapBuffers");
goto HANDLE_ERROR;
}