{"id":21556,"url":"https://patchwork.libcamera.org/api/patches/21556/?format=json","web_url":"https://patchwork.libcamera.org/patch/21556/","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":"<20241009074642.2965791-5-chenghaoyang@chromium.org>","date":"2024-10-09T07:41:22","name":"[4/5] libcamera: Add stride in FrameBuffer::Plane","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"2ae324bc971d66b48b584cf53fb654e8af6d207d","submitter":{"id":117,"url":"https://patchwork.libcamera.org/api/people/117/?format=json","name":"Cheng-Hao Yang","email":"chenghaoyang@chromium.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/21556/mbox/","series":[{"id":4670,"url":"https://patchwork.libcamera.org/api/series/4670/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4670","date":"2024-10-09T07:41:18","name":"Add InfoFrame","version":1,"mbox":"https://patchwork.libcamera.org/series/4670/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/21556/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/21556/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 ADBE8C32E7\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  9 Oct 2024 07:47:01 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 488DE63527;\n\tWed,  9 Oct 2024 09:47:01 +0200 (CEST)","from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com\n\t[IPv6:2607:f8b0:4864:20::102e])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 75E0365373\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  9 Oct 2024 09:46:55 +0200 (CEST)","by mail-pj1-x102e.google.com with SMTP id\n\t98e67ed59e1d1-2e29522f0f1so954000a91.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 09 Oct 2024 00:46:55 -0700 (PDT)","from chenghaoyang-low.c.googlers.com.com\n\t(199.211.81.34.bc.googleusercontent.com. [34.81.211.199])\n\tby smtp.gmail.com with ESMTPSA id\n\t98e67ed59e1d1-2e2a57077c2sm944414a91.17.2024.10.09.00.46.52\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 09 Oct 2024 00:46:53 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"gJXAPL2e\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=chromium.org; s=google; t=1728460014; x=1729064814;\n\tdarn=lists.libcamera.org; \n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=hIYRjwA8UoGnGjd32bbuoBgeCFx8Qw8gErvHW8Wrnvw=;\n\tb=gJXAPL2eqGNQoQrB8Dp6ApUz9n6luulWraxZ45AXh4Z4uBf0H5+rxLOkPLJoMddl6Q\n\taYw5HTv45hYctIJlpRjyAN3IDlFAXM/ZeqmBWL9fKN3ET3XgCxTpwio0DiVPJC0yfolI\n\t+Fe12ytUHDb+uG01YUi/j7IB/GzPnBdH0bYY4=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1728460014; x=1729064814;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n\t:subject:date:message-id:reply-to;\n\tbh=hIYRjwA8UoGnGjd32bbuoBgeCFx8Qw8gErvHW8Wrnvw=;\n\tb=E+9sPZrkjHdRifQ/zv/Jt79aUT0lhmQ3y/r3Oex87TUyEA30Ig/azBXJGF/pldAH6I\n\tk1vpk7BUi6Ex78xMfRVExt8xV++CShJWhaF51iH5mUsOwATGDsB78oKbScrFJSgkSrBB\n\tTu7rIiW1lqgt+RfNNoGkKhYftXiboyVae56Nr8IwdWipNQiJw4kMhwMNvMLTjQ8xvtl6\n\tWwX+hLbZuEwQ+3bak15lzhrSRREUkEEQmMQw7ruzC4iWRhgrA6shH5/u59dxeXSbq4rY\n\tdjGLTx1IgVqHxaIOuhRNnY64F42wgxVI4CSW+wAGJHAb7Ps1W386C/kImjh64eNw6IjX\n\tlcfg==","X-Gm-Message-State":"AOJu0Yy1+gWY+Fx1nTN6SR9cGPBK0Wgtk58oUTnhDr3ExA7FCyEvWUP3\n\t/I+WOV/d2XwoZPvyMFrTc3pf7JzKXaFeEs0KOZRc14/R7Naw75pwFuv7GdhPMciXIi9+hgV4WtE\n\tjdw==","X-Google-Smtp-Source":"AGHT+IGhpAn5NpRtGtKjEr8o4YFApr6aKAtH2EF99znKPWIMSgohChmotRBfaLeiXwS43nFjDpYd2g==","X-Received":"by 2002:a17:90b:1288:b0:2e0:7012:335a with SMTP id\n\t98e67ed59e1d1-2e2a21eb985mr1820248a91.6.1728460013686; \n\tWed, 09 Oct 2024 00:46:53 -0700 (PDT)","From":"Harvey Yang <chenghaoyang@chromium.org>","To":"libcamera-devel@lists.libcamera.org","Cc":"Harvey Yang <chenghaoyang@chromium.org>","Subject":"[PATCH 4/5] libcamera: Add stride in FrameBuffer::Plane","Date":"Wed,  9 Oct 2024 07:41:22 +0000","Message-ID":"<20241009074642.2965791-5-chenghaoyang@chromium.org>","X-Mailer":"git-send-email 2.47.0.rc0.187.ge670bccf7e-goog","In-Reply-To":"<20241009074642.2965791-1-chenghaoyang@chromium.org>","References":"<20241009074642.2965791-1-chenghaoyang@chromium.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","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":"Some platforms, like mtkisp7, need the stride information in a\nFrameBuffer. This patch adds the member variable in FrameBuffer::Plane,\nand appends the member variable in IPA (de)serializer.\n\nSigned-off-by: Harvey Yang <chenghaoyang@chromium.org>\n---\n include/libcamera/framebuffer.h       | 1 +\n src/libcamera/dma_buf_allocator.cpp   | 3 ++-\n src/libcamera/framebuffer.cpp         | 5 +++++\n src/libcamera/ipa_data_serializer.cpp | 3 +++\n 4 files changed, 11 insertions(+), 1 deletion(-)","diff":"diff --git a/include/libcamera/framebuffer.h b/include/libcamera/framebuffer.h\nindex ff8392430..059c66f31 100644\n--- a/include/libcamera/framebuffer.h\n+++ b/include/libcamera/framebuffer.h\n@@ -55,6 +55,7 @@ public:\n \t\tSharedFD fd;\n \t\tunsigned int offset = kInvalidOffset;\n \t\tunsigned int length;\n+\t\tunsigned int stride;\n \t};\n \n \tFrameBuffer(const std::vector<Plane> &planes, unsigned int cookie = 0);\ndiff --git a/src/libcamera/dma_buf_allocator.cpp b/src/libcamera/dma_buf_allocator.cpp\nindex 262eb53a0..e6a29c2d7 100644\n--- a/src/libcamera/dma_buf_allocator.cpp\n+++ b/src/libcamera/dma_buf_allocator.cpp\n@@ -255,7 +255,8 @@ DmaBufAllocator::createBuffer(std::string name,\n \t\treturn nullptr;\n \n \tfor (auto planeSize : planeSizes) {\n-\t\tplanes.emplace_back(FrameBuffer::Plane{ fd, offset, planeSize });\n+\t\t/* \\todo Invalid stride information. Consider adding strides as input. */\n+\t\tplanes.emplace_back(FrameBuffer::Plane{ fd, offset, planeSize, 0 });\n \t\toffset += planeSize;\n \t}\n \ndiff --git a/src/libcamera/framebuffer.cpp b/src/libcamera/framebuffer.cpp\nindex 826848f75..61a3cc024 100644\n--- a/src/libcamera/framebuffer.cpp\n+++ b/src/libcamera/framebuffer.cpp\n@@ -282,6 +282,11 @@ FrameBuffer::Private::~Private()\n  * \\brief The plane length in bytes\n  */\n \n+/**\n+ * \\var FrameBuffer::Plane::stride\n+ * \\brief The plane stride in bytes\n+ */\n+\n namespace {\n \n ino_t fileDescriptorInode(const SharedFD &fd)\ndiff --git a/src/libcamera/ipa_data_serializer.cpp b/src/libcamera/ipa_data_serializer.cpp\nindex 2189a2466..d9d76c57c 100644\n--- a/src/libcamera/ipa_data_serializer.cpp\n+++ b/src/libcamera/ipa_data_serializer.cpp\n@@ -572,6 +572,7 @@ SharedFD IPADataSerializer<SharedFD>::deserialize(const std::vector<uint8_t> &da\n  * 4 byte  - SharedFD\n  * 4 bytes - uint32_t Offset\n  * 4 bytes - uint32_t Length\n+ * 4 bytes - uint32_t Stride\n  */\n template<>\n std::tuple<std::vector<uint8_t>, std::vector<SharedFD>>\n@@ -590,6 +591,7 @@ IPADataSerializer<FrameBuffer::Plane>::serialize(const FrameBuffer::Plane &data,\n \n \tappendPOD<uint32_t>(dataVec, data.offset);\n \tappendPOD<uint32_t>(dataVec, data.length);\n+\tappendPOD<uint32_t>(dataVec, data.stride);\n \n \treturn { dataVec, fdsVec };\n }\n@@ -608,6 +610,7 @@ IPADataSerializer<FrameBuffer::Plane>::deserialize(std::vector<uint8_t>::const_i\n \t\t\t\t\t\t\t  fdsBegin, fdsBegin + 1);\n \tret.offset = readPOD<uint32_t>(dataBegin, 4, dataEnd);\n \tret.length = readPOD<uint32_t>(dataBegin, 8, dataEnd);\n+\tret.stride = readPOD<uint32_t>(dataBegin, 12, dataEnd);\n \n \treturn ret;\n }\n","prefixes":["4/5"]}