gl, rpi: consolidate print_egl_error_state()

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@gmail.com>
dev
Pekka Paalanen 12 years ago committed by Kristian Høgsberg
parent 0a887728ea
commit 326529f900
  1. 40
      src/compositor-rpi.c
  2. 16
      src/gl-renderer.c
  3. 3
      src/gl-renderer.h

@ -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)
{
@ -1095,10 +1059,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;
}

@ -146,8 +146,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;
@ -683,7 +683,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;
}
@ -985,7 +985,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;
@ -1732,7 +1732,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;
}
@ -1812,7 +1812,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;
}
@ -1822,7 +1822,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;
}
@ -1830,7 +1830,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;
}

@ -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);

Loading…
Cancel
Save