Patch Detail
Show a patch.
GET /api/1.1/patches/16802/?format=api
{ "id": 16802, "url": "https://patchwork.libcamera.org/api/1.1/patches/16802/?format=api", "web_url": "https://patchwork.libcamera.org/patch/16802/", "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": "<20220726182500.425182-2-hanlinchen@chromium.org>", "date": "2022-07-26T18:24:55", "name": "[libcamera-devel,1/6] libcamera: Camera: Add RequestCompletionMode to configure the completion order", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "c2efff9dd506e609a1ae3ff57d87cc745fa19e21", "submitter": { "id": 98, "url": "https://patchwork.libcamera.org/api/1.1/people/98/?format=api", "name": "Hanlin Chen", "email": "hanlinchen@chromium.org" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/16802/mbox/", "series": [ { "id": 3329, "url": "https://patchwork.libcamera.org/api/1.1/series/3329/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3329", "date": "2022-07-26T18:24:54", "name": "Implement Android Partial Result Featrue", "version": 1, "mbox": "https://patchwork.libcamera.org/series/3329/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/16802/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/16802/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 DE37EBE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 26 Jul 2022 18:25:30 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A7A1563315;\n\tTue, 26 Jul 2022 20:25:30 +0200 (CEST)", "from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com\n\t[IPv6:2607:f8b0:4864:20::62b])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C819360487\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 26 Jul 2022 20:25:28 +0200 (CEST)", "by mail-pl1-x62b.google.com with SMTP id x1so12319610plb.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 26 Jul 2022 11:25:28 -0700 (PDT)", "from localhost ([2401:fa00:1:17:739:6574:4032:5911])\n\tby smtp.gmail.com with UTF8SMTPSA id\n\ty14-20020a17090a644e00b001f217ec21efsm13470920pjm.13.2022.07.26.11.25.26\n\t(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);\n\tTue, 26 Jul 2022 11:25:26 -0700 (PDT)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1658859930;\n\tbh=ltpFuCAuihvbOmL8Fyz176w5YjlXklIGUIsQYWVnMoM=;\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=LCuH9XH5VrCbNoSAotXoqMajbAsX1wCaLVjhvHR9PNh+HOuo7agItAIk/HBZtamdn\n\tty/lXoXG02Pwf/oc3/h6505Nc3qwAQ/G2bmI/9ffqVwyHOoUrLvBeYFX/8RJD+RlGR\n\txOdIuxAfEiaz3pDqmt0TJthzxSE0/8K1mLIpJnEboxW0j1I8J9sFa7JfG93HR2OBGT\n\tQzD4m3P1HFUcSf15lgDfQd+j4BlHWE4w8j8Jw5d6RWJobfLlVvb/X0n/0WND/CPlsl\n\tduXP1sTMDe0KM7lIbx8zwR3HNJEk/WQvXTmXaiaxKKOIIoGwqRHxxqIWPBIeH8neP0\n\tLtSP/tjDZVfwQ==", "v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; \n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=uIpXw/38Bee1gJ74s8fAiVV6faeIlVK6IkLgUHBeyLs=;\n\tb=jwUXHmJ2UgLxCtpqOwO2/WU3Q1UZDl3KLugBHcXPf8L1ssySEkpZf5Lg5GcOonEgIF\n\tN9e4SJZEYhBdjLP51Dnb5pYw1XiWXBX4WaKtjmEbOt/s/RXCIOag58Gm79/kgBgcaQCj\n\tvZ+UDLe+NtkzjRYWmi2biB1wL9MlbvuaUCNho=" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=chromium.org\n\theader.i=@chromium.org header.b=\"jwUXHmJ2\"; \n\tdkim-atps=neutral", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=uIpXw/38Bee1gJ74s8fAiVV6faeIlVK6IkLgUHBeyLs=;\n\tb=nH41PQ9o3rjV2LDZszWh9fnV2Xx8ha+wi6R1oAyFZfrjq63Cqf865WRJr2f/NYnVBR\n\tGxOdliSZmyXQScP1CLrDBaskG8gGDz4HySOkDLY2WO1UE0EgXmhm2qpkxNZ5remeHeZE\n\tTvTrkZb1J6z2rYhS2qjY7KweibIF+lYs/3I8R1Dt7xp3MDaHOFD/0PqsBPcYdE/A9Pk3\n\tATJmLYLPrq8pqzEiB+2DLGYY7ltY/EBwrzErhlSVfawjD7B6KAoF1vpjypZEhdgoILwR\n\t7LAaOCXA7ZDCkVCu//xUaNquZkD7SLgIkmqINWLzaI8n6bW70cywTouLDWx/+Bj5k/UO\n\tpC9g==", "X-Gm-Message-State": "AJIora/plJKZxpOKztTHUvWf9Z/mFo05E4ONJzquAtYbpf+MZJU8d3ye\n\t4p+QupQ1JLZlTYt16YIp5vVSAHt6y3dlMw==", "X-Google-Smtp-Source": "AGRyM1tuukfknGyAQ7pxixW71f0OyFJdX2DWXPSOk2eWB28Gr3Z+31ESTv4EFRqfqZVMR6AuX6XO0g==", "X-Received": "by 2002:a17:902:eb8f:b0:16d:4215:5f23 with SMTP id\n\tq15-20020a170902eb8f00b0016d42155f23mr18258091plg.70.1658859927170; \n\tTue, 26 Jul 2022 11:25:27 -0700 (PDT)", "To": "libcamera-devel@lists.libcamera.org", "Date": "Wed, 27 Jul 2022 02:24:55 +0800", "Message-Id": "<20220726182500.425182-2-hanlinchen@chromium.org>", "X-Mailer": "git-send-email 2.37.1.359.gd136c6c3e2-goog", "In-Reply-To": "<20220726182500.425182-1-hanlinchen@chromium.org>", "References": "<20220726182500.425182-1-hanlinchen@chromium.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH 1/6] libcamera: Camera: Add\n\tRequestCompletionMode to configure the completion order", "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": "Han-Lin Chen via libcamera-devel <libcamera-devel@lists.libcamera.org>", "Reply-To": "Han-Lin Chen <hanlinchen@chromium.org>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Add enum RequestCompletionMode to Camera with two value: InSubmissionOrder and\nImmediately. The purpose is to allow the application configure the order of\nsignaling requestCompleted. The InSubmissionOrder mode is the default mode which\nsignals according to the request submission order. The Immediately mode allows\nthe pipeline handler to signal as soon as a request is completed. Applications\nneed to reconstruct the order by self.\n\nSigned-off-by: Han-Lin Chen <hanlinchen@chromium.org>\n---\n include/libcamera/camera.h | 8 ++++\n include/libcamera/internal/camera.h | 4 ++\n src/libcamera/camera.cpp | 68 ++++++++++++++++++++++++++++-\n src/libcamera/pipeline_handler.cpp | 20 ++++++---\n 4 files changed, 92 insertions(+), 8 deletions(-)", "diff": "diff --git a/include/libcamera/camera.h b/include/libcamera/camera.h\nindex 5bb06584..5aa4bf69 100644\n--- a/include/libcamera/camera.h\n+++ b/include/libcamera/camera.h\n@@ -88,6 +88,11 @@ class Camera final : public Object, public std::enable_shared_from_this<Camera>,\n \tLIBCAMERA_DECLARE_PRIVATE()\n \n public:\n+\tenum RequestCompletionMode {\n+\t\tInSubmissionOrder,\n+\t\tImmediately,\n+\t};\n+\n \tstatic std::shared_ptr<Camera> create(std::unique_ptr<Private> d,\n \t\t\t\t\t const std::string &id,\n \t\t\t\t\t const std::set<Stream *> &streams);\n@@ -101,6 +106,9 @@ public:\n \tint acquire();\n \tint release();\n \n+\tint setRequestCompletionMode(RequestCompletionMode order);\n+\tRequestCompletionMode requestCompletionMode() const;\n+\n \tconst ControlInfoMap &controls() const;\n \tconst ControlList &properties() const;\n \ndiff --git a/include/libcamera/internal/camera.h b/include/libcamera/internal/camera.h\nindex 597426a6..68e8d952 100644\n--- a/include/libcamera/internal/camera.h\n+++ b/include/libcamera/internal/camera.h\n@@ -33,6 +33,9 @@ public:\n \n \tPipelineHandler *pipe() { return pipe_.get(); }\n \n+\tvoid setRequestCompletionMode(RequestCompletionMode mode);\n+\tRequestCompletionMode requestCompletionMode() const;\n+\n \tstd::list<Request *> queuedRequests_;\n \tControlInfoMap controlInfo_;\n \tControlList properties_;\n@@ -67,6 +70,7 @@ private:\n \n \tbool disconnected_;\n \tstd::atomic<State> state_;\n+\tRequestCompletionMode requestCompletionMode_;\n \n \tstd::unique_ptr<CameraControlValidator> validator_;\n };\ndiff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp\nindex 2a8ef60e..4d3523e2 100644\n--- a/src/libcamera/camera.cpp\n+++ b/src/libcamera/camera.cpp\n@@ -435,7 +435,8 @@ CameraConfiguration::Status CameraConfiguration::validateColorSpaces(ColorSpaceF\n */\n Camera::Private::Private(PipelineHandler *pipe)\n \t: requestSequence_(0), pipe_(pipe->shared_from_this()),\n-\t disconnected_(false), state_(CameraAvailable)\n+\t disconnected_(false), state_(CameraAvailable),\n+\t requestCompletionMode_(Camera::InSubmissionOrder)\n {\n }\n \n@@ -573,6 +574,28 @@ void Camera::Private::setState(State state)\n \tstate_.store(state, std::memory_order_release);\n }\n \n+/**\n+ * \\brief Set the request completion mode\n+ * \\param[in] mode The RequestCompletionMode\n+ *\n+ * This function set the request completion mode.\n+ * InSubmissionOrder is the default mode.\n+ */\n+void Camera::Private::setRequestCompletionMode(RequestCompletionMode mode)\n+{\n+\trequestCompletionMode_ = mode;\n+}\n+\n+/**\n+ * \\brief Get the request completion mode\n+ *\n+ * \\return The current RequestCompletionMode.\n+ */\n+Camera::RequestCompletionMode Camera::Private::requestCompletionMode() const\n+{\n+\treturn requestCompletionMode_;\n+}\n+\n /**\n * \\class Camera\n * \\brief Camera device\n@@ -702,6 +725,15 @@ std::shared_ptr<Camera> Camera::create(std::unique_ptr<Private> d,\n \treturn std::shared_ptr<Camera>(camera, Deleter());\n }\n \n+/**\n+ * \\enum Camera::RequestCompletionMode\n+ * \\brief The mode of request completion behavior\n+ * \\var Camera::RequestCompletionMode::InSubmissionOrder\n+ * \\brief requestCompleted will be emited according to the request submission order\n+ * \\var Camera::RequestCompletionMode::Immediately\n+ * \\brief requestCompleted will be emited immediately when a request is completed.\n+ */\n+\n /**\n * \\brief Retrieve the ID of the camera\n *\n@@ -1237,6 +1269,40 @@ int Camera::stop()\n \treturn 0;\n }\n \n+/**\n+ * \\brief Set the request completion mode\n+ * \\param[in] mode The RequestCompletionMode\n+ *\n+ * This function set the request completion mode.\n+ * InSubmissionOrder is the default mode.\n+ *\n+ * \\return 0 on success or a negative error code otherwise\n+ * \\retval -EACCES The camera is running so can't change the behavior\n+ */\n+int Camera::setRequestCompletionMode(RequestCompletionMode mode)\n+{\n+\tPrivate *const d = _d();\n+\n+\tint ret = d->isAccessAllowed(Private::CameraAvailable,\n+\t\t\t\t Private::CameraConfigured);\n+\tif (ret < 0)\n+\t\treturn -EACCES;\n+\n+\td->setRequestCompletionMode(mode);\n+\n+\treturn 0;\n+}\n+\n+/**\n+ * \\brief Get the request completion mode\n+ *\n+ * \\return The current RequestCompletionMode.\n+ */\n+Camera::RequestCompletionMode Camera::requestCompletionMode() const\n+{\n+\treturn _d()->requestCompletionMode();\n+}\n+\n /**\n * \\brief Handle request completion and notify application\n * \\param[in] request The request that has completed\ndiff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp\nindex 67540533..7c180a8e 100644\n--- a/src/libcamera/pipeline_handler.cpp\n+++ b/src/libcamera/pipeline_handler.cpp\n@@ -494,14 +494,20 @@ void PipelineHandler::completeRequest(Request *request)\n \n \tCamera::Private *data = camera->_d();\n \n-\twhile (!data->queuedRequests_.empty()) {\n-\t\tRequest *req = data->queuedRequests_.front();\n-\t\tif (req->status() == Request::RequestPending)\n-\t\t\tbreak;\n+\tauto iter = data->queuedRequests_.begin();\n+\twhile (iter != data->queuedRequests_.end()) {\n+\t\tif ((*iter)->status() != Request::RequestPending) {\n+\t\t\tASSERT(!(*iter)->hasPendingBuffers());\n+\t\t\tcamera->requestComplete((*iter));\n+\t\t\titer = data->queuedRequests_.erase(iter);\n+\t\t\tcontinue;\n+\t\t}\n \n-\t\tASSERT(!req->hasPendingBuffers());\n-\t\tdata->queuedRequests_.pop_front();\n-\t\tcamera->requestComplete(req);\n+\t\t/* Break at the pending result to reflect the submission order */\n+\t\tif (camera->requestCompletionMode() == Camera::InSubmissionOrder) {\n+\t\t\tbreak;\n+\t\t}\n+\t\titer++;\n \t}\n }\n \n", "prefixes": [ "libcamera-devel", "1/6" ] }