Patch Detail
Show a patch.
GET /api/patches/9685/?format=api
{ "id": 9685, "url": "https://patchwork.libcamera.org/api/patches/9685/?format=api", "web_url": "https://patchwork.libcamera.org/patch/9685/", "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": "<20200922094738.5327-2-jacopo@jmondi.org>", "date": "2020-09-22T09:47:31", "name": "[libcamera-devel,v3,1/8] android: camera_device: Add CameraStream::Type", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "a62016e15b0f4d34c09f8a82cb6568f52d969795", "submitter": { "id": 3, "url": "https://patchwork.libcamera.org/api/people/3/?format=api", "name": "Jacopo Mondi", "email": "jacopo@jmondi.org" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/9685/mbox/", "series": [ { "id": 1306, "url": "https://patchwork.libcamera.org/api/series/1306/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1306", "date": "2020-09-22T09:47:30", "name": "android: camera_device: Add support for internal buffers", "version": 3, "mbox": "https://patchwork.libcamera.org/series/1306/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/9685/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/9685/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 7C519BF01C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 22 Sep 2020 09:44:02 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 56B5262FD5;\n\tTue, 22 Sep 2020 11:44:02 +0200 (CEST)", "from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net\n\t[217.70.183.196])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id BD70260364\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 22 Sep 2020 11:44:00 +0200 (CEST)", "from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay4-d.mail.gandi.net (Postfix) with ESMTPSA id 542D9E000E;\n\tTue, 22 Sep 2020 09:43:57 +0000 (UTC)" ], "X-Originating-IP": "93.34.118.233", "From": "Jacopo Mondi <jacopo@jmondi.org>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Tue, 22 Sep 2020 11:47:31 +0200", "Message-Id": "<20200922094738.5327-2-jacopo@jmondi.org>", "X-Mailer": "git-send-email 2.28.0", "In-Reply-To": "<20200922094738.5327-1-jacopo@jmondi.org>", "References": "<20200922094738.5327-1-jacopo@jmondi.org>", "MIME-Version": "1.0", "Subject": "[libcamera-devel] [PATCH v3 1/8] android: camera_device: Add\n\tCameraStream::Type", "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>", "Cc": "hanlinchen@chromium.org", "Content-Type": "text/plain; charset=\"utf-8\"", "Content-Transfer-Encoding": "base64", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Define the CameraStream::Type enumeration and assign it to\neach CameraStream instance at construction time.\n\nThe CameraStream type will be used to decide if memory needs to be\nallocated on its behalf or if the stream is backed by memory externally\nallocated by the Android framework.\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nReviewed-by: Hirokazu Honda <hiroh@chromium.org>\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/android/camera_device.cpp | 14 ++++--\n src/android/camera_device.h | 87 ++++++++++++++++++++++++++++++++++-\n 2 files changed, 96 insertions(+), 5 deletions(-)", "diff": "diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\nindex 70d77a17ef43..e4ffbc02c2da 100644\n--- a/src/android/camera_device.cpp\n+++ b/src/android/camera_device.cpp\n@@ -169,9 +169,11 @@ MappedCamera3Buffer::MappedCamera3Buffer(const buffer_handle_t camera3buffer,\n \t}\n }\n \n-CameraStream::CameraStream(PixelFormat format, Size size,\n+CameraStream::CameraStream(PixelFormat format, Size size, Type type,\n \t\t\t unsigned int index, Encoder *encoder)\n-\t: format_(format), size_(size), index_(index), encoder_(encoder)\n+\n+\t: format_(format), size_(size), type_(type), index_(index),\n+\t encoder_(encoder)\n {\n }\n \n@@ -1222,12 +1224,14 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)\n \n \t\tconfig_->addConfiguration(streamConfiguration);\n \t\tunsigned int index = config_->size() - 1;\n-\t\tstreams_.emplace_back(format, size, index);\n+\t\tstreams_.emplace_back(format, size, CameraStream::Type::Direct,\n+\t\t\t\t index);\n \t\tstream->priv = static_cast<void *>(&streams_.back());\n \t}\n \n \t/* Now handle the MJPEG streams, adding a new stream if required. */\n \tif (jpegStream) {\n+\t\tCameraStream::Type type;\n \t\tint index = -1;\n \n \t\t/* Search for a compatible stream in the non-JPEG ones. */\n@@ -1245,6 +1249,7 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)\n \t\t\tLOG(HAL, Info)\n \t\t\t\t<< \"Android JPEG stream mapped to libcamera stream \" << i;\n \n+\t\t\ttype = CameraStream::Type::Mapped;\n \t\t\tindex = i;\n \t\t\tbreak;\n \t\t}\n@@ -1269,6 +1274,7 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)\n \t\t\tLOG(HAL, Info) << \"Adding \" << streamConfiguration.toString()\n \t\t\t\t << \" for MJPEG support\";\n \n+\t\t\ttype = CameraStream::Type::Internal;\n \t\t\tconfig_->addConfiguration(streamConfiguration);\n \t\t\tindex = config_->size() - 1;\n \t\t}\n@@ -1287,7 +1293,7 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)\n \t\t\treturn ret;\n \t\t}\n \n-\t\tstreams_.emplace_back(formats::MJPEG, cfg.size, index, encoder);\n+\t\tstreams_.emplace_back(formats::MJPEG, cfg.size, type, index, encoder);\n \t\tjpegStream->priv = static_cast<void *>(&streams_.back());\n \t}\n \ndiff --git a/src/android/camera_device.h b/src/android/camera_device.h\nindex 1837748d2efc..9a9406cc257c 100644\n--- a/src/android/camera_device.h\n+++ b/src/android/camera_device.h\n@@ -30,17 +30,102 @@ class CameraMetadata;\n class CameraStream\n {\n public:\n+\t/*\n+\t * Enumeration of CameraStream types.\n+\t *\n+\t * A camera stream associates an Android stream to a libcamera stream.\n+\t * This enumeration describes how the two streams are associated and how\n+\t * and where data produced from libcamera are delivered to the\n+\t * Android framework.\n+\t *\n+\t * Direct:\n+\t *\n+\t * The Android stream is directly mapped onto a libcamera stream: frames\n+\t * are delivered by the library directly in the memory location\n+\t * specified by the Android stream (buffer_handle_t->data) and provided\n+\t * to the framework as they are. The Android stream characteristics are\n+\t * directly translated to the libcamera stream configuration.\n+\t *\n+\t * +-----+ +-----+\n+\t * | A | | L |\n+\t * +-----+ +-----+\n+\t * | |\n+\t * V V\n+\t * +-----+ +------+\n+\t * | B |<---------------| FB |\n+\t * +-----+ +------+\n+\t *\n+\t *\n+\t * Internal:\n+\t *\n+\t * Data for the Android stream is produced by processing a libcamera\n+\t * stream created by the HAL for that purpose. The libcamera stream\n+\t * needs to be supplied with intermediate buffers where the library\n+\t * delivers frames to be processed and then provided to the framework.\n+\t * The libcamera stream configuration is not a direct translation of the\n+\t * Android stream characteristics, but it describes the format and size\n+\t * required for the processing procedure to produce frames in the\n+\t * Android required format.\n+\t *\n+\t * +-----+ +-----+ +-----+\n+\t * | A | | L |--->| FB |\n+\t * +-----+ +-----+ +-----+\n+\t * | | |\n+\t * V V |\n+\t * +-----+ +------+ |\n+\t * | B | | B |<----+\n+\t * +-----+ +------+\n+\t * ^ |\n+\t * |-------Processing------|\n+\t *\n+\t *\n+\t * Mapped:\n+\t *\n+\t * Data for the Android stream is produced by processing a libcamera\n+\t * stream associated with another CameraStream. Mapped camera streams do\n+\t * not need any memory to be reserved for them as they process data\n+\t * produced by libcamera for a different stream whose format and size\n+\t * is compatible with the processing procedure requirements to produce\n+\t * frames in the Android required format.\n+\t *\n+\t * +-----+ +-----+ +-----+\n+\t * | A | | A' | | L |\n+\t * +-----+ +-----+ +-----+\n+\t * | | |\n+\t * V V V\n+\t * +-----+ +-----+ +------+\n+\t * | B | | B' |<---------| FB |\n+\t * +-----+ +-----+ +------+\n+\t * ^ |\n+\t * |--Processing--|\n+\t *\n+\t *\n+\t * --------------------------------------------------------------------\n+\t * A = Android stream\n+\t * L = libcamera stream\n+\t * B = memory buffer\n+\t * FB = libcamera FrameBuffer\n+\t * \"Processing\" = Frame processing procedure (Encoding, scaling etc)\n+\t */\n+\tenum class Type {\n+\t\tDirect,\n+\t\tInternal,\n+\t\tMapped,\n+\t};\n+\n \tCameraStream(libcamera::PixelFormat format, libcamera::Size size,\n-\t\t unsigned int index, Encoder *encoder = nullptr);\n+\t\t Type type, unsigned int index, Encoder *encoder = nullptr);\n \n \tconst libcamera::PixelFormat &format() const { return format_; }\n \tconst libcamera::Size &size() const { return size_; }\n+\tType type() const { return type_; }\n \tunsigned int index() const { return index_; }\n \tEncoder *encoder() const { return encoder_.get(); }\n \n private:\n \tlibcamera::PixelFormat format_;\n \tlibcamera::Size size_;\n+\tType type_;\n \t/*\n \t * The index of the libcamera StreamConfiguration as added during\n \t * configureStreams(). A single libcamera Stream may be used to deliver\n", "prefixes": [ "libcamera-devel", "v3", "1/8" ] }