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 <laurent.pinchart@ideasonboard.com>
Tested-by: Dorota Czaplejewicz <dorota.czaplejewicz@puri.sm>
Reviewed-by: Dorota Czaplejewicz <dorota.czaplejewicz@puri.sm>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
Laurent Pinchart 2022-04-07 14:12:15 +03:00
parent 6984f07c0e
commit 5fe1f00f19

View file

@ -225,6 +225,7 @@ public:
struct Configuration {
uint32_t code;
Size sensorSize;
PixelFormat captureFormat;
Size captureSize;
std::vector<PixelFormat> 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)