Message ID | 20210528030531.189492-5-hiroh@chromium.org |
---|---|
State | Changes Requested |
Headers | show |
Series |
|
Related | show |
Hi Hiro, Thank you for the patch. On Fri, May 28, 2021 at 12:05:30PM +0900, Hirokazu Honda wrote: > PipelineHandlerIPU3 gets available test pattern modes of the > sensor device and reports them to a client. > > Signed-off-by: Hirokazu Honda <hiroh@chromium.org> > Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> > --- > src/libcamera/pipeline/ipu3/ipu3.cpp | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp > index 58923bc7..0e028cff 100644 > --- a/src/libcamera/pipeline/ipu3/ipu3.cpp > +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp > @@ -936,6 +936,18 @@ int PipelineHandlerIPU3::initControls(IPU3CameraData *data) > ControlInfoMap::Map controls = IPU3Controls; > const ControlInfoMap &sensorControls = sensor->controls(); > > + if (const std::vector<uint8_t> &testPatternModes = > + sensor->testPatternModes(); > + !testPatternModes.empty()) { That's a really weird construct. const std::vector<uint8_t> &testPatternModes = sensor->testPatternModes(); if (!testPatternModes.empty()) { would be more readable. > + std::vector<ControlValue> values; > + values.reserve(testPatternModes.size()); > + > + for (uint8_t pattern : testPatternModes) > + values.emplace_back(static_cast<int32_t>(pattern)); You will be able to drop the cast if you make the test pattern modes map store int32_t (the CameraSensor::testPatternModes() function will need to be updated accordingly). Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > + > + controls[&controls::draft::TestPatternMode] = ControlInfo(values); > + } > + > /* > * Compute exposure time limits. > *
diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index 58923bc7..0e028cff 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -936,6 +936,18 @@ int PipelineHandlerIPU3::initControls(IPU3CameraData *data) ControlInfoMap::Map controls = IPU3Controls; const ControlInfoMap &sensorControls = sensor->controls(); + if (const std::vector<uint8_t> &testPatternModes = + sensor->testPatternModes(); + !testPatternModes.empty()) { + std::vector<ControlValue> values; + values.reserve(testPatternModes.size()); + + for (uint8_t pattern : testPatternModes) + values.emplace_back(static_cast<int32_t>(pattern)); + + controls[&controls::draft::TestPatternMode] = ControlInfo(values); + } + /* * Compute exposure time limits. *