From 5fe1f00f197ed2d8dbfe3baf0d147ad610345c3c Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Thu, 7 Apr 2022 14:12:15 +0300 Subject: libcamera: pipeline: simple: Store sensor resolution in configuration When enumerating the supported configurations, store the corresponding sensor resolution in the SimpleCameraData::Configuration structure and use it when configuring the camera, instead of hardcoding the sensor full resolution. This prepares for support of downscaling in the camera sensor. Signed-off-by: Laurent Pinchart Tested-by: Dorota Czaplejewicz Reviewed-by: Dorota Czaplejewicz Reviewed-by: Kieran Bingham --- src/libcamera/pipeline/simple/simple.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp index 3c90bdec..8c48162d 100644 --- a/src/libcamera/pipeline/simple/simple.cpp +++ b/src/libcamera/pipeline/simple/simple.cpp @@ -225,6 +225,7 @@ public: struct Configuration { uint32_t code; + Size sensorSize; PixelFormat captureFormat; Size captureSize; std::vector outputFormats; @@ -542,6 +543,7 @@ void SimpleCameraData::tryPipeline(unsigned int code, const Size &size) Configuration config; config.code = code; + config.sensorSize = size; config.captureFormat = pixelFormat; config.captureSize = format.size; @@ -943,7 +945,7 @@ int SimplePipelineHandler::configure(Camera *camera, CameraConfiguration *c) const SimpleCameraData::Configuration *pipeConfig = config->pipeConfig(); V4L2SubdeviceFormat format{}; format.mbus_code = pipeConfig->code; - format.size = data->sensor_->resolution(); + format.size = pipeConfig->sensorSize; ret = data->setupFormats(&format, V4L2Subdevice::ActiveFormat); if (ret < 0) -- cgit v1.2.1