From patchwork Thu Aug 5 17:01:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 13216 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 CB329C3237 for ; Thu, 5 Aug 2021 17:02:05 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 1FB1368811; Thu, 5 Aug 2021 19:02:05 +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="H7F2mXoZ"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id E39776026D for ; Thu, 5 Aug 2021 19:02:03 +0200 (CEST) Received: from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 5BED3E04; Thu, 5 Aug 2021 19:02:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1628182923; bh=PF74wVMjU9cGzXogwQXVKzLBhT5hFFquNex4WXOhwMk=; h=From:To:Cc:Subject:Date:From; b=H7F2mXoZBBnwSOSPgyLPrRDyhF+a4SUuSs24Jeb0QHgWeEzO57/o+ua7vYOwJBibT E/JIpKvoj/7rp/k4zmOeS+O+8kXtNElplpXPl8hiQGWahdYcvWGSsSgbWm5wIMJfyd shsvPt22eJDJ95JyMA9u+lUdGM2PYyIOJdch9vuY= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Thu, 5 Aug 2021 20:01:47 +0300 Message-Id: <20210805170147.20050-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] ipa: vimc: Add 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" As part of an effort to make the vimc IPA usable for testing, extend it with a configure function. The configuration is currently ignored by the IPA. Signed-off-by: Laurent Pinchart Reviewed-by: Paul Elder Reviewed-by: Umang Jain --- Umang, I've had this in my tree for some time, if it helps the work you're doing on testing buffer mapping in vimc, please feel free to use this patch (as-is, or squashed into anything else). --- include/libcamera/ipa/vimc.mojom | 5 +++++ src/ipa/vimc/vimc.cpp | 11 +++++++++++ src/libcamera/pipeline/vimc/vimc.cpp | 16 ++++++++++++++++ 3 files changed, 32 insertions(+) diff --git a/include/libcamera/ipa/vimc.mojom b/include/libcamera/ipa/vimc.mojom index 86bc318a878e..85d25e27ebcd 100644 --- a/include/libcamera/ipa/vimc.mojom +++ b/include/libcamera/ipa/vimc.mojom @@ -19,6 +19,11 @@ enum IPAOperationCode { interface IPAVimcInterface { init(libcamera.IPASettings settings) => (int32 ret); + + configure(libcamera.IPACameraSensorInfo sensorInfo, + map streamConfig, + map entityControls) => (); + start() => (int32 ret); stop(); }; diff --git a/src/ipa/vimc/vimc.cpp b/src/ipa/vimc/vimc.cpp index 0c0ee006fdc7..5da5c6c09d68 100644 --- a/src/ipa/vimc/vimc.cpp +++ b/src/ipa/vimc/vimc.cpp @@ -34,6 +34,10 @@ public: int start() override; void stop() override; + void configure(const IPACameraSensorInfo &sensorInfo, + const std::map &streamConfig, + const std::map &entityControls) override; + private: void initTrace(); void trace(enum ipa::vimc::IPAOperationCode operation); @@ -86,6 +90,13 @@ void IPAVimc::stop() LOG(IPAVimc, Debug) << "stop vimc IPA!"; } +void IPAVimc::configure([[maybe_unused]] const IPACameraSensorInfo &sensorInfo, + [[maybe_unused]] const std::map &streamConfig, + [[maybe_unused]] const std::map &entityControls) +{ + LOG(IPAVimc, Debug) << "configure()"; +} + void IPAVimc::initTrace() { struct stat fifoStat; diff --git a/src/libcamera/pipeline/vimc/vimc.cpp b/src/libcamera/pipeline/vimc/vimc.cpp index 12f7517fd0ae..b7dd6595d608 100644 --- a/src/libcamera/pipeline/vimc/vimc.cpp +++ b/src/libcamera/pipeline/vimc/vimc.cpp @@ -295,6 +295,22 @@ int PipelineHandlerVimc::configure(Camera *camera, CameraConfiguration *config) cfg.setStream(&data->stream_); + if (data->ipa_) { + /* Inform IPA of stream configuration and sensor controls. */ + std::map streamConfig; + streamConfig.emplace(std::piecewise_construct, + std::forward_as_tuple(0), + std::forward_as_tuple(cfg.pixelFormat, cfg.size)); + + std::map entityControls; + entityControls.emplace(0, data->sensor_->controls()); + + IPACameraSensorInfo sensorInfo; + data->sensor_->sensorInfo(&sensorInfo); + + data->ipa_->configure(sensorInfo, streamConfig, entityControls); + } + return 0; }