Message ID | 20241126151203.108407-3-dan.scally@ideasonboard.com |
---|---|
State | Accepted |
Headers | show |
Series |
|
Related | show |
Quoting Daniel Scally (2024-11-26 15:12:03) > Rather than hard coding default delays for control values in the > pipeline handlers, pick up the ones defined in the CameraSensor > properties. > > Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> > Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> > --- > Changes in v5: > > - Fixed the includes in each pipeline (remove property_ids.h, added > camera_sensor_properties.h) > > Changes in v4: > > - Used the struct reference rather than values directly > > Changes in v3: > > - Fixed some broken alignment > > Changes in v2: > > - Switched to use the new getSensorDelays() function > > src/libcamera/pipeline/ipu3/ipu3.cpp | 11 ++++------- > src/libcamera/pipeline/rkisp1/rkisp1.cpp | 11 ++++------- > src/libcamera/pipeline/simple/simple.cpp | 6 ++++-- > 3 files changed, 12 insertions(+), 16 deletions(-) > > diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp > index 0069d5e2..e31e3879 100644 > --- a/src/libcamera/pipeline/ipu3/ipu3.cpp > +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp > @@ -28,6 +28,7 @@ > #include "libcamera/internal/camera.h" > #include "libcamera/internal/camera_lens.h" > #include "libcamera/internal/camera_sensor.h" > +#include "libcamera/internal/camera_sensor_properties.h" > #include "libcamera/internal/delayed_controls.h" > #include "libcamera/internal/device_enumerator.h" > #include "libcamera/internal/framebuffer.h" > @@ -1077,14 +1078,10 @@ int PipelineHandlerIPU3::registerCameras() > if (ret) > continue; > > - /* > - * \todo Read delay values from the sensor itself or from a > - * a sensor database. For now use generic values taken from > - * the Raspberry Pi and listed as 'generic values'. > - */ > + const CameraSensorProperties::SensorDelays &delays = cio2->sensor()->sensorDelays(); > std::unordered_map<uint32_t, DelayedControls::ControlParams> params = { > - { V4L2_CID_ANALOGUE_GAIN, { 1, false } }, > - { V4L2_CID_EXPOSURE, { 2, false } }, > + { V4L2_CID_ANALOGUE_GAIN, { delays.gainDelay, false } }, > + { V4L2_CID_EXPOSURE, { delays.exposureDelay, false } }, > }; > > data->delayedCtrls_ = > diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp > index 6c6d711f..908724e2 100644 > --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp > +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp > @@ -34,6 +34,7 @@ > > #include "libcamera/internal/camera.h" > #include "libcamera/internal/camera_sensor.h" > +#include "libcamera/internal/camera_sensor_properties.h" > #include "libcamera/internal/converter/converter_v4l2_m2m.h" > #include "libcamera/internal/delayed_controls.h" > #include "libcamera/internal/device_enumerator.h" > @@ -1239,14 +1240,10 @@ int PipelineHandlerRkISP1::createCamera(MediaEntity *sensor) > /* Initialize the camera properties. */ > data->properties_ = data->sensor_->properties(); > > - /* > - * \todo Read delay values from the sensor itself or from a > - * a sensor database. For now use generic values taken from > - * the Raspberry Pi and listed as generic values. > - */ > + const CameraSensorProperties::SensorDelays &delays = data->sensor_->sensorDelays(); > std::unordered_map<uint32_t, DelayedControls::ControlParams> params = { > - { V4L2_CID_ANALOGUE_GAIN, { 1, false } }, > - { V4L2_CID_EXPOSURE, { 2, false } }, > + { V4L2_CID_ANALOGUE_GAIN, { delays.gainDelay, false } }, > + { V4L2_CID_EXPOSURE, { delays.exposureDelay, false } }, > }; > > data->delayedCtrls_ = > diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp > index 41fdf84c..dae9f31f 100644 > --- a/src/libcamera/pipeline/simple/simple.cpp > +++ b/src/libcamera/pipeline/simple/simple.cpp > @@ -31,6 +31,7 @@ > > #include "libcamera/internal/camera.h" > #include "libcamera/internal/camera_sensor.h" > +#include "libcamera/internal/camera_sensor_properties.h" > #include "libcamera/internal/converter.h" > #include "libcamera/internal/delayed_controls.h" > #include "libcamera/internal/device_enumerator.h" > @@ -1290,9 +1291,10 @@ int SimplePipelineHandler::configure(Camera *camera, CameraConfiguration *c) > if (outputCfgs.empty()) > return 0; > > + const CameraSensorProperties::SensorDelays &delays = data->sensor_->sensorDelays(); > std::unordered_map<uint32_t, DelayedControls::ControlParams> params = { > - { V4L2_CID_ANALOGUE_GAIN, { 2, false } }, > - { V4L2_CID_EXPOSURE, { 2, false } }, > + { V4L2_CID_ANALOGUE_GAIN, { delays.gainDelay, false } }, > + { V4L2_CID_EXPOSURE, { delays.exposureDelay, false } }, > }; > data->delayedCtrls_ = > std::make_unique<DelayedControls>(data->sensor_->device(), > -- > 2.30.2 >
On Tue, Nov 26, 2024 at 03:12:03PM +0000, Daniel Scally wrote: > Rather than hard coding default delays for control values in the > pipeline handlers, pick up the ones defined in the CameraSensor > properties. > > Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> > Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Any chance we could do the same for the Raspberry Pi pipeline handler, and drop the delays from its IPA module (in a separate patch of course) ? > --- > Changes in v5: > > - Fixed the includes in each pipeline (remove property_ids.h, added > camera_sensor_properties.h) > > Changes in v4: > > - Used the struct reference rather than values directly > > Changes in v3: > > - Fixed some broken alignment > > Changes in v2: > > - Switched to use the new getSensorDelays() function > > src/libcamera/pipeline/ipu3/ipu3.cpp | 11 ++++------- > src/libcamera/pipeline/rkisp1/rkisp1.cpp | 11 ++++------- > src/libcamera/pipeline/simple/simple.cpp | 6 ++++-- > 3 files changed, 12 insertions(+), 16 deletions(-) > > diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp > index 0069d5e2..e31e3879 100644 > --- a/src/libcamera/pipeline/ipu3/ipu3.cpp > +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp > @@ -28,6 +28,7 @@ > #include "libcamera/internal/camera.h" > #include "libcamera/internal/camera_lens.h" > #include "libcamera/internal/camera_sensor.h" > +#include "libcamera/internal/camera_sensor_properties.h" > #include "libcamera/internal/delayed_controls.h" > #include "libcamera/internal/device_enumerator.h" > #include "libcamera/internal/framebuffer.h" > @@ -1077,14 +1078,10 @@ int PipelineHandlerIPU3::registerCameras() > if (ret) > continue; > > - /* > - * \todo Read delay values from the sensor itself or from a > - * a sensor database. For now use generic values taken from > - * the Raspberry Pi and listed as 'generic values'. > - */ > + const CameraSensorProperties::SensorDelays &delays = cio2->sensor()->sensorDelays(); > std::unordered_map<uint32_t, DelayedControls::ControlParams> params = { > - { V4L2_CID_ANALOGUE_GAIN, { 1, false } }, > - { V4L2_CID_EXPOSURE, { 2, false } }, > + { V4L2_CID_ANALOGUE_GAIN, { delays.gainDelay, false } }, > + { V4L2_CID_EXPOSURE, { delays.exposureDelay, false } }, > }; > > data->delayedCtrls_ = > diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp > index 6c6d711f..908724e2 100644 > --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp > +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp > @@ -34,6 +34,7 @@ > > #include "libcamera/internal/camera.h" > #include "libcamera/internal/camera_sensor.h" > +#include "libcamera/internal/camera_sensor_properties.h" > #include "libcamera/internal/converter/converter_v4l2_m2m.h" > #include "libcamera/internal/delayed_controls.h" > #include "libcamera/internal/device_enumerator.h" > @@ -1239,14 +1240,10 @@ int PipelineHandlerRkISP1::createCamera(MediaEntity *sensor) > /* Initialize the camera properties. */ > data->properties_ = data->sensor_->properties(); > > - /* > - * \todo Read delay values from the sensor itself or from a > - * a sensor database. For now use generic values taken from > - * the Raspberry Pi and listed as generic values. > - */ > + const CameraSensorProperties::SensorDelays &delays = data->sensor_->sensorDelays(); > std::unordered_map<uint32_t, DelayedControls::ControlParams> params = { > - { V4L2_CID_ANALOGUE_GAIN, { 1, false } }, > - { V4L2_CID_EXPOSURE, { 2, false } }, > + { V4L2_CID_ANALOGUE_GAIN, { delays.gainDelay, false } }, > + { V4L2_CID_EXPOSURE, { delays.exposureDelay, false } }, > }; > > data->delayedCtrls_ = > diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp > index 41fdf84c..dae9f31f 100644 > --- a/src/libcamera/pipeline/simple/simple.cpp > +++ b/src/libcamera/pipeline/simple/simple.cpp > @@ -31,6 +31,7 @@ > > #include "libcamera/internal/camera.h" > #include "libcamera/internal/camera_sensor.h" > +#include "libcamera/internal/camera_sensor_properties.h" > #include "libcamera/internal/converter.h" > #include "libcamera/internal/delayed_controls.h" > #include "libcamera/internal/device_enumerator.h" > @@ -1290,9 +1291,10 @@ int SimplePipelineHandler::configure(Camera *camera, CameraConfiguration *c) > if (outputCfgs.empty()) > return 0; > > + const CameraSensorProperties::SensorDelays &delays = data->sensor_->sensorDelays(); > std::unordered_map<uint32_t, DelayedControls::ControlParams> params = { > - { V4L2_CID_ANALOGUE_GAIN, { 2, false } }, > - { V4L2_CID_EXPOSURE, { 2, false } }, > + { V4L2_CID_ANALOGUE_GAIN, { delays.gainDelay, false } }, > + { V4L2_CID_EXPOSURE, { delays.exposureDelay, false } }, > }; > data->delayedCtrls_ = > std::make_unique<DelayedControls>(data->sensor_->device(),
Morning Laurent On 27/11/2024 07:01, Laurent Pinchart wrote: > On Tue, Nov 26, 2024 at 03:12:03PM +0000, Daniel Scally wrote: >> Rather than hard coding default delays for control values in the >> pipeline handlers, pick up the ones defined in the CameraSensor >> properties. >> >> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> >> Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com> > Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Thanks > Any chance we could do the same for the Raspberry Pi pipeline handler, > and drop the delays from its IPA module (in a separate patch of course) > ? Sure, will do. > >> --- >> Changes in v5: >> >> - Fixed the includes in each pipeline (remove property_ids.h, added >> camera_sensor_properties.h) >> >> Changes in v4: >> >> - Used the struct reference rather than values directly >> >> Changes in v3: >> >> - Fixed some broken alignment >> >> Changes in v2: >> >> - Switched to use the new getSensorDelays() function >> >> src/libcamera/pipeline/ipu3/ipu3.cpp | 11 ++++------- >> src/libcamera/pipeline/rkisp1/rkisp1.cpp | 11 ++++------- >> src/libcamera/pipeline/simple/simple.cpp | 6 ++++-- >> 3 files changed, 12 insertions(+), 16 deletions(-) >> >> diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp >> index 0069d5e2..e31e3879 100644 >> --- a/src/libcamera/pipeline/ipu3/ipu3.cpp >> +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp >> @@ -28,6 +28,7 @@ >> #include "libcamera/internal/camera.h" >> #include "libcamera/internal/camera_lens.h" >> #include "libcamera/internal/camera_sensor.h" >> +#include "libcamera/internal/camera_sensor_properties.h" >> #include "libcamera/internal/delayed_controls.h" >> #include "libcamera/internal/device_enumerator.h" >> #include "libcamera/internal/framebuffer.h" >> @@ -1077,14 +1078,10 @@ int PipelineHandlerIPU3::registerCameras() >> if (ret) >> continue; >> >> - /* >> - * \todo Read delay values from the sensor itself or from a >> - * a sensor database. For now use generic values taken from >> - * the Raspberry Pi and listed as 'generic values'. >> - */ >> + const CameraSensorProperties::SensorDelays &delays = cio2->sensor()->sensorDelays(); >> std::unordered_map<uint32_t, DelayedControls::ControlParams> params = { >> - { V4L2_CID_ANALOGUE_GAIN, { 1, false } }, >> - { V4L2_CID_EXPOSURE, { 2, false } }, >> + { V4L2_CID_ANALOGUE_GAIN, { delays.gainDelay, false } }, >> + { V4L2_CID_EXPOSURE, { delays.exposureDelay, false } }, >> }; >> >> data->delayedCtrls_ = >> diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp >> index 6c6d711f..908724e2 100644 >> --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp >> +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp >> @@ -34,6 +34,7 @@ >> >> #include "libcamera/internal/camera.h" >> #include "libcamera/internal/camera_sensor.h" >> +#include "libcamera/internal/camera_sensor_properties.h" >> #include "libcamera/internal/converter/converter_v4l2_m2m.h" >> #include "libcamera/internal/delayed_controls.h" >> #include "libcamera/internal/device_enumerator.h" >> @@ -1239,14 +1240,10 @@ int PipelineHandlerRkISP1::createCamera(MediaEntity *sensor) >> /* Initialize the camera properties. */ >> data->properties_ = data->sensor_->properties(); >> >> - /* >> - * \todo Read delay values from the sensor itself or from a >> - * a sensor database. For now use generic values taken from >> - * the Raspberry Pi and listed as generic values. >> - */ >> + const CameraSensorProperties::SensorDelays &delays = data->sensor_->sensorDelays(); >> std::unordered_map<uint32_t, DelayedControls::ControlParams> params = { >> - { V4L2_CID_ANALOGUE_GAIN, { 1, false } }, >> - { V4L2_CID_EXPOSURE, { 2, false } }, >> + { V4L2_CID_ANALOGUE_GAIN, { delays.gainDelay, false } }, >> + { V4L2_CID_EXPOSURE, { delays.exposureDelay, false } }, >> }; >> >> data->delayedCtrls_ = >> diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp >> index 41fdf84c..dae9f31f 100644 >> --- a/src/libcamera/pipeline/simple/simple.cpp >> +++ b/src/libcamera/pipeline/simple/simple.cpp >> @@ -31,6 +31,7 @@ >> >> #include "libcamera/internal/camera.h" >> #include "libcamera/internal/camera_sensor.h" >> +#include "libcamera/internal/camera_sensor_properties.h" >> #include "libcamera/internal/converter.h" >> #include "libcamera/internal/delayed_controls.h" >> #include "libcamera/internal/device_enumerator.h" >> @@ -1290,9 +1291,10 @@ int SimplePipelineHandler::configure(Camera *camera, CameraConfiguration *c) >> if (outputCfgs.empty()) >> return 0; >> >> + const CameraSensorProperties::SensorDelays &delays = data->sensor_->sensorDelays(); >> std::unordered_map<uint32_t, DelayedControls::ControlParams> params = { >> - { V4L2_CID_ANALOGUE_GAIN, { 2, false } }, >> - { V4L2_CID_EXPOSURE, { 2, false } }, >> + { V4L2_CID_ANALOGUE_GAIN, { delays.gainDelay, false } }, >> + { V4L2_CID_EXPOSURE, { delays.exposureDelay, false } }, >> }; >> data->delayedCtrls_ = >> std::make_unique<DelayedControls>(data->sensor_->device(),
diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index 0069d5e2..e31e3879 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -28,6 +28,7 @@ #include "libcamera/internal/camera.h" #include "libcamera/internal/camera_lens.h" #include "libcamera/internal/camera_sensor.h" +#include "libcamera/internal/camera_sensor_properties.h" #include "libcamera/internal/delayed_controls.h" #include "libcamera/internal/device_enumerator.h" #include "libcamera/internal/framebuffer.h" @@ -1077,14 +1078,10 @@ int PipelineHandlerIPU3::registerCameras() if (ret) continue; - /* - * \todo Read delay values from the sensor itself or from a - * a sensor database. For now use generic values taken from - * the Raspberry Pi and listed as 'generic values'. - */ + const CameraSensorProperties::SensorDelays &delays = cio2->sensor()->sensorDelays(); std::unordered_map<uint32_t, DelayedControls::ControlParams> params = { - { V4L2_CID_ANALOGUE_GAIN, { 1, false } }, - { V4L2_CID_EXPOSURE, { 2, false } }, + { V4L2_CID_ANALOGUE_GAIN, { delays.gainDelay, false } }, + { V4L2_CID_EXPOSURE, { delays.exposureDelay, false } }, }; data->delayedCtrls_ = diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp index 6c6d711f..908724e2 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp @@ -34,6 +34,7 @@ #include "libcamera/internal/camera.h" #include "libcamera/internal/camera_sensor.h" +#include "libcamera/internal/camera_sensor_properties.h" #include "libcamera/internal/converter/converter_v4l2_m2m.h" #include "libcamera/internal/delayed_controls.h" #include "libcamera/internal/device_enumerator.h" @@ -1239,14 +1240,10 @@ int PipelineHandlerRkISP1::createCamera(MediaEntity *sensor) /* Initialize the camera properties. */ data->properties_ = data->sensor_->properties(); - /* - * \todo Read delay values from the sensor itself or from a - * a sensor database. For now use generic values taken from - * the Raspberry Pi and listed as generic values. - */ + const CameraSensorProperties::SensorDelays &delays = data->sensor_->sensorDelays(); std::unordered_map<uint32_t, DelayedControls::ControlParams> params = { - { V4L2_CID_ANALOGUE_GAIN, { 1, false } }, - { V4L2_CID_EXPOSURE, { 2, false } }, + { V4L2_CID_ANALOGUE_GAIN, { delays.gainDelay, false } }, + { V4L2_CID_EXPOSURE, { delays.exposureDelay, false } }, }; data->delayedCtrls_ = diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp index 41fdf84c..dae9f31f 100644 --- a/src/libcamera/pipeline/simple/simple.cpp +++ b/src/libcamera/pipeline/simple/simple.cpp @@ -31,6 +31,7 @@ #include "libcamera/internal/camera.h" #include "libcamera/internal/camera_sensor.h" +#include "libcamera/internal/camera_sensor_properties.h" #include "libcamera/internal/converter.h" #include "libcamera/internal/delayed_controls.h" #include "libcamera/internal/device_enumerator.h" @@ -1290,9 +1291,10 @@ int SimplePipelineHandler::configure(Camera *camera, CameraConfiguration *c) if (outputCfgs.empty()) return 0; + const CameraSensorProperties::SensorDelays &delays = data->sensor_->sensorDelays(); std::unordered_map<uint32_t, DelayedControls::ControlParams> params = { - { V4L2_CID_ANALOGUE_GAIN, { 2, false } }, - { V4L2_CID_EXPOSURE, { 2, false } }, + { V4L2_CID_ANALOGUE_GAIN, { delays.gainDelay, false } }, + { V4L2_CID_EXPOSURE, { delays.exposureDelay, false } }, }; data->delayedCtrls_ = std::make_unique<DelayedControls>(data->sensor_->device(),