Patch Detail
Show a patch.
GET /api/patches/17731/?format=api
{ "id": 17731, "url": "https://patchwork.libcamera.org/api/patches/17731/?format=api", "web_url": "https://patchwork.libcamera.org/patch/17731/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20221030230500.74842-3-nicholas@rothemail.net>", "date": "2022-10-30T23:04:57", "name": "[libcamera-devel,v6,2/5] ipa: rkisp1: add FrameDurationLimits control", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "fc6169fd8bcfb2ab8c48394991ece02649a51269", "submitter": { "id": 137, "url": "https://patchwork.libcamera.org/api/people/137/?format=api", "name": "Nicholas Roth", "email": "nicholas@rothemail.net" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/17731/mbox/", "series": [ { "id": 3589, "url": "https://patchwork.libcamera.org/api/series/3589/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3589", "date": "2022-10-30T23:04:56", "name": "[libcamera-devel,v6,1/5] ipa: workaround libcxx duration limitation", "version": 6, "mbox": "https://patchwork.libcamera.org/series/3589/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/17731/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/17731/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 DA737BD16B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSun, 30 Oct 2022 23:05:22 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 91DC86303B;\n\tMon, 31 Oct 2022 00:05:22 +0100 (CET)", "from mail-oi1-x22c.google.com (mail-oi1-x22c.google.com\n\t[IPv6:2607:f8b0:4864:20::22c])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 1C79E6302B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 31 Oct 2022 00:05:19 +0100 (CET)", "by mail-oi1-x22c.google.com with SMTP id u132so11464884oib.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 30 Oct 2022 16:05:19 -0700 (PDT)", "from nroth-pc.attlocal.net\n\t(104-5-61-214.lightspeed.austtx.sbcglobal.net. [104.5.61.214])\n\tby smtp.gmail.com with ESMTPSA id\n\tu4-20020a056871008400b0013c8ae74a14sm2269403oaa.42.2022.10.30.16.05.17\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tSun, 30 Oct 2022 16:05:17 -0700 (PDT)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1667171122;\n\tbh=NUlh5POdicEvwiEE6SOqJlrUM4OBdNHXOkVKtYNrgYE=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=120rAWBstOklaOi0ZAgUeELn/iZAwKQ6JqpWcLCRiorx9Ghxy23Z8uDrQRG3UxQk8\n\tCOPbAD1Pbsj0aEXBilaGAphK1yOEFszDbxoReyjE8v4+wRe7/Zao4lgb3Vn/K61tx/\n\tU5dWgRacOmQItPKSojNAgcT8VQsJWZvBb2uUQudH7SJ6ne7eRAtpbsR1bWKyPCOCe/\n\tPcZFz+//Ys+X6hALfgNBkBS0TA+SvqiXgNAYoEA2qQO5JLrF8YeDWkQYp1bcL79MT9\n\txXmkVLvRDw1ugtVKOVQNlKMYLCR9X++CMZkHEdE0FtuqUQS21XtkfMIox+LnqRm6Dz\n\tI5ebmzxS25QlQ==", "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=rothemail-net.20210112.gappssmtp.com; s=20210112;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=E5rYlHmHyHLxAeMcW9QRK0c92nButyvzD61yfmD0Lpo=;\n\tb=X8OFbwgSH1yzU4BmimpijD8ctqzhYYCUwfIZD58QeTl+g4C9VNxvnAH8zZRyUQequV\n\tQKXFJ2gCaGaazgUMZfqnoe/QbiAKOPN8QWzpuF7e8w4qxDLM3T37sfsB/MHRJSIKz/96\n\t2THPh7wF2R399Qpn91hQUqaqqnvB7zA+KvPmB2Gq4ornp/ddh9El6uDjlOVjofLxfizH\n\t5Nkd1BbvrBgGNIgbiNi6YHxpx8aoSRr1HrlvNAj4Y9bJFDVJpJ6qHS80dDvswxAn7BiS\n\tltN989xPFHFCbqrVgrth/lD0kHnVDMVScefncoFjFvGqDQ+xrgijx7UpToPUH5WCRDPX\n\tIXzw==" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected)\n\theader.d=rothemail-net.20210112.gappssmtp.com\n\theader.i=@rothemail-net.20210112.gappssmtp.com header.b=\"X8OFbwgS\"; \n\tdkim-atps=neutral", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n\t:subject:date:message-id:reply-to;\n\tbh=E5rYlHmHyHLxAeMcW9QRK0c92nButyvzD61yfmD0Lpo=;\n\tb=uqwqHEbemqwYhUoA2+bZSVCleMSZ+5nIvd1n0Rqi/xKB27aL8AsAhqSc4igYvEEImd\n\tPZThYc7EWqomKYwCBdNu1QBFAahrt2dzjC2HA1lDyWj86+jJbGntktuECqI7euM1VysF\n\tfkTc2GBCQqm/P5SjgIIWgMqanMCvblaGZRiZW3Gk37yblSxkJ7xBHO5nQaYcSViEdVTQ\n\ta6MeHthzR6kTAfl9oIfbT6L6Ce/BL673oZhfrCul+YggZcBHAOLXzLyy+/uesctmxqFh\n\t0Y8cQ8EBWBawvg0ntvJvCW+Q1gfc4rnrXcaJmOiobBYFGcc8k4cpg1QLXA3N8pYpk8gB\n\tf5cA==", "X-Gm-Message-State": "ACrzQf2lM/i2TFR6u47g2pcAsLiLzNcP7SlIHYi8m2ByTLDlJXP8MGXT\n\tArZjzlHHqxeg4C//rFnAtij/00zw/DPZJw==", "X-Google-Smtp-Source": "AMsMyM5MefH7rgoPIQzleI91iuvZqb76wOlU9OKmiNrDZeigxASQNI7gKSVrkAxd7oRJvd1HyVeLvg==", "X-Received": "by 2002:a05:6808:1a13:b0:354:b339:25f2 with SMTP id\n\tbk19-20020a0568081a1300b00354b33925f2mr13400510oib.285.1667171117380; \n\tSun, 30 Oct 2022 16:05:17 -0700 (PDT)", "To": "libcamera-devel@lists.libcamera.org", "Date": "Sun, 30 Oct 2022 18:04:57 -0500", "Message-Id": "<20221030230500.74842-3-nicholas@rothemail.net>", "X-Mailer": "git-send-email 2.34.1", "In-Reply-To": "<20221030230500.74842-1-nicholas@rothemail.net>", "References": "<20221030230500.74842-1-nicholas@rothemail.net>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v6 2/5] ipa: rkisp1: add\n\tFrameDurationLimits control", "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>", "From": "Nicholas Roth via libcamera-devel <libcamera-devel@lists.libcamera.org>", "Reply-To": "Nicholas Roth <nicholas@rothemail.net>", "Cc": "Nicholas Roth <nicholas@rothemail.net>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Currently, the Android HAL does not work on rkisp1-based devices because\nrequired FrameDurationLimits metadata is missing from the IPA\nimplementation.\n\nThis change sets FrameDurationLimits for rkisp1 based on the existing\nipu3 implementation, using the sensor's reported range of vertical\nblanking intervals with the minimum reported horizontal blanking\ninterval.\n\nSigned-off-by: Nicholas Roth <nicholas@rothemail.net>\n---\n include/libcamera/ipa/rkisp1.mojom | 6 ++-\n src/ipa/rkisp1/rkisp1.cpp | 57 +++++++++++++++++++++---\n src/libcamera/pipeline/rkisp1/rkisp1.cpp | 12 +++--\n 3 files changed, 64 insertions(+), 11 deletions(-)", "diff": "diff --git a/include/libcamera/ipa/rkisp1.mojom b/include/libcamera/ipa/rkisp1.mojom\nindex eaf3955e..86ff6d0e 100644\n--- a/include/libcamera/ipa/rkisp1.mojom\n+++ b/include/libcamera/ipa/rkisp1.mojom\n@@ -10,7 +10,9 @@ import \"include/libcamera/ipa/core.mojom\";\n \n interface IPARkISP1Interface {\n \tinit(libcamera.IPASettings settings,\n-\t uint32 hwRevision)\n+\t uint32 hwRevision,\n+\t libcamera.IPACameraSensorInfo sensorInfo,\n+\t libcamera.ControlInfoMap sensorControls)\n \t\t=> (int32 ret, libcamera.ControlInfoMap ipaControls);\n \tstart() => (int32 ret);\n \tstop();\n@@ -18,7 +20,7 @@ interface IPARkISP1Interface {\n \tconfigure(libcamera.IPACameraSensorInfo sensorInfo,\n \t\t map<uint32, libcamera.IPAStream> streamConfig,\n \t\t map<uint32, libcamera.ControlInfoMap> entityControls)\n-\t\t=> (int32 ret);\n+\t\t=> (int32 ret, libcamera.ControlInfoMap ipaControls);\n \n \tmapBuffers(array<libcamera.IPABuffer> buffers);\n \tunmapBuffers(array<uint32> ids);\ndiff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp\nindex 069c901b..49239a87 100644\n--- a/src/ipa/rkisp1/rkisp1.cpp\n+++ b/src/ipa/rkisp1/rkisp1.cpp\n@@ -49,13 +49,16 @@ public:\n \tIPARkISP1();\n \n \tint init(const IPASettings &settings, unsigned int hwRevision,\n+\t\t const IPACameraSensorInfo &sensorInfo,\n+\t\t const ControlInfoMap &sensorControls,\n \t\t ControlInfoMap *ipaControls) override;\n \tint start() override;\n \tvoid stop() override;\n \n \tint configure(const IPACameraSensorInfo &info,\n \t\t const std::map<uint32_t, IPAStream> &streamConfig,\n-\t\t const std::map<uint32_t, ControlInfoMap> &entityControls) override;\n+\t\t const std::map<uint32_t, ControlInfoMap> &entityControls,\n+\t\t ControlInfoMap *ipaControls) override;\n \tvoid mapBuffers(const std::vector<IPABuffer> &buffers) override;\n \tvoid unmapBuffers(const std::vector<unsigned int> &ids) override;\n \n@@ -68,6 +71,9 @@ protected:\n \tstd::string logPrefix() const override;\n \n private:\n+\tvoid updateControls(const IPACameraSensorInfo &sensorInfo,\n+\t\t\t const ControlInfoMap &sensorControls,\n+\t\t\t ControlInfoMap *ipaControls);\n \tvoid setControls(unsigned int frame);\n \n \tstd::map<unsigned int, FrameBuffer> buffers_;\n@@ -115,6 +121,8 @@ std::string IPARkISP1::logPrefix() const\n }\n \n int IPARkISP1::init(const IPASettings &settings, unsigned int hwRevision,\n+\t\t const IPACameraSensorInfo &sensorInfo,\n+\t\t const ControlInfoMap &sensorControls,\n \t\t ControlInfoMap *ipaControls)\n {\n \t/* \\todo Add support for other revisions */\n@@ -180,9 +188,8 @@ int IPARkISP1::init(const IPASettings &settings, unsigned int hwRevision,\n \tif (ret)\n \t\treturn ret;\n \n-\t/* Return the controls handled by the IPA. */\n-\tControlInfoMap::Map ctrlMap = rkisp1Controls;\n-\t*ipaControls = ControlInfoMap(std::move(ctrlMap), controls::controls);\n+\t/* Initialize controls. */\n+\tupdateControls(sensorInfo, sensorControls, ipaControls);\n \n \treturn 0;\n }\n@@ -207,7 +214,8 @@ void IPARkISP1::stop()\n */\n int IPARkISP1::configure([[maybe_unused]] const IPACameraSensorInfo &info,\n \t\t\t [[maybe_unused]] const std::map<uint32_t, IPAStream> &streamConfig,\n-\t\t\t const std::map<uint32_t, ControlInfoMap> &entityControls)\n+\t\t\t const std::map<uint32_t, ControlInfoMap> &entityControls,\n+\t\t\t ControlInfoMap *ipaControls)\n {\n \tif (entityControls.empty())\n \t\treturn -EINVAL;\n@@ -249,6 +257,9 @@ int IPARkISP1::configure([[maybe_unused]] const IPACameraSensorInfo &info,\n \tcontext_.configuration.sensor.size = info.outputSize;\n \tcontext_.configuration.sensor.lineDuration = info.minLineLength * 1.0s / info.pixelRate;\n \n+\t/* Update the camera controls using the new sensor settings. */\n+\tupdateControls(info, ctrls_, ipaControls);\n+\n \t/*\n \t * When the AGC computes the new exposure values for a frame, it needs\n \t * to know the limits for shutter speed and analogue gain.\n@@ -349,6 +360,42 @@ void IPARkISP1::processStatsBuffer(const uint32_t frame, const uint32_t bufferId\n \tmetadataReady.emit(frame, metadata);\n }\n \n+void IPARkISP1::updateControls(const IPACameraSensorInfo &sensorInfo,\n+\t\t\t const ControlInfoMap &sensorControls,\n+\t\t\t ControlInfoMap *ipaControls)\n+{\n+\tControlInfoMap::Map ctrlMap = rkisp1Controls;\n+\n+\t/*\n+\t * Compute the frame duration limits.\n+\t *\n+\t * The frame length is computed assuming a fixed line length combined\n+\t * with the vertical frame sizes.\n+\t */\n+\tconst ControlInfo &v4l2HBlank = sensorControls.find(V4L2_CID_HBLANK)->second;\n+\tuint32_t hblank = v4l2HBlank.def().get<int32_t>();\n+\tuint32_t lineLength = sensorInfo.outputSize.width + hblank;\n+\n+\tconst ControlInfo &v4l2VBlank = sensorControls.find(V4L2_CID_VBLANK)->second;\n+\tstd::array<uint32_t, 3> frameHeights{\n+\t\tv4l2VBlank.min().get<int32_t>() + sensorInfo.outputSize.height,\n+\t\tv4l2VBlank.max().get<int32_t>() + sensorInfo.outputSize.height,\n+\t\tv4l2VBlank.def().get<int32_t>() + sensorInfo.outputSize.height,\n+\t};\n+\n+\tstd::array<int64_t, 3> frameDurations;\n+\tfor (unsigned int i = 0; i < frameHeights.size(); ++i) {\n+\t\tuint64_t frameSize = lineLength * frameHeights[i];\n+\t\tframeDurations[i] = frameSize / (sensorInfo.pixelRate / 1000000U);\n+\t}\n+\n+\tctrlMap[&controls::FrameDurationLimits] = ControlInfo(frameDurations[0],\n+\t\t\t\t\t\t\t frameDurations[1],\n+\t\t\t\t\t\t\t frameDurations[2]);\n+\n+\t*ipaControls = ControlInfoMap(std::move(ctrlMap), controls::controls);\n+}\n+\n void IPARkISP1::setControls(unsigned int frame)\n {\n \t/*\ndiff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\nindex 455ee2a0..dae29a2c 100644\n--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n@@ -340,15 +340,19 @@ int RkISP1CameraData::loadIPA(unsigned int hwRevision)\n \t\t/*\n \t\t * If the tuning file isn't found, fall back to the\n \t\t * 'uncalibrated' configuration file.\n-\t\t */\n+\t */\n \t\tif (ipaTuningFile.empty())\n \t\t\tipaTuningFile = ipa_->configurationFile(\"uncalibrated.yaml\");\n \t} else {\n \t\tipaTuningFile = std::string(configFromEnv);\n \t}\n \n-\tint ret = ipa_->init({ ipaTuningFile, sensor_->model() }, hwRevision,\n-\t\t\t &controlInfo_);\n+\tIPACameraSensorInfo sensorInfo{};\n+\tint ret = sensor_->sensorInfo(&sensorInfo);\n+\tif (ret)\n+\t\treturn ret;\n+\tret = ipa_->init({ ipaTuningFile, sensor_->model() }, hwRevision,\n+\t\t\t sensorInfo, sensor_->controls(), &controlInfo_);\n \tif (ret < 0) {\n \t\tLOG(RkISP1, Error) << \"IPA initialization failure\";\n \t\treturn ret;\n@@ -725,7 +729,7 @@ int PipelineHandlerRkISP1::configure(Camera *camera, CameraConfiguration *c)\n \tstd::map<uint32_t, ControlInfoMap> entityControls;\n \tentityControls.emplace(0, data->sensor_->controls());\n \n-\tret = data->ipa_->configure(sensorInfo, streamConfig, entityControls);\n+\tret = data->ipa_->configure(sensorInfo, streamConfig, entityControls, &data->controlInfo_);\n \tif (ret) {\n \t\tLOG(RkISP1, Error) << \"failed configuring IPA (\" << ret << \")\";\n \t\treturn ret;\n", "prefixes": [ "libcamera-devel", "v6", "2/5" ] }