[libcamera-devel] [PATCH v3 17/22] libcamera: raspberrypi: Fill stride and frameSize at config validation
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Sat Jul 4 23:50:04 CEST 2020
Hi Paul,
Thank you for the patch.
On Sat, Jul 04, 2020 at 10:31:35PM +0900, Paul Elder wrote:
> Fill the stride and frameSize fields of the StreamConfiguration at
> configuration validation time instead of at camera configuration time.
>
> Signed-off-by: Paul Elder <paul.elder at ideasonboard.com>
>
> ---
> New in v3
> ---
> src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> index 18d068a..fc696ff 100644
> --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> @@ -447,6 +447,10 @@ CameraConfiguration::Status RPiCameraConfiguration::validate()
>
> count++;
>
> + const PixelFormatInfo &info = PixelFormatInfo::info(cfg.pixelFormat);
> + cfg.stride = info.stride(cfg.size.width, 0);
> + cfg.frameSize = info.frameSize(cfg.size);
Same comment as for patch 16/22. If you want to calculate the stride and
frame size, you need to check the kernel drivers to see what additional
constraints they have. unicam_calc_format_size_bpl() in
drivers/media/platform/bcm2835/bcm2835-unicam.c for raw formats,
bcm2835_isp_node_try_fmt() in
drivers/staging/vc04_services/bcm2835-isp/bcm2835-v4l2-isp.c for other
formats.
> +
> /* Can only output 1 RAW stream, or 2 YUV/RGB streams. */
> if (rawCount > 1 || outCount > 2) {
> LOG(RPI, Error) << "Invalid number of streams requested";
> @@ -655,7 +659,6 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config)
>
> if (isRaw(cfg.pixelFormat)) {
> cfg.setStream(&data->isp_[Isp::Input]);
> - cfg.stride = sensorFormat.planes[0].bpl;
> data->isp_[Isp::Input].setExternal(true);
> continue;
> }
> @@ -679,7 +682,6 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config)
> }
>
> cfg.setStream(&data->isp_[Isp::Output0]);
> - cfg.stride = format.planes[0].bpl;
> data->isp_[Isp::Output0].setExternal(true);
> }
>
> @@ -705,7 +707,6 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config)
> */
> if (!cfg.stream()) {
> cfg.setStream(&data->isp_[Isp::Output1]);
> - cfg.stride = format.planes[0].bpl;
> data->isp_[Isp::Output1].setExternal(true);
> }
> }
--
Regards,
Laurent Pinchart
More information about the libcamera-devel
mailing list