Show a patch.

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

{
    "id": 16713,
    "url": "https://patchwork.libcamera.org/api/patches/16713/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/16713/",
    "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": "<20220721121310.1286862-2-kieran.bingham@ideasonboard.com>",
    "date": "2022-07-21T12:12:59",
    "name": "[libcamera-devel,RFC,01/12] libcamera: request: Add support for error flags",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "562b64319cb1b994a03791bbb635c09627845400",
    "submitter": {
        "id": 4,
        "url": "https://patchwork.libcamera.org/api/people/4/?format=api",
        "name": "Kieran Bingham",
        "email": "kieran.bingham@ideasonboard.com"
    },
    "delegate": {
        "id": 11,
        "url": "https://patchwork.libcamera.org/api/users/11/?format=api",
        "username": "kbingham",
        "first_name": "Kieran",
        "last_name": "Bingham",
        "email": "kieran.bingham@ideasonboard.com"
    },
    "mbox": "https://patchwork.libcamera.org/patch/16713/mbox/",
    "series": [
        {
            "id": 3313,
            "url": "https://patchwork.libcamera.org/api/series/3313/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3313",
            "date": "2022-07-21T12:12:58",
            "name": "libcamera: Align IPU3 and RKISP1 interfaces",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/3313/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/16713/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/16713/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 4F5BFBD1F1\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 21 Jul 2022 12:13:20 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2595C63326;\n\tThu, 21 Jul 2022 14:13:18 +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 1F266601B8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 21 Jul 2022 14:13:14 +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 735D29B1;\n\tThu, 21 Jul 2022 14:13:13 +0200 (CEST)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1658405598;\n\tbh=TvAEGOpGpmpFjfSWAB3ltiYQFcd0bvglEnKX0K7YKqE=;\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=PtIib24QC6crQ0v2D2dNzIjzkP/A9nOscASlRwLp6/809BSifhunvuo4ApzvvTMD8\n\t1JBT6dt9617uZqSxgB3d4ay/9m5jOSb7PV0fny8yEpahQe2K5b7/WOtfjo8xox/Z1v\n\ta/iUGOgUpOOFp/yQXh3lK/+xpsryXUDMcmz3PMBNSmAQmqXFcZPSdfLkzRRnlj5M1Q\n\tA9fw9EENs5iOxXHguSSwFFy2Z9TvD9rRhEgGvAWUaoImEou64hfJNAGJcg0eouSrkZ\n\tc4OtAcwCfKs2A4atVb6hWfUWPh8Dh7KPLe978XbARO0C0LBlLsyco/YKYvURO6etcr\n\tp54yOiq86wMHA==",
            "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1658405593;\n\tbh=TvAEGOpGpmpFjfSWAB3ltiYQFcd0bvglEnKX0K7YKqE=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=I1jiVEjQFiNooDoHK6fzvxI0dTiyUTbTSpm9/d2Z6AYTTOl+AJDPxqCbEDxWIUgnl\n\tV/WkHZIy4aERoq1oEJCN3Ne3lguKKtaAPCE7fO4EbpjSitkrftxpbkzSvOxUqO1Gr+\n\tQNRd/aqrZjZFGTw0tyPSB4OmLk8m19EmNfDpmAk0="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"I1jiVEjQ\"; dkim-atps=neutral",
        "To": "libcamera devel <libcamera-devel@lists.libcamera.org>",
        "Date": "Thu, 21 Jul 2022 13:12:59 +0100",
        "Message-Id": "<20220721121310.1286862-2-kieran.bingham@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.34.1",
        "In-Reply-To": "<20220721121310.1286862-1-kieran.bingham@ideasonboard.com>",
        "References": "<20220721121310.1286862-1-kieran.bingham@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [RFC PATCH 01/12] libcamera: request: Add support\n\tfor error 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---\nv2:\n - Add documentation for Request::Private::setErrorFlags\n\n---\nv2\n - Extend documentation\n\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            | 46 ++++++++++++++++++++++++++++\n 3 files changed, 58 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 d2af1d2212ad..8b82757ea7e3 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,21 @@ void Request::Private::notifierActivated(FrameBuffer *buffer)\n \temitPrepareCompleted();\n }\n \n+/**\n+ * \\brief Update the error flags of the Request\n+ * \\param[in] flags Flags to apply on the Request\n+ *\n+ * Apply \\a flags to the Request to report to the application when the Request\n+ * completes.\n+ *\n+ * Setting an Error flag does not cause a Request to fail, and once set it can\n+ * only be cleared by the application destroying the Request or calling reuse().\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 +334,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 defined by \\a Request::ErrorFlag\n+ */\n+\n /**\n  * \\typedef Request::BufferMap\n  * \\brief A map of Stream to FrameBuffer pointers\n@@ -560,6 +592,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",
        "RFC",
        "01/12"
    ]
}