[libcamera-devel,3/3] test: v4l2_videodevice: Fix format configuration in the vimc pipeline
diff mbox series

Message ID 20220407083719.21631-4-laurent.pinchart@ideasonboard.com
State Accepted
Commit 302731cdf8e107f8fa005309f3475f98581de8e6
Headers show
Series
  • test: Fix dequeue_watchdog test failure when running the whole test suite
Related show

Commit Message

Laurent Pinchart April 7, 2022, 8:37 a.m. UTC
The V4L2VideoDeviceTest class configures the capture pipeline with
parameters that are partly hardcoded, and partly come from the current
configuration of the device. In particular, with the vimc pipeline, the
sensor subdevice is configured with the size retrieved from the capture
video node, and the video node is then reconfigured to 640x480.

Relying on the current (and thus possibly random) device configuration
can lead to broken pipes when starting streaming. This currently causes
failures of the dequeue_watchdog test when run after the formats test.

Fix it by explicitly setting the same size for both the vimc subdevs and
the video capture device.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 test/v4l2_videodevice/v4l2_videodevice_test.cpp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Nicolas Dufresne via libcamera-devel April 7, 2022, 11:27 a.m. UTC | #1
Hi Laurent,

On Thu, Apr 07, 2022 at 11:37:19AM +0300, Laurent Pinchart via libcamera-devel wrote:
> The V4L2VideoDeviceTest class configures the capture pipeline with
> parameters that are partly hardcoded, and partly come from the current
> configuration of the device. In particular, with the vimc pipeline, the
> sensor subdevice is configured with the size retrieved from the capture
> video node, and the video node is then reconfigured to 640x480.
> 
> Relying on the current (and thus possibly random) device configuration
> can lead to broken pipes when starting streaming. This currently causes
> failures of the dequeue_watchdog test when run after the formats test.
> 
> Fix it by explicitly setting the same size for both the vimc subdevs and
> the video capture device.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>

> ---
>  test/v4l2_videodevice/v4l2_videodevice_test.cpp | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/test/v4l2_videodevice/v4l2_videodevice_test.cpp b/test/v4l2_videodevice/v4l2_videodevice_test.cpp
> index f23aaf8f514b..125aafd65041 100644
> --- a/test/v4l2_videodevice/v4l2_videodevice_test.cpp
> +++ b/test/v4l2_videodevice/v4l2_videodevice_test.cpp
> @@ -60,6 +60,9 @@ int V4L2VideoDeviceTest::init()
>  	if (capture_->getFormat(&format))
>  		return TestFail;
>  
> +	format.size.width = 640;
> +	format.size.height = 480;
> +
>  	if (driver_ == "vimc") {
>  		sensor_ = new CameraSensor(media_->getEntityByName("Sensor A"));
>  		if (sensor_->init())
> @@ -82,8 +85,6 @@ int V4L2VideoDeviceTest::init()
>  			return TestFail;
>  	}
>  
> -	format.size.width = 640;
> -	format.size.height = 480;
>  	if (capture_->setFormat(&format))
>  		return TestFail;

Patch
diff mbox series

diff --git a/test/v4l2_videodevice/v4l2_videodevice_test.cpp b/test/v4l2_videodevice/v4l2_videodevice_test.cpp
index f23aaf8f514b..125aafd65041 100644
--- a/test/v4l2_videodevice/v4l2_videodevice_test.cpp
+++ b/test/v4l2_videodevice/v4l2_videodevice_test.cpp
@@ -60,6 +60,9 @@  int V4L2VideoDeviceTest::init()
 	if (capture_->getFormat(&format))
 		return TestFail;
 
+	format.size.width = 640;
+	format.size.height = 480;
+
 	if (driver_ == "vimc") {
 		sensor_ = new CameraSensor(media_->getEntityByName("Sensor A"));
 		if (sensor_->init())
@@ -82,8 +85,6 @@  int V4L2VideoDeviceTest::init()
 			return TestFail;
 	}
 
-	format.size.width = 640;
-	format.size.height = 480;
 	if (capture_->setFormat(&format))
 		return TestFail;