Show a patch.

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

{
    "id": 26790,
    "url": "https://patchwork.libcamera.org/api/patches/26790/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/26790/",
    "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": "<20260521141006.101016-4-robert.mader@collabora.com>",
    "date": "2026-05-21T14:10:06",
    "name": "[v1,3/3] debayer_egl: Sync output buffers after processing stats",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "a791b2193715ee563bed76807a01a2a9501683fb",
    "submitter": {
        "id": 140,
        "url": "https://patchwork.libcamera.org/api/people/140/?format=api",
        "name": "Robert Mader",
        "email": "robert.mader@collabora.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/26790/mbox/",
    "series": [
        {
            "id": 5959,
            "url": "https://patchwork.libcamera.org/api/series/5959/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5959",
            "date": "2026-05-21T14:10:04",
            "name": "debayer_egl: Sync output buffers after processing stats",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/5959/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/26790/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/26790/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 3CB48BDCBC\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 21 May 2026 14:10:40 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C5FA663020;\n\tThu, 21 May 2026 16:10:37 +0200 (CEST)",
            "from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com\n\t[136.143.188.112])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A96B16302A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 21 May 2026 16:10:32 +0200 (CEST)",
            "by mx.zohomail.com with SMTPS id 1779372627967665.2306654464332;\n\tThu, 21 May 2026 07:10:27 -0700 (PDT)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=collabora.com\n\theader.i=robert.mader@collabora.com header.b=\"D72usO02\"; \n\tdkim-atps=neutral",
        "ARC-Seal": "i=1; a=rsa-sha256; t=1779372629; cv=none; \n\td=zohomail.com; s=zohoarc; \n\tb=Hd8h9LVo/vpqBlV9Tz6FhxFDEKJ3NK29Tn7aCkyQyvBmzYLp4lb16oaLD8ZiAFOcdTGidCrRAGmAC5mZAcLeOWMtuLZEs6UawZeqZI86OkTHiGdpv+U1CFN3picbK2rbBK50cEd5a5kX4LpJDMULKnWGC+Xod3bZ0fVBQs5EcUA=",
        "ARC-Message-Signature": "i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; \n\ts=zohoarc; t=1779372629;\n\th=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To;\n\tbh=vNdfs2ygqxRglKSfPeUPEWTNMPx/kX9pm9a4kd4TirQ=; \n\tb=Pn32yaFVWw49bap7lxmJh/yXNIOw6KyqHeg/TRXsm8OmnuV+EPEVHfe4xlyx8ZKdUpvkaXI4vWHBCU+nXEtOWIBbEaj9omUknYPVCinQy0AsUEdyguWtENLE5wjkqfZwzzcImZitKzzASIgDrnc03sTL3/1Wdxvu9l/NpJxoSKI=",
        "ARC-Authentication-Results": "i=1; mx.zohomail.com;\n\tdkim=pass  header.i=collabora.com;\n\tspf=pass  smtp.mailfrom=robert.mader@collabora.com;\n\tdmarc=pass header.from=<robert.mader@collabora.com>",
        "DKIM-Signature": "v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1779372629;\n\ts=zohomail; d=collabora.com; i=robert.mader@collabora.com;\n\th=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-ID:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Message-Id:Reply-To;\n\tbh=vNdfs2ygqxRglKSfPeUPEWTNMPx/kX9pm9a4kd4TirQ=;\n\tb=D72usO02TmR95dV08ptWgglQboqyGOxwo9fyTWfER9uTZc7L8kJsMRqyYsqQXKhm\n\tSbR5XcVRkUyObaxqfnvb8VETdWZn938HB6bkfXffd98xbJw2XABZXj6sEodJjjPAZl/\n\trtPyYYpZJa6qrFQdMj+0WwnrqeIvBf5iYhrlDhQk=",
        "From": "Robert Mader <robert.mader@collabora.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "Robert Mader <robert.mader@collabora.com>",
        "Subject": "[PATCH v1 3/3] debayer_egl: Sync output buffers after processing\n\tstats",
        "Date": "Thu, 21 May 2026 16:10:06 +0200",
        "Message-ID": "<20260521141006.101016-4-robert.mader@collabora.com>",
        "X-Mailer": "git-send-email 2.54.0",
        "In-Reply-To": "<20260521141006.101016-1-robert.mader@collabora.com>",
        "References": "<20260521141006.101016-1-robert.mader@collabora.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": "Instead of waiting for the GPU to finish output buffers *before*\ncomputing stats, do so afterwards. This allows work to happen in\nparallel on the GPU and CPU, potentially improving throughput and\nreducing latency.\n\nOn order for this to happen efficiently we still need to flush all\nGL commands to the GPU first, thus split out glFlush into a dedicated\nfunction.\n\nBelow are some benchmark results. All where done using postmarketOS edge\nwith updates from 21th May 2026 (Mesa 26.1.1). The mentioned pipelines\nwhere run five times each, with the mean value included here, which should\nbe quite representive as the variance was rather small. All devices\nwhere using the powersave governor.\n\nNote that we only expect changes for frames where stats get computed,\ncurrently every fourth frame (see kStatPerNumFrames) - and the improvements\nindeed have been observed to increase when computing stats more often.\n\ncam -c /base/soc@0/cci@ac4a000/i2c-bus@0/camera@1a -s width=1920,height=1080 --capture=60\nBefore: 33596 us/frame\nAfter: 30179 us/frame\n\ncam -c /base/soc@0/cci@ac4a000/i2c-bus@1/camera@1a -s width=1920,height=1080 --capture=60\nBefore: 14922 us/frame\nAfter: 14304 us/frame\n\ncam -c /base/soc@0/cci@ac4b000/i2c-bus@1/camera@10 -s width=1920,height=1080 --capture=60\nBefore: 26106 us/frame\nAfter: 23312 us/frame\n\ncam -c /base/soc@0/cci@ac4a000/i2c-bus@1/camera@29 -s width=1920,height=1080 --capture=60\nBefore: 15897 us/frame\nAfter: 14791 us/frame\n\ncam -c /base/soc@0/cci@ac4a000/i2c-bus@1/camera@10 -s width=1920,height=1080 --capture=60\nBefore: 25721 us/frame\nAfter: 23625 us/frame\n\ncam -c /base/soc@0/cci@ac4a000/i2c-bus@0/camera@10 -s width=1920,height=1080 --capture=60\nBefore: 34124 us/frame\nAfter: 29471 us/frame\n\ncam -c /base/soc@0/cci@ac4a000/i2c-bus@0/camera@1a -s width=1920,height=1080 --capture=60\nBefore: 23707 us/frame\nAfter: 21890 us/frame\n\ncam -c /base/soc@0/bus@30800000/i2c@30a40000/camera@20 -s width=1280,height=720 --capture=60\nBefore: 91649 us/frame\nAfter: 83233 us/frame\n\ncam -c /base/soc@0/bus@30800000/i2c@30a50000/camera@2d -s width=1280,height=720 --capture=60\nBefore: 76956 us/frame\nAfter: 69569 us/frame\n\ncam -c /base/i2c-csi/front-camera@3c -s width=1280,height=720 --capture=60\nBefore: 188500 us/frame\nAfter: 173764 us/frame\n\ncam -c /base/i2c-csi/rear-camera@4c -s width=1280,height=720 --capture=60\nBefore: 190222 us/frame\nAfter: 177251 us/frame\n\nSigned-off-by: Robert Mader <robert.mader@collabora.com>\n---\n include/libcamera/internal/egl.h           |  1 +\n src/libcamera/egl.cpp                      | 14 +++++++++++++-\n src/libcamera/software_isp/debayer_egl.cpp |  3 ++-\n 3 files changed, 16 insertions(+), 2 deletions(-)",
    "diff": "diff --git a/include/libcamera/internal/egl.h b/include/libcamera/internal/egl.h\nindex 0ad2320b1..0ec8ea6ec 100644\n--- a/include/libcamera/internal/egl.h\n+++ b/include/libcamera/internal/egl.h\n@@ -119,6 +119,7 @@ public:\n \tvoid useProgram(GLuint programId);\n \tvoid deleteProgram(GLuint programId);\n \tvoid syncOutput();\n+\tvoid flushOutput();\n \n private:\n \tLIBCAMERA_DISABLE_COPY_AND_MOVE(eGL)\ndiff --git a/src/libcamera/egl.cpp b/src/libcamera/egl.cpp\nindex d9bc4f555..19ae92305 100644\n--- a/src/libcamera/egl.cpp\n+++ b/src/libcamera/egl.cpp\n@@ -94,10 +94,22 @@ void eGL::syncOutput()\n {\n \tASSERT(tid_ == Thread::currentId());\n \n-\tglFlush();\n \tglFinish();\n }\n \n+/**\n+ * \\brief Flush the rendering pipeline\n+ *\n+ * Calls glFlush().\n+ *\n+ */\n+void eGL::flushOutput()\n+{\n+\tASSERT(tid_ == Thread::currentId());\n+\n+\tglFlush();\n+}\n+\n /**\n  * \\brief Create a DMA-BUF backed 2D texture\n  * \\param[in,out] eglImage EGL image to associate with the DMA-BUF\ndiff --git a/src/libcamera/software_isp/debayer_egl.cpp b/src/libcamera/software_isp/debayer_egl.cpp\nindex ed9a68013..7b9e02d90 100644\n--- a/src/libcamera/software_isp/debayer_egl.cpp\n+++ b/src/libcamera/software_isp/debayer_egl.cpp\n@@ -521,7 +521,7 @@ int DebayerEGL::debayerGPU(MappedFrameBuffer &in, int out_fd, const DebayerParam\n \t\tLOG(eGL, Error) << \"Drawing scene fail \" << err;\n \t\treturn -ENODEV;\n \t} else {\n-\t\tegl_.syncOutput();\n+\t\tegl_.flushOutput();\n \t}\n \n \treturn 0;\n@@ -558,6 +558,7 @@ void DebayerEGL::process(uint32_t frame, FrameBuffer *input, FrameBuffer *output\n \tstats_->processFrame(frame, 0, input);\n \tdmaSyncers.clear();\n \n+\tegl_.syncOutput();\n \tbench_.finishFrame();\n \n \toutputBufferReady.emit(output);\n",
    "prefixes": [
        "v1",
        "3/3"
    ]
}