Show a patch.

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

{
    "id": 23411,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/23411/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/23411/",
    "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": "<20250521125327.6378-2-david.plowman@raspberrypi.com>",
    "date": "2025-05-21T12:53:27",
    "name": "[1/1] libcamera: camera: Fix up the AeEnable control during Camera::start()",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "77a61f10e55cd616d0c758da4c58f75ffef4b250",
    "submitter": {
        "id": 42,
        "url": "https://patchwork.libcamera.org/api/1.1/people/42/?format=api",
        "name": "David Plowman",
        "email": "david.plowman@raspberrypi.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/23411/mbox/",
    "series": [
        {
            "id": 5186,
            "url": "https://patchwork.libcamera.org/api/1.1/series/5186/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5186",
            "date": "2025-05-21T12:53:26",
            "name": "Fix AeEnable when camera starts",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/5186/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/23411/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/23411/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 28D1DC31E9\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 21 May 2025 12:53:38 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8AC9268D8E;\n\tWed, 21 May 2025 14:53:35 +0200 (CEST)",
            "from mail-wr1-x436.google.com (mail-wr1-x436.google.com\n\t[IPv6:2a00:1450:4864:20::436])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6292B68D85\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 21 May 2025 14:53:31 +0200 (CEST)",
            "by mail-wr1-x436.google.com with SMTP id\n\tffacd0b85a97d-3a35919fa8bso2753336f8f.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 21 May 2025 05:53:31 -0700 (PDT)",
            "from raspberrypi.pitowers.org\n\t([2a00:1098:3142:1f:ffc9:aff6:7f7f:893b])\n\tby smtp.gmail.com with ESMTPSA id\n\t5b1f17b1804b1-447f6f0556bsm67938395e9.12.2025.05.21.05.53.30\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 21 May 2025 05:53:30 -0700 (PDT)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"t0NHxRQZ\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1747832011; x=1748436811;\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=Ro6xXZVSsfDY1zwGPPTsbwHeqpAv0ev++txLt8duHVY=;\n\tb=t0NHxRQZ5Tk9Q6pB2tviOOdQ9SLYShqX1n2woTbXKkaSnf6uc44wfO1K2xsxX3mIh1\n\tDk0aZweYZRm1UsK0yZdS8XbePIXuqED1YggORnstvDhTfp94yVsjz9ehhsmSnFVEsHvH\n\tac4qG0XaPqthuT/1ImGjv5jYWW5OUZDbeakzgcwKAz/PEjSFssNPyUDcMSLOAYAYEB/d\n\tr8Fd9xr6Yo/lhOlPxgfd+1OXJXaQwtB0Sp67+oth/xqFFhZr6WwvILdi+cZ9fbodTDmH\n\tez58qW/SkV1uV8y7a/D3EsJQdV+xsxxRRmY4xUVGfw5mbT9Yq43K7vegQF1iL2NmGVQe\n\t4hyg==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1747832011; x=1748436811;\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=Ro6xXZVSsfDY1zwGPPTsbwHeqpAv0ev++txLt8duHVY=;\n\tb=IfOjmJZBCp3wAK78qFsHNusM5K6BQgHK9OaEeE3aZRjJpfhHCfg8TUHNjdZjxsC5c2\n\tGROYCCNVS47+FE5wkJ2LW87g4vtBxGhFv/zhj5hXewrlJ+PeNxbmgu9KqMkrYkfiez/8\n\tmrS3G4QeSdstLDtYeGxuJGS2sg7gi0uO/Wjyb3hWPPGcjyBrHEZy8rQ02f+3E7P4G4OB\n\tNT+csdz5Bq22n9kjQwDRCisSm0ATVOnkWTpCbUxKwK93rCeI29Q82SgXjDS44r5inmb4\n\tEfnkooNT6NrO5yutlVAHm+FUwG7v2xSXgIfR7BTs9PjlAUuCmmn9yZ15N4J/IrbdMyco\n\tC/QQ==",
        "X-Gm-Message-State": "AOJu0YyUh0im+sBos0HQDYHFqKdPdxJ59d3xpctOoBd/JB0kjzjjOQzR\n\tyKG6v7k3Vn0VZvCAKKD6ObkwYfyCjpr7DMdavvT+Z8Thq/Yv6QkrAT/lCv30ONcObaSuNtfw+8+\n\tskM/twqk=",
        "X-Gm-Gg": "ASbGncuLb+Smb8H4g4kLrWKjENtP0LAkfgHAsOacTMgIN61cf1uM0/jdakK/IKhGTZI\n\taTipMAHqqLhd3yyvFbNz8/AAqF3zA4EhtwOfrG7aGGx05h9xHSqDMFTX1ppRTR/uGANp6RmPhDM\n\tEXTeb6oOMwUIovrpCApys52orNCCQIxdypujm8XPhiS3SGe5eAxJpwVhF6CX8Cg281tp4neMw7G\n\tC5R4nRj4BfbdDEv12tnPjaAxb4333N+LttyxPvpMNqeLqMSL1Ygh6uxAqaq4QCRN+GOhBAR34Da\n\tuO6BRuNRE68LhjS1+aUj4b4BFkQrasBtjCqp6NuqjUYNSws2UoY91qV/SsuECpn4kaL7QthMcKJ\n\tLOsADzTWMjk2zkyR/6w==",
        "X-Google-Smtp-Source": "AGHT+IF3/JpUnR8kOX9nsqxmJXlAhtXE6PYzvz9ilUgs64ciThy/OUkffYjbKT1Aj7vbcKjj4ZuvGA==",
        "X-Received": "by 2002:a05:6000:22c8:b0:3a3:76cd:3e80 with SMTP id\n\tffacd0b85a97d-3a376cd4028mr7563807f8f.21.1747832010592; \n\tWed, 21 May 2025 05:53:30 -0700 (PDT)",
        "From": "David Plowman <david.plowman@raspberrypi.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "David Plowman <david.plowman@raspberrypi.com>",
        "Subject": "[PATCH 1/1] libcamera: camera: Fix up the AeEnable control during\n\tCamera::start()",
        "Date": "Wed, 21 May 2025 13:53:27 +0100",
        "Message-Id": "<20250521125327.6378-2-david.plowman@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.39.5",
        "In-Reply-To": "<20250521125327.6378-1-david.plowman@raspberrypi.com>",
        "References": "<20250521125327.6378-1-david.plowman@raspberrypi.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": "In Camera::queueRequest() the control list is updated transparently by\nconverting AeEnable into ExposureTimeMode and AnalogueGainMode\ncontrols.\n\nHowever, this was not happening during Camera::start(), meaning that\nsetting AeEnable there was having no effect. It should behave the same\nhere too.\n\nFixes: 7abd4139051c (\"libcamera: camera: Pre-process AeEnable control\")\nSigned-off-by: David Plowman <david.plowman@raspberrypi.com>\n---\n include/libcamera/camera.h |  2 ++\n src/libcamera/camera.cpp   | 57 +++++++++++++++++++++++++-------------\n 2 files changed, 40 insertions(+), 19 deletions(-)",
    "diff": "diff --git a/include/libcamera/camera.h b/include/libcamera/camera.h\nindex 94cee7bd..b24a2974 100644\n--- a/include/libcamera/camera.h\n+++ b/include/libcamera/camera.h\n@@ -165,6 +165,8 @@ private:\n \tfriend class FrameBufferAllocator;\n \tint exportFrameBuffers(Stream *stream,\n \t\t\t       std::vector<std::unique_ptr<FrameBuffer>> *buffers);\n+\n+\tvoid patchControlList(ControlList &controls);\n };\n \n } /* namespace libcamera */\ndiff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp\nindex c180a5fd..23b9207a 100644\n--- a/src/libcamera/camera.cpp\n+++ b/src/libcamera/camera.cpp\n@@ -1266,6 +1266,33 @@ std::unique_ptr<Request> Camera::createRequest(uint64_t cookie)\n \treturn request;\n }\n \n+/**\n+ * \\brief Patch a control list that contains the AeEnable control\n+ * \\param[inout] controls The control list to be patched\n+ *\n+ * The control list is patched in place, turning the AeEnable control into\n+ * the equivalent ExposureTimeMode/AnalogueGainMode controls.\n+ */\n+void Camera::patchControlList(ControlList &controls)\n+{\n+\tconst auto &aeEnable = controls.get(controls::AeEnable);\n+\tif (aeEnable) {\n+\t\tif (_d()->controlInfo_.count(controls::AnalogueGainMode.id()) &&\n+\t\t    !controls.contains(controls::AnalogueGainMode.id())) {\n+\t\t\tcontrols.set(controls::AnalogueGainMode,\n+\t\t\t\t     *aeEnable ? controls::AnalogueGainModeAuto\n+\t\t\t\t\t       : controls::AnalogueGainModeManual);\n+\t\t}\n+\n+\t\tif (_d()->controlInfo_.count(controls::ExposureTimeMode.id()) &&\n+\t\t    !controls.contains(controls::ExposureTimeMode.id())) {\n+\t\t\tcontrols.set(controls::ExposureTimeMode,\n+\t\t\t\t     *aeEnable ? controls::ExposureTimeModeAuto\n+\t\t\t\t\t       : controls::ExposureTimeModeManual);\n+\t\t}\n+\t}\n+}\n+\n /**\n  * \\brief Queue a request to the camera\n  * \\param[in] request The request to queue to the camera\n@@ -1329,23 +1356,7 @@ int Camera::queueRequest(Request *request)\n \t}\n \n \t/* Pre-process AeEnable. */\n-\tControlList &controls = request->controls();\n-\tconst auto &aeEnable = controls.get(controls::AeEnable);\n-\tif (aeEnable) {\n-\t\tif (_d()->controlInfo_.count(controls::AnalogueGainMode.id()) &&\n-\t\t    !controls.contains(controls::AnalogueGainMode.id())) {\n-\t\t\tcontrols.set(controls::AnalogueGainMode,\n-\t\t\t\t     *aeEnable ? controls::AnalogueGainModeAuto\n-\t\t\t\t\t       : controls::AnalogueGainModeManual);\n-\t\t}\n-\n-\t\tif (_d()->controlInfo_.count(controls::ExposureTimeMode.id()) &&\n-\t\t    !controls.contains(controls::ExposureTimeMode.id())) {\n-\t\t\tcontrols.set(controls::ExposureTimeMode,\n-\t\t\t\t     *aeEnable ? controls::ExposureTimeModeAuto\n-\t\t\t\t\t       : controls::ExposureTimeModeManual);\n-\t\t}\n-\t}\n+\tpatchControlList(request->controls());\n \n \td->pipe_->invokeMethod(&PipelineHandler::queueRequest,\n \t\t\t       ConnectionTypeQueued, request);\n@@ -1383,8 +1394,16 @@ int Camera::start(const ControlList *controls)\n \n \tASSERT(d->requestSequence_ == 0);\n \n-\tret = d->pipe_->invokeMethod(&PipelineHandler::start,\n-\t\t\t\t     ConnectionTypeBlocking, this, controls);\n+\tif (controls) {\n+\t\tControlList copy(*controls);\n+\t\tpatchControlList(copy);\n+\t\tret = d->pipe_->invokeMethod(&PipelineHandler::start,\n+\t\t\t\t\t     ConnectionTypeBlocking, this, &copy);\n+\t}\n+\telse\n+\t\tret = d->pipe_->invokeMethod(&PipelineHandler::start,\n+\t\t\t\t\t     ConnectionTypeBlocking, this, nullptr);\n+\n \tif (ret)\n \t\treturn ret;\n \n",
    "prefixes": [
        "1/1"
    ]
}