Patch Detail
Show a patch.
GET /api/1.1/patches/16976/?format=api
{ "id": 16976, "url": "https://patchwork.libcamera.org/api/1.1/patches/16976/?format=api", "web_url": "https://patchwork.libcamera.org/patch/16976/", "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": "<20220805135312.47497-2-jacopo@jmondi.org>", "date": "2022-08-05T13:53:03", "name": "[libcamera-devel,v2,01/10] libcamera: request: Add support for error flags", "commit_ref": null, "pull_url": null, "state": "not-applicable", "archived": true, "hash": "e704f633a0607be4634075a6996658100cf251ab", "submitter": { "id": 3, "url": "https://patchwork.libcamera.org/api/1.1/people/3/?format=api", "name": "Jacopo Mondi", "email": "jacopo@jmondi.org" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/16976/mbox/", "series": [ { "id": 3376, "url": "https://patchwork.libcamera.org/api/1.1/series/3376/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3376", "date": "2022-08-05T13:53:02", "name": "libcamera: Align IPU3 and RKISP1 interfaces", "version": 2, "mbox": "https://patchwork.libcamera.org/series/3376/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/16976/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/16976/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 B904FC3275\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 5 Aug 2022 13:53:23 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7921763330;\n\tFri, 5 Aug 2022 15:53:23 +0200 (CEST)", "from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net\n\t[IPv6:2001:4b98:dc4:8::225])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 32D45603E4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 5 Aug 2022 15:53:22 +0200 (CEST)", "(Authenticated sender: jacopo@jmondi.org)\n\tby mail.gandi.net (Postfix) with ESMTPSA id ECAD51C0006;\n\tFri, 5 Aug 2022 13:53:20 +0000 (UTC)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1659707603;\n\tbh=W6NC1ak50tjRO4caGdKFpzqz8LNPSrx/DA8vaqvBstc=;\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=bBh4tBu5QiFpr4hJPW/RebuRq9/+vK87oUvOZA0bkKRVSglGDBM67oTKfA2swXQ8+\n\tyxbCwlvFRBeouunFDzm3OYL6Xy3/6+AHJYsj+uRogBPkxxPJSKJbpdhAfUFigQhivm\n\tokiPuOmSil0yvZemgnCn79MNaEbOWizsI6Bby6bw5xWiJE8Sl+LB8LcyAJK2q6A1tz\n\tUUDsVArc4BXFHpQp8SwlVImh5yoyFuUN8kdfWtkAdtanUJPbG+AiT1TTt6sioBlyhw\n\tW/j5NHFkwl7XspzjUqN8SN6sqaLKcRaQdniCxctKsQF6dTas/axmhH6eebVmpF3XwU\n\tvCcxUBphNWoBA==", "To": "libcamera-devel@lists.libcamera.org", "Date": "Fri, 5 Aug 2022 15:53:03 +0200", "Message-Id": "<20220805135312.47497-2-jacopo@jmondi.org>", "X-Mailer": "git-send-email 2.37.1", "In-Reply-To": "<20220805135312.47497-1-jacopo@jmondi.org>", "References": "<20220805135312.47497-1-jacopo@jmondi.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v2 01/10] 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": "Jacopo Mondi via libcamera-devel <libcamera-devel@lists.libcamera.org>", "Reply-To": "Jacopo Mondi <jacopo@jmondi.org>", "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 occurred 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\nControlError occurs 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>\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n include/libcamera/internal/request.h | 4 ++\n include/libcamera/request.h | 9 ++++\n src/libcamera/request.cpp | 72 ++++++++++++++++++++++++++--\n 3 files changed, 81 insertions(+), 4 deletions(-)", "diff": "diff --git a/include/libcamera/internal/request.h b/include/libcamera/internal/request.h\nindex 9dadd6c60361..76cc32f73f9c 100644\n--- a/include/libcamera/internal/request.h\n+++ b/include/libcamera/internal/request.h\n@@ -42,6 +42,8 @@ public:\n \tvoid prepare(std::chrono::milliseconds timeout = 0ms);\n \tSignal<> prepared;\n \n+\tvoid setError(Errors error);\n+\n private:\n \tfriend class PipelineHandler;\n \tfriend std::ostream &operator<<(std::ostream &out, const Request &r);\n@@ -59,6 +61,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+\tErrors errors_;\n };\n \n } /* namespace libcamera */\ndiff --git a/include/libcamera/request.h b/include/libcamera/request.h\nindex dffde1536cad..3304da31200d 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 Errors = 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+\tErrors error() const;\n \n \tbool hasPendingBuffers() const;\n \ndiff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp\nindex d2af1d2212ad..9a808f19fc03 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+\terrors_ = 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] error Error flags to apply on the Request\n+ *\n+ * Flag \\a error in the Request which will get reported to the application when\n+ * the Request 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::setError(Errors error)\n+{\n+\terrors_ |= error;\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,25 @@ 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 errors on a completed request\n+ *\n+ * \\var Request::NoError\n+ * No error. The Request completed succesfully and all its buffer contain\n+ * valid data\n+ *\n+ * \\var Request::ControlError\n+ * Control Error. At least one control was not applied correctly to the camera.\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::Errors\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@@ -552,14 +587,43 @@ uint32_t Request::sequence() const\n * \\brief Retrieve the request completion status\n *\n * The request status indicates whether the request has completed successfully\n- * or with an error. When requests are created and before they complete the\n- * request status is set to RequestPending, and is updated at completion time\n- * to RequestComplete. If a request is cancelled at capture stop before it has\n- * completed, its status is set to RequestCancelled.\n+ * or has been cancelled before being processed.\n+ *\n+ * Requests are created with their status set to RequestPending. When\n+ * a Request is successfully processed and completed by the Camera its\n+ * status is set to RequestComplete. If a Request is cancelled before\n+ * being processed, for example because the Camera has been stopped\n+ * before the request is completed, its status is set to RequestCancelled.\n+ *\n+ * Successfully completed requests can complete with errors. Applications shall\n+ * inspect the error mask returned by Request::error() before accessing buffers\n+ * and data associated with a completed request.\n *\n * \\return The request completion status\n */\n \n+/**\n+ * \\brief Retrieve the mask of error flags associated with a completed request\n+ *\n+ * The request could complete with errors, which indicate failures in\n+ * completing correctly parts of the request submitted by the application.\n+ *\n+ * The possible failure reasons are defined by the error flags defined\n+ * by Request::ErrorFlag and application are expected to retrieve the\n+ * mask of error flags by using this function before accessing the\n+ * buffers and data associated with a completed request.\n+ *\n+ * Error conditions reported through this function do not change the\n+ * request completion status retrieved through Request::status() which\n+ * indicates if the Request has been processed or not.\n+ *\n+ * \\return A mask of error identifier with which the request was completed\n+ */\n+Request::Errors Request::error() const\n+{\n+\treturn _d()->errors_;\n+}\n+\n /**\n * \\brief Check if a request has buffers yet to be completed\n *\n", "prefixes": [ "libcamera-devel", "v2", "01/10" ] }