uterm: video: ignore NULL buffers in vector requests
authorDavid Herrmann <dh.herrmann@googlemail.com>
Fri, 21 Sep 2012 11:20:21 +0000 (13:20 +0200)
committerDavid Herrmann <dh.herrmann@googlemail.com>
Fri, 21 Sep 2012 11:20:21 +0000 (13:20 +0200)
When multiple requests are pushed into the video backends at once, we
should ignore NULL buffers. Otherwise, users might have to re-order
buffers just so we don't segfault. Instead, we now ignore them and the
application can set requests to NULL to signal us that it is unused.

This fixes some bugs with multi-monitor setups and kmscon.

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

index 1259145..6ea5355 100644 (file)
@@ -766,6 +766,9 @@ static int display_fake_blendv(struct uterm_display *disp,
                return -EINVAL;
 
        for (i = 0; i < num; ++i, ++req) {
+               if (!req->buf)
+                       continue;
+
                ret = display_blend(disp, req->buf, req->x, req->y,
                                    req->fr, req->fg, req->fb,
                                    req->br, req->bg, req->bb);
index c3c4506..b054ff2 100644 (file)
@@ -518,6 +518,9 @@ static int display_fake_blendv(struct uterm_display *disp,
        sh = disp->current_mode->dumb.info.vdisplay;
 
        for (j = 0; j < num; ++j, ++req) {
+               if (!req->buf)
+                       continue;
+
                if (req->buf->format != UTERM_FORMAT_GREY)
                        return -EOPNOTSUPP;
 
index ed17ae1..877ea28 100644 (file)
@@ -651,6 +651,9 @@ static int display_fake_blendv(struct uterm_display *disp,
                return -EINVAL;
 
        for (j = 0; j < num; ++j, ++req) {
+               if (!req->buf)
+                       continue;
+
                if (req->buf->format != UTERM_FORMAT_GREY)
                        return -EOPNOTSUPP;