From patchwork Tue Aug 9 14:47:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Semkowicz X-Patchwork-Id: 17049 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 7895EC3272 for ; Tue, 9 Aug 2022 14:47:14 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 2560863330; Tue, 9 Aug 2022 16:47:14 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1660056434; bh=mOCCKhMkLACzG+Qm14Ztu6VV6uEYpBKJBBmkQEn/lqw=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=XLNJois0kUbqjgyG4N7tyZgzliEAbl0CaLILwhYPz/acuYIcEoLbhN1tSeXaF1f6h DxxmwuuV5+a7f3xPFpIVhFpVSEIm8WxF+r3bsZ6YzJAF7htqT8VC3RnuyLyyyRUjk8 jXR6lHB2ejWQxOMpFm2XptEZrPeUgJtS2nZcABZzvt3oF9mZ5KhpoZGD1z1bdAN4OQ dZXt33f6Wxe35/7vVL1Bdz/tL1n17B3Ff6/d2BtSvuW/PXKYZCau7ZiTTUgGXwg0tY dv5kxcXLZBVIJHAHuAVvk0CopA2TzUmuT4WZhXYilNvGJ3s3l39yAVIJbfsoggtWmj n6bSd6nHbeqng== Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [IPv6:2a00:1450:4864:20::62e]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 2131D63326 for ; Tue, 9 Aug 2022 16:47:11 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=thaumatec-com.20210112.gappssmtp.com header.i=@thaumatec-com.20210112.gappssmtp.com header.b="2uKvOnLS"; dkim-atps=neutral Received: by mail-ej1-x62e.google.com with SMTP id kb8so22655819ejc.4 for ; Tue, 09 Aug 2022 07:47:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thaumatec-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=LqXoxDZDBQ41e/9ovPZw7Mb2q+SlI9QHIG7vwlMPzTo=; b=2uKvOnLSw6hSDi3S+G/4UqVPM8OWI9aJIp8Lz2/++6Z468EFYV71s8KVUAsaWmlcrD 5A4LpmEed2BlfVDcn0OWjmUg8+GazPjPzRlUu1dfcNOLGnrUI+TVHYZLtFo9o18A/kqY QqYUnnfbFHzBwnfZOPNU1ssO0MjAStzkbuUQgzxmrdX/jUxImPpBDo+73KbcKn9yLivY IOoGRc8OA6pG+/xUA9Nj89u3gbg+RkpbUAOxfU0xjkX4mxMP+nWoh+pjbV8LqT/sF6rc CeUW5RokPOzmLsukf0SPG5Dm473pKeFWlSWYTSvkFHEPfDXP+z/RbYrt8Cwt/dxlUxzl BdaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=LqXoxDZDBQ41e/9ovPZw7Mb2q+SlI9QHIG7vwlMPzTo=; b=Jy7YpimlrxYVZvp8UCr+xzrCaHQuC+Mr9pYEFhuUFQE5TFSqM+Pf1vDmcizOIDMV1a uNuue531R3qqZCxJfbtd1NnOoRK2W8vtvrdTB31XrQ3rvX2Y5XJfkE8sqdcKkZnqgEQf wXY2o9GXW8MHJ1huea7i484Sie7NB4tkLHKpcFXZfPQt6ZvcmHtWpoM9xXrfS9d9Ykoe +u5teV3J7XdVh1+X257DLr00zoXQgqUdXFF5hmJtY6uRg+FP1HJTMiDuOzdEfWw2tPYX CBsi5YtKq9ffacivP4Mzsf8AEeJ2yTAih/cUX/SCCnrBgrHYSkj34RpmI+QIk2S7JpE9 dKCw== X-Gm-Message-State: ACgBeo3r5S0DOigrxkWgalkfh+UxbM5F4XsrkHeZtP8DSBQFUpgHHxUJ tKXrI7oi8pNBb6aAZquN3tEMLKXy5GITow== X-Google-Smtp-Source: AA6agR4tbls6q384gtkBdUKfd1lUi305IEE/82MpYU2lrHPi+NvgVXSq8t31Aq0ssToY6kaQBarQ9A== X-Received: by 2002:a17:906:29d:b0:6f0:18d8:7be0 with SMTP id 29-20020a170906029d00b006f018d87be0mr16983672ejf.561.1660056430632; Tue, 09 Aug 2022 07:47:10 -0700 (PDT) Received: from localhost.localdomain (ip092042140082.rev.nessus.at. [92.42.140.82]) by smtp.gmail.com with ESMTPSA id cn15-20020a0564020caf00b0043ba0cf5dbasm6058486edb.2.2022.08.09.07.47.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Aug 2022 07:47:10 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Tue, 9 Aug 2022 16:47:03 +0200 Message-Id: <20220809144704.61682-3-dse@thaumatec.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220809144704.61682-1-dse@thaumatec.com> References: <20220809144704.61682-1-dse@thaumatec.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 2/3] rkisp1: Add camera lens to PH and expose it to the IPA 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: , X-Patchwork-Original-From: Daniel Semkowicz via libcamera-devel From: Daniel Semkowicz Reply-To: Daniel Semkowicz Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Check in pipeline handler if camera lens exists, add expose its controls to the IPA. Signed-off-by: Daniel Semkowicz Reviewed-by: Jacopo Mondi Reviewed-by: Kieran Bingham --- src/ipa/rkisp1/rkisp1.cpp | 7 +++++++ src/libcamera/pipeline/rkisp1/rkisp1.cpp | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp index ee484845..9e4c48a2 100644 --- a/src/ipa/rkisp1/rkisp1.cpp +++ b/src/ipa/rkisp1/rkisp1.cpp @@ -7,6 +7,7 @@ #include #include +#include #include #include #include @@ -70,6 +71,7 @@ private: std::map mappedBuffers_; ControlInfoMap sensorCtrls_; + std::optional lensCtrls_; /* Camera sensor controls. */ bool autoExposure_; @@ -201,6 +203,11 @@ int IPARkISP1::configure([[maybe_unused]] const IPACameraSensorInfo &info, sensorCtrls_ = entityControls.at(0); + auto lensControls = entityControls.find(1); + if (lensControls != entityControls.end()) { + lensCtrls_ = lensControls->second; + } + const auto itExp = sensorCtrls_.find(V4L2_CID_EXPOSURE); if (itExp == sensorCtrls_.end()) { LOG(IPARkISP1, Error) << "Can't find exposure control"; diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp index 93287332..5f10c26b 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp @@ -28,6 +28,7 @@ #include #include "libcamera/internal/camera.h" +#include "libcamera/internal/camera_lens.h" #include "libcamera/internal/camera_sensor.h" #include "libcamera/internal/delayed_controls.h" #include "libcamera/internal/device_enumerator.h" @@ -694,6 +695,10 @@ int PipelineHandlerRkISP1::configure(Camera *camera, CameraConfiguration *c) std::map entityControls; entityControls.emplace(0, data->sensor_->controls()); + CameraLens *lens = data->sensor_->focusLens(); + if (lens) + entityControls.emplace(1, lens->controls()); + ret = data->ipa_->configure(sensorInfo, streamConfig, entityControls); if (ret) { LOG(RkISP1, Error) << "failed configuring IPA (" << ret << ")";