Show a patch.

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

{
    "id": 15240,
    "url": "https://patchwork.libcamera.org/api/patches/15240/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/15240/",
    "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": "<20220104065201.25744-2-umang.jain@ideasonboard.com>",
    "date": "2022-01-04T06:52:00",
    "name": "[libcamera-devel,1/2] android: Document the structures and functions for post-processing",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "9d7ced56d254c34e241055337ad92fb4e849ad42",
    "submitter": {
        "id": 86,
        "url": "https://patchwork.libcamera.org/api/people/86/?format=api",
        "name": "Umang Jain",
        "email": "umang.jain@ideasonboard.com"
    },
    "delegate": {
        "id": 12,
        "url": "https://patchwork.libcamera.org/api/users/12/?format=api",
        "username": "uajain",
        "first_name": "Umang",
        "last_name": "Jain",
        "email": "umang.jain@ideasonboard.com"
    },
    "mbox": "https://patchwork.libcamera.org/patch/15240/mbox/",
    "series": [
        {
            "id": 2874,
            "url": "https://patchwork.libcamera.org/api/series/2874/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2874",
            "date": "2022-01-04T06:51:59",
            "name": "Document post-processing",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/2874/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/15240/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/15240/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 AF505BE080\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  4 Jan 2022 06:52:17 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 633B360868;\n\tTue,  4 Jan 2022 07:52:17 +0100 (CET)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 92695604F8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  4 Jan 2022 07:52:15 +0100 (CET)",
            "from perceval.ideasonboard.com (unknown [27.57.188.152])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 08FD3501;\n\tTue,  4 Jan 2022 07:52:13 +0100 (CET)"
        ],
        "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=\"ZS7qRhbT\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1641279135;\n\tbh=Ks6nKJAYbpZIrmZMuXMEfBfagqHt24KWdGQvIJ/x5zE=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=ZS7qRhbTLt76MpJmLN07FUhpZeF/uu6Fe4IOyqMpu4nrjv9/7j5xESmJBuQeb17OD\n\tBe4wVWVF6MwJMnm8IEFlWNxR31M7HM/8bCNapF5DZ5j7XOb0KvWO/AB55QvGAeKJYZ\n\tnMMZLxfikmoxval1i3QLIt5QZcteNfhO2IaJciec=",
        "From": "Umang Jain <umang.jain@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Tue,  4 Jan 2022 12:22:00 +0530",
        "Message-Id": "<20220104065201.25744-2-umang.jain@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.31.1",
        "In-Reply-To": "<20220104065201.25744-1-umang.jain@ideasonboard.com>",
        "References": "<20220104065201.25744-1-umang.jain@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH 1/2] android: Document the structures and\n\tfunctions 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": "Specifically document:\n - CameraDevice::sendCaptureResults()\n - CameraDevice::completeDescriptor()\n - CameraDevice::streamProcessingComplete()\n\n - CameraStream::PostProcessorWorker class\n - Camera3RequestDescriptor::StreamBuffer structure\n\nSigned-off-by: Umang Jain <umang.jain@ideasonboard.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/android/camera_device.cpp  | 37 +++++++++++++++++++++++++++++++++\n src/android/camera_request.cpp | 38 ++++++++++++++++++++++++++++++++++\n src/android/camera_stream.cpp  | 12 +++++++++++\n 3 files changed, 87 insertions(+)",
    "diff": "diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\nindex 83825736..00d48471 100644\n--- a/src/android/camera_device.cpp\n+++ b/src/android/camera_device.cpp\n@@ -1164,6 +1164,17 @@ void CameraDevice::requestComplete(Request *request)\n \t}\n }\n \n+/**\n+ * \\brief Complete the Camera3RequestDescriptor\n+ * \\param[in] descriptor The Camera3RequestDescriptor that has completed\n+ *\n+ * The function marks the Camera3RequestDescriptor as 'complete'. It shall be\n+ * called when all the streams in the Camera3RequestDescriptor have completed\n+ * capture (or have been generated via post-processing) and the request is ready\n+ * to be sent back to the framework.\n+ *\n+ * \\context This function is \\threadsafe.\n+ */\n void CameraDevice::completeDescriptor(Camera3RequestDescriptor *descriptor)\n {\n \tMutexLocker lock(descriptorsMutex_);\n@@ -1172,6 +1183,19 @@ void CameraDevice::completeDescriptor(Camera3RequestDescriptor *descriptor)\n \tsendCaptureResults();\n }\n \n+/**\n+ * \\brief Sequentially send capture results to the framework\n+ *\n+ * Iterate over the descriptors queue to send completed descriptors back to the\n+ * framework, in the same order as they have been queued. For each complete\n+ * descriptor, populate a locally-scoped camera3_capture_result_t from the\n+ * descriptor, send the capture result back by calling the\n+ * process_capture_result() callback, and remove the descriptor from the queue.\n+ * Stop iterating if the descriptor at the front of the queue is not complete.\n+ *\n+ * This function should never be called directly in the codebase. Use\n+ * completeDescriptor() instead.\n+ */\n void CameraDevice::sendCaptureResults()\n {\n \twhile (!descriptors_.empty() && !descriptors_.front()->isPending()) {\n@@ -1231,6 +1255,19 @@ void CameraDevice::setBufferStatus(Camera3RequestDescriptor::StreamBuffer &strea\n \t}\n }\n \n+/**\n+ * \\brief Handle post-processing completion of a stream in a capture request\n+ * \\param[in] streamBuffer The StreamBuffer for which processing is complete\n+ * \\param[in] status Stream post-processing status\n+ *\n+ * This function is called from the post-processor's thread whenever a camera\n+ * stream has finished post processing. The corresponding entry is dropped from\n+ * the descriptor's pendingStreamsToProcess_ map.\n+ *\n+ * If the pendingStreamsToProcess_ map is then empty, all streams requiring to\n+ * be generated from post-processing have been completed. Mark the descriptor as\n+ * complete using completeDescriptor() in that case.\n+ */\n void CameraDevice::streamProcessingComplete(Camera3RequestDescriptor::StreamBuffer *streamBuffer,\n \t\t\t\t\t    Camera3RequestDescriptor::Status status)\n {\ndiff --git a/src/android/camera_request.cpp b/src/android/camera_request.cpp\nindex 91776907..027b46d3 100644\n--- a/src/android/camera_request.cpp\n+++ b/src/android/camera_request.cpp\n@@ -52,6 +52,44 @@ Camera3RequestDescriptor::Camera3RequestDescriptor(\n \n Camera3RequestDescriptor::~Camera3RequestDescriptor() = default;\n \n+/**\n+ * \\struct Camera3RequestDescriptor::StreamBuffer\n+ * \\brief Group information for per-stream buffer of Camera3RequestDescriptor\n+ *\n+ * A capture request placed to the libcamera HAL can contain multiple streams.\n+ * Each stream will have an associated buffer to be filled. StreamBuffer\n+ * tracks this buffer with contextual information which aids in the stream's\n+ * generation. The generation of the stream will depend on its type (refer to\n+ * the CameraStream::Type documentation).\n+ *\n+ * \\var Camera3RequestDescriptor::StreamBuffer::stream\n+ * \\brief Pointer to the corresponding CameraStream\n+ *\n+ * \\var Camera3RequestDescriptor::StreamBuffer::camera3Buffer\n+ * \\brief Native handle to the buffer\n+ *\n+ * \\var Camera3RequestDescriptor::StreamBuffer::frameBuffer\n+ * \\brief Encapsulate the dmabuf handle inside a libcamera::FrameBuffer for\n+ * direct streams\n+ *\n+ * \\var Camera3RequestDescriptor::StreamBuffer::fence\n+ * \\brief Acquire fence of the buffer\n+ *\n+ * \\var Camera3RequestDescriptor::StreamBuffer::status\n+ * \\brief Track the status of the buffer\n+ *\n+ * \\var Camera3RequestDescriptor::StreamBuffer::internalBuffer\n+ * \\brief Pointer to a buffer internally handled by CameraStream (if any)\n+ *\n+ * \\var Camera3RequestDescriptor::StreamBuffer::srcBuffer\n+ * \\brief Pointer to the source frame buffer used for post-processing\n+ *\n+ * \\var Camera3RequestDescriptor::StreamBuffer::dstBuffer\n+ * \\brief Pointer to the destination frame buffer used for post-processing\n+ *\n+ * \\var Camera3RequestDescriptor::StreamBuffer::request\n+ * \\brief Back pointer to Camera3RequestDescriptor to which StreamBuffer belongs\n+ */\n Camera3RequestDescriptor::StreamBuffer::StreamBuffer(\n \tCameraStream *cameraStream, const camera3_stream_buffer_t &buffer,\n \tCamera3RequestDescriptor *requestDescriptor)\ndiff --git a/src/android/camera_stream.cpp b/src/android/camera_stream.cpp\nindex c2157450..94f1884c 100644\n--- a/src/android/camera_stream.cpp\n+++ b/src/android/camera_stream.cpp\n@@ -244,6 +244,18 @@ void CameraStream::putBuffer(FrameBuffer *buffer)\n \tbuffers_.push_back(buffer);\n }\n \n+/**\n+ * \\class CameraStream::PostProcessorWorker\n+ * \\brief Post-process a CameraStream in an internal thread\n+ *\n+ * If the association between CameraStream and camera3_stream_t dictated by\n+ * CameraStream::Type is internal or mapped, the stream is generated by post\n+ * processing of a libcamera stream. Such a request is queued to a\n+ * PostProcessorWorker in CameraStream::process(). A queue of post-processing\n+ * requests is maintained by the PostProcessorWorker and it will run the\n+ * post-processing on an internal thread as soon as any request is available on\n+ * its queue.\n+ */\n CameraStream::PostProcessorWorker::PostProcessorWorker(PostProcessor *postProcessor)\n \t: postProcessor_(postProcessor)\n {\n",
    "prefixes": [
        "libcamera-devel",
        "1/2"
    ]
}