Show a patch.

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

{
    "id": 21764,
    "url": "https://patchwork.libcamera.org/api/patches/21764/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/21764/",
    "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": "<20241028173659.247353-3-mike.rudenko@gmail.com>",
    "date": "2024-10-28T17:36:58",
    "name": "[RFC,2/3] libcamera: libipa: camera_sensor: Add sensorDelays method",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "2849e07cbd6e181f4643616ecf3adb58a0e12bbf",
    "submitter": {
        "id": 146,
        "url": "https://patchwork.libcamera.org/api/people/146/?format=api",
        "name": "Mikhail Rudenko",
        "email": "mike.rudenko@gmail.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/21764/mbox/",
    "series": [
        {
            "id": 4750,
            "url": "https://patchwork.libcamera.org/api/series/4750/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4750",
            "date": "2024-10-28T17:36:56",
            "name": "Pass sensor delays from rkisp1 IPA to the pipeline handler",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/4750/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/21764/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/21764/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 3CD00C3220\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 28 Oct 2024 17:37:16 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 4ACEF653AA;\n\tMon, 28 Oct 2024 18:37:15 +0100 (CET)",
            "from mail-lj1-x22f.google.com (mail-lj1-x22f.google.com\n\t[IPv6:2a00:1450:4864:20::22f])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B86C7653A8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 28 Oct 2024 18:37:12 +0100 (CET)",
            "by mail-lj1-x22f.google.com with SMTP id\n\t38308e7fff4ca-2fb51e00c05so66528431fa.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 28 Oct 2024 10:37:12 -0700 (PDT)",
            "from localhost.localdomain ([45.12.135.46])\n\tby smtp.gmail.com with ESMTPSA id\n\t38308e7fff4ca-2fcb453e3afsm12115511fa.57.2024.10.28.10.37.09\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 28 Oct 2024 10:37:10 -0700 (PDT)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"YyU9YlxO\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=gmail.com; s=20230601; t=1730137031; x=1730741831;\n\tdarn=lists.libcamera.org; \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=0MZLbbG5Qo3cBMwhK7+oDHDAVsCfu8MFjHiLIIpXIQE=;\n\tb=YyU9YlxOW/xAiBarQKoBrI5lTrsHuJkVsmk/89UnjLL/5iKWv38xZawV6KQq2edLeJ\n\tzb+bIi4hnWQb9WdlLG35PgpmxDUlES8bfEN4Oc8Pcuz8fgQ9pfCa8o8dd7NdTbGuKulC\n\t1pIwx+AiAbQUniF1MG0qWT41YgRUbQU17+Wd9dq8qnyUBGpAPewhl3FtVeySE+YWtw+X\n\tduTkeLOTWdUKbeLx/PeXc4hVBJQjacThc9YJTjNMXtiGDx7ry1ZhxLTrCBaWhGWzRXqG\n\th27oRlzVsBq9WAV/px5IXYJzTrN7MaoRWo0ra4ZmlGq0Vmgp/kfAwh9EmZTQkPOX4+Ej\n\tppYw==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1730137031; x=1730741831;\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=0MZLbbG5Qo3cBMwhK7+oDHDAVsCfu8MFjHiLIIpXIQE=;\n\tb=LZdQJYuZi5LBeZ8yI0vNTvWuUm0ScKHdGI3xehW0tysAUzaM4L4FFsy9IWF/GwfJzd\n\terpfiocAnkvi95MO3qgJMsMca81zjogJ4w0cSwZytcTCOshGoUp8utJd4TPSdd8RW68K\n\tROxo5GeemcX4lW8IxD5BX/F3aw8RNYRxZV4dC/Q0+jEgnBffDdsX6dpfMVK3J+s2zbhh\n\tV9uCDi4SQXvWWp9LNNhCRp/frwmqWcOKrYACw2NIk4E4pMnkCwT6klrp8E292biNUIRm\n\tPiciUO/laG7Xfn+InAgebhXso3s0LBnkZgPHlMBnA+REJ2Bx4Dt9SeQ/nPa6suI1gqpu\n\tp02g==",
        "X-Gm-Message-State": "AOJu0Yyf7/ALjA7V7Ez34fQ3ZduRlOzhFcs2BAok1UQUijAjVpWJU7LP\n\tLK8EFbtxHBh/JJ5Ouhw0TwMValrV2dLIj1wFB6ZF6Zxuqt8w1ouIikYyj+3zJw4=",
        "X-Google-Smtp-Source": "AGHT+IEp7c1h44SlSJ7txHyNPVWgZpaXMc6RS7E8nPb2qzF2fXmMmhrlp/0Ab5nhySN8aIeXtvbEZg==",
        "X-Received": "by 2002:a2e:bc09:0:b0:2fa:cdac:8732 with SMTP id\n\t38308e7fff4ca-2fcbe06462cmr52851151fa.30.1730137030699; \n\tMon, 28 Oct 2024 10:37:10 -0700 (PDT)",
        "From": "Mikhail Rudenko <mike.rudenko@gmail.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "Kieran Bingham <kieran.bingham@ideasonboard.com>,\n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tMikhail Rudenko <mike.rudenko@gmail.com>",
        "Subject": "[PATCH RFC 2/3] libcamera: libipa: camera_sensor: Add sensorDelays\n\tmethod",
        "Date": "Mon, 28 Oct 2024 20:36:58 +0300",
        "Message-ID": "<20241028173659.247353-3-mike.rudenko@gmail.com>",
        "X-Mailer": "git-send-email 2.46.0",
        "In-Reply-To": "<20241028173659.247353-1-mike.rudenko@gmail.com>",
        "References": "<20241028173659.247353-1-mike.rudenko@gmail.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "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": "Add a method to return sensor control application delays. Internally,\na protected member variable sensorDelays_ with default delays is added\nto the base class CameraSensorHelper. Subsclasses for specific sensor,\nwhere the delays are known, are supposed to override default values in\ntheir constructors.\n\nAlso override the defaults where correct delays are known from\nCamHelper or other sources.\n\nSigned-off-by: Mikhail Rudenko <mike.rudenko@gmail.com>\n---\n src/ipa/libipa/camera_sensor_helper.cpp | 59 +++++++++++++++++++++++++\n src/ipa/libipa/camera_sensor_helper.h   |  5 +++\n 2 files changed, 64 insertions(+)",
    "diff": "diff --git a/src/ipa/libipa/camera_sensor_helper.cpp b/src/ipa/libipa/camera_sensor_helper.cpp\nindex c6169bdc..117c2f4e 100644\n--- a/src/ipa/libipa/camera_sensor_helper.cpp\n+++ b/src/ipa/libipa/camera_sensor_helper.cpp\n@@ -140,6 +140,17 @@ double CameraSensorHelper::gain(uint32_t gainCode) const\n \t}\n }\n \n+/**\n+ * \\fn CameraSensorHelper::sensorDelays()\n+ * \\brief Fetch the delays for sensor subdevice controls\n+ *\n+ * This function returns the delays between setting a control on a\n+ * sensor subdevice and it becoming effective, measured in frames. If\n+ * they are unknown, default values are used.\n+ *\n+ * \\return The delays for sensor subdevice controls\n+ */\n+\n /**\n  * \\enum CameraSensorHelper::AnalogueGainType\n  * \\brief The gain calculation modes as defined by the MIPI CCS\n@@ -252,6 +263,12 @@ double CameraSensorHelper::gain(uint32_t gainCode) const\n  * sensor specific. Use this variable to store the values at init time.\n  */\n \n+/**\n+ * \\var CameraSensorHelper::sensorDelays_\n+ * \\brief The delays for sensor subdevice controls\n+ * \\sa CameraSensorHelper::sensorDelays()\n+ */\n+\n /**\n  * \\class CameraSensorHelperFactoryBase\n  * \\brief Base class for camera sensor helper factories\n@@ -567,6 +584,12 @@ public:\n \t\tblackLevel_ = 3200;\n \t\tgainType_ = AnalogueGainLinear;\n \t\tgainConstants_.linear = { 0, 2048, -1, 2048 };\n+\n+\t\t/* Taken from CamHelper. */\n+\t\tsensorDelays_.exposureDelay = 2;\n+\t\tsensorDelays_.gainDelay = 2;\n+\t\tsensorDelays_.vblankDelay = 2;\n+\t\tsensorDelays_.hblankDelay = 2;\n \t}\n };\n REGISTER_CAMERA_SENSOR_HELPER(\"imx283\", CameraSensorHelperImx283)\n@@ -578,6 +601,12 @@ public:\n \t{\n \t\tgainType_ = AnalogueGainExponential;\n \t\tgainConstants_.exp = { 1.0, expGainDb(0.3) };\n+\n+\t\t/* Taken from CamHelper. */\n+\t\tsensorDelays_.exposureDelay = 2;\n+\t\tsensorDelays_.gainDelay = 2;\n+\t\tsensorDelays_.vblankDelay = 2;\n+\t\tsensorDelays_.hblankDelay = 2;\n \t}\n };\n REGISTER_CAMERA_SENSOR_HELPER(\"imx290\", CameraSensorHelperImx290)\n@@ -589,6 +618,12 @@ public:\n \t{\n \t\tgainType_ = AnalogueGainExponential;\n \t\tgainConstants_.exp = { 1.0, expGainDb(0.1) };\n+\n+\t\t/* Taken from CamHelper. */\n+\t\tsensorDelays_.exposureDelay = 2;\n+\t\tsensorDelays_.gainDelay = 2;\n+\t\tsensorDelays_.vblankDelay = 2;\n+\t\tsensorDelays_.hblankDelay = 2;\n \t}\n };\n REGISTER_CAMERA_SENSOR_HELPER(\"imx296\", CameraSensorHelperImx296)\n@@ -629,6 +664,12 @@ public:\n \t{\n \t\tgainType_ = AnalogueGainLinear;\n \t\tgainConstants_.linear = { 0, 1024, -1, 1024 };\n+\n+\t\t/* Taken from CamHelper. */\n+\t\tsensorDelays_.exposureDelay = 2;\n+\t\tsensorDelays_.gainDelay = 2;\n+\t\tsensorDelays_.vblankDelay = 3;\n+\t\tsensorDelays_.hblankDelay = 3;\n \t}\n };\n REGISTER_CAMERA_SENSOR_HELPER(\"imx477\", CameraSensorHelperImx477)\n@@ -668,6 +709,12 @@ public:\n \t\tblackLevel_ = 1024;\n \t\tgainType_ = AnalogueGainLinear;\n \t\tgainConstants_.linear = { 1, 0, 0, 128 };\n+\n+\t\t/* Found by experimentation. */\n+\t\tsensorDelays_.exposureDelay = 2;\n+\t\tsensorDelays_.gainDelay = 2;\n+\t\tsensorDelays_.vblankDelay = 2;\n+\t\tsensorDelays_.hblankDelay = 2;\n \t}\n };\n REGISTER_CAMERA_SENSOR_HELPER(\"ov4689\", CameraSensorHelperOv4689)\n@@ -692,6 +739,12 @@ public:\n \t{\n \t\tgainType_ = AnalogueGainLinear;\n \t\tgainConstants_.linear = { 1, 0, 0, 16 };\n+\n+\t\t/* Taken from CamHelper. */\n+\t\tsensorDelays_.exposureDelay = 2;\n+\t\tsensorDelays_.gainDelay = 2;\n+\t\tsensorDelays_.vblankDelay = 2;\n+\t\tsensorDelays_.hblankDelay = 2;\n \t}\n };\n REGISTER_CAMERA_SENSOR_HELPER(\"ov5647\", CameraSensorHelperOv5647)\n@@ -738,6 +791,12 @@ public:\n \t{\n \t\tgainType_ = AnalogueGainLinear;\n \t\tgainConstants_.linear = { 1, 0, 0, 128 };\n+\n+\t\t/* Taken from CamHelper. */\n+\t\tsensorDelays_.exposureDelay = 2;\n+\t\tsensorDelays_.gainDelay = 2;\n+\t\tsensorDelays_.vblankDelay = 2;\n+\t\tsensorDelays_.hblankDelay = 2;\n \t}\n };\n REGISTER_CAMERA_SENSOR_HELPER(\"ov64a40\", CameraSensorHelperOv64a40)\ndiff --git a/src/ipa/libipa/camera_sensor_helper.h b/src/ipa/libipa/camera_sensor_helper.h\nindex 75868205..bef8380e 100644\n--- a/src/ipa/libipa/camera_sensor_helper.h\n+++ b/src/ipa/libipa/camera_sensor_helper.h\n@@ -14,6 +14,7 @@\n #include <vector>\n \n #include <libcamera/base/class.h>\n+#include <libcamera/ipa/core_ipa_interface.h>\n \n namespace libcamera {\n \n@@ -28,6 +29,7 @@ public:\n \tstd::optional<int16_t> blackLevel() const { return blackLevel_; }\n \tvirtual uint32_t gainCode(double gain) const;\n \tvirtual double gain(uint32_t gainCode) const;\n+\tIPASensorDelays sensorDelays() const { return sensorDelays_; };\n \n protected:\n \tenum AnalogueGainType {\n@@ -56,6 +58,9 @@ protected:\n \tAnalogueGainType gainType_;\n \tAnalogueGainConstants gainConstants_;\n \n+\t/* Generic values taken from the Raspberry Pi. */\n+\tIPASensorDelays sensorDelays_{ 2, 1, 2, 2 };\n+\n private:\n \tLIBCAMERA_DISABLE_COPY_AND_MOVE(CameraSensorHelper)\n };\n",
    "prefixes": [
        "RFC",
        "2/3"
    ]
}