summaryrefslogtreecommitdiff
path: root/test/v4l2_videodevice/v4l2_videodevice_test.cpp
diff options
context:
space:
mode:
authorNiklas Söderlund <niklas.soderlund@ragnatech.se>2019-08-05 17:23:29 +0200
committerNiklas Söderlund <niklas.soderlund@ragnatech.se>2019-08-11 02:16:21 +0200
commit440f7b4153f22ac061a9fd2b2e7beb2370f158f5 (patch)
tree8271cd46935fa639ddd64f5634eb66e3206168cc /test/v4l2_videodevice/v4l2_videodevice_test.cpp
parent4debc71ffa7ffe92d23189c9157855ba89fccfea (diff)
tests: v4l2_videodevice: Set media bus and pixel formats for vimc
Most of the video device tests are based on vimc and Linux commit 85ab1aa1fac17bcd ("media: vimc: deb: fix default sink bayer format") changes the default media bus format for the debayer subdevices. This leads to a -EPIPE error when trying to use the raw capture video device nodes. Fix this by explicitly setting media bus and pixel formats to known good values which works before and after the upstream change. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'test/v4l2_videodevice/v4l2_videodevice_test.cpp')
-rw-r--r--test/v4l2_videodevice/v4l2_videodevice_test.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/v4l2_videodevice/v4l2_videodevice_test.cpp b/test/v4l2_videodevice/v4l2_videodevice_test.cpp
index b26d06ad..a0d269fe 100644
--- a/test/v4l2_videodevice/v4l2_videodevice_test.cpp
+++ b/test/v4l2_videodevice/v4l2_videodevice_test.cpp
@@ -8,6 +8,8 @@
#include <iostream>
#include <sys/stat.h>
+#include <linux/media-bus-format.h>
+
#include "v4l2_videodevice_test.h"
#include "device_enumerator.h"
@@ -69,6 +71,28 @@ int V4L2VideoDeviceTest::init()
if (capture_->getFormat(&format))
return TestFail;
+ if (driver_ == "vimc") {
+ sensor_ = new CameraSensor(media_->getEntityByName("Sensor A"));
+ if (sensor_->init())
+ return TestFail;
+
+ debayer_ = new V4L2Subdevice(media_->getEntityByName("Debayer A"));
+ if (debayer_->open())
+ return TestFail;
+
+ format.fourcc = V4L2_PIX_FMT_SBGGR8;
+
+ V4L2SubdeviceFormat subformat = {};
+ subformat.mbus_code = MEDIA_BUS_FMT_SBGGR8_1X8;
+ subformat.size = format.size;
+
+ if (sensor_->setFormat(&subformat))
+ return TestFail;
+
+ if (debayer_->setFormat(0, &subformat))
+ return TestFail;
+ }
+
format.size.width = 640;
format.size.height = 480;
if (capture_->setFormat(&format))
@@ -83,5 +107,7 @@ void V4L2VideoDeviceTest::cleanup()
capture_->releaseBuffers();
capture_->close();
+ delete debayer_;
+ delete sensor_;
delete capture_;
};