From 4e1065491bebef7213b8f496c6b8e1be526f1be0 Mon Sep 17 00:00:00 2001 From: Pekka Paalanen Date: Thu, 14 Feb 2013 11:49:12 +0200 Subject: [PATCH] window: improve EGL-related error messages Make them explicitly mention EGL, otherwise one can easily think that "failed to initialize display" refers to Wayland display. Also explicitly mention falling back to wl_shm. I tested this with a LD_PRELOAD trick that overrides eglBindAPI and makes it fail. Signed-off-by: Pekka Paalanen --- clients/window.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/clients/window.c b/clients/window.c index 9c21f06..404c92f 100644 --- a/clients/window.c +++ b/clients/window.c @@ -4147,36 +4147,36 @@ init_egl(struct display *d) d->dpy = eglGetDisplay(d->display); if (!eglInitialize(d->dpy, &major, &minor)) { - fprintf(stderr, "failed to initialize display\n"); + fprintf(stderr, "failed to initialize EGL\n"); return -1; } if (!eglBindAPI(api)) { - fprintf(stderr, "failed to bind api EGL_OPENGL_API\n"); + fprintf(stderr, "failed to bind EGL client API\n"); return -1; } if (!eglChooseConfig(d->dpy, argb_cfg_attribs, &d->argb_config, 1, &n) || n != 1) { - fprintf(stderr, "failed to choose argb config\n"); + fprintf(stderr, "failed to choose argb EGL config\n"); return -1; } d->argb_ctx = eglCreateContext(d->dpy, d->argb_config, EGL_NO_CONTEXT, context_attribs); if (d->argb_ctx == NULL) { - fprintf(stderr, "failed to create context\n"); + fprintf(stderr, "failed to create EGL context\n"); return -1; } if (!eglMakeCurrent(d->dpy, NULL, NULL, d->argb_ctx)) { - fprintf(stderr, "failed to make context current\n"); + fprintf(stderr, "failed to make EGL context current\n"); return -1; } d->argb_device = cairo_egl_device_create(d->dpy, d->argb_ctx); if (cairo_device_status(d->argb_device) != CAIRO_STATUS_SUCCESS) { - fprintf(stderr, "failed to get cairo egl argb device\n"); + fprintf(stderr, "failed to get cairo EGL argb device\n"); return -1; } @@ -4260,7 +4260,7 @@ display_create(int argc, char *argv[]) d->display = wl_display_connect(NULL); if (d->display == NULL) { - fprintf(stderr, "failed to create display: %m\n"); + fprintf(stderr, "failed to connect to Wayland display: %m\n"); free(d); return NULL; } @@ -4289,7 +4289,9 @@ display_create(int argc, char *argv[]) wl_registry_add_listener(d->registry, ®istry_listener, d); wl_display_dispatch(d->display); #ifdef HAVE_CAIRO_EGL - init_egl(d); + if (init_egl(d) < 0) + fprintf(stderr, "EGL does not seem to work, " + "falling back to software rendering and wl_shm.\n"); #endif create_cursors(d); -- 2.7.4