diff --git a/dmabuftest.c b/dmabuftest.c
index 120db820e46a4661e22fc7e2a8bd1c1f5b0cd6c7..0dbb32ad702cfb1f2b49f1b51b5d55394e14ba6d 100644 (file)
--- a/dmabuftest.c
+++ b/dmabuftest.c
/*
* Copyright (C) 2011 Texas Instruments
* Author: Rob Clark <rob.clark@linaro.org>
+ * Adopted for testing VIP capture by: Nikhil Devshatwar <nikhil.nd@ti.com>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published by
#define NBUF 6
#define CNT 500000
-
-enum display_area {
- FULL,
- OVERLAY
-};
+#define MAX_CAP 6
struct thr_data {
struct display *disp;
struct v4l2 *v4l2;
uint32_t fourcc, width, height;
- enum display_area area;
};
static void
MSG("Usage: %s [OPTION]...", name);
MSG("Test of buffer passing between v4l2 camera and display.");
MSG("");
+ MSG("viddec3test options:");
+ MSG("\t-h, --help: Print this help and exit.");
+ MSG("\t--multi <num>: Capture from <num> different devices.");
+ MSG("\t\t\tEach device name and format would be parsed in the cmdline");
+ MSG("");
disp_usage();
v4l2_usage();
}
return NULL;
}
- if(data->area == OVERLAY) {
- for (i = 0; i < NBUF; i++) {
- buffers[i]->noScale = true;
- get_overlay_plane(disp, buffers[i]);
- }
- }
-
for (i = 0; i < NBUF; i++) {
v4l2_qbuf(v4l2, buffers[i]);
}
- v4l2_streamon(v4l2);
+ ret = v4l2_streamon(v4l2);
+ if (ret) {
+ return NULL;
+ }
+
for (i = 1; i < CNT; i++) {
capt = v4l2_dqbuf(v4l2);
- switch(data->area) {
- case FULL:
- ret = disp_post_vid_buffer(disp, capt,
- 0, 0, width, height);
- break;
- case OVERLAY:
- ret = disp_post_vid_buffer(disp, capt,
- 0, 0, width, height);
- break;
- }
+ ret = disp_post_vid_buffer(disp, capt,
+ 0, 0, width, height);
if (ret) {
+ ERROR("Post buffer failed");
return NULL;
}
v4l2_qbuf(v4l2, capt);
{
struct display *disp;
struct v4l2 *v4l2;
- pthread_t threads[2];
- struct thr_data tdata[2];
+ pthread_t threads[MAX_CAP];
+ struct thr_data tdata[MAX_CAP];
void *result = NULL;
- int ret = 0, i, dual = 0;
+ int ret = 0, i, multi = 1, idx = 0;
+ char c;
MSG("Opening Display..");
disp = disp_open(argc, argv);
if (!argv[i])
continue;
- if (!strcmp("--dual", argv[i])) {
- dual = 1;
+ if (!strcmp("--multi", argv[i])) {
+ argv[i++] = NULL;
+ sscanf(argv[i], "%d", &multi);
argv[i] = NULL;
+ if(multi < 1 || multi > MAX_CAP) {
+ usage(argv[i]);
+ return 1;
+ }
}
}
- MSG("Opening V4L2..");
- v4l2 = v4l2_open(argc, argv, &tdata[0].fourcc,
- &tdata[0].width, &tdata[0].height);
- if (!v4l2) {
- usage(argv[0]);
- return 1;
- }
- tdata[0].disp = disp;
- tdata[0].v4l2 = v4l2;
- tdata[0].area = FULL;
-
- if(dual) {
- MSG("Opening second V4L2..");
- v4l2 = v4l2_open(argc, argv, &tdata[1].fourcc,
- &tdata[1].width, &tdata[1].height);
+ for (i = 0; i < multi; i++) {
+ MSG("Opening V4L2..");
+ v4l2 = v4l2_open(argc, argv, &tdata[i].fourcc,
+ &tdata[i].width, &tdata[i].height);
if (!v4l2) {
usage(argv[0]);
return 1;
}
- tdata[1].disp = disp;
- tdata[1].v4l2 = v4l2;
- tdata[1].area = OVERLAY;
+ tdata[i].disp = disp;
+ tdata[i].v4l2 = v4l2;
}
if (check_args(argc, argv)) {
return 0;
}
- if(dual) {
- ret = pthread_create(&threads[0], NULL, capture_loop, &tdata[0]);
+ for (i = 0; i < multi; i++) {
+ ret = pthread_create(&threads[i], NULL, capture_loop, &tdata[i]);
if(ret) {
MSG("Failed creating thread");
}
- ret = pthread_create(&threads[1], NULL, capture_loop, &tdata[1]);
- if(ret) {
- MSG("Failed creating thread");
- }
- } else {
- capture_loop(&tdata[0]);
}
- pthread_join(threads[0], &result);
- pthread_join(threads[1], &result);
+ for (i = 0; i < multi; i++) {
+ pthread_join(threads[i], &result);
+ }
disp_close(disp);