Show a patch.

GET /api/1.1/patches/13748/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 13748,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/13748/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/13748/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/1.1/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": "<20210907194107.803730-18-jacopo@jmondi.org>",
    "date": "2021-09-07T19:41:07",
    "name": "[libcamera-devel,v2,17/17] ipa: ipu3: Cap frame duration to 30 FPS",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "4d81d1dd6fd4405e1188b0dd9a26ffa443247381",
    "submitter": {
        "id": 3,
        "url": "https://patchwork.libcamera.org/api/1.1/people/3/?format=api",
        "name": "Jacopo Mondi",
        "email": "jacopo@jmondi.org"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/13748/mbox/",
    "series": [
        {
            "id": 2492,
            "url": "https://patchwork.libcamera.org/api/1.1/series/2492/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2492",
            "date": "2021-09-07T19:40:50",
            "name": "IPU3 control info update and HAL frame durations",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/2492/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/13748/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/13748/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 7CF18BDB1D\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  7 Sep 2021 19:40:45 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3E9B169184;\n\tTue,  7 Sep 2021 21:40:45 +0200 (CEST)",
            "from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net\n\t[217.70.183.193])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7A5806917F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  7 Sep 2021 21:40:42 +0200 (CEST)",
            "(Authenticated sender: jacopo@jmondi.org)\n\tby relay1-d.mail.gandi.net (Postfix) with ESMTPSA id D76E9240002;\n\tTue,  7 Sep 2021 19:40:41 +0000 (UTC)"
        ],
        "From": "Jacopo Mondi <jacopo@jmondi.org>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Tue,  7 Sep 2021 21:41:07 +0200",
        "Message-Id": "<20210907194107.803730-18-jacopo@jmondi.org>",
        "X-Mailer": "git-send-email 2.32.0",
        "In-Reply-To": "<20210907194107.803730-1-jacopo@jmondi.org>",
        "References": "<20210907194107.803730-1-jacopo@jmondi.org>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v2 17/17] ipa: ipu3: Cap frame duration to\n\t30 FPS",
        "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>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "Limit the IPU3 frame rate to 30 FPS.\n\nThe reason to do is to bring the IPU3 IPA in par with the Intel\nHAL implementation on IPU3 platform, where 30FPS is the frame rate used\nto perform quality tuning in the closed-source IPA module and has been\nvalidated as the most efficient rate for the power/performace budget.\n\nCompute the vertical blanking to maintain such frame rate and configure\nthe sensor with that.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n---\n src/ipa/ipu3/ipu3.cpp | 37 ++++++++++++++++++++++++++++++++-----\n 1 file changed, 32 insertions(+), 5 deletions(-)",
    "diff": "diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp\nindex ec75b3ffa305..3480c828ea62 100644\n--- a/src/ipa/ipu3/ipu3.cpp\n+++ b/src/ipa/ipu3/ipu3.cpp\n@@ -183,7 +183,7 @@ private:\n \tIPACameraSensorInfo sensorInfo_;\n \n \t/* Camera sensor controls. */\n-\tuint32_t defVBlank_;\n+\tuint32_t vBlank_;\n \tuint32_t exposure_;\n \tuint32_t minExposure_;\n \tuint32_t maxExposure_;\n@@ -257,10 +257,39 @@ void IPAIPU3::updateControls(const IPACameraSensorInfo &sensorInfo,\n \t\tframeDurations[i] = frameSize / (sensorInfo.pixelRate / 1000000U);\n \t}\n \n+\t/*\n+\t * Cap minimum frame duration to 30FPS.\n+\t *\n+\t * 30 FPS has been validated in the closed source Intel 3A module as the\n+\t * most opportune frame rate for quality tuning, and power\n+\t * vs performances budget on Intel IPU3.\n+\t *\n+\t * Reduce the maximum achievable frame rate to 30 FPS and compute the\n+\t * vertical blanking to maintain that rate.\n+\t */\n+\tint64_t *minFrameDuration = &frameDurations[0];\n+\tif (*minFrameDuration < 1e6 / 30.0)\n+\t\t*minFrameDuration = 1e6 / 30.0;\n+\n \tcontrols[&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/*\n+\t * Adjust the vertical blanking to obtain the desired frame duration.\n+\t *\n+\t * Assume a fixed line length as horizontal blanking is seldom\n+\t * controllable.\n+\t *\n+\t * \\todo Support making this overridable by the application through\n+\t * controls::FrameDuration.\n+\t *\n+\t * \\todo Clamp exposure to frame duration.\n+\t */\n+\tvBlank_ = *minFrameDuration * (sensorInfo.pixelRate / 1000000U);\n+\tvBlank_ /= lineLength;\n+\tvBlank_ -= sensorInfo.outputSize.height;\n+\n \t*ipaControls = ControlInfoMap(std::move(controls), controls::controls);\n }\n \n@@ -399,8 +428,6 @@ int IPAIPU3::configure(const IPAConfigInfo &configInfo,\n \tmaxGain_ = itGain->second.max().get<int32_t>();\n \tgain_ = minGain_;\n \n-\tdefVBlank_ = itVBlank->second.def().get<int32_t>();\n-\n \t/* Clean context at configuration */\n \tcontext_ = {};\n \n@@ -511,8 +538,7 @@ void IPAIPU3::parseStatistics(unsigned int frame,\n \n \tsetControls(frame);\n \n-\t/* \\todo Use VBlank value calculated from each frame exposure. */\n-\tint64_t frameDuration = sensorInfo_.lineLength * (defVBlank_ + sensorInfo_.outputSize.height) /\n+\tint64_t frameDuration = sensorInfo_.lineLength * (vBlank_ + sensorInfo_.outputSize.height) /\n \t\t\t\t(sensorInfo_.pixelRate / 1e6);\n \tctrls.set(controls::FrameDuration, frameDuration);\n \n@@ -534,6 +560,7 @@ void IPAIPU3::setControls(unsigned int frame)\n \tControlList ctrls(ctrls_);\n \tctrls.set(V4L2_CID_EXPOSURE, static_cast<int32_t>(exposure_));\n \tctrls.set(V4L2_CID_ANALOGUE_GAIN, static_cast<int32_t>(gain_));\n+\tctrls.set(V4L2_CID_VBLANK, static_cast<int32_t>(vBlank_));\n \top.controls = ctrls;\n \n \tqueueFrameAction.emit(frame, op);\n",
    "prefixes": [
        "libcamera-devel",
        "v2",
        "17/17"
    ]
}