mirror of
https://gitlab.com/qemu-project/qemu
synced 2024-11-05 20:35:44 +00:00
ui/egl: print EGL error, helping debugging
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
This commit is contained in:
parent
aa34554a99
commit
1f086ef642
1 changed files with 48 additions and 6 deletions
|
@ -26,6 +26,48 @@ DisplayGLMode qemu_egl_mode;
|
|||
|
||||
/* ------------------------------------------------------------------ */
|
||||
|
||||
#if defined(CONFIG_X11) || defined(CONFIG_GBM)
|
||||
static const char *egl_get_error_string(void)
|
||||
{
|
||||
EGLint error = eglGetError();
|
||||
|
||||
switch (error) {
|
||||
case EGL_SUCCESS:
|
||||
return "EGL_SUCCESS";
|
||||
case EGL_NOT_INITIALIZED:
|
||||
return "EGL_NOT_INITIALIZED";
|
||||
case EGL_BAD_ACCESS:
|
||||
return "EGL_BAD_ACCESS";
|
||||
case EGL_BAD_ALLOC:
|
||||
return "EGL_BAD_ALLOC";
|
||||
case EGL_BAD_ATTRIBUTE:
|
||||
return "EGL_BAD_ATTRIBUTE";
|
||||
case EGL_BAD_CONTEXT:
|
||||
return "EGL_BAD_CONTEXT";
|
||||
case EGL_BAD_CONFIG:
|
||||
return "EGL_BAD_CONFIG";
|
||||
case EGL_BAD_CURRENT_SURFACE:
|
||||
return "EGL_BAD_CURRENT_SURFACE";
|
||||
case EGL_BAD_DISPLAY:
|
||||
return "EGL_BAD_DISPLAY";
|
||||
case EGL_BAD_SURFACE:
|
||||
return "EGL_BAD_SURFACE";
|
||||
case EGL_BAD_MATCH:
|
||||
return "EGL_BAD_MATCH";
|
||||
case EGL_BAD_PARAMETER:
|
||||
return "EGL_BAD_PARAMETER";
|
||||
case EGL_BAD_NATIVE_PIXMAP:
|
||||
return "EGL_BAD_NATIVE_PIXMAP";
|
||||
case EGL_BAD_NATIVE_WINDOW:
|
||||
return "EGL_BAD_NATIVE_WINDOW";
|
||||
case EGL_CONTEXT_LOST:
|
||||
return "EGL_CONTEXT_LOST";
|
||||
default:
|
||||
return "Unknown EGL error";
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void egl_fb_delete_texture(egl_fb *fb)
|
||||
{
|
||||
if (!fb->delete_texture) {
|
||||
|
@ -438,20 +480,20 @@ static int qemu_egl_init_dpy(EGLNativeDisplayType dpy,
|
|||
|
||||
qemu_egl_display = qemu_egl_get_display(dpy, platform);
|
||||
if (qemu_egl_display == EGL_NO_DISPLAY) {
|
||||
error_report("egl: eglGetDisplay failed");
|
||||
error_report("egl: eglGetDisplay failed: %s", egl_get_error_string());
|
||||
return -1;
|
||||
}
|
||||
|
||||
b = eglInitialize(qemu_egl_display, &major, &minor);
|
||||
if (b == EGL_FALSE) {
|
||||
error_report("egl: eglInitialize failed");
|
||||
error_report("egl: eglInitialize failed: %s", egl_get_error_string());
|
||||
return -1;
|
||||
}
|
||||
|
||||
b = eglBindAPI(gles ? EGL_OPENGL_ES_API : EGL_OPENGL_API);
|
||||
if (b == EGL_FALSE) {
|
||||
error_report("egl: eglBindAPI failed (%s mode)",
|
||||
gles ? "gles" : "core");
|
||||
error_report("egl: eglBindAPI failed (%s mode): %s",
|
||||
gles ? "gles" : "core", egl_get_error_string());
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -459,8 +501,8 @@ static int qemu_egl_init_dpy(EGLNativeDisplayType dpy,
|
|||
gles ? conf_att_gles : conf_att_core,
|
||||
&qemu_egl_config, 1, &n);
|
||||
if (b == EGL_FALSE || n != 1) {
|
||||
error_report("egl: eglChooseConfig failed (%s mode)",
|
||||
gles ? "gles" : "core");
|
||||
error_report("egl: eglChooseConfig failed (%s mode): %s",
|
||||
gles ? "gles" : "core", egl_get_error_string());
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue