Patch Detail
Show a patch.
GET /api/patches/15810/?format=api
{ "id": 15810, "url": "https://patchwork.libcamera.org/api/patches/15810/?format=api", "web_url": "https://patchwork.libcamera.org/patch/15810/", "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": "<20220506095307.78370-4-umang.jain@ideasonboard.com>", "date": "2022-05-06T09:53:07", "name": "[libcamera-devel,v2,3/3] ipa: ipu3: Introduce a IPAFrameContext queue", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "873a9abccec2f5846fd2a13f514e03471bd826a2", "submitter": { "id": 86, "url": "https://patchwork.libcamera.org/api/people/86/?format=api", "name": "Umang Jain", "email": "umang.jain@ideasonboard.com" }, "delegate": { "id": 12, "url": "https://patchwork.libcamera.org/api/users/12/?format=api", "username": "uajain", "first_name": "Umang", "last_name": "Jain", "email": "umang.jain@ideasonboard.com" }, "mbox": "https://patchwork.libcamera.org/patch/15810/mbox/", "series": [ { "id": 3097, "url": "https://patchwork.libcamera.org/api/series/3097/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3097", "date": "2022-05-06T09:53:04", "name": "ipa: ipu3: IPAFrameContext queue", "version": 2, "mbox": "https://patchwork.libcamera.org/series/3097/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/15810/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/15810/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 430E4C3256\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 6 May 2022 09:53:29 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0462C65643;\n\tFri, 6 May 2022 11:53:29 +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 1EE7C65643\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 6 May 2022 11:53:28 +0200 (CEST)", "from perceval.ideasonboard.com (unknown [103.251.226.91])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id E21A5487;\n\tFri, 6 May 2022 11:53:26 +0200 (CEST)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1651830809;\n\tbh=IFeCJ3yN3MrRoQpo1uDUprI+hmvYjx9F9SXDZ9enxK8=;\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:\n\tFrom;\n\tb=BdrtPQ9EfktgGLgboJZEmx+YOSViVlKS7dc+4oHYLCIBALm6DOmbzY84V6AcxwYiF\n\tJUcvTfmtK0ZWsrs6KHNZNlNwPrxzDyeSYyjJBchfZ9MVsmOeyWVRM/eH/dHR6zgDHQ\n\t3E4f0N1HTztuQYIadi5vpAfhnwFRcZXzlaP9npFeWaRmJQw3Y2535baKbZQ70oZQAc\n\tnMI+K6etYO9nPYSacG/USNEWTCSYcoHGnvTZ8ozjIhf/mIdZlBHR2UkOhWOLpoU9W4\n\t9Rc4aVzYwH++BvCe74NqeK1VaQHzyT67b+CsFA/srPPPI629cfzdDHuAiPHPxPgJmU\n\tX3pRA4ER2+Y+Q==", "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1651830807;\n\tbh=IFeCJ3yN3MrRoQpo1uDUprI+hmvYjx9F9SXDZ9enxK8=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=tgZaxrir2jwUnv9UCiKwKJc6oZG9Tt436i5gMFv4aK/MuIHakfx4PVN/1nmgdrroy\n\toVlXZ2NzLsunc+pzhuK53F3xYOgnjaFcsM087rNhYIjJJdUrFxpvSe4qc+TYGsqQFB\n\tDI1Rx8V6KkRFEznPZICHtMy9bCxQFpESA0RZhp8c=" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"tgZaxrir\"; dkim-atps=neutral", "To": "libcamera-devel@lists.libcamera.org", "Date": "Fri, 6 May 2022 15:23:07 +0530", "Message-Id": "<20220506095307.78370-4-umang.jain@ideasonboard.com>", "X-Mailer": "git-send-email 2.31.1", "In-Reply-To": "<20220506095307.78370-1-umang.jain@ideasonboard.com>", "References": "<20220506095307.78370-1-umang.jain@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v2 3/3] ipa: ipu3: Introduce a\n\tIPAFrameContext queue", "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": "Umang Jain via libcamera-devel <libcamera-devel@lists.libcamera.org>", "Reply-To": "Umang Jain <umang.jain@ideasonboard.com>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Introduce a queue of IPAFrameContext which shall maintain the data\nrequired to track each frame. Currently, it is storing only the\nsensor controls values applied for the frame but new structures\ncan be introduced in IPAFrameContext to extend any frame-related\ncontexts (either in-processing or new frames being queued).\n\nFor example, this patch provides the foundation for the extension\nof IPAFrameContext to store incoming request controls.\n\nSigned-off-by: Umang Jain <umang.jain@ideasonboard.com>\n---\n src/ipa/ipu3/algorithms/agc.cpp | 2 +-\n src/ipa/ipu3/ipa_context.cpp | 16 ++++++++++++++--\n src/ipa/ipu3/ipa_context.h | 8 +++++++-\n src/ipa/ipu3/ipu3.cpp | 31 ++++++++++++++++++++++++++-----\n 4 files changed, 48 insertions(+), 9 deletions(-)", "diff": "diff --git a/src/ipa/ipu3/algorithms/agc.cpp b/src/ipa/ipu3/algorithms/agc.cpp\nindex fdeec09d..4784af00 100644\n--- a/src/ipa/ipu3/algorithms/agc.cpp\n+++ b/src/ipa/ipu3/algorithms/agc.cpp\n@@ -187,7 +187,7 @@ void Agc::computeExposure(IPAContext &context, double yGain,\n \t\t\t double iqMeanGain)\n {\n \tconst IPASessionConfiguration &configuration = context.configuration;\n-\tIPAFrameContext &frameContext = context.frameContext;\n+\tIPAFrameContext &frameContext = context.frameContextQueue.front();\n \t/* Get the effective exposure and gain applied on the sensor. */\n \tuint32_t exposure = frameContext.sensor.exposure;\n \tdouble analogueGain = frameContext.sensor.gain;\ndiff --git a/src/ipa/ipu3/ipa_context.cpp b/src/ipa/ipu3/ipa_context.cpp\nindex 06eb2776..fb48bc9b 100644\n--- a/src/ipa/ipu3/ipa_context.cpp\n+++ b/src/ipa/ipu3/ipa_context.cpp\n@@ -58,8 +58,8 @@ namespace libcamera::ipa::ipu3 {\n * \\var IPAContext::configuration\n * \\brief The IPA session configuration, immutable during the session\n *\n- * \\var IPAContext::frameContext\n- * \\brief The frame context for the frame being processed\n+ * \\var IPAContext::frameContextQueue\n+ * \\brief FIFO container of IPAFrameContext for all the frames being queued\n *\n * \\var IPAContext::activeState\n * \\brief The current state of IPA algorithms\n@@ -182,6 +182,15 @@ namespace libcamera::ipa::ipu3 {\n * <linux/intel-ipu3.h> struct ipu3_uapi_gamma_corr_lut for further details.\n */\n \n+/**\n+ * \\brief Construct a IPAFrameContext instance\n+ */\n+IPAFrameContext::IPAFrameContext(uint32_t frame)\n+\t: frame(frame)\n+{\n+\tsensor = {};\n+}\n+\n /**\n * \\var IPAFrameContext::sensor\n * \\brief Effective sensor values that were applied for the frame\n@@ -191,6 +200,9 @@ namespace libcamera::ipa::ipu3 {\n *\n * \\var IPAFrameContext::sensor.gain\n * \\brief Analogue gain multiplier\n+ *\n+ * \\var IPAFrameContext::frame\n+ * \\brief The frame number associated with this IPAFrameContext\n */\n \n } /* namespace libcamera::ipa::ipu3 */\ndiff --git a/src/ipa/ipu3/ipa_context.h b/src/ipa/ipu3/ipa_context.h\nindex 8d681131..20cccc97 100644\n--- a/src/ipa/ipu3/ipa_context.h\n+++ b/src/ipa/ipu3/ipa_context.h\n@@ -8,6 +8,8 @@\n \n #pragma once\n \n+#include <queue>\n+\n #include <linux/intel-ipu3.h>\n \n #include <libcamera/base/utils.h>\n@@ -71,17 +73,21 @@ struct IPAActiveState {\n };\n \n struct IPAFrameContext {\n+\tIPAFrameContext(uint32_t frame);\n+\n \tstruct {\n \t\tuint32_t exposure;\n \t\tdouble gain;\n \t} sensor;\n+\n+\tuint32_t frame;\n };\n \n struct IPAContext {\n \tIPASessionConfiguration configuration;\n \tIPAActiveState activeState;\n \n-\tIPAFrameContext frameContext;\n+\tstd::queue<IPAFrameContext> frameContextQueue;\n };\n \n } /* namespace ipa::ipu3 */\ndiff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp\nindex 268c8f61..1b566f14 100644\n--- a/src/ipa/ipu3/ipu3.cpp\n+++ b/src/ipa/ipu3/ipu3.cpp\n@@ -350,6 +350,8 @@ int IPAIPU3::start()\n */\n void IPAIPU3::stop()\n {\n+\twhile (!context_.frameContextQueue.empty())\n+\t\tcontext_.frameContextQueue.pop();\n }\n \n /**\n@@ -458,7 +460,7 @@ int IPAIPU3::configure(const IPAConfigInfo &configInfo,\n \n \t/* Clean IPAActiveState at each reconfiguration. */\n \tcontext_.activeState = {};\n-\tcontext_.frameContext = {};\n+\tcontext_.frameContextQueue = {};\n \n \tif (!validateSensorControls()) {\n \t\tLOG(IPAIPU3, Error) << \"Sensor control validation failed.\";\n@@ -510,6 +512,13 @@ void IPAIPU3::unmapBuffers(const std::vector<unsigned int> &ids)\n \n void IPAIPU3::frameCompleted([[maybe_unused]] const uint32_t frame)\n {\n+\twhile (!context_.frameContextQueue.empty()) {\n+\t\tauto &fc = context_.frameContextQueue.front();\n+\t\tif (fc.frame <= frame)\n+\t\t\tcontext_.frameContextQueue.pop();\n+\t\telse\n+\t\t\tbreak;\n+\t}\n }\n \n /**\n@@ -574,8 +583,18 @@ void IPAIPU3::processStatsBuffer(const uint32_t frame,\n \tconst ipu3_uapi_stats_3a *stats =\n \t\treinterpret_cast<ipu3_uapi_stats_3a *>(mem.data());\n \n-\tcontext_.frameContext.sensor.exposure = sensorControls.get(V4L2_CID_EXPOSURE).get<int32_t>();\n-\tcontext_.frameContext.sensor.gain = camHelper_->gain(sensorControls.get(V4L2_CID_ANALOGUE_GAIN).get<int32_t>());\n+\tauto &frameContext = context_.frameContextQueue.front();\n+\n+\t/*\n+\t * An assert might be too harsh here. We want to know the cases\n+\t * where the front of the queue (implies the current frame in processing,\n+\t * diverges from the frame parameter of this function\n+\t * \\todo Identify those cases - e.g. frame drop?\n+\t */\n+\tASSERT(context_.frameContextQueue.front().frame == frame);\n+\n+\tframeContext.sensor.exposure = sensorControls.get(V4L2_CID_EXPOSURE).get<int32_t>();\n+\tframeContext.sensor.gain = camHelper_->gain(sensorControls.get(V4L2_CID_ANALOGUE_GAIN).get<int32_t>());\n \n \tdouble lineDuration = context_.configuration.sensor.lineDuration.get<std::micro>();\n \tint32_t vBlank = context_.configuration.sensor.defVBlank;\n@@ -590,11 +609,11 @@ void IPAIPU3::processStatsBuffer(const uint32_t frame,\n \tint64_t frameDuration = (vBlank + sensorInfo_.outputSize.height) * lineDuration;\n \tctrls.set(controls::FrameDuration, frameDuration);\n \n-\tctrls.set(controls::AnalogueGain, context_.frameContext.sensor.gain);\n+\tctrls.set(controls::AnalogueGain, frameContext.sensor.gain);\n \n \tctrls.set(controls::ColourTemperature, context_.activeState.awb.temperatureK);\n \n-\tctrls.set(controls::ExposureTime, context_.frameContext.sensor.exposure * lineDuration);\n+\tctrls.set(controls::ExposureTime, frameContext.sensor.exposure * lineDuration);\n \n \t/*\n \t * \\todo The Metadata provides a path to getting extended data\n@@ -621,6 +640,8 @@ void IPAIPU3::queueRequest([[maybe_unused]] const uint32_t frame,\n \t\t\t [[maybe_unused]] const ControlList &controls)\n {\n \t/* \\todo Start processing for 'frame' based on 'controls'. */\n+\n+\tcontext_.frameContextQueue.emplace(frame);\n }\n \n /**\n", "prefixes": [ "libcamera-devel", "v2", "3/3" ] }