{"id":13444,"url":"https://patchwork.libcamera.org/api/patches/13444/?format=json","web_url":"https://patchwork.libcamera.org/patch/13444/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20210823131221.1034059-2-hiroh@chromium.org>","date":"2021-08-23T13:12:12","name":"[libcamera-devel,RFC,v2,01/10] libcamera: framebuffer: Add offset to FrameBuffer::Plane","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"482bf3fce4d8447a772cbbc3fb7432eb44545b8a","submitter":{"id":63,"url":"https://patchwork.libcamera.org/api/people/63/?format=json","name":"Hirokazu Honda","email":"hiroh@chromium.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/13444/mbox/","series":[{"id":2386,"url":"https://patchwork.libcamera.org/api/series/2386/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2386","date":"2021-08-23T13:12:11","name":"Add offset to FrameBuffer::Plane","version":2,"mbox":"https://patchwork.libcamera.org/series/2386/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/13444/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/13444/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 CACC4BD87C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 23 Aug 2021 13:12:37 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 785AD688D2;\n\tMon, 23 Aug 2021 15:12:37 +0200 (CEST)","from mail-pf1-x431.google.com (mail-pf1-x431.google.com\n\t[IPv6:2607:f8b0:4864:20::431])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7391F688A2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 23 Aug 2021 15:12:35 +0200 (CEST)","by mail-pf1-x431.google.com with SMTP id m26so15320318pff.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 23 Aug 2021 06:12:35 -0700 (PDT)","from hiroh2.tok.corp.google.com\n\t([2401:fa00:8f:203:184e:5d20:8fcb:dfcd])\n\tby smtp.gmail.com with ESMTPSA id\n\tj4sm18596891pgi.6.2021.08.23.06.12.32\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 23 Aug 2021 06:12:33 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"Ut7SSl78\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; \n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=9UJviNb4DpnhQj5osTY6f0kvGeRQy+OdwckPD5N+q80=;\n\tb=Ut7SSl78ctnG1noGbqNg58wzBLc5ae+C/rkmQ8XMDvUH0eE/RcZMa2QIfU+i8CT6XG\n\t+p+Y3Frp+wPYOtOnC1nFMRig198pimul5BYMjnCRLTdxhFwfvIWOVGPs/JKW42yEePxt\n\t5lfU/ObOselqSIwWD+vDF+ePf+4iRbw3eBlxc=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=9UJviNb4DpnhQj5osTY6f0kvGeRQy+OdwckPD5N+q80=;\n\tb=YzV4/uDFshlHVRrQC5mfKCkbKi0lwcKKiTA1PqBh4VlhDgU3gotcQu83GXKjZOS/vY\n\tVrtUjEF5edeBUEvHz7jmh94fUvFo2PaoKhwAnspH+m8TkysBqML703ZeEAXSnkcQgK26\n\tblgCmSY+OFtEL3Mhl2N8epGoAUB8mqhsSVIrTz2V44KCq0jEX161diMRtei9vFJWgmTx\n\tW7/cVN3VL+tPECcHGBILVqMAHFZHPUdWyQjZHNIx0htL7nc4WuoA5XvOFGkda3qNa8PR\n\tHy1v4SFQUu8VtjbQg263x8M6u/d0IyoStxH7Bmf6PKHKb/kAGgnL+LoHGiKiSsOAp2cG\n\tqSkQ==","X-Gm-Message-State":"AOAM533OSbUSzqoeI8YMt2rejN/ai011BTNABL5DGF9lawiDHpZ5gKgf\n\to9MSYKRCpldSFcOhpckGgtJZXbtUNiiXbQ==","X-Google-Smtp-Source":"ABdhPJwYLchTSp3iD14b1Zfh6iztidyRVDwGk9tcSv0N1HKuA5YZJZ5fe6KLBOTgxwvfndgae6x6FA==","X-Received":"by 2002:a05:6a00:190c:b0:3e2:911c:b7ca with SMTP id\n\ty12-20020a056a00190c00b003e2911cb7camr32584189pfi.5.1629724353659; \n\tMon, 23 Aug 2021 06:12:33 -0700 (PDT)","From":"Hirokazu Honda <hiroh@chromium.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Mon, 23 Aug 2021 22:12:12 +0900","Message-Id":"<20210823131221.1034059-2-hiroh@chromium.org>","X-Mailer":"git-send-email 2.33.0.rc2.250.ged5fa647cd-goog","In-Reply-To":"<20210823131221.1034059-1-hiroh@chromium.org>","References":"<20210823131221.1034059-1-hiroh@chromium.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [RFC PATCH v2 01/10] libcamera: framebuffer: Add\n\toffset to FrameBuffer::Plane","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":"This adds offset to FrameBuffer::Plane. It enables representing frame\nbuffers that store planes in the same dmabuf at different offsets, as\nfor instance required by the V4L2 NV12 pixel format.\n\nSigned-off-by: Hirokazu Honda <hiroh@chromium.org>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n include/libcamera/framebuffer.h          |  1 +\n src/android/mm/generic_camera_buffer.cpp |  2 --\n src/libcamera/framebuffer.cpp            | 27 ++++++++++++++----------\n 3 files changed, 17 insertions(+), 13 deletions(-)","diff":"diff --git a/include/libcamera/framebuffer.h b/include/libcamera/framebuffer.h\nindex 28307890..5de3c744 100644\n--- a/include/libcamera/framebuffer.h\n+++ b/include/libcamera/framebuffer.h\n@@ -42,6 +42,7 @@ class FrameBuffer final : public Extensible\n public:\n \tstruct Plane {\n \t\tFileDescriptor fd;\n+\t\tunsigned int offset;\n \t\tunsigned int length;\n \t};\n \ndiff --git a/src/android/mm/generic_camera_buffer.cpp b/src/android/mm/generic_camera_buffer.cpp\nindex b296b3e3..73fbd97a 100644\n--- a/src/android/mm/generic_camera_buffer.cpp\n+++ b/src/android/mm/generic_camera_buffer.cpp\n@@ -52,8 +52,6 @@ private:\n \tint fd_;\n \tint flags_;\n \tstd::vector<PlaneInfo> planeInfo_;\n-\t/* \\todo remove planes_ is added to MappedBuffer. */\n-\tstd::vector<Span<uint8_t>> planes_;\n };\n \n CameraBuffer::Private::Private([[maybe_unused]] CameraBuffer *cameraBuffer,\ndiff --git a/src/libcamera/framebuffer.cpp b/src/libcamera/framebuffer.cpp\nindex b401c50e..e9467aa0 100644\n--- a/src/libcamera/framebuffer.cpp\n+++ b/src/libcamera/framebuffer.cpp\n@@ -131,7 +131,7 @@ FrameBuffer::Private::Private()\n  *\n  * The static information describes the memory planes that make a frame. The\n  * planes are specified when creating the FrameBuffer and are expressed as a set\n- * of dmabuf file descriptors and length.\n+ * of dmabuf file descriptors, offset and length.\n  *\n  * The dynamic information is grouped in a FrameMetadata instance. It is updated\n  * during the processing of a queued capture request, and is valid from the\n@@ -151,18 +151,18 @@ FrameBuffer::Private::Private()\n  *\n  * Planar pixel formats use multiple memory regions to store the different\n  * colour components of a frame. The Plane structure describes such a memory\n- * region by a dmabuf file descriptor and a length. A FrameBuffer then\n- * contains one or multiple planes, depending on the pixel format of the\n- * frames it is meant to store.\n+ * region by a dmabuf file descriptor, an offset within the dmabuf and a length.\n+ * A FrameBuffer then contains one or multiple planes, depending on the pixel\n+ * format of the frames it is meant to store.\n  *\n- * To support DMA access, planes are associated with dmabuf objects represented\n- * by FileDescriptor handles. The Plane class doesn't handle mapping of the\n- * memory to the CPU, but applications and IPAs may use the dmabuf file\n- * descriptors to map the plane memory with mmap() and access its contents.\n+ * The offset identifies the location of the plane data from the start of the\n+ * memory referenced by the dmabuf file descriptor. Multiple planes may be\n+ * stored in the same dmabuf, in which case they will reference the same dmabuf\n+ * and different offsets. No two planes may overlap, as specified by their\n+ * offset and length.\n  *\n- * \\todo Once we have a Kernel API which can express offsets within a plane\n- * this structure shall be extended to contain this information. See commit\n- * 83148ce8be55e for initial documentation of this feature.\n+ * \\todo Specify how an application shall decide whether to use a single or\n+ * multiple dmabufs, based on the camera requirements.\n  */\n \n /**\n@@ -170,6 +170,11 @@ FrameBuffer::Private::Private()\n  * \\brief The dmabuf file descriptor\n  */\n \n+/**\n+ * \\var FrameBuffer::Plane::offset\n+ * \\brief The plane offset in bytes\n+*/\n+\n /**\n  * \\var FrameBuffer::Plane::length\n  * \\brief The plane length in bytes\n","prefixes":["libcamera-devel","RFC","v2","01/10"]}