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>
This commit is contained in:
Naushir Patuck
2021-02-18 12:48:24 +00:00
committed by Kieran Bingham
parent a6c41759fc
commit b147de2553

View File

@@ -1338,17 +1338,16 @@ void RPiCameraData::embeddedComplete(uint32_t bufferId)
void RPiCameraData::setIspControls(const ControlList &controls)
{
ControlList ctrls = controls;
ControlList ctrls = std::move(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);
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();