diff options
author | Naushir Patuck <naush@raspberrypi.com> | 2021-02-18 12:48:24 +0000 |
---|---|---|
committer | Kieran Bingham <kieran.bingham@ideasonboard.com> | 2021-02-19 11:37:39 +0000 |
commit | b147de25537652f8dabf40d5165350dad083a28a (patch) | |
tree | d0cdcdbcb8592b2c72574fc111889a6252f6177d | |
parent | a6c41759fcdd90f395ea90040e55d1b881ea04f6 (diff) |
pipeline: raspberrypi: Update the lens shading control in-place
Only update the lens shading control if it is present in the
ControlList.
Add the dmabuf file descriptor to the lens shading control in-place
rather than taking a copy.
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
-rw-r--r-- | src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index acf2d56c..a60415d9 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -1338,17 +1338,16 @@ void RPiCameraData::embeddedComplete(uint32_t bufferId) void RPiCameraData::setIspControls(const ControlList &controls) { - ControlList ctrls = controls; - - Span<const uint8_t> s = - ctrls.get(V4L2_CID_USER_BCM2835_ISP_LENS_SHADING).data(); - bcm2835_isp_lens_shading ls = - *reinterpret_cast<const bcm2835_isp_lens_shading *>(s.data()); - ls.dmabuf = lsTable_.fd(); - - ControlValue c(Span<const uint8_t>{ reinterpret_cast<uint8_t *>(&ls), - sizeof(ls) }); - ctrls.set(V4L2_CID_USER_BCM2835_ISP_LENS_SHADING, c); + ControlList ctrls = std::move(controls); + + if (ctrls.contains(V4L2_CID_USER_BCM2835_ISP_LENS_SHADING)) { + ControlValue &value = + const_cast<ControlValue &>(ctrls.get(V4L2_CID_USER_BCM2835_ISP_LENS_SHADING)); + Span<uint8_t> s = value.data(); + bcm2835_isp_lens_shading *ls = + reinterpret_cast<bcm2835_isp_lens_shading *>(s.data()); + ls->dmabuf = lsTable_.fd(); + } isp_[Isp::Input].dev()->setControls(&ctrls); handleState(); |