[libcamera-devel] [PATCH 3/3] pipeline: raspberrypi: Update lens shading control in-place

Naushir Patuck naush at raspberrypi.com
Wed Feb 17 11:08:52 CET 2021


Add the dmabuf file descriptor to the lens shading control in-place
rather than taking a copy.

Signed-off-by: Naushir Patuck <naush at raspberrypi.com>
---
 src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
index 9dd4d112a907..a60415d93705 100644
--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
@@ -1338,13 +1338,14 @@ void RPiCameraData::embeddedComplete(uint32_t bufferId)
 
 void RPiCameraData::setIspControls(const ControlList &controls)
 {
-	ControlList ctrls = controls;
+	ControlList ctrls = std::move(controls);
 
 	if (ctrls.contains(V4L2_CID_USER_BCM2835_ISP_LENS_SHADING)) {
-		Span<const uint8_t> s =
-			ctrls.get(V4L2_CID_USER_BCM2835_ISP_LENS_SHADING).data();
-		const bcm2835_isp_lens_shading *ls =
-			reinterpret_cast<const bcm2835_isp_lens_shading *>(s.data());
+		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();
 	}
 
-- 
2.25.1



More information about the libcamera-devel mailing list