Show a patch.

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

{
    "id": 16685,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/16685/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/16685/",
    "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": "<20220719103144.3686313-2-kieran.bingham@ideasonboard.com>",
    "date": "2022-07-19T10:31:43",
    "name": "[libcamera-devel,1/2] libcamera: request: Add support for error flags",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "15c4ef244fccc960c7c342446b05315f37a3b38c",
    "submitter": {
        "id": 4,
        "url": "https://patchwork.libcamera.org/api/1.1/people/4/?format=api",
        "name": "Kieran Bingham",
        "email": "kieran.bingham@ideasonboard.com"
    },
    "delegate": {
        "id": 11,
        "url": "https://patchwork.libcamera.org/api/1.1/users/11/?format=api",
        "username": "kbingham",
        "first_name": "Kieran",
        "last_name": "Bingham",
        "email": "kieran.bingham@ideasonboard.com"
    },
    "mbox": "https://patchwork.libcamera.org/patch/16685/mbox/",
    "series": [
        {
            "id": 3299,
            "url": "https://patchwork.libcamera.org/api/1.1/series/3299/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3299",
            "date": "2022-07-19T10:31:42",
            "name": "request: Support non fatal errors",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/3299/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/16685/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/16685/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 51A80BE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 19 Jul 2022 10:31:51 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1868A63315;\n\tTue, 19 Jul 2022 12:31:50 +0200 (CEST)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A1E4F6330E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 19 Jul 2022 12:31:48 +0200 (CEST)",
            "from Monstersaurus.local\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 15DDA896;\n\tTue, 19 Jul 2022 12:31:48 +0200 (CEST)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1658226710;\n\tbh=jp4nxfN6xfM63XVDRGE0HJVJVRZ4VxQmFjEaedaqgKQ=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=C4AsX4Nhkk9tHqmKYrJUvU9I1EZ7nSgu5aevmtHUlJj1jSNgWBQE8EaH54/PTn8Wm\n\turb4Tlk9VBu3ID8dC/9mzwnXQmRSqLh9nT5OH1147DXjozaT1yngXiMg+aeJSQvR+A\n\tuaeWSFOFkmXOBpeAvD7z2KhU7BTa727NDJBksVBWub5Zqb6AqvFBiPKmBxB1t1MH1L\n\tQYSpJj6PySCCCCt3/uq8ZxsNUkLlr9R9gUr3Eb7DWpuTjDZolw1I8iXIXkxc1Kp2Nu\n\tmpPWxI63WhogLpoMcMuGfckzgxmg+qCljNETsgMKUZxNPx+FWHzfD+wy6rcwoMVZw1\n\txNhlp5YS10GPQ==",
            "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1658226708;\n\tbh=jp4nxfN6xfM63XVDRGE0HJVJVRZ4VxQmFjEaedaqgKQ=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=k+ffmEAltQCtb40knznrzBvBY+Tefjxy3xSr71NKQ96Tc9D3p8KI0JA0qU58bFfmQ\n\t+uncwfgkyUcOZCjFRuR5UUppoBHB+MTHkVPzw3gRoLPKoGRrhIR69Gy9mPABvUwuAl\n\tcuFRvBIIYXoJgGintRJnn0AEH9K9RKmIJUasbNaE="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"k+ffmEAl\"; dkim-atps=neutral",
        "To": "libcamera devel <libcamera-devel@lists.libcamera.org>",
        "Date": "Tue, 19 Jul 2022 11:31:43 +0100",
        "Message-Id": "<20220719103144.3686313-2-kieran.bingham@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.34.1",
        "In-Reply-To": "<20220719103144.3686313-1-kieran.bingham@ideasonboard.com>",
        "References": "<20220719103144.3686313-1-kieran.bingham@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH 1/2] libcamera: request: Add support for\n\terror flags",
        "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>",
        "From": "Kieran Bingham via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>",
        "Reply-To": "Kieran Bingham <kieran.bingham@ideasonboard.com>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "From: Paul Elder <paul.elder@ideasonboard.com>\n\nAdd error flags to the Request to indicate non-fatal errors.\n\nApplications should check the error() state of the Request to determine\nif any fault occured while processing the request.\n\nInitially, a single error flag ControlError is added to allow a pipeline\nhandler to report a failure to set controls on a hardware device while\nprocessing the request.\n\nControlErrors occur when a Request was asked to set a control and the\npipeline handler attempted to do so, but it was rejected by the kernel.\n\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n include/libcamera/internal/request.h |  3 +++\n include/libcamera/request.h          |  9 +++++++\n src/libcamera/request.cpp            | 36 ++++++++++++++++++++++++++++\n 3 files changed, 48 insertions(+)",
    "diff": "diff --git a/include/libcamera/internal/request.h b/include/libcamera/internal/request.h\nindex 9dadd6c60361..8e592272cfae 100644\n--- a/include/libcamera/internal/request.h\n+++ b/include/libcamera/internal/request.h\n@@ -38,6 +38,7 @@ public:\n \tvoid complete();\n \tvoid cancel();\n \tvoid reuse();\n+\tvoid setErrorFlags(ErrorFlags flags);\n \n \tvoid prepare(std::chrono::milliseconds timeout = 0ms);\n \tSignal<> prepared;\n@@ -59,6 +60,8 @@ private:\n \tstd::unordered_set<FrameBuffer *> pending_;\n \tstd::map<FrameBuffer *, std::unique_ptr<EventNotifier>> notifiers_;\n \tstd::unique_ptr<Timer> timer_;\n+\n+\tErrorFlags error_;\n };\n \n } /* namespace libcamera */\ndiff --git a/include/libcamera/request.h b/include/libcamera/request.h\nindex dffde1536cad..992629e11aa4 100644\n--- a/include/libcamera/request.h\n+++ b/include/libcamera/request.h\n@@ -15,6 +15,7 @@\n #include <unordered_set>\n \n #include <libcamera/base/class.h>\n+#include <libcamera/base/flags.h>\n #include <libcamera/base/signal.h>\n \n #include <libcamera/controls.h>\n@@ -43,6 +44,13 @@ public:\n \t\tReuseBuffers = (1 << 0),\n \t};\n \n+\tenum ErrorFlag {\n+\t\tNoError = 0,\n+\t\tControlError = (1 << 0),\n+\t};\n+\n+\tusing ErrorFlags = Flags<ErrorFlag>;\n+\n \tusing BufferMap = std::map<const Stream *, FrameBuffer *>;\n \n \tRequest(Camera *camera, uint64_t cookie = 0);\n@@ -60,6 +68,7 @@ public:\n \tuint32_t sequence() const;\n \tuint64_t cookie() const { return cookie_; }\n \tStatus status() const { return status_; }\n+\tErrorFlags error() const;\n \n \tbool hasPendingBuffers() const;\n \ndiff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp\nindex 07613cb33709..d585ef0b0ae4 100644\n--- a/src/libcamera/request.cpp\n+++ b/src/libcamera/request.cpp\n@@ -162,6 +162,7 @@ void Request::Private::cancel()\n  */\n void Request::Private::reuse()\n {\n+\terror_ = Request::NoError;\n \tsequence_ = 0;\n \tcancelled_ = false;\n \tprepared_ = false;\n@@ -284,6 +285,11 @@ void Request::Private::notifierActivated(FrameBuffer *buffer)\n \temitPrepareCompleted();\n }\n \n+void Request::Private::setErrorFlags(ErrorFlags flags)\n+{\n+\terror_ |= flags;\n+}\n+\n void Request::Private::timeout()\n {\n \t/* A timeout can only happen if there are fences not yet signalled. */\n@@ -318,6 +324,22 @@ void Request::Private::timeout()\n  * Reuse the buffers that were previously added by addBuffer()\n  */\n \n+/**\n+ * \\enum Request::ErrorFlag\n+ * Flags to report non-fatal errors\n+ * \\var Request::NoError\n+ * No error\n+ * \\var Request::ControlError\n+ * Control Error. At least on control was not able to be applied to the device.\n+ * The application should compare the metadata to the requested control values\n+ * to check which controls weren't applied.\n+ */\n+\n+/**\n+ * \\typedef Request::ErrorFlags\n+ * The error state of the request.\n+ */\n+\n /**\n  * \\typedef Request::BufferMap\n  * \\brief A map of Stream to FrameBuffer pointers\n@@ -560,6 +582,20 @@ uint32_t Request::sequence() const\n  * \\return The request completion status\n  */\n \n+/**\n+ * \\brief Retrieve the error flags\n+ *\n+ * The request could complete with non-fatal error. The completion status will\n+ * indicate success. This function returns the non-fatal errors that the\n+ * request completed with\n+ *\n+ * \\return Flags of non-fatal errors that the request completed with\n+ */\n+Request::ErrorFlags Request::error() const\n+{\n+\treturn _d()->error_;\n+}\n+\n /**\n  * \\brief Check if a request has buffers yet to be completed\n  *\n",
    "prefixes": [
        "libcamera-devel",
        "1/2"
    ]
}