Show a patch.

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

{
    "id": 14175,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/14175/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/14175/",
    "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": "<20211019114802.665980-2-umang.jain@ideasonboard.com>",
    "date": "2021-10-19T11:47:51",
    "name": "[libcamera-devel,v2,01/12] camera_device: Remove private scope of Camera3RequestDescriptor",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "e5b8b2ffd4283423be322c42fc0c1e477503c061",
    "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/14175/mbox/",
    "series": [
        {
            "id": 2638,
            "url": "https://patchwork.libcamera.org/api/1.1/series/2638/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2638",
            "date": "2021-10-19T11:47:50",
            "name": "android: Overhaul request handling",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/2638/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/14175/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/14175/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 F22E7C324C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 19 Oct 2021 11:48:14 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id BF7B768F5C;\n\tTue, 19 Oct 2021 13:48:14 +0200 (CEST)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9303E604FE\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 19 Oct 2021 13:48:12 +0200 (CEST)",
            "from perceval.ideasonboard.com (unknown [103.251.226.98])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 0AB5012A;\n\tTue, 19 Oct 2021 13:48:10 +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=\"YmZXM2ZQ\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1634644092;\n\tbh=bYHmkfzBcEi93zcs6ElAxBO3tlvXUUjYCDz0DUMYluY=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=YmZXM2ZQE1c/JmpcoMiPMD0r5wkyY6LWhxhGL7ktdssAM4tEOKe2Tl/KrmI/lfKua\n\tzn2Qs6hre7moixtdyMYhNBzxkA+Mrwl/KNFM2hOqwyUby4m829Mk+zpx/cxN+867Qi\n\tcBR9VaZZnP5/a9bm2+tbd4OaaKqeirINpXyFpJvM=",
        "From": "Umang Jain <umang.jain@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Tue, 19 Oct 2021 17:17:51 +0530",
        "Message-Id": "<20211019114802.665980-2-umang.jain@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.31.1",
        "In-Reply-To": "<20211019114802.665980-1-umang.jain@ideasonboard.com>",
        "References": "<20211019114802.665980-1-umang.jain@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v2 01/12] camera_device: Remove private\n\tscope of Camera3RequestDescriptor",
        "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": "Camera3RequestDescriptor is a utility structure that groups information\nabout a capture request. It can be and will be extended to preserve the\ncontext of a capture overall. Since the context of a capture needs to\nbe shared among other classes (for e.g. CameraStream) having a private\ndefinition of the struct in CameraDevice class doesn't help.\n\nHence, de-scope the structure so that it can be shared with other\ncomponents (through references or pointers). Splitting the structure to\na separate file will help avoiding circular dependencies when using it\nthrough the HAL implementation.\n\nSigned-off-by: Umang Jain <umang.jain@ideasonboard.com>\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\nReviewed-by: Hirokazu Honda <hiroh@chromium.org>\n---\n src/android/camera_device.cpp  | 43 ++++---------------------------\n src/android/camera_device.h    | 27 ++------------------\n src/android/camera_request.cpp | 45 +++++++++++++++++++++++++++++++++\n src/android/camera_request.h   | 46 ++++++++++++++++++++++++++++++++++\n src/android/meson.build        |  1 +\n 5 files changed, 99 insertions(+), 63 deletions(-)\n create mode 100644 src/android/camera_request.cpp\n create mode 100644 src/android/camera_request.h",
    "diff": "diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\nindex fe29b7bc..3689940d 100644\n--- a/src/android/camera_device.cpp\n+++ b/src/android/camera_device.cpp\n@@ -6,9 +6,6 @@\n  */\n \n #include \"camera_device.h\"\n-#include \"camera_hal_config.h\"\n-#include \"camera_ops.h\"\n-#include \"post_processor.h\"\n \n #include <algorithm>\n #include <fstream>\n@@ -27,6 +24,11 @@\n \n #include \"system/graphics.h\"\n \n+#include \"camera_hal_config.h\"\n+#include \"camera_ops.h\"\n+#include \"camera_request.h\"\n+#include \"post_processor.h\"\n+\n using namespace libcamera;\n \n LOG_DECLARE_CATEGORY(HAL)\n@@ -213,41 +215,6 @@ bool validateCropRotate(const camera3_stream_configuration_t &streamList)\n \n } /* namespace */\n \n-/*\n- * \\struct Camera3RequestDescriptor\n- *\n- * A utility structure that groups information about a capture request to be\n- * later re-used at request complete time to notify the framework.\n- */\n-\n-CameraDevice::Camera3RequestDescriptor::Camera3RequestDescriptor(\n-\tCamera *camera, const camera3_capture_request_t *camera3Request)\n-{\n-\tframeNumber_ = camera3Request->frame_number;\n-\n-\t/* Copy the camera3 request stream information for later access. */\n-\tconst uint32_t numBuffers = camera3Request->num_output_buffers;\n-\tbuffers_.resize(numBuffers);\n-\tfor (uint32_t i = 0; i < numBuffers; i++)\n-\t\tbuffers_[i] = camera3Request->output_buffers[i];\n-\n-\t/*\n-\t * FrameBuffer instances created by wrapping a camera3 provided dmabuf\n-\t * are emplaced in this vector of unique_ptr<> for lifetime management.\n-\t */\n-\tframeBuffers_.reserve(numBuffers);\n-\n-\t/* Clone the controls associated with the camera3 request. */\n-\tsettings_ = CameraMetadata(camera3Request->settings);\n-\n-\t/*\n-\t * Create the CaptureRequest, stored as a unique_ptr<> to tie its\n-\t * lifetime to the descriptor.\n-\t */\n-\trequest_ = std::make_unique<CaptureRequest>(camera,\n-\t\t\t\t\t\t    reinterpret_cast<uint64_t>(this));\n-}\n-\n /*\n  * \\class CameraDevice\n  *\ndiff --git a/src/android/camera_device.h b/src/android/camera_device.h\nindex b7d774fe..86224aa1 100644\n--- a/src/android/camera_device.h\n+++ b/src/android/camera_device.h\n@@ -33,7 +33,9 @@\n #include \"camera_worker.h\"\n #include \"jpeg/encoder.h\"\n \n+struct Camera3RequestDescriptor;\n struct CameraConfigData;\n+\n class CameraDevice : protected libcamera::Loggable\n {\n public:\n@@ -73,31 +75,6 @@ private:\n \n \tCameraDevice(unsigned int id, std::shared_ptr<libcamera::Camera> camera);\n \n-\tstruct Camera3RequestDescriptor {\n-\t\tenum class Status {\n-\t\t\tPending,\n-\t\t\tSuccess,\n-\t\t\tError,\n-\t\t};\n-\n-\t\tCamera3RequestDescriptor() = default;\n-\t\t~Camera3RequestDescriptor() = default;\n-\t\tCamera3RequestDescriptor(libcamera::Camera *camera,\n-\t\t\t\t\t const camera3_capture_request_t *camera3Request);\n-\t\tCamera3RequestDescriptor &operator=(Camera3RequestDescriptor &&) = default;\n-\n-\t\tbool isPending() const { return status_ == Status::Pending; }\n-\n-\t\tuint32_t frameNumber_ = 0;\n-\t\tstd::vector<camera3_stream_buffer_t> buffers_;\n-\t\tstd::vector<std::unique_ptr<libcamera::FrameBuffer>> frameBuffers_;\n-\t\tCameraMetadata settings_;\n-\t\tstd::unique_ptr<CaptureRequest> request_;\n-\n-\t\tcamera3_capture_result_t captureResult_ = {};\n-\t\tStatus status_ = Status::Pending;\n-\t};\n-\n \tenum class State {\n \t\tStopped,\n \t\tFlushing,\ndiff --git a/src/android/camera_request.cpp b/src/android/camera_request.cpp\nnew file mode 100644\nindex 00000000..93e546bf\n--- /dev/null\n+++ b/src/android/camera_request.cpp\n@@ -0,0 +1,45 @@\n+/* SPDX-License-Identifier: LGPL-2.1-or-later */\n+/*\n+ * Copyright (C) 2019-2021, Google Inc.\n+ *\n+ * camera_request.cpp - libcamera Android Camera Request Descriptor\n+ */\n+\n+#include \"camera_request.h\"\n+\n+using namespace libcamera;\n+\n+/*\n+ * \\struct Camera3RequestDescriptor\n+ *\n+ * A utility structure that groups information about a capture request to be\n+ * later re-used at request complete time to notify the framework.\n+ */\n+\n+Camera3RequestDescriptor::Camera3RequestDescriptor(\n+\tCamera *camera, const camera3_capture_request_t *camera3Request)\n+{\n+\tframeNumber_ = camera3Request->frame_number;\n+\n+\t/* Copy the camera3 request stream information for later access. */\n+\tconst uint32_t numBuffers = camera3Request->num_output_buffers;\n+\tbuffers_.resize(numBuffers);\n+\tfor (uint32_t i = 0; i < numBuffers; i++)\n+\t\tbuffers_[i] = camera3Request->output_buffers[i];\n+\n+\t/*\n+\t * FrameBuffer instances created by wrapping a camera3 provided dmabuf\n+\t * are emplaced in this vector of unique_ptr<> for lifetime management.\n+\t */\n+\tframeBuffers_.reserve(numBuffers);\n+\n+\t/* Clone the controls associated with the camera3 request. */\n+\tsettings_ = CameraMetadata(camera3Request->settings);\n+\n+\t/*\n+\t * Create the CaptureRequest, stored as a unique_ptr<> to tie its\n+\t * lifetime to the descriptor.\n+\t */\n+\trequest_ = std::make_unique<CaptureRequest>(camera,\n+\t\t\t\t\t\t    reinterpret_cast<uint64_t>(this));\n+}\ndiff --git a/src/android/camera_request.h b/src/android/camera_request.h\nnew file mode 100644\nindex 00000000..1346f6fa\n--- /dev/null\n+++ b/src/android/camera_request.h\n@@ -0,0 +1,46 @@\n+/* SPDX-License-Identifier: LGPL-2.1-or-later */\n+/*\n+ * Copyright (C) 2019-2021, Google Inc.\n+ *\n+ * camera_request.h - libcamera Android Camera Request Descriptor\n+ */\n+#ifndef __ANDROID_CAMERA_REQUEST_H__\n+#define __ANDROID_CAMERA_REQUEST_H__\n+\n+#include <memory>\n+#include <vector>\n+\n+#include <libcamera/camera.h>\n+#include <libcamera/framebuffer.h>\n+\n+#include <hardware/camera3.h>\n+\n+#include \"camera_metadata.h\"\n+#include \"camera_worker.h\"\n+\n+struct Camera3RequestDescriptor {\n+\tenum class Status {\n+\t\tPending,\n+\t\tSuccess,\n+\t\tError,\n+\t};\n+\n+\tCamera3RequestDescriptor() = default;\n+\t~Camera3RequestDescriptor() = default;\n+\tCamera3RequestDescriptor(libcamera::Camera *camera,\n+\t\t\t\t const camera3_capture_request_t *camera3Request);\n+\tCamera3RequestDescriptor &operator=(Camera3RequestDescriptor &&) = default;\n+\n+\tbool isPending() const { return status_ == Status::Pending; }\n+\n+\tuint32_t frameNumber_ = 0;\n+\tstd::vector<camera3_stream_buffer_t> buffers_;\n+\tstd::vector<std::unique_ptr<libcamera::FrameBuffer>> frameBuffers_;\n+\tCameraMetadata settings_;\n+\tstd::unique_ptr<CaptureRequest> request_;\n+\n+\tcamera3_capture_result_t captureResult_ = {};\n+\tStatus status_ = Status::Pending;\n+};\n+\n+#endif /* __ANDROID_CAMERA_REQUEST_H__ */\ndiff --git a/src/android/meson.build b/src/android/meson.build\nindex 7d1e7e85..332b177c 100644\n--- a/src/android/meson.build\n+++ b/src/android/meson.build\n@@ -45,6 +45,7 @@ android_hal_sources = files([\n     'camera_hal_manager.cpp',\n     'camera_metadata.cpp',\n     'camera_ops.cpp',\n+    'camera_request.cpp',\n     'camera_stream.cpp',\n     'camera_worker.cpp',\n     'jpeg/encoder_libjpeg.cpp',\n",
    "prefixes": [
        "libcamera-devel",
        "v2",
        "01/12"
    ]
}