Cover Letter Detail
Show a cover letter.
GET /api/covers/11393/?format=api
{ "id": 11393, "url": "https://patchwork.libcamera.org/api/covers/11393/?format=api", "web_url": "https://patchwork.libcamera.org/cover/11393/", "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": "<20210226132932.165484-1-jacopo@jmondi.org>", "date": "2021-02-26T13:29:20", "name": "[libcamera-devel,00/12] android: Support memory backends", "submitter": { "id": 3, "url": "https://patchwork.libcamera.org/api/people/3/?format=api", "name": "Jacopo Mondi", "email": "jacopo@jmondi.org" }, "mbox": "https://patchwork.libcamera.org/cover/11393/mbox/", "series": [ { "id": 1731, "url": "https://patchwork.libcamera.org/api/series/1731/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1731", "date": "2021-02-26T13:29:20", "name": "android: Support memory backends", "version": 1, "mbox": "https://patchwork.libcamera.org/series/1731/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/covers/11393/comments/", "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 E2DD3BD1F1\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 26 Feb 2021 13:29:15 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1D0F568A6B;\n\tFri, 26 Feb 2021 14:29:15 +0100 (CET)", "from relay12.mail.gandi.net (relay12.mail.gandi.net\n\t[217.70.178.232])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2F86060106\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 26 Feb 2021 14:29:13 +0100 (CET)", "from uno.LocalDomain (93-61-96-190.ip145.fastwebnet.it\n\t[93.61.96.190]) (Authenticated sender: jacopo@jmondi.org)\n\tby relay12.mail.gandi.net (Postfix) with ESMTPSA id CE588200007\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 26 Feb 2021 13:29:12 +0000 (UTC)" ], "From": "Jacopo Mondi <jacopo@jmondi.org>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Fri, 26 Feb 2021 14:29:20 +0100", "Message-Id": "<20210226132932.165484-1-jacopo@jmondi.org>", "X-Mailer": "git-send-email 2.30.0", "MIME-Version": "1.0", "Subject": "[libcamera-devel] [PATCH 00/12] android: Support memory backends", "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>", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "The Android Camera HAL need deals with frame buffers in two different ways:\n\n- When it receives a buffer already exported as dmabuf handle that can be\n imported in the video device it wraps it in a libcamera::FrameBuffer instance\n in CameraDevice::createFrameBuffer and associates it to a libcamera::Stream\n in a libcamera::Request\n\n- When it receives a buffer that needs to be mapped to a CPU accessible\n address for, in example, software post-processing it currently wraps it in\n a CameraDevice::MappedCamera3Buffer instance, where the buffer's dmabuf handle\n is mmapp-ed and the buffer size gets computed using lseek.\n\nRelying on mmap and lseek to map the buffer and be able to access its content\nfor writing is unfortunately not enough, as the Android camera framework\nallocates memory from the graphic stack and the DRM/KMS primitives have to be\nused to be able to access the buffer at the right location and calculate the\nsize of its plane properly.\n\nIn regular Android platforms access to the buffers allocated in the graphic\nstack is usually mediated by the Gralloc API which implement platform\nspecific support sometimes through custom API extensions (afaiu).\n\nIn ChromeOS the CameraBufferManager class implements the Gralloc API\nand provide a system-wide component to be able to map/unmap memory buffers.\n\nThis series implements a CameraBuffer interface thought the PIMPL design patter\nwhich provide a single interface towards the camera HAL with different\ncompile-time selected back-ends which depend on the platform in use.\n\nThe first patch introduces a combo option that allows to select the memory\nbackend in use. Then the MappedCamera3Buffer class is moved outside of\nCameraDevice and renamed it in CameraBuffer. The PIMPL design pattern is\nintroduced by implementing a 'generic android' memory backend which implements\nthe current mmap+lseek. At the end of the series a ChromeOS specific backend\nimplementation 'cros_cbm' is introduced, which uses the\ncros::CameraBufferManager class to register and map the frame buffers.\n\nCurrently the memory backend is only used for post-processing. It is not clear\nto me yet if it should be used for intermediate buffer allocation, image\nformat translation and other operations.\n\nTested by\n\n- JPEG capture with CCA on ChromeOS\n - Works with the generic backend as it used to\n - Works with the cbm backend\n\n- CTS android.hardware.camera2.cts.ImageReaderTest with cbm backend making sure\n the calculated buffer size is correct ( aka < maxJpegBufferSize)\n\n- Picture capture with OpenCamera which results in a well formed picture\n\nTo be defined: the memory backend selection option can be merged with Paul's\ncros=true in-review option.\n\nThanks\n j\n\nJacopo Mondi (12):\n meson: options: Add an option to select Android memory backend\n android: Introduce CameraBuffer interface\n android: Rename MappedCamera3Buffer to CameraBuffer\n android: camera_buffer: Drop 'const' from buffer_handle_t\n android: camera_device: Rename buffer fields\n android: Move buffer mapping to CameraStream\n android: camera_buffer: Implement PIMPL pattern\n android: post_processor: Use CameraBuffer API\n android: jpeg: Use maxJpegBufferSize() for compatibility\n meson: options: Introduce 'cros_cbm' memory backend\n android: Introduce cros_cbm_buffer\n android: mm: Provide helper macro for PIMPL\n\n meson_options.txt | 6 +\n src/android/camera_buffer.h | 64 +++++++++++\n src/android/camera_device.cpp | 51 +--------\n src/android/camera_device.h | 6 -\n src/android/camera_stream.cpp | 16 ++-\n src/android/camera_stream.h | 2 +-\n src/android/jpeg/encoder.h | 4 +-\n src/android/jpeg/encoder_libjpeg.cpp | 19 ++--\n src/android/jpeg/encoder_libjpeg.h | 4 +-\n src/android/jpeg/post_processor_jpeg.cpp | 34 +++---\n src/android/jpeg/post_processor_jpeg.h | 2 +-\n src/android/meson.build | 2 +\n src/android/mm/android_generic_buffer.cpp | 92 +++++++++++++++\n src/android/mm/cros_cbm.cpp | 133 ++++++++++++++++++++++\n src/android/mm/meson.build | 9 ++\n src/android/post_processor.h | 4 +-\n src/android/yuv/post_processor_yuv.cpp | 20 ++--\n src/android/yuv/post_processor_yuv.h | 4 +-\n 18 files changed, 373 insertions(+), 99 deletions(-)\n create mode 100644 src/android/camera_buffer.h\n create mode 100644 src/android/mm/android_generic_buffer.cpp\n create mode 100644 src/android/mm/cros_cbm.cpp\n create mode 100644 src/android/mm/meson.build\n\n--\n2.30.0" }