[PATCH weston] gl, rpi: consolidate print_egl_error_state()
Pekka Paalanen
ppaalanen at gmail.com
Tue Nov 27 02:25:25 PST 2012
Rename print_egl_error_state() to gl_renderer_print_egl_error_state()
and exports it.
Remove the copy of that function from the rpi backend, and call
the exported function instead.
Signed-off-by: Pekka Paalanen <ppaalanen at gmail.com>
---
src/compositor-rpi.c | 40 ++--------------------------------------
src/gl-renderer.c | 16 ++++++++--------
src/gl-renderer.h | 3 +++
3 files changed, 13 insertions(+), 46 deletions(-)
diff --git a/src/compositor-rpi.c b/src/compositor-rpi.c
index 55184a5..fe6901b 100644
--- a/src/compositor-rpi.c
+++ b/src/compositor-rpi.c
@@ -193,42 +193,6 @@ to_rpi_compositor(struct weston_compositor *base)
return container_of(base, struct rpi_compositor, base);
}
-static const char *
-egl_error_string(EGLint code)
-{
-#define MYERRCODE(x) case x: return #x;
- switch (code) {
- MYERRCODE(EGL_SUCCESS)
- MYERRCODE(EGL_NOT_INITIALIZED)
- MYERRCODE(EGL_BAD_ACCESS)
- MYERRCODE(EGL_BAD_ALLOC)
- MYERRCODE(EGL_BAD_ATTRIBUTE)
- MYERRCODE(EGL_BAD_CONTEXT)
- MYERRCODE(EGL_BAD_CONFIG)
- MYERRCODE(EGL_BAD_CURRENT_SURFACE)
- MYERRCODE(EGL_BAD_DISPLAY)
- MYERRCODE(EGL_BAD_SURFACE)
- MYERRCODE(EGL_BAD_MATCH)
- MYERRCODE(EGL_BAD_PARAMETER)
- MYERRCODE(EGL_BAD_NATIVE_PIXMAP)
- MYERRCODE(EGL_BAD_NATIVE_WINDOW)
- MYERRCODE(EGL_CONTEXT_LOST)
- default:
- return "unknown";
- }
-#undef MYERRCODE
-}
-
-static void
-print_egl_error_state(void)
-{
- EGLint code;
-
- code = eglGetError();
- weston_log("EGL error state: %s (0x%04lx)\n",
- egl_error_string(code), (long)code);
-}
-
static inline int
int_max(int a, int b)
{
@@ -1094,10 +1058,10 @@ rpi_output_create(struct rpi_compositor *compositor)
goto out_output;
if (!eglSurfaceAttrib(gl_renderer_display(&compositor->base),
- gl_renderer_output_surface(&output->base),
+ gl_renderer_output_surface(&output->base),
EGL_SWAP_BEHAVIOR, EGL_BUFFER_PRESERVED)) {
- print_egl_error_state();
weston_log("Failed to set swap behaviour to preserved.\n");
+ gl_renderer_print_egl_error_state();
goto out_gl;
}
diff --git a/src/gl-renderer.c b/src/gl-renderer.c
index 9a1d80a..9c931e8 100644
--- a/src/gl-renderer.c
+++ b/src/gl-renderer.c
@@ -151,8 +151,8 @@ egl_error_string(EGLint code)
#undef MYERRCODE
}
-static void
-print_egl_error_state(void)
+WL_EXPORT void
+gl_renderer_print_egl_error_state(void)
{
EGLint code;
@@ -689,7 +689,7 @@ use_output(struct weston_output *output)
return -1;
errored = 1;
weston_log("Failed to make EGL context current.\n");
- print_egl_error_state();
+ gl_renderer_print_egl_error_state();
return -1;
}
@@ -991,7 +991,7 @@ gl_renderer_repaint_output(struct weston_output *output,
if (ret == EGL_FALSE && !errored) {
errored = 1;
weston_log("Failed in eglSwapBuffers.\n");
- print_egl_error_state();
+ gl_renderer_print_egl_error_state();
}
go->current_buffer ^= 1;
@@ -1766,7 +1766,7 @@ gl_renderer_create(struct weston_compositor *ec, EGLNativeDisplayType display,
return 0;
err_egl:
- print_egl_error_state();
+ gl_renderer_print_egl_error_state();
free(gr);
return -1;
}
@@ -1846,7 +1846,7 @@ gl_renderer_setup(struct weston_compositor *ec, EGLSurface egl_surface)
if (!eglBindAPI(EGL_OPENGL_ES_API)) {
weston_log("failed to bind EGL_OPENGL_ES_API\n");
- print_egl_error_state();
+ gl_renderer_print_egl_error_state();
return -1;
}
@@ -1856,7 +1856,7 @@ gl_renderer_setup(struct weston_compositor *ec, EGLSurface egl_surface)
EGL_NO_CONTEXT, context_attribs);
if (gr->egl_context == NULL) {
weston_log("failed to create context\n");
- print_egl_error_state();
+ gl_renderer_print_egl_error_state();
return -1;
}
@@ -1864,7 +1864,7 @@ gl_renderer_setup(struct weston_compositor *ec, EGLSurface egl_surface)
egl_surface, gr->egl_context);
if (ret == EGL_FALSE) {
weston_log("Failed to make EGL context current.\n");
- print_egl_error_state();
+ gl_renderer_print_egl_error_state();
return -1;
}
diff --git a/src/gl-renderer.h b/src/gl-renderer.h
index 7494cff..09c58c5 100644
--- a/src/gl-renderer.h
+++ b/src/gl-renderer.h
@@ -44,3 +44,6 @@ gl_renderer_set_border(struct weston_compositor *ec, int32_t width, int32_t heig
int32_t *edges);
void
gl_renderer_destroy(struct weston_compositor *ec);
+
+void
+gl_renderer_print_egl_error_state(void);
--
1.7.8.6
More information about the wayland-devel
mailing list