Show a patch.

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

{
    "id": 10543,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/10543/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/10543/",
    "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": "<20201202115253.14705-3-david.plowman@raspberrypi.com>",
    "date": "2020-12-02T11:52:50",
    "name": "[libcamera-devel,2/5] src: raspberrypi: Pass the drop frame count in start, not configure",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "6d6ff444edb955e9b548269840d39aaa3de9a2c3",
    "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/10543/mbox/",
    "series": [
        {
            "id": 1500,
            "url": "https://patchwork.libcamera.org/api/1.1/series/1500/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1500",
            "date": "2020-12-02T11:52:48",
            "name": "Raspberry Pi AGC: initial frame drop count",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/1500/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/10543/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/10543/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 60378BE177\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  2 Dec 2020 11:53:02 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2F76D635A3;\n\tWed,  2 Dec 2020 12:53:02 +0100 (CET)",
            "from mail-wr1-x443.google.com (mail-wr1-x443.google.com\n\t[IPv6:2a00:1450:4864:20::443])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2A336634A2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  2 Dec 2020 12:53:00 +0100 (CET)",
            "by mail-wr1-x443.google.com with SMTP id s8so3521167wrw.10\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 02 Dec 2020 03:53:00 -0800 (PST)",
            "from pi4-davidp.lan (plowpeople3.plus.com. [80.229.223.72])\n\tby smtp.gmail.com with ESMTPSA id\n\tn189sm1739215wmf.20.2020.12.02.03.52.58\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 02 Dec 2020 03:52:59 -0800 (PST)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"JI1C4A5E\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=ekSVYZR1R2TpVJqM/5kfzNoQQzPb4N/VRXvaptAxp6E=;\n\tb=JI1C4A5E4p4cqcZAcIbJXcfuv2s6t90870h38AT1y9U2v1TwqfXl48ye/TYf60XJhY\n\t2o8Vwoy4jE2xy3/2aW2CHzF/0xR0LgQCyylcwh9XNrHPWhJVO8qdz6tzuY1lhaSDUlt6\n\tkZfPkGi/unJdf5J5LrIjPXN/4urP4920hsM7jtDOi9qPn7qBNP8FI00uoNxOw41mA55r\n\t7InUUgmuoxaBCgXb9numVgYveaIn7yUgKdIvGkerlXKriIywaMaGmr2p60iRks7438fr\n\tX2et6MPn6RvoFuqUY15RiivfTHQJr8bxuSniGBCnxDfL/yPDc1xCisZGQunhu6o0y4J1\n\tps1Q==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=ekSVYZR1R2TpVJqM/5kfzNoQQzPb4N/VRXvaptAxp6E=;\n\tb=ZMTgXLB9jKgL8r+t0YKHuQEWhT72u5sCPJbW+PICN1ejXd6Z09Hg2BHIf55JSfi0PC\n\tFqWW39/AJ8/s9auYXMkr+P9Bhc3uFHeobJl+yf5e3TjKIXv7m2tRne2km88ZWoxh6JOO\n\tvJ8mAkmVIWcCCBpCOEMBkIWYQ77Vc4RPukQQK4Ei0zhLCnjP0aogUXDAn5G31ZdaBn4M\n\tFIif/v4swp96hjwRBFx7LNPM49UySFl/bxDt96jp+7U1JxgYyDgsSCD4jZAregBCXD3y\n\t68ozzhR78HchOkZIpOhvKftnd3AZ99G04tLIFGSuh3IqcZomqu+hvA+QF64ZfaspYItk\n\tiqYg==",
        "X-Gm-Message-State": "AOAM531idIaAP56sZ6C8p+Hc5b+kVKW4UKCa/UDptWTZ4UVjRv0Qu9gV\n\tGxrkewgrdX6Mo+i0yZfav3xaXKdxJOn8CuLy",
        "X-Google-Smtp-Source": "ABdhPJy1+BrHTsTX2Jw15oZ80M9bUY6NvYNSVA7vMzTJ3zKz00nnwBWWZ+5vcZuCh2rz8enW+2+R9w==",
        "X-Received": "by 2002:adf:c452:: with SMTP id\n\ta18mr3024151wrg.189.1606909979584; \n\tWed, 02 Dec 2020 03:52:59 -0800 (PST)",
        "From": "David Plowman <david.plowman@raspberrypi.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Wed,  2 Dec 2020 11:52:50 +0000",
        "Message-Id": "<20201202115253.14705-3-david.plowman@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.20.1",
        "In-Reply-To": "<20201202115253.14705-1-david.plowman@raspberrypi.com>",
        "References": "<20201202115253.14705-1-david.plowman@raspberrypi.com>",
        "MIME-Version": "1.0",
        "Subject": "[libcamera-devel] [PATCH 2/5] src: raspberrypi: Pass the drop frame\n\tcount in start, not configure",
        "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>",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "The number of frames to drop (not display) is passed back now from the\nstart method, not configure. This means applications have a chance to\nset fixed exposure/gain before starting the camera and this can affect\nthe frame drop count that is returned.\n\nBoth the IPA implementation file and the pipeline handler need\nmatching modifications.\n\nSigned-off-by: David Plowman <david.plowman@raspberrypi.com>\n---\n src/ipa/raspberrypi/raspberrypi.cpp           | 38 +++++++++----------\n .../pipeline/raspberrypi/raspberrypi.cpp      | 25 ++++++------\n 2 files changed, 32 insertions(+), 31 deletions(-)",
    "diff": "diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp\nindex b8298768..0300b8d9 100644\n--- a/src/ipa/raspberrypi/raspberrypi.cpp\n+++ b/src/ipa/raspberrypi/raspberrypi.cpp\n@@ -182,6 +182,25 @@ int IPARPi::start(const IPAOperationData &ipaConfig, IPAOperationData *result)\n \t\tresult->operation |= RPi::IPA_CONFIG_SENSOR;\n \t}\n \n+\t/*\n+\t * Initialise frame counts, and decide how many frames must be hidden or\n+\t *\"mistrusted\", which depends on whether this is a startup from cold,\n+\t * or merely a mode switch in a running system.\n+\t */\n+\tframeCount_ = 0;\n+\tcheckCount_ = 0;\n+\tunsigned int dropFrame = 0;\n+\tif (firstStart_) {\n+\t\tdropFrame = helper_->HideFramesStartup();\n+\t\tmistrustCount_ = helper_->MistrustFramesStartup();\n+\t} else {\n+\t\tdropFrame = helper_->HideFramesModeSwitch();\n+\t\tmistrustCount_ = helper_->MistrustFramesModeSwitch();\n+\t}\n+\n+\tresult->data.push_back(dropFrame);\n+\tresult->operation |= RPi::IPA_CONFIG_DROP_FRAMES;\n+\n \tfirstStart_ = false;\n \n \treturn 0;\n@@ -298,25 +317,6 @@ void IPARPi::configure(const CameraSensorInfo &sensorInfo,\n \t/* Pass the camera mode to the CamHelper to setup algorithms. */\n \thelper_->SetCameraMode(mode_);\n \n-\t/*\n-\t * Initialise frame counts, and decide how many frames must be hidden or\n-\t *\"mistrusted\", which depends on whether this is a startup from cold,\n-\t * or merely a mode switch in a running system.\n-\t */\n-\tframeCount_ = 0;\n-\tcheckCount_ = 0;\n-\tunsigned int dropFrame = 0;\n-\tif (controllerInit_) {\n-\t\tdropFrame = helper_->HideFramesModeSwitch();\n-\t\tmistrustCount_ = helper_->MistrustFramesModeSwitch();\n-\t} else {\n-\t\tdropFrame = helper_->HideFramesStartup();\n-\t\tmistrustCount_ = helper_->MistrustFramesStartup();\n-\t}\n-\n-\tresult->data.push_back(dropFrame);\n-\tresult->operation |= RPi::IPA_CONFIG_DROP_FRAMES;\n-\n \tif (!controllerInit_) {\n \t\t/* Load the tuning file for this sensor. */\n \t\tcontroller_.Read(tuningFile_.c_str());\ndiff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\nindex 89a44763..5ae56628 100644\n--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n@@ -745,13 +745,6 @@ int PipelineHandlerRPi::start(Camera *camera, [[maybe_unused]] ControlList *cont\n \t\treturn ret;\n \t}\n \n-\tret = queueAllBuffers(camera);\n-\tif (ret) {\n-\t\tLOG(RPI, Error) << \"Failed to queue buffers\";\n-\t\tstop(camera);\n-\t\treturn ret;\n-\t}\n-\n \t/* Check if a ScalerCrop control was specified. */\n \tif (controls)\n \t\tdata->applyScalerCrop(*controls);\n@@ -778,6 +771,19 @@ int PipelineHandlerRPi::start(Camera *camera, [[maybe_unused]] ControlList *cont\n \t\t\tLOG(RPI, Error) << \"V4L2 staggered set failed\";\n \t}\n \n+\tif (result.operation & RPi::IPA_CONFIG_DROP_FRAMES) {\n+\t\t/* Configure the number of dropped frames required on startup. */\n+\t\tdata->dropFrameCount_ = result.data[0];\n+\t}\n+\n+\t/* We need to set the dropFrameCount_ before queueing buffers. */\n+\tret = queueAllBuffers(camera);\n+\tif (ret) {\n+\t\tLOG(RPI, Error) << \"Failed to queue buffers\";\n+\t\tstop(camera);\n+\t\treturn ret;\n+\t}\n+\n \t/*\n \t * IPA configure may have changed the sensor flips - hence the bayer\n \t * order. Get the sensor format and set the ISP input now.\n@@ -1231,11 +1237,6 @@ int RPiCameraData::configureIPA(const CameraConfiguration *config)\n \t\t\tLOG(RPI, Error) << \"V4L2 staggered set failed\";\n \t}\n \n-\tif (result.operation & RPi::IPA_CONFIG_DROP_FRAMES) {\n-\t\t/* Configure the number of dropped frames required on startup. */\n-\t\tdropFrameCount_ = result.data[resultIdx++];\n-\t}\n-\n \t/*\n \t * Configure the H/V flip controls based on the combination of\n \t * the sensor and user transform.\n",
    "prefixes": [
        "libcamera-devel",
        "2/5"
    ]
}