gl/egl: pass the error value to get_error_string()

This commit is contained in:
Matthew Waters 2016-01-28 14:31:33 +11:00 committed by Tim-Philipp Müller
parent 2bef3f740e
commit 786b2fb9f1
3 changed files with 16 additions and 16 deletions

View file

@ -450,7 +450,7 @@ gst_egl_image_memory_from_dmabuf (GstGLContext * context,
if (!img) { if (!img) {
GST_WARNING_OBJECT (allocator, "eglCreateImage failed: %s", GST_WARNING_OBJECT (allocator, "eglCreateImage failed: %s",
gst_gl_context_egl_get_error_string ()); gst_gl_context_egl_get_error_string (eglGetError ()));
return NULL; return NULL;
} }

View file

@ -108,11 +108,9 @@ gst_gl_context_egl_new (GstGLDisplay * display)
} }
const gchar * const gchar *
gst_gl_context_egl_get_error_string (void) gst_gl_context_egl_get_error_string (EGLint err)
{ {
EGLint nErr = eglGetError (); switch (err) {
switch (nErr) {
case EGL_SUCCESS: case EGL_SUCCESS:
return "EGL_SUCCESS"; return "EGL_SUCCESS";
case EGL_BAD_DISPLAY: case EGL_BAD_DISPLAY:
@ -210,7 +208,7 @@ gst_gl_context_egl_choose_config (GstGLContextEGL * egl,
} else { } else {
g_set_error (error, GST_GL_CONTEXT_ERROR, GST_GL_CONTEXT_ERROR_WRONG_CONFIG, g_set_error (error, GST_GL_CONTEXT_ERROR, GST_GL_CONTEXT_ERROR_WRONG_CONFIG,
"Failed to set window configuration: %s", "Failed to set window configuration: %s",
gst_gl_context_egl_get_error_string ()); gst_gl_context_egl_get_error_string (eglGetError ()));
goto failure; goto failure;
} }
@ -288,7 +286,8 @@ gst_gl_context_egl_create_context (GstGLContext * context,
} else { } else {
g_set_error (error, GST_GL_CONTEXT_ERROR, g_set_error (error, GST_GL_CONTEXT_ERROR,
GST_GL_CONTEXT_ERROR_RESOURCE_UNAVAILABLE, GST_GL_CONTEXT_ERROR_RESOURCE_UNAVAILABLE,
"Failed to initialize egl: %s", gst_gl_context_egl_get_error_string ()); "Failed to initialize egl: %s",
gst_gl_context_egl_get_error_string (eglGetError ()));
goto failure; goto failure;
} }
@ -318,7 +317,7 @@ gst_gl_context_egl_create_context (GstGLContext * context,
if (!eglBindAPI (EGL_OPENGL_API)) { if (!eglBindAPI (EGL_OPENGL_API)) {
g_set_error (error, GST_GL_CONTEXT_ERROR, GST_GL_CONTEXT_ERROR_FAILED, g_set_error (error, GST_GL_CONTEXT_ERROR, GST_GL_CONTEXT_ERROR_FAILED,
"Failed to bind OpenGL API: %s", "Failed to bind OpenGL API: %s",
gst_gl_context_egl_get_error_string ()); gst_gl_context_egl_get_error_string (eglGetError ()));
goto failure; goto failure;
} }
@ -329,7 +328,7 @@ gst_gl_context_egl_create_context (GstGLContext * context,
if (!eglBindAPI (EGL_OPENGL_ES_API)) { if (!eglBindAPI (EGL_OPENGL_ES_API)) {
g_set_error (error, GST_GL_CONTEXT_ERROR, GST_GL_CONTEXT_ERROR_FAILED, g_set_error (error, GST_GL_CONTEXT_ERROR, GST_GL_CONTEXT_ERROR_FAILED,
"Failed to bind OpenGL|ES API: %s", "Failed to bind OpenGL|ES API: %s",
gst_gl_context_egl_get_error_string ()); gst_gl_context_egl_get_error_string (eglGetError ()));
goto failure; goto failure;
} }
@ -386,7 +385,7 @@ gst_gl_context_egl_create_context (GstGLContext * context,
g_set_error (error, GST_GL_CONTEXT_ERROR, g_set_error (error, GST_GL_CONTEXT_ERROR,
GST_GL_CONTEXT_ERROR_CREATE_CONTEXT, GST_GL_CONTEXT_ERROR_CREATE_CONTEXT,
"Failed to create a OpenGL context: %s", "Failed to create a OpenGL context: %s",
gst_gl_context_egl_get_error_string ()); gst_gl_context_egl_get_error_string (eglGetError ()));
goto failure; goto failure;
} }
/* FIXME do we want a window vfunc ? */ /* FIXME do we want a window vfunc ? */
@ -458,7 +457,7 @@ gst_gl_context_egl_create_context (GstGLContext * context,
} else { } else {
g_set_error (error, GST_GL_CONTEXT_ERROR, GST_GL_CONTEXT_ERROR_FAILED, g_set_error (error, GST_GL_CONTEXT_ERROR, GST_GL_CONTEXT_ERROR_FAILED,
"Failed to create window surface: %s", "Failed to create window surface: %s",
gst_gl_context_egl_get_error_string ()); gst_gl_context_egl_get_error_string (eglGetError ()));
goto failure; goto failure;
} }
} }
@ -540,7 +539,7 @@ gst_gl_context_egl_activate (GstGLContext * context, gboolean activate)
egl->egl_surface = EGL_NO_SURFACE; egl->egl_surface = EGL_NO_SURFACE;
if (!result) { if (!result) {
GST_ERROR_OBJECT (context, "Failed to destroy old window surface: %s", GST_ERROR_OBJECT (context, "Failed to destroy old window surface: %s",
gst_gl_context_egl_get_error_string ()); gst_gl_context_egl_get_error_string (eglGetError ()));
goto done; goto done;
} }
} }
@ -551,21 +550,22 @@ gst_gl_context_egl_activate (GstGLContext * context, gboolean activate)
if (egl->egl_surface == EGL_NO_SURFACE) { if (egl->egl_surface == EGL_NO_SURFACE) {
GST_ERROR_OBJECT (context, "Failed to create window surface: %s", GST_ERROR_OBJECT (context, "Failed to create window surface: %s",
gst_gl_context_egl_get_error_string ()); gst_gl_context_egl_get_error_string (eglGetError ()));
result = FALSE; result = FALSE;
goto done; goto done;
} }
} }
result = eglMakeCurrent (egl->egl_display, egl->egl_surface, result = eglMakeCurrent (egl->egl_display, egl->egl_surface,
egl->egl_surface, egl->egl_context); egl->egl_surface, egl->egl_context);
} else } else {
result = eglMakeCurrent (egl->egl_display, EGL_NO_SURFACE, result = eglMakeCurrent (egl->egl_display, EGL_NO_SURFACE,
EGL_NO_SURFACE, EGL_NO_CONTEXT); EGL_NO_SURFACE, EGL_NO_CONTEXT);
}
if (!result) { if (!result) {
GST_ERROR_OBJECT (context, GST_ERROR_OBJECT (context,
"Failed to bind context to the current rendering thread: %s", "Failed to bind context to the current rendering thread: %s",
gst_gl_context_egl_get_error_string ()); gst_gl_context_egl_get_error_string (eglGetError ()));
} }
done: done:

View file

@ -64,7 +64,7 @@ GstGLContextEGL * gst_gl_context_egl_new (GstGLDisplay * disp
guintptr gst_gl_context_egl_get_current_context (void); guintptr gst_gl_context_egl_get_current_context (void);
gpointer gst_gl_context_egl_get_proc_address (GstGLAPI gl_api, const gchar * name); gpointer gst_gl_context_egl_get_proc_address (GstGLAPI gl_api, const gchar * name);
const gchar * gst_gl_context_egl_get_error_string (void); const gchar * gst_gl_context_egl_get_error_string (EGLint err);
/* TODO: /* TODO: