From patchwork Sat Jul 4 00:52:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 8614 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 17F7BBE905 for ; Sat, 4 Jul 2020 00:52:45 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id D07FF60D4D; Sat, 4 Jul 2020 02:52:44 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="Vyl7heUS"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id F3C9460DE2 for ; Sat, 4 Jul 2020 02:52:40 +0200 (CEST) Received: from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi [81.175.216.236]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 7741C814; Sat, 4 Jul 2020 02:52:40 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1593823960; bh=VPCmnQ4YuricgbO9cwtAVoaM5klyPxzflzhZGXoJrbI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Vyl7heUSsFB88JELOi6J6ZpSdYE6ACK7meIR8f643XSEX095HHcoHU5zSGzyfH9st LNquqb4BP9YLH2XCncjo0NVgapf/ljsZ/LN8uSeEFoDFoSUPKu1H3aU5MJewo57eMb xSi1YR6kzdPk4fV1WU+QrhnMfZ+51prk+SomjaPM= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Sat, 4 Jul 2020 03:52:25 +0300 Message-Id: <20200704005227.21782-11-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200704005227.21782-1-laurent.pinchart@ideasonboard.com> References: <20200704005227.21782-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 10/12] ipa: raspberrypi: Pass lens shading table through configure() function 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" The IPAInterface::configure() function now accepts custom configuration data. Use it to pass the lens shading table instead of using a custom IPA event. This will allow starting the IPA when starting the camera, instead of pre-starting it early in order to process the lens shading table allocation event. Signed-off-by: Laurent Pinchart Reviewed-by: Niklas Söderlund Reviewed-by: Naushir Patuck --- Changes since v1: - Update the commit message - Rename RPI_IPA_CONFIG_LSTABLE to RPI_IPA_CONFIG_LS_TABLE --- include/libcamera/ipa/raspberrypi.h | 5 ++++- src/ipa/raspberrypi/raspberrypi.cpp | 12 ++++++------ src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 10 ++++------ 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/include/libcamera/ipa/raspberrypi.h b/include/libcamera/ipa/raspberrypi.h index a18ce9a884b6..46ce7c286b20 100644 --- a/include/libcamera/ipa/raspberrypi.h +++ b/include/libcamera/ipa/raspberrypi.h @@ -10,6 +10,10 @@ #include #include +enum RPiConfigParameters { + RPI_IPA_CONFIG_LS_TABLE = (1 << 0), +}; + enum RPiOperations { RPI_IPA_ACTION_V4L2_SET_STAGGERED = 1, RPI_IPA_ACTION_V4L2_SET_ISP, @@ -21,7 +25,6 @@ enum RPiOperations { RPI_IPA_EVENT_SIGNAL_STAT_READY, RPI_IPA_EVENT_SIGNAL_ISP_PREPARE, RPI_IPA_EVENT_QUEUE_REQUEST, - RPI_IPA_EVENT_LS_TABLE_ALLOCATION, }; enum RPiIpaMask { diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp index b40ca9e44776..0e39a1137cd0 100644 --- a/src/ipa/raspberrypi/raspberrypi.cpp +++ b/src/ipa/raspberrypi/raspberrypi.cpp @@ -271,6 +271,12 @@ void IPARPi::configure(const CameraSensorInfo &sensorInfo, applyAGC(&agcStatus); lastMode_ = mode_; + + /* Store the lens shading table pointer and handle if available. */ + if (ipaConfig.operation & RPI_IPA_CONFIG_LS_TABLE) { + lsTable_ = reinterpret_cast(ipaConfig.data[0]); + lsTableHandle_ = ipaConfig.data[1]; + } } void IPARPi::mapBuffers(const std::vector &buffers) @@ -352,12 +358,6 @@ void IPARPi::processEvent(const IPAOperationData &event) break; } - case RPI_IPA_EVENT_LS_TABLE_ALLOCATION: { - lsTable_ = reinterpret_cast(event.data[0]); - lsTableHandle_ = event.data[1]; - break; - } - default: LOG(IPARPI, Error) << "Unknown event " << event.operation; break; diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index fda6831e6a7e..57602349cab2 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -1122,6 +1122,7 @@ int RPiCameraData::configureIPA() { std::map streamConfig; std::map entityControls; + IPAOperationData ipaConfig = {}; /* Get the device format to pass to the IPA. */ V4L2DeviceFormat sensorFormat; @@ -1156,11 +1157,9 @@ int RPiCameraData::configureIPA() * IPA module isolation and should be reworked when vc_sma_cma * will permit. */ - IPAOperationData op; - op.operation = RPI_IPA_EVENT_LS_TABLE_ALLOCATION; - op.data = { static_cast(ptr & 0xffffffff), - vcsm_.getVCHandle(lsTable_) }; - ipa_->processEvent(op); + ipaConfig.operation = RPI_IPA_CONFIG_LS_TABLE; + ipaConfig.data = { static_cast(ptr & 0xffffffff), + vcsm_.getVCHandle(lsTable_) }; } CameraSensorInfo sensorInfo = {}; @@ -1171,7 +1170,6 @@ int RPiCameraData::configureIPA() } /* Ready the IPA - it must know about the sensor resolution. */ - IPAOperationData ipaConfig; ipa_->configure(sensorInfo, streamConfig, entityControls, ipaConfig, nullptr);