Patch Detail
Show a patch.
GET /api/1.1/patches/14082/?format=api
{ "id": 14082, "url": "https://patchwork.libcamera.org/api/1.1/patches/14082/?format=api", "web_url": "https://patchwork.libcamera.org/patch/14082/", "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": "<20211011073505.243864-8-umang.jain@ideasonboard.com>", "date": "2021-10-11T07:35:05", "name": "[libcamera-devel,v4,7/7] android: camera_device: Synchronise completion and cleanup of requests", "commit_ref": null, "pull_url": null, "state": "changes-requested", "archived": false, "hash": "4512a2ce4227ce8ef0b528a56335d697231292c0", "submitter": { "id": 86, "url": "https://patchwork.libcamera.org/api/1.1/people/86/?format=api", "name": "Umang Jain", "email": "umang.jain@ideasonboard.com" }, "delegate": { "id": 12, "url": "https://patchwork.libcamera.org/api/1.1/users/12/?format=api", "username": "uajain", "first_name": "Umang", "last_name": "Jain", "email": "umang.jain@ideasonboard.com" }, "mbox": "https://patchwork.libcamera.org/patch/14082/mbox/", "series": [ { "id": 2611, "url": "https://patchwork.libcamera.org/api/1.1/series/2611/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2611", "date": "2021-10-11T07:34:58", "name": "Async Post Processor", "version": 4, "mbox": "https://patchwork.libcamera.org/series/2611/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/14082/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/14082/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 8D8F4C3243\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 11 Oct 2021 07:35:29 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 47A6568F61;\n\tMon, 11 Oct 2021 09:35:29 +0200 (CEST)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2449B68F4F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 11 Oct 2021 09:35:28 +0200 (CEST)", "from perceval.ideasonboard.com (unknown [103.251.226.107])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 3C6E12BD;\n\tMon, 11 Oct 2021 09:35:27 +0200 (CEST)" ], "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"AfdA0riu\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1633937727;\n\tbh=77mH4GT/iT5pP6gMmtYzgEvBNsw/EzvFIkiylzj+P1Y=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=AfdA0riud6DdHqPAL6Zl9r8mhRINbXZQv6/qkBZiqnjoT2FeKmuJaH/xRu78x5O+3\n\tpsLhBzDetwmTLSZsn/57ZFDphLVG0FRtuRUi6DWyIycEfg+RW7n4Y+AUxBofs2IFMK\n\tfuSSxxWYGUZtwEJyMyRGOOx8+TdbTiSYdzBxOTtM=", "From": "Umang Jain <umang.jain@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Mon, 11 Oct 2021 13:05:05 +0530", "Message-Id": "<20211011073505.243864-8-umang.jain@ideasonboard.com>", "X-Mailer": "git-send-email 2.31.1", "In-Reply-To": "<20211011073505.243864-1-umang.jain@ideasonboard.com>", "References": "<20211011073505.243864-1-umang.jain@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v4 7/7] android: camera_device:\n\tSynchronise completion and cleanup of requests", "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": "Synchronise a way where queued requests in descriptors_ do not end up\nwith Camera3RequestDescriptor::Status::Pending forever. To ensure this,\nstop the camera worker first, which will not let any new requests\nqueue up to the libcamera::Camera. It is then followed by\nlibcamera::Camera::stop() which is synchronous and will ensure all\nrequests in-flight gets completed (and requestComplete() handler is\ncalled for all of them).\n\nSince CameraDevice::requestComplete() handler can even queue\npost-processing requests to CameraStream::PostProcessorWorker, ensure\nthe worker is stopped and all those post-processing requests too, are\npurged as per CameraStream::flush() implemented earlier.\n\nAll this operations is encapsulated in a a helper function\nCameraDevice::stopCamera() which can be used in stop() and flush()\nscenarios.\n\nSigned-off-by: Umang Jain <umang.jain@ideasonboard.com>\n---\n src/android/camera_device.cpp | 34 ++++++++++++++++++++++++++++------\n src/android/camera_device.h | 1 +\n 2 files changed, 29 insertions(+), 6 deletions(-)", "diff": "diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\nindex 3541a74b..9433dde7 100644\n--- a/src/android/camera_device.cpp\n+++ b/src/android/camera_device.cpp\n@@ -424,13 +424,37 @@ int CameraDevice::open(const hw_module_t *hardwareModule)\n \n void CameraDevice::close()\n {\n-\tstreams_.clear();\n-\n \tstop();\n \n+\tstreams_.clear();\n+\n \tcamera_->release();\n }\n \n+void CameraDevice::stopCamera()\n+{\n+\t/*\n+\t * Stopping the worker will prevent any new requests queued to\n+\t * libcamera::Camera.\n+\t */\n+\tworker_.stop();\n+\n+\t/*\n+\t * libcamera::Camera::stop() will synchronously complete all requests\n+\t * thereby, ensuring requestComplete() signal handler is executed for\n+\t * all requests which are in-flight.\n+\t */\n+\tcamera_->stop();\n+\n+\t/*\n+\t * While libcamera::Camera::stop() is completing in-flight requests,\n+\t * some of those request might queue post-processing of a stream.\n+\t * Purge the post-processsing queue in this case so that the descriptors\n+\t * can be processed and get offloaded from descriptors_.\n+\t */\n+\tfor (auto &stream : streams_)\n+\t\tstream.flush();\n+}\n void CameraDevice::flush()\n {\n \t{\n@@ -441,8 +465,7 @@ void CameraDevice::flush()\n \t\tstate_ = State::Flushing;\n \t}\n \n-\tworker_.stop();\n-\tcamera_->stop();\n+\tstopCamera();\n \n \tMutexLocker stateLock(stateMutex_);\n \tstate_ = State::Stopped;\n@@ -454,8 +477,7 @@ void CameraDevice::stop()\n \tif (state_ == State::Stopped)\n \t\treturn;\n \n-\tworker_.stop();\n-\tcamera_->stop();\n+\tstopCamera();\n \n \tdescriptors_ = {};\n \ndiff --git a/src/android/camera_device.h b/src/android/camera_device.h\nindex 0ce6caeb..20eae704 100644\n--- a/src/android/camera_device.h\n+++ b/src/android/camera_device.h\n@@ -115,6 +115,7 @@ private:\n \t};\n \n \tvoid stop();\n+\tvoid stopCamera();\n \n \tstd::unique_ptr<libcamera::FrameBuffer>\n \tcreateFrameBuffer(const buffer_handle_t camera3buffer,\n", "prefixes": [ "libcamera-devel", "v4", "7/7" ] }