log: Add some diagnostics to the log
authorKristian Høgsberg <krh@bitplanet.net>
Fri, 8 Jun 2012 20:45:33 +0000 (16:45 -0400)
committerKristian Høgsberg <krh@bitplanet.net>
Fri, 8 Jun 2012 20:45:33 +0000 (16:45 -0400)
Just a few useful things to get this started: egl vendor and extensions,
gles2 extensions, drm and kms info and just a bit of x11 backend info.

src/compositor-drm.c
src/compositor-x11.c
src/compositor.c

index 23b814c..45ef6ef 100644 (file)
@@ -1018,6 +1018,8 @@ init_egl(struct drm_compositor *ec, struct udev_device *device)
                return -1;
        }
 
+       weston_log("using %s\n", filename);
+
        ec->drm.fd = fd;
        ec->gbm = gbm_create_device(ec->drm.fd);
        ec->base.display = eglGetDisplay(ec->gbm);
@@ -1350,6 +1352,12 @@ create_output_for_connector(struct drm_compositor *ec,
        output->base.set_dpms = drm_set_dpms;
        output->base.switch_mode = drm_output_switch_mode;
 
+       weston_log("kms connector %d, crtc %d at mode %dx%d@%.1f\n",
+                  output->connector_id, output->crtc_id,
+                  output->base.current->width,
+                  output->base.current->height,
+                  output->base.current->refresh / 1000.0);
+
        return 0;
 
 err_surface:
@@ -1748,6 +1756,8 @@ drm_compositor_create(struct wl_display *display,
        struct wl_event_loop *loop;
        uint32_t key;
 
+       weston_log("initializing drm backend\n");
+
        ec = malloc(sizeof *ec);
        if (ec == NULL)
                return NULL;
index 4230a56..44a48b0 100644 (file)
@@ -523,6 +523,9 @@ x11_compositor_create_output(struct x11_compositor *c, int x, int y,
 
        wl_list_insert(c->base.output_list.prev, &output->base.link);
 
+       weston_log("x11 output %dx%d, window id %d\n",
+                  width, height, output->window);
+
        return 0;
 }
 
@@ -865,6 +868,8 @@ x11_compositor_create(struct wl_display *display,
        xcb_screen_iterator_t s;
        int i, x;
 
+       weston_log("initializing x11 backend\n");
+
        c = malloc(sizeof *c);
        if (c == NULL)
                return NULL;
index 8f02422..700f31b 100644 (file)
@@ -46,6 +46,7 @@
 #include <setjmp.h>
 #include <sys/time.h>
 #include <time.h>
+#include <ctype.h>
 
 #include <wayland-server.h>
 #include "compositor.h"
@@ -2873,6 +2874,26 @@ compositor_bind(struct wl_client *client,
                             &compositor_interface, id, compositor);
 }
 
+static void
+log_extensions(const char *name, const char *extensions)
+{
+       const char *p, *end;
+       int l;
+
+       l = weston_log("%s:", name);
+       p = extensions;
+       while (*p) {
+               end = strchrnul(p, ' ');
+               if (l + (end - p) > 78)
+                       l = weston_log_continue("\n  %.*s", end - p, p);
+               else
+                       l += weston_log_continue(" %.*s", end - p, p);
+               for (p = end; isspace(*p); p++)
+                       ;
+       }
+       weston_log_continue("\n");
+}
+
 WL_EXPORT int
 weston_compositor_init(struct weston_compositor *ec,
                       struct wl_display *display,
@@ -2913,6 +2934,11 @@ weston_compositor_init(struct weston_compositor *ec,
 
        wl_display_init_shm(display);
 
+       weston_log("egl vendor: %s\n",
+                  eglQueryString(ec->display, EGL_VENDOR));
+       log_extensions("egl extensions",
+                      eglQueryString(ec->display, EGL_EXTENSIONS));
+
        ec->image_target_texture_2d =
                (void *) eglGetProcAddress("glEGLImageTargetTexture2DOES");
        ec->image_target_renderbuffer_storage = (void *)
@@ -2930,6 +2956,8 @@ weston_compositor_init(struct weston_compositor *ec,
                return -1;
        }
 
+       log_extensions("gles2 extensions", extensions);
+
        if (!strstr(extensions, "GL_EXT_texture_format_BGRA8888")) {
                weston_log("GL_EXT_texture_format_BGRA8888 not available\n");
                return -1;