Patch Detail
Show a patch.
GET /api/1.1/patches/13805/?format=api
{ "id": 13805, "url": "https://patchwork.libcamera.org/api/1.1/patches/13805/?format=api", "web_url": "https://patchwork.libcamera.org/patch/13805/", "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": "<20210910070638.467294-8-umang.jain@ideasonboard.com>", "date": "2021-09-10T07:06:36", "name": "[libcamera-devel,v2,7/9] android: camera_device: Move buffer mapping for post processing", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "1f494ed75db8d860c1db8b4087d25d09765a53bb", "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/13805/mbox/", "series": [ { "id": 2513, "url": "https://patchwork.libcamera.org/api/1.1/series/2513/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2513", "date": "2021-09-10T07:06:29", "name": "Async Post Processor", "version": 2, "mbox": "https://patchwork.libcamera.org/series/2513/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/13805/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/13805/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 03711BEFBE\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 10 Sep 2021 07:07:03 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A203269174;\n\tFri, 10 Sep 2021 09:07:02 +0200 (CEST)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8316069169\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 10 Sep 2021 09:07:00 +0200 (CEST)", "from perceval.ideasonboard.com (unknown [103.251.226.149])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 68D68883;\n\tFri, 10 Sep 2021 09:06:59 +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=\"hFcGIGiM\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1631257620;\n\tbh=L5ElbkmgBrisKXGQ7Lfz+IPE87H2WKrEoB/zaDYeFPM=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=hFcGIGiM4Jooqch2N/zHVfKrIjzLMJBBSDA9GsnedOTMceZq/xHzK54jcdGQMPPus\n\t27oqykhvIYVzABluy8AtAGIhWmIbTV3ZZGh0/gNBWXdDq19cMOWDS5Awh22JZ98Q5d\n\tMFGakRu+vWJ5SBht4FnTNs+92OyZlmzLABAOqZrQ=", "From": "Umang Jain <umang.jain@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Fri, 10 Sep 2021 12:36:36 +0530", "Message-Id": "<20210910070638.467294-8-umang.jain@ideasonboard.com>", "X-Mailer": "git-send-email 2.31.1", "In-Reply-To": "<20210910070638.467294-1-umang.jain@ideasonboard.com>", "References": "<20210910070638.467294-1-umang.jain@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v2 7/9] android: camera_device: Move\n\tbuffer mapping for post processing", "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": "Buffer mapping for post processing currently happens in\nCameraStream::process(). However, it can be easily be moved to\nCameraDevice just before the call to CameraStream::process(). The\nreason to do so is that, we can hold the mapped destination buffer\npointer as a part of Camera3RequestDescriptor. Camera3RequestDescriptor\nalready hold other post-processing related context to enable async post\nprocessing in subsequent commits.\n\nSigned-off-by: Umang Jain <umang.jain@ideasonboard.com>\n---\n src/android/camera_device.cpp | 14 +++++++++++++-\n src/android/camera_device.h | 1 +\n src/android/camera_stream.cpp | 16 ++--------------\n src/android/camera_stream.h | 2 +-\n 4 files changed, 17 insertions(+), 16 deletions(-)", "diff": "diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\nindex 7f04d225..988d4232 100644\n--- a/src/android/camera_device.cpp\n+++ b/src/android/camera_device.cpp\n@@ -1163,13 +1163,25 @@ void CameraDevice::requestComplete(Request *request)\n \t\tdescriptor.resultMetadata_ = std::move(resultMetadata);\n \t\tdescriptor.captureResult_ = captureResult;\n \n+\t\t/* \\todo Buffer mapping should be moved to a separate thread? */\n+\t\tconst StreamConfiguration &output = cameraStream->configuration();\n+\t\tdescriptor.destBuffer_ = std::make_unique<CameraBuffer>(\n+\t\t\t*buffer.buffer, formats::MJPEG, output.size,\n+\t\t\tPROT_READ | PROT_WRITE);\n+\n+\t\tif (!descriptor.destBuffer_->isValid()) {\n+\t\t\tLOG(HAL, Error) << \"Failed to map android blob buffer\";\n+\t\t\treturn;\n+\t\t}\n+\n \t\tstd::unique_ptr<Camera3RequestDescriptor> reqDescriptor =\n \t\t\tstd::make_unique<Camera3RequestDescriptor>();\n \t\t*reqDescriptor = std::move(descriptor);\n \t\tqueuedDescriptor_.push_back(std::move(reqDescriptor));\n \n \t\tCamera3RequestDescriptor *currentDescriptor = queuedDescriptor_.back().get();\n-\t\tint ret = cameraStream->process(src, *buffer.buffer,\n+\t\tint ret = cameraStream->process(src,\n+\t\t\t\t\t\tcurrentDescriptor->destBuffer_.get(),\n \t\t\t\t\t\tcurrentDescriptor->settings_,\n \t\t\t\t\t\tcurrentDescriptor->resultMetadata_.get(),\n \t\t\t\t\t\tcurrentDescriptor);\ndiff --git a/src/android/camera_device.h b/src/android/camera_device.h\nindex e7318358..b62d373c 100644\n--- a/src/android/camera_device.h\n+++ b/src/android/camera_device.h\n@@ -58,6 +58,7 @@ struct Camera3RequestDescriptor {\n \t\tFailed,\n \t};\n \tstd::unique_ptr<CameraMetadata> resultMetadata_;\n+\tstd::unique_ptr<CameraBuffer> destBuffer_;\n \tcamera3_capture_result_t captureResult_;\n \tlibcamera::FrameBuffer *internalBuffer_;\n \tcompletionStatus status_;\ndiff --git a/src/android/camera_stream.cpp b/src/android/camera_stream.cpp\nindex c7d874b2..5fd04bbf 100644\n--- a/src/android/camera_stream.cpp\n+++ b/src/android/camera_stream.cpp\n@@ -102,7 +102,7 @@ int CameraStream::configure()\n }\n \n int CameraStream::process(const FrameBuffer *source,\n-\t\t\t buffer_handle_t camera3Dest,\n+\t\t\t CameraBuffer *destBuffer,\n \t\t\t const CameraMetadata &requestMetadata,\n \t\t\t CameraMetadata *resultMetadata,\n \t\t\t const Camera3RequestDescriptor *context)\n@@ -110,19 +110,7 @@ int CameraStream::process(const FrameBuffer *source,\n \tif (!postProcessor_)\n \t\treturn 0;\n \n-\t/*\n-\t * \\todo Buffer mapping and processing should be moved to a\n-\t * separate thread.\n-\t */\n-\tconst StreamConfiguration &output = configuration();\n-\tCameraBuffer dest(camera3Dest, formats::MJPEG, output.size,\n-\t\t\t PROT_READ | PROT_WRITE);\n-\tif (!dest.isValid()) {\n-\t\tLOG(HAL, Error) << \"Failed to map android blob buffer\";\n-\t\treturn -EINVAL;\n-\t}\n-\n-\treturn postProcessor_->process(source, &dest, requestMetadata,\n+\treturn postProcessor_->process(source, destBuffer, requestMetadata,\n \t\t\t\t resultMetadata, context);\n }\n \ndiff --git a/src/android/camera_stream.h b/src/android/camera_stream.h\nindex be076995..8097ddbc 100644\n--- a/src/android/camera_stream.h\n+++ b/src/android/camera_stream.h\n@@ -124,7 +124,7 @@ public:\n \n \tint configure();\n \tint process(const libcamera::FrameBuffer *source,\n-\t\t buffer_handle_t camera3Dest,\n+\t\t CameraBuffer *destBuffer,\n \t\t const CameraMetadata &requestMetadata,\n \t\t CameraMetadata *resultMetadata,\n \t\t const Camera3RequestDescriptor *context);\n", "prefixes": [ "libcamera-devel", "v2", "7/9" ] }