{"id":8614,"url":"https://patchwork.libcamera.org/api/patches/8614/?format=json","web_url":"https://patchwork.libcamera.org/patch/8614/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20200704005227.21782-11-laurent.pinchart@ideasonboard.com>","date":"2020-07-04T00:52:25","name":"[libcamera-devel,v2,10/12] ipa: raspberrypi: Pass lens shading table through configure() function","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"62050c335b4aace3616bb6322fd10770af380a09","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/8614/mbox/","series":[{"id":1081,"url":"https://patchwork.libcamera.org/api/series/1081/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1081","date":"2020-07-04T00:52:15","name":"Support passing custom data to IPA configure()","version":2,"mbox":"https://patchwork.libcamera.org/series/1081/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/8614/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/8614/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 17F7BBE905\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSat,  4 Jul 2020 00:52:45 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D07FF60D4D;\n\tSat,  4 Jul 2020 02:52:44 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id F3C9460DE2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat,  4 Jul 2020 02:52:40 +0200 (CEST)","from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 7741C814;\n\tSat,  4 Jul 2020 02:52:40 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"Vyl7heUS\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1593823960;\n\tbh=VPCmnQ4YuricgbO9cwtAVoaM5klyPxzflzhZGXoJrbI=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=Vyl7heUSsFB88JELOi6J6ZpSdYE6ACK7meIR8f643XSEX095HHcoHU5zSGzyfH9st\n\tLNquqb4BP9YLH2XCncjo0NVgapf/ljsZ/LN8uSeEFoDFoSUPKu1H3aU5MJewo57eMb\n\txSi1YR6kzdPk4fV1WU+QrhnMfZ+51prk+SomjaPM=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","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\n\tshading table through configure() function","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"The IPAInterface::configure() function now accepts custom configuration\ndata. Use it to pass the lens shading table instead of using a custom\nIPA event. This will allow starting the IPA when starting the camera,\ninstead of pre-starting it early in order to process the lens shading\ntable allocation event.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\nReviewed-by: Naushir Patuck <naush@raspberrypi.com>\n---\nChanges since v1:\n\n- Update the commit message\n- Rename RPI_IPA_CONFIG_LSTABLE to RPI_IPA_CONFIG_LS_TABLE\n---\n include/libcamera/ipa/raspberrypi.h                |  5 ++++-\n src/ipa/raspberrypi/raspberrypi.cpp                | 12 ++++++------\n src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 10 ++++------\n 3 files changed, 14 insertions(+), 13 deletions(-)","diff":"diff --git a/include/libcamera/ipa/raspberrypi.h b/include/libcamera/ipa/raspberrypi.h\nindex a18ce9a884b6..46ce7c286b20 100644\n--- a/include/libcamera/ipa/raspberrypi.h\n+++ b/include/libcamera/ipa/raspberrypi.h\n@@ -10,6 +10,10 @@\n #include <libcamera/control_ids.h>\n #include <libcamera/controls.h>\n \n+enum RPiConfigParameters {\n+\tRPI_IPA_CONFIG_LS_TABLE = (1 << 0),\n+};\n+\n enum RPiOperations {\n \tRPI_IPA_ACTION_V4L2_SET_STAGGERED = 1,\n \tRPI_IPA_ACTION_V4L2_SET_ISP,\n@@ -21,7 +25,6 @@ enum RPiOperations {\n \tRPI_IPA_EVENT_SIGNAL_STAT_READY,\n \tRPI_IPA_EVENT_SIGNAL_ISP_PREPARE,\n \tRPI_IPA_EVENT_QUEUE_REQUEST,\n-\tRPI_IPA_EVENT_LS_TABLE_ALLOCATION,\n };\n \n enum RPiIpaMask {\ndiff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp\nindex b40ca9e44776..0e39a1137cd0 100644\n--- a/src/ipa/raspberrypi/raspberrypi.cpp\n+++ b/src/ipa/raspberrypi/raspberrypi.cpp\n@@ -271,6 +271,12 @@ void IPARPi::configure(const CameraSensorInfo &sensorInfo,\n \t\tapplyAGC(&agcStatus);\n \n \tlastMode_ = mode_;\n+\n+\t/* Store the lens shading table pointer and handle if available. */\n+\tif (ipaConfig.operation & RPI_IPA_CONFIG_LS_TABLE) {\n+\t\tlsTable_ = reinterpret_cast<void *>(ipaConfig.data[0]);\n+\t\tlsTableHandle_ = ipaConfig.data[1];\n+\t}\n }\n \n void IPARPi::mapBuffers(const std::vector<IPABuffer> &buffers)\n@@ -352,12 +358,6 @@ void IPARPi::processEvent(const IPAOperationData &event)\n \t\tbreak;\n \t}\n \n-\tcase RPI_IPA_EVENT_LS_TABLE_ALLOCATION: {\n-\t\tlsTable_ = reinterpret_cast<void *>(event.data[0]);\n-\t\tlsTableHandle_ = event.data[1];\n-\t\tbreak;\n-\t}\n-\n \tdefault:\n \t\tLOG(IPARPI, Error) << \"Unknown event \" << event.operation;\n \t\tbreak;\ndiff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\nindex fda6831e6a7e..57602349cab2 100644\n--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n@@ -1122,6 +1122,7 @@ int RPiCameraData::configureIPA()\n {\n \tstd::map<unsigned int, IPAStream> streamConfig;\n \tstd::map<unsigned int, const ControlInfoMap &> entityControls;\n+\tIPAOperationData ipaConfig = {};\n \n \t/* Get the device format to pass to the IPA. */\n \tV4L2DeviceFormat sensorFormat;\n@@ -1156,11 +1157,9 @@ int RPiCameraData::configureIPA()\n \t\t * IPA module isolation and should be reworked when vc_sma_cma\n \t\t * will permit.\n \t\t */\n-\t\tIPAOperationData op;\n-\t\top.operation = RPI_IPA_EVENT_LS_TABLE_ALLOCATION;\n-\t\top.data = { static_cast<uint32_t>(ptr & 0xffffffff),\n-\t\t\t    vcsm_.getVCHandle(lsTable_) };\n-\t\tipa_->processEvent(op);\n+\t\tipaConfig.operation = RPI_IPA_CONFIG_LS_TABLE;\n+\t\tipaConfig.data = { static_cast<uint32_t>(ptr & 0xffffffff),\n+\t\t\t\t   vcsm_.getVCHandle(lsTable_) };\n \t}\n \n \tCameraSensorInfo sensorInfo = {};\n@@ -1171,7 +1170,6 @@ int RPiCameraData::configureIPA()\n \t}\n \n \t/* Ready the IPA - it must know about the sensor resolution. */\n-\tIPAOperationData ipaConfig;\n \tipa_->configure(sensorInfo, streamConfig, entityControls, ipaConfig,\n \t\t\tnullptr);\n \n","prefixes":["libcamera-devel","v2","10/12"]}