mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-24 17:15:07 +03:00
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>
This commit is contained in:
parent
4debc71ffa
commit
440f7b4153
2 changed files with 32 additions and 1 deletions
|
@ -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_;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue