Show a patch.

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

{
    "id": 22947,
    "url": "https://patchwork.libcamera.org/api/patches/22947/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/22947/",
    "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": "<20250310170335.185297-1-barnabas.pocze@ideasonboard.com>",
    "date": "2025-03-10T17:03:35",
    "name": "[v1] libcamera: request: Store fence `EventNotifier` directly",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "09a614a84a3eb7df99d9a964fd53cab5a4e880a9",
    "submitter": {
        "id": 216,
        "url": "https://patchwork.libcamera.org/api/people/216/?format=api",
        "name": "Barnabás Pőcze",
        "email": "barnabas.pocze@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/22947/mbox/",
    "series": [
        {
            "id": 5055,
            "url": "https://patchwork.libcamera.org/api/series/5055/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5055",
            "date": "2025-03-10T17:03:35",
            "name": "[v1] libcamera: request: Store fence `EventNotifier` directly",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/5055/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/22947/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/22947/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 CB7FCC32F1\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 10 Mar 2025 17:03:42 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6F6AC68920;\n\tMon, 10 Mar 2025 18:03:42 +0100 (CET)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3A7EB687F0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 10 Mar 2025 18:03:41 +0100 (CET)",
            "from pb-laptop.local (185.221.143.221.nat.pool.zt.hu\n\t[185.221.143.221])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 18CBA227\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 10 Mar 2025 18:02:03 +0100 (CET)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"EPCxeaqH\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1741626124;\n\tbh=aEfP9AeNqiqfLnmsCO6iPblvlvXmIz0A89NTs35W+d8=;\n\th=From:To:Subject:Date:From;\n\tb=EPCxeaqH61FFSBlkOIfXzJ/pOexZtHNxZxazsnMB8g6hqhdQr3QTlRwjcmoZ6S+M3\n\tQHkgDiJA5p47dkoRzhGBDHOfTt7VcxQdGwhNFuWjxddynW/Bm8eeMjZkh0MhnSXjz4\n\tsDCba1vTFFO9Ganf53pJreJvN8P4/mkc8zEQC/0I=",
        "From": "=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Subject": "[PATCH v1] libcamera: request: Store fence `EventNotifier` directly",
        "Date": "Mon, 10 Mar 2025 18:03:35 +0100",
        "Message-ID": "<20250310170335.185297-1-barnabas.pocze@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.48.1",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "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": "Simplify a bit by storing the `EventNotifier` objects directly in the\n`std::map` instead of wrapping them in unique_ptr. An other advantage\nis that it removes one allocation per fence.\n\nSigned-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n---\n include/libcamera/internal/request.h |  2 +-\n src/libcamera/request.cpp            | 13 +++++--------\n 2 files changed, 6 insertions(+), 9 deletions(-)",
    "diff": "diff --git a/include/libcamera/internal/request.h b/include/libcamera/internal/request.h\nindex 73e9bb5cc..78cb99f36 100644\n--- a/include/libcamera/internal/request.h\n+++ b/include/libcamera/internal/request.h\n@@ -59,7 +59,7 @@ private:\n \tbool prepared_ = false;\n \n \tstd::unordered_set<FrameBuffer *> pending_;\n-\tstd::map<FrameBuffer *, std::unique_ptr<EventNotifier>> notifiers_;\n+\tstd::map<FrameBuffer *, EventNotifier> notifiers_;\n \tstd::unique_ptr<Timer> timer_;\n };\n \ndiff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp\nindex b206ac132..6fa1801a0 100644\n--- a/src/libcamera/request.cpp\n+++ b/src/libcamera/request.cpp\n@@ -228,15 +228,12 @@ void Request::Private::prepare(std::chrono::milliseconds timeout)\n \t\tif (!fence)\n \t\t\tcontinue;\n \n-\t\tstd::unique_ptr<EventNotifier> notifier =\n-\t\t\tstd::make_unique<EventNotifier>(fence->fd().get(),\n-\t\t\t\t\t\t\tEventNotifier::Read);\n+\t\tauto [it, inserted] = notifiers_.try_emplace(buffer, fence->fd().get(), EventNotifier::Type::Read);\n+\t\tASSERT(inserted);\n \n-\t\tnotifier->activated.connect(this, [this, buffer] {\n-\t\t\t\t\t\t\tnotifierActivated(buffer);\n-\t\t\t\t\t    });\n-\n-\t\tnotifiers_[buffer] = std::move(notifier);\n+\t\tit->second.activated.connect(this, [this, buffer] {\n+\t\t\tnotifierActivated(buffer);\n+\t\t});\n \t}\n \n \tif (notifiers_.empty()) {\n",
    "prefixes": [
        "v1"
    ]
}