Show a patch.

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

{
    "id": 21642,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/21642/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/21642/",
    "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": "<20241016131730.3634805-1-chenghaoyang@chromium.org>",
    "date": "2024-10-16T13:17:28",
    "name": "libcamera: reserve frame sequence reported from the hardware",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "932a7e90e96ad10b570b689b83ecf5b12ee15f1e",
    "submitter": {
        "id": 117,
        "url": "https://patchwork.libcamera.org/api/1.1/people/117/?format=api",
        "name": "Cheng-Hao Yang",
        "email": "chenghaoyang@chromium.org"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/21642/mbox/",
    "series": [
        {
            "id": 4706,
            "url": "https://patchwork.libcamera.org/api/1.1/series/4706/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4706",
            "date": "2024-10-16T13:17:28",
            "name": "libcamera: reserve frame sequence reported from the hardware",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/4706/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/21642/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/21642/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 D24FCC32FA\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 16 Oct 2024 13:17:40 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 89D056537F;\n\tWed, 16 Oct 2024 15:17:39 +0200 (CEST)",
            "from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com\n\t[IPv6:2607:f8b0:4864:20::62d])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 498956537E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 16 Oct 2024 15:17:37 +0200 (CEST)",
            "by mail-pl1-x62d.google.com with SMTP id\n\td9443c01a7336-20c805a0753so53961745ad.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 16 Oct 2024 06:17:37 -0700 (PDT)",
            "from chenghaoyang-low.c.googlers.com.com\n\t(199.211.81.34.bc.googleusercontent.com. [34.81.211.199])\n\tby smtp.gmail.com with ESMTPSA id\n\td9443c01a7336-20d17f9a0cbsm28315325ad.81.2024.10.16.06.17.34\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 16 Oct 2024 06:17:34 -0700 (PDT)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"cgJ0mAbe\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=chromium.org; s=google; t=1729084655; x=1729689455;\n\tdarn=lists.libcamera.org; \n\th=content-transfer-encoding:mime-version:message-id:date:subject:cc\n\t:to:from:from:to:cc:subject:date:message-id:reply-to;\n\tbh=rWWA1rt5ePfkk+kLieZFRk1f2IM3EcWsIRC4Jkz6C/8=;\n\tb=cgJ0mAbeH2pfZGAg2flBv2C+pgMWFmFGsPBWSmNSB2Xf58qIQvo4raIucX9uh7HFnb\n\t3vYcHHZ7YZoAQUkumg37R9k5uKveVQzGa60z06xRZdhFsFjjySgcJ51q4j0ZzKU6Qeun\n\tg/czJlUL7l8mCXhApSSqmT/L9MVOCfJTqAYHQ=",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1729084655; x=1729689455;\n\th=content-transfer-encoding:mime-version:message-id:date:subject:cc\n\t:to:from:x-gm-message-state:from:to:cc:subject:date:message-id\n\t:reply-to;\n\tbh=rWWA1rt5ePfkk+kLieZFRk1f2IM3EcWsIRC4Jkz6C/8=;\n\tb=Pe7DgYNkMeN1QQ/Iu64cP6R8josOaXlQCcrLYzqFrLZtGJVHTg2ofoX16fE/plIJxb\n\t67UgcWVl3DytsoLTgxgFFJfLi/gy8rxp+ylitBgADEFM9wVUUCQ/bNroDhuweFSkqSpp\n\tlY0y+b2ccBfrJZHYH8GfPDBABl/1xWKYEE3ZsRS390FlU1BTY9BeN+INaWCMnE5i8+9E\n\ti6/0HUFdrumM0LroNXrTM/0UxVjDELYLQTVYTg2pybbBL5KXVNNJkNC0IlRDNweKmdtp\n\tfSRu3SvFNWnnpQyCb76UDsciZNgGokVJFgetLO/xlmnoLIwH600b6EMCyRotjLgCeezT\n\tOkqQ==",
        "X-Gm-Message-State": "AOJu0YxWPbqRcQhmE3BfJ+U+yCzP3G7p8+Zv0Xg9uBnXaha+u1ztwWjZ\n\t7uOKwoozT8/XPcDRUkkMejXo2D7WjA6SElSqONDOH0XdYf+S6D+2SDyEfBl15fbSjX2HbIzncZQ\n\t=",
        "X-Google-Smtp-Source": "AGHT+IHSVWd7Ge/Q8SvndviogqSjDPX32IVMK3zBJ1ivZAneso37cJEJRRFpHACVG+lKOM/08Feapw==",
        "X-Received": "by 2002:a17:902:f792:b0:20d:2804:bcde with SMTP id\n\td9443c01a7336-20d2804bd8fmr41406015ad.35.1729084655270; \n\tWed, 16 Oct 2024 06:17:35 -0700 (PDT)",
        "From": "Harvey Yang <chenghaoyang@chromium.org>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "Yudhistira Erlandinata <yerlandinata@chromium.org>,\n\tHarvey Yang <chenghaoyang@chromium.org>",
        "Subject": "[PATCH] libcamera: reserve frame sequence reported from the hardware",
        "Date": "Wed, 16 Oct 2024 13:17:28 +0000",
        "Message-ID": "<20241016131730.3634805-1-chenghaoyang@chromium.org>",
        "X-Mailer": "git-send-email 2.47.0.rc1.288.g06298d1525-goog",
        "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": "From: Yudhistira Erlandinata <yerlandinata@chromium.org>\n\nOriginally libcamera resets the sequence to 0 on streamOn. However,\nHowever, there are occasions when the user needs the original\nhardware sequence to query processing information of the particular\nframe. The patch reserves the hwSequence in the FrameMetadata.\n\nSigned-off-by: Yudhistira Erlandinata <yerlandinata@chromium.org>\nCo-developed-by: Harvey Yang <chenghaoyang@chromium.org>\nSigned-off-by: Harvey Yang <chenghaoyang@chromium.org>\n---\n include/libcamera/framebuffer.h    | 1 +\n src/libcamera/framebuffer.cpp      | 9 +++++++++\n src/libcamera/v4l2_videodevice.cpp | 1 +\n 3 files changed, 11 insertions(+)",
    "diff": "diff --git a/include/libcamera/framebuffer.h b/include/libcamera/framebuffer.h\nindex ff8392430..fccfaa82a 100644\n--- a/include/libcamera/framebuffer.h\n+++ b/include/libcamera/framebuffer.h\n@@ -34,6 +34,7 @@ struct FrameMetadata {\n \n \tStatus status;\n \tunsigned int sequence;\n+\tunsigned int hwSequence;\n \tuint64_t timestamp;\n \n \tSpan<Plane> planes() { return planes_; }\ndiff --git a/src/libcamera/framebuffer.cpp b/src/libcamera/framebuffer.cpp\nindex 826848f75..d9d6294bc 100644\n--- a/src/libcamera/framebuffer.cpp\n+++ b/src/libcamera/framebuffer.cpp\n@@ -86,6 +86,15 @@ LOG_DEFINE_CATEGORY(Buffer)\n  * Gaps in the sequence numbers indicate dropped frames.\n  */\n \n+/**\n+ * \\var FrameMetadata::hwSequence\n+ * \\brief The real hardware Frame sequence number\n+ *\n+ * \\a FrameMetadata::sequence auto-corrects the initial value to zero on frame\n+ * start. This value keeps the original hardware sequence to allow users to\n+ * query processing information of particular frames.\n+ */\n+\n /**\n  * \\var FrameMetadata::timestamp\n  * \\brief Time when the frame was captured\ndiff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp\nindex 14eba0561..9bc677edf 100644\n--- a/src/libcamera/v4l2_videodevice.cpp\n+++ b/src/libcamera/v4l2_videodevice.cpp\n@@ -1862,6 +1862,7 @@ FrameBuffer *V4L2VideoDevice::dequeueBuffer()\n \t\t\t? FrameMetadata::FrameError\n \t\t\t: FrameMetadata::FrameSuccess;\n \tmetadata.sequence = buf.sequence;\n+\tmetadata.hwSequence = buf.sequence;\n \tmetadata.timestamp = buf.timestamp.tv_sec * 1000000000ULL\n \t\t\t   + buf.timestamp.tv_usec * 1000ULL;\n \n",
    "prefixes": []
}