{"id":8489,"url":"https://patchwork.libcamera.org/api/patches/8489/?format=json","web_url":"https://patchwork.libcamera.org/patch/8489/","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":"<20200628231934.29025-6-laurent.pinchart@ideasonboard.com>","date":"2020-06-28T23:19:30","name":"[libcamera-devel,v1,5/9] libcamera: pipeline: raspberrypi: Move configureIPA() to RPiCameraData","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"6a176cf4170d423a9a87aae8dfa7b89c6bb518ce","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/8489/mbox/","series":[{"id":1054,"url":"https://patchwork.libcamera.org/api/series/1054/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1054","date":"2020-06-28T23:19:25","name":"Support passing custom data to IPA configure()","version":1,"mbox":"https://patchwork.libcamera.org/series/1054/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/8489/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/8489/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 0589CC2E66\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSun, 28 Jun 2020 23:19:52 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C949A60B00;\n\tMon, 29 Jun 2020 01:19:51 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5927560AF1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 29 Jun 2020 01:19:43 +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 B6D934FB;\n\tMon, 29 Jun 2020 01:19:42 +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=\"lDPeoNJm\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1593386382;\n\tbh=dbBYdgdx2A9b3rVj18b78K4/NFH7Ho0429N8US51R2E=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=lDPeoNJmMGfOfHQbJAdYuvvcBET23E+YBs4PCLcM21iRyzuMxj+0EuhrZbGrRBle+\n\tWDujxi2KlHePrFEncw5IdsEeHd6Vi8TMKtB2qjPNqMQc5M3CXDcomuIL9KD0Ei34uS\n\tw2V7o7rfO1B+Eqsacrb3kWZJIiNMS4q01t/Uks24=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Mon, 29 Jun 2020 02:19:30 +0300","Message-Id":"<20200628231934.29025-6-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.27.0","In-Reply-To":"<20200628231934.29025-1-laurent.pinchart@ideasonboard.com>","References":"<20200628231934.29025-1-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH v1 5/9] libcamera: pipeline: raspberrypi:\n\tMove configureIPA() to RPiCameraData","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=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"The PipelineHandlerRPi::configureIPA() function accesses plenty of\nmember data from the RPiCameraData class and no member from the\nPipelineHandlerRPi class. Move it to RPiCameraData where it logically\nbelongs.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n .../pipeline/raspberrypi/raspberrypi.cpp      | 117 +++++++++---------\n 1 file changed, 58 insertions(+), 59 deletions(-)","diff":"diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\nindex 3b5cdf1e1849..0f9237a7f346 100644\n--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n@@ -311,6 +311,8 @@ public:\n \tvoid frameStarted(uint32_t sequence);\n \n \tint loadIPA();\n+\tint configureIPA();\n+\n \tvoid queueFrameAction(unsigned int frame, const IPAOperationData &action);\n \n \t/* bufferComplete signal handlers. */\n@@ -396,8 +398,6 @@ private:\n \t\treturn static_cast<RPiCameraData *>(PipelineHandler::cameraData(camera));\n \t}\n \n-\tint configureIPA(Camera *camera);\n-\n \tint queueAllBuffers(Camera *camera);\n \tint prepareBuffers(Camera *camera);\n \tvoid freeBuffers(Camera *camera);\n@@ -752,7 +752,7 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config)\n \tcrop.y = (sensorFormat.size.height - crop.height) >> 1;\n \tdata->isp_[Isp::Input].dev()->setSelection(V4L2_SEL_TGT_CROP, &crop);\n \n-\tret = configureIPA(camera);\n+\tret = data->configureIPA();\n \tif (ret)\n \t\tLOG(RPI, Error) << \"Failed to configure the IPA: \" << ret;\n \n@@ -968,62 +968,6 @@ bool PipelineHandlerRPi::match(DeviceEnumerator *enumerator)\n \treturn true;\n }\n \n-int PipelineHandlerRPi::configureIPA(Camera *camera)\n-{\n-\tstd::map<unsigned int, IPAStream> streamConfig;\n-\tstd::map<unsigned int, const ControlInfoMap &> entityControls;\n-\tRPiCameraData *data = cameraData(camera);\n-\n-\t/* Get the device format to pass to the IPA. */\n-\tV4L2DeviceFormat sensorFormat;\n-\tdata->unicam_[Unicam::Image].dev()->getFormat(&sensorFormat);\n-\t/* Inform IPA of stream configuration and sensor controls. */\n-\tunsigned int i = 0;\n-\tfor (auto const &stream : data->isp_) {\n-\t\tif (stream.isExternal()) {\n-\t\t\tstreamConfig[i] = {\n-\t\t\t\t.pixelFormat = stream.configuration().pixelFormat,\n-\t\t\t\t.size = stream.configuration().size\n-\t\t\t};\n-\t\t}\n-\t}\n-\tentityControls.emplace(0, data->unicam_[Unicam::Image].dev()->controls());\n-\tentityControls.emplace(1, data->isp_[Isp::Input].dev()->controls());\n-\n-\t/* Allocate the lens shading table via vcsm and pass to the IPA. */\n-\tif (!data->lsTable_) {\n-\t\tdata->lsTable_ = data->vcsm_.alloc(\"ls_grid\", MAX_LS_GRID_SIZE);\n-\t\tuintptr_t ptr = reinterpret_cast<uintptr_t>(data->lsTable_);\n-\n-\t\tif (!data->lsTable_)\n-\t\t\treturn -ENOMEM;\n-\n-\t\t/*\n-\t\t * The vcsm allocation will always be in the memory region\n-\t\t * < 32-bits to allow Videocore to access the memory.\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    data->vcsm_.getVCHandle(data->lsTable_) };\n-\t\tdata->ipa_->processEvent(op);\n-\t}\n-\n-\tCameraSensorInfo sensorInfo = {};\n-\tint ret = data->sensor_->sensorInfo(&sensorInfo);\n-\tif (ret) {\n-\t\tLOG(RPI, Error) << \"Failed to retrieve camera sensor info\";\n-\t\treturn ret;\n-\t}\n-\n-\t/* Ready the IPA - it must know about the sensor resolution. */\n-\tIPAOperationData ipaConfig;\n-\tdata->ipa_->configure(sensorInfo, streamConfig, entityControls,\n-\t\t\t      ipaConfig, nullptr);\n-\n-\treturn 0;\n-}\n-\n int PipelineHandlerRPi::queueAllBuffers(Camera *camera)\n {\n \tRPiCameraData *data = cameraData(camera);\n@@ -1161,6 +1105,61 @@ int RPiCameraData::loadIPA()\n \treturn ipa_->start();\n }\n \n+int RPiCameraData::configureIPA()\n+{\n+\tstd::map<unsigned int, IPAStream> streamConfig;\n+\tstd::map<unsigned int, const ControlInfoMap &> entityControls;\n+\n+\t/* Get the device format to pass to the IPA. */\n+\tV4L2DeviceFormat sensorFormat;\n+\tunicam_[Unicam::Image].dev()->getFormat(&sensorFormat);\n+\t/* Inform IPA of stream configuration and sensor controls. */\n+\tunsigned int i = 0;\n+\tfor (auto const &stream : isp_) {\n+\t\tif (stream.isExternal()) {\n+\t\t\tstreamConfig[i] = {\n+\t\t\t\t.pixelFormat = stream.configuration().pixelFormat,\n+\t\t\t\t.size = stream.configuration().size\n+\t\t\t};\n+\t\t}\n+\t}\n+\tentityControls.emplace(0, unicam_[Unicam::Image].dev()->controls());\n+\tentityControls.emplace(1, isp_[Isp::Input].dev()->controls());\n+\n+\t/* Allocate the lens shading table via vcsm and pass to the IPA. */\n+\tif (!lsTable_) {\n+\t\tlsTable_ = vcsm_.alloc(\"ls_grid\", MAX_LS_GRID_SIZE);\n+\t\tuintptr_t ptr = reinterpret_cast<uintptr_t>(lsTable_);\n+\n+\t\tif (!lsTable_)\n+\t\t\treturn -ENOMEM;\n+\n+\t\t/*\n+\t\t * The vcsm allocation will always be in the memory region\n+\t\t * < 32-bits to allow Videocore to access the memory.\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}\n+\n+\tCameraSensorInfo sensorInfo = {};\n+\tint ret = sensor_->sensorInfo(&sensorInfo);\n+\tif (ret) {\n+\t\tLOG(RPI, Error) << \"Failed to retrieve camera sensor info\";\n+\t\treturn ret;\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+\treturn 0;\n+}\n+\n void RPiCameraData::queueFrameAction(unsigned int frame, const IPAOperationData &action)\n {\n \t/*\n","prefixes":["libcamera-devel","v1","5/9"]}