dmabuftest: Use 6 buffers instead of 3
authorNikhil Devshatwar <nikhil.nd@ti.com>
Sun, 5 Jan 2014 16:36:27 +0000 (22:06 +0530)
committerNikhil Devshatwar <nikhil.nd@ti.com>
Tue, 25 Mar 2014 09:02:51 +0000 (14:32 +0530)
Use 6 buffers instead of 3
Queue all the buffers before calling stream ON

Signed-off-by: Nikhil Devshatwar <nikhil.nd@ti.com>
dmabuftest.c

index a8329eb723e7330b0381d23f4d9c37f7f2e895e6..120db820e46a4661e22fc7e2a8bd1c1f5b0cd6c7 100644 (file)
@@ -19,8 +19,8 @@
 #include <pthread.h>
 #include "util.h"
 
-#define NBUF 3
-#define CNT  500
+#define NBUF 6
+#define CNT  500000
 
 enum display_area {
        FULL,
@@ -53,7 +53,7 @@ capture_loop(void *arg)
        uint32_t fourcc = data->fourcc;
        uint32_t width = data->width, height = data->height;
 
-       struct buffer **buffers;
+       struct buffer **buffers, *capt;
        int ret, i;
 
        buffers = disp_get_vid_buffers(disp, NBUF, fourcc, width, height);
@@ -72,24 +72,29 @@ capture_loop(void *arg)
                        get_overlay_plane(disp, buffers[i]);
                }
        }
-       v4l2_qbuf(v4l2, buffers[0]);
+
+       for (i = 0; i < NBUF; i++) {
+               v4l2_qbuf(v4l2, buffers[i]);
+       }
+
        v4l2_streamon(v4l2);
        for (i = 1; i < CNT; i++) {
-               v4l2_qbuf(v4l2, buffers[i % NBUF]);
 
+               capt = v4l2_dqbuf(v4l2);
                switch(data->area) {
                case FULL:
-                       ret = disp_post_vid_buffer(disp, v4l2_dqbuf(v4l2),
+                       ret = disp_post_vid_buffer(disp, capt,
                                0, 0, width, height);
                break;
                case OVERLAY:
-                       ret = disp_post_vid_buffer(disp, v4l2_dqbuf(v4l2),
+                       ret = disp_post_vid_buffer(disp, capt,
                                0, 0, width, height);
                break;
                }
                if (ret) {
                        return NULL;
                }
+               v4l2_qbuf(v4l2, capt);
        }
        v4l2_streamoff(v4l2);