From patchwork Thu Feb 18 12:48:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 11334 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 7C756BD1F6 for ; Thu, 18 Feb 2021 12:48:39 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 470F2689B1; Thu, 18 Feb 2021 13:48:39 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="ixh7zVIm"; dkim-atps=neutral Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 24D586836F for ; Thu, 18 Feb 2021 13:48:36 +0100 (CET) Received: by mail-wm1-x32b.google.com with SMTP id a132so3556222wmc.0 for ; Thu, 18 Feb 2021 04:48:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Llu3rk37nadcwxNGL+VmmMCkZ76r0uhevYyMgruKdMM=; b=ixh7zVImuYVQm3dfx9FS9LrHMiqgEhlqtSVMA2NGkfghuWQhomOwjN/zau352CRSCu NGlY0kPdHrs6YprqIiRlp6gI7Tt1fu07iSO5LzzQZPF0jsJhd1Qs4FONbtQkNoEfMhv5 gzfv1dM7/lqdE3K9kTDyTuL8LRV2W5mQYIar+yX/fJ7A1X8emXaB6SQoTWj7DfYkPDUe eZIH05M8gHrEUOnrufxCKbiZLpt5JRZSPk1YmMqyVSS5j+NJ3xe0t4WkdLgdpaUOP/71 IhK9yE2lG/CWEP1iIn6fRyuXHbxqDGmXTps6nPYPQ4pgIyRfON+Aoe7gGGFrSm8cvJR6 4itg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Llu3rk37nadcwxNGL+VmmMCkZ76r0uhevYyMgruKdMM=; b=V+bh9DcYXCn4fHkHkN3IG8P+8Qb0ghmOJ1aOUMaC4HWw+YecXEDrtC25rldvmRAj95 Zg+H4Sr1dcV7PykeCnjxlpe/tpVmMoMSn5aLa1h4bSbMGI+HNCoAHB+qYMVW58/HjEZ6 VzaJf3WtUhJf4WRUKYmoXDKV2R1oHfHmjdMsMmYgix0zffZikjb2TtJMGx4RtefJJhNA np6NkTLuVfajKFOuUcsgNk27uKCcf5S5Jffvkxjnrhu7Svjm3z1fWVxto5lJWVMzZUD3 t8u760Ite5seeXJpnGKCq8mNEMUPaurAkeDdxZ9kq/cyct+adusft27htXUAXIuW40V0 zjgA== X-Gm-Message-State: AOAM5306UmuAcrdVimtmqtzYc6KdBcRNJfeAQoqebujRJAdPUM/qp3VK 3mkUQDMPdvOZiQ2o0h9XmOZUBItfIpLc52HT X-Google-Smtp-Source: ABdhPJxIZYN9JsRczykAOfZioHU0/4pMG35rP7hM84q5mxVlu6YIbBYzuLs/WRiADO6tZVntp5EQ/A== X-Received: by 2002:a1c:23c2:: with SMTP id j185mr3459528wmj.96.1613652515677; Thu, 18 Feb 2021 04:48:35 -0800 (PST) Received: from naush-laptop.pitowers.org ([2a00:1098:3142:15:c37b:2722:9ed2:1d58]) by smtp.gmail.com with ESMTPSA id z63sm7675876wme.8.2021.02.18.04.48.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Feb 2021 04:48:34 -0800 (PST) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Thu, 18 Feb 2021 12:48:24 +0000 Message-Id: <20210218124824.1825418-5-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210218124824.1825418-1-naush@raspberrypi.com> References: <20210218124824.1825418-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 4/4] pipeline: raspberrypi: Update the lens shading control in-place X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" 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 Reviewed-by: Paul Elder Reviewed-by: Kieran Bingham --- .../pipeline/raspberrypi/raspberrypi.cpp | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index acf2d56cddb2..a60415d93705 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 s = - ctrls.get(V4L2_CID_USER_BCM2835_ISP_LENS_SHADING).data(); - bcm2835_isp_lens_shading ls = - *reinterpret_cast(s.data()); - ls.dmabuf = lsTable_.fd(); - - ControlValue c(Span{ reinterpret_cast(&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(ctrls.get(V4L2_CID_USER_BCM2835_ISP_LENS_SHADING)); + Span s = value.data(); + bcm2835_isp_lens_shading *ls = + reinterpret_cast(s.data()); + ls->dmabuf = lsTable_.fd(); + } isp_[Isp::Input].dev()->setControls(&ctrls); handleState();