display-kms: add option to disable multiplanar
authorHervé Fache <h-fache@ti.com>
Tue, 28 Aug 2012 12:00:26 +0000 (14:00 +0200)
committerHervé Fache <h-fache@ti.com>
Thu, 30 Aug 2012 07:59:43 +0000 (09:59 +0200)
Signed-off-by: Hervé Fache <h-fache@ti.com>
Conflicts:

util/display-kms.c

util/display-kms.c

index c15bf79a6c8c717dcea24a83a497a1493501cbab..b9cdc4e7af2dca3985adc14ad213f4eccbbe08ff 100644 (file)
@@ -138,11 +138,21 @@ alloc_buffer(struct display *disp, uint32_t fourcc, uint32_t w, uint32_t h)
                                &bo_handles[0], &buf->pitches[0]);
                break;
        case FOURCC('N','V','1','2'):
-               buf->nbo = 2;
-               buf->bo[0] = alloc_bo(disp, 8, buf->width, buf->height,
-                               &bo_handles[0], &buf->pitches[0]);
-               buf->bo[1] = alloc_bo(disp, 16, buf->width/2, buf->height/2,
-                               &bo_handles[1], &buf->pitches[1]);
+               if (disp->multiplanar) {
+                       buf->nbo = 2;
+                       buf->bo[0] = alloc_bo(disp, 8, buf->width, buf->height,
+                                       &bo_handles[0], &buf->pitches[0]);
+                       buf->bo[1] = alloc_bo(disp, 16, buf->width/2, buf->height/2,
+                                       &bo_handles[1], &buf->pitches[1]);
+               } else {
+                       buf->nbo = 1;
+                       buf->bo[0] = alloc_bo(disp, 8, buf->width, buf->height * 3 / 2,
+                                       &bo_handles[0], &buf->pitches[0]);
+                       bo_handles[1] = bo_handles[0];
+                       buf->pitches[1] = buf->pitches[0];
+                       offsets[1] = buf->width * buf->height;
+                       buf->multiplanar = false;
+               }
                break;
        case FOURCC('I','4','2','0'):
                buf->nbo = 3;
@@ -443,6 +453,7 @@ void
 disp_kms_usage(void)
 {
        MSG("KMS Display Options:");
+       MSG("\t-1 \t\tforce single-plane buffers");
        MSG("\t-t <tiled-mode>\t8, 16, 32, or auto");
        MSG("\t-s <connector_id>:<mode>\tset a mode");
        MSG("\t-s <connector_id>@<crtc_id>:<mode>\tset a mode");
@@ -492,6 +503,8 @@ disp_kms_open(int argc, char **argv)
                goto fail;
        }
 
+       disp->multiplanar = true;
+
        /* note: set args to NULL after we've parsed them so other modules know
         * that it is already parsed (since the arg parsing is decentralized)
         */
@@ -499,7 +512,9 @@ disp_kms_open(int argc, char **argv)
                if (!argv[i]) {
                        continue;
                }
-               if (!strcmp("-t", argv[i])) {
+               if (!strcmp("-1", argv[i])) {
+                       disp->multiplanar = false;
+               } else if (!strcmp("-t", argv[i])) {
                        int n;
                        argv[i++] = NULL;
                        if (!strcmp(argv[i], "auto")) {
@@ -549,7 +564,6 @@ disp_kms_open(int argc, char **argv)
 
        disp->width = 0;
        disp->height = 0;
-       disp->multiplanar = true;
        for (i = 0; i < (int)disp_kms->connectors_count; i++) {
                struct connector *c = &disp_kms->connector[i];
                connector_find_mode(disp, c);