Show a patch.

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

{
    "id": 10613,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/10613/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/10613/",
    "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": "<20201208204441.9356-2-david.plowman@raspberrypi.com>",
    "date": "2020-12-08T20:44:36",
    "name": "[libcamera-devel,v3,1/6] src: raspberrypi: Pass the drop frame count in start, not configure",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "2d17a2cc15ec948258626a839758d5495560da6d",
    "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/10613/mbox/",
    "series": [
        {
            "id": 1515,
            "url": "https://patchwork.libcamera.org/api/1.1/series/1515/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1515",
            "date": "2020-12-08T20:44:35",
            "name": "Raspberry Pi AGC: initial frame drop count",
            "version": 3,
            "mbox": "https://patchwork.libcamera.org/series/1515/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/10613/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/10613/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 60833BDB20\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  8 Dec 2020 20:44:47 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 76F1467F0A;\n\tTue,  8 Dec 2020 21:44:46 +0100 (CET)",
            "from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com\n\t[IPv6:2a00:1450:4864:20::52e])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7DAFA67E4D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  8 Dec 2020 21:44:45 +0100 (CET)",
            "by mail-ed1-x52e.google.com with SMTP id k4so19057498edl.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 08 Dec 2020 12:44:45 -0800 (PST)",
            "from pi4-davidp.lan (plowpeople3.plus.com. [80.229.223.72])\n\tby smtp.gmail.com with ESMTPSA id\n\tbe6sm18441471edb.29.2020.12.08.12.44.43\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 08 Dec 2020 12:44:44 -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=\"hNckknXQ\"; 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=jR9ohWFy4goGadcZ87qnt51zd0sDVZUtX2ovYrNp/ek=;\n\tb=hNckknXQO2Vt3nZkdqhID1qxKQVsYTtskKh/PseIpFxUT8YwEmrf0JGgljo/DyITiC\n\tt1L0rgP8pbil70UmFGyIH9SPszTTsWjXcdEDkWXrm3iuCGpT8vDLUtbnLzxmUnkFEo88\n\tlDVYJJ0hQWuU7E0xErcEK53A6jvPtyBiQVk8UgKfTQDke/UF53pSlSiNJiXZ4isnMoki\n\tIwB5mlGCiO4zsn58409ljX/L45xOcU8czS8pOha7L9eJ9hotDj1oGuHgqTf9FLd4r+Xi\n\tET6xCuyolBWxIlXB6oSqiDbfw6dRQNMeNEIaqVHaauKs+rxRHD46b7BBuV/7xG//5OPP\n\thc6A==",
        "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=jR9ohWFy4goGadcZ87qnt51zd0sDVZUtX2ovYrNp/ek=;\n\tb=Qdy2ncLI6/DDFlHfrTjIKWJQUtebARfVxmPm7PxxFzD0HPlZZAfy9xEi6Uaf16/6ZS\n\teDdSo2USzL5YAz7SYCJ3dnzARdg1qvXwB7PLYrtnWWn34bilCtF0r2VvWsEQupnCIibh\n\tDKqBvJV5xHiQ0Zo6aJKkKvF8wUvYmV9gubebNpQe24TNg+WiIVbiNxMmuoH64RZ2LmCr\n\tN3bEzZ4YwKXt1fQ6HCzvls9OtTqi1z6831X1457ze8DZKhFc4Rf3qDmzNw3UuH7QPJkr\n\tFTeMwx+F7Y/AguEUngEB+yIIHIKrYZkLFq+t91m70EX1+/kBfGcYbFno1Q1VTaaaWKir\n\tvWrg==",
        "X-Gm-Message-State": "AOAM531f3orKzyhhL/eBJxnciSx4P6Hx86KRhV4BwDEdJgaGLf3mk/wO\n\twSqLY6aylt0hToBO0MlQHYdV2Lm5AQSOHadk",
        "X-Google-Smtp-Source": "ABdhPJwV1eh7fLIhvhYY8j+w+f7CnQQ98TrXK/XkoNi0dKlTkFAEnJT3CQMxfyHfboqmTM01MqSDEw==",
        "X-Received": "by 2002:a50:f089:: with SMTP id\n\tv9mr26797692edl.353.1607460284809; \n\tTue, 08 Dec 2020 12:44:44 -0800 (PST)",
        "From": "David Plowman <david.plowman@raspberrypi.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Tue,  8 Dec 2020 20:44:36 +0000",
        "Message-Id": "<20201208204441.9356-2-david.plowman@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.20.1",
        "In-Reply-To": "<20201208204441.9356-1-david.plowman@raspberrypi.com>",
        "References": "<20201208204441.9356-1-david.plowman@raspberrypi.com>",
        "MIME-Version": "1.0",
        "Subject": "[libcamera-devel] [PATCH v3 1/6] src: raspberrypi: Pass the drop\n\tframe count 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\nNote how we need to be able to tell the very first time we start the\ncamera from subsequent restarts, hence addition of the \"firstStart_\"\nflag.\n\nBoth the IPA implementation file and the pipeline handler need\nmatching modifications.\n\nSigned-off-by: David Plowman <david.plowman@raspberrypi.com>\nReviewed-by: Naushir Patuck <naush@raspberrypi.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/ipa/raspberrypi/raspberrypi.cpp           | 45 ++++++++++---------\n .../pipeline/raspberrypi/raspberrypi.cpp      | 25 ++++++-----\n 2 files changed, 38 insertions(+), 32 deletions(-)",
    "diff": "diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp\nindex ebe3013a..ba63480e 100644\n--- a/src/ipa/raspberrypi/raspberrypi.cpp\n+++ b/src/ipa/raspberrypi/raspberrypi.cpp\n@@ -67,7 +67,7 @@ public:\n \tIPARPi()\n \t\t: lastMode_({}), controller_(), controllerInit_(false),\n \t\t  frameCount_(0), checkCount_(0), mistrustCount_(0),\n-\t\t  lsTable_(nullptr)\n+\t\t  lsTable_(nullptr), firstStart_(true)\n \t{\n \t}\n \n@@ -145,6 +145,9 @@ private:\n \t/* LS table allocation passed in from the pipeline handler. */\n \tFileDescriptor lsTableHandle_;\n \tvoid *lsTable_;\n+\n+\t/* Distinguish the first camera start from others. */\n+\tbool firstStart_;\n };\n \n int IPARPi::init(const IPASettings &settings)\n@@ -180,6 +183,27 @@ int IPARPi::start(const IPAOperationData &data, 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 }\n \n@@ -305,25 +329,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 593fd7ac..439c21ce 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@@ -779,6 +772,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@@ -1237,11 +1243,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",
        "v3",
        "1/6"
    ]
}