terminal: be more verbose when adding displays
authorDavid Herrmann <dh.herrmann@googlemail.com>
Sat, 21 Jul 2012 13:32:19 +0000 (15:32 +0200)
committerDavid Herrmann <dh.herrmann@googlemail.com>
Sat, 21 Jul 2012 13:32:19 +0000 (15:32 +0200)
When adding displays, we know print errors if we cannot allocate buffers
or other resources. This helps debugging video problems where the device
is ready but the terminal is not printed.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
src/terminal.c

index f87bfeb..9b8f345 100644 (file)
@@ -133,26 +133,34 @@ static int add_display(struct kmscon_terminal *term, struct uterm_display *disp)
        }
 
        scr = malloc(sizeof(*scr));
-       if (!scr)
+       if (!scr) {
+               log_error("cannot allocate memory for display %p");
                return -ENOMEM;
+       }
        memset(scr, 0, sizeof(*scr));
        scr->disp = disp;
 
        ret = uterm_screen_new_single(&scr->screen, disp);
-       if (ret)
+       if (ret) {
+               log_error("cannot create screen for display %p", scr->disp);
                goto err_free;
+       }
 
        width = uterm_screen_width(scr->screen);
        height = uterm_screen_height(scr->screen);
 
        ret = font_buffer_new(&scr->buf, width, height);
-       if (ret)
+       if (ret) {
+               log_error("cannot create buffer for display %p", scr->disp);
                goto err_screen;
+       }
 
        ret = font_screen_new_fixed(&scr->fscr, scr->buf, FONT_ATTR(NULL, 12, 0),
                                80, 24, scr->screen, term->shader);
-       if (ret)
+       if (ret) {
+               log_error("cannot create font for display %p", scr->disp);
                goto err_buf;
+       }
 
        scr->next = term->screens;
        if (scr->next)