Patch Detail
Show a patch.
GET /api/patches/13500/?format=api
{ "id": 13500, "url": "https://patchwork.libcamera.org/api/patches/13500/?format=api", "web_url": "https://patchwork.libcamera.org/patch/13500/", "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": "<20210826080021.3454520-4-hiroh@chromium.org>", "date": "2021-08-26T08:00:21", "name": "[libcamera-devel,v3,3/3] android: camera_buffer: Add stride/offset/size function", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "289f1ea7d38b8dec58b55f8012678bcb0d2aa1ae", "submitter": { "id": 63, "url": "https://patchwork.libcamera.org/api/people/63/?format=api", "name": "Hirokazu Honda", "email": "hiroh@chromium.org" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/13500/mbox/", "series": [ { "id": 2397, "url": "https://patchwork.libcamera.org/api/series/2397/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2397", "date": "2021-08-26T08:00:18", "name": "Improve CameraBuffer implementation", "version": 3, "mbox": "https://patchwork.libcamera.org/series/2397/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/13500/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/13500/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 0A97FBD87C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 26 Aug 2021 08:00:39 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B95DD688A3;\n\tThu, 26 Aug 2021 10:00:38 +0200 (CEST)", "from mail-pl1-x631.google.com (mail-pl1-x631.google.com\n\t[IPv6:2607:f8b0:4864:20::631])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 813D368919\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 26 Aug 2021 10:00:35 +0200 (CEST)", "by mail-pl1-x631.google.com with SMTP id q3so1312519plx.4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 26 Aug 2021 01:00:35 -0700 (PDT)", "from hiroh2.tok.corp.google.com\n\t([2401:fa00:8f:203:a5bc:b3dd:7208:bec1])\n\tby smtp.gmail.com with ESMTPSA id\n\tg3sm2570805pgj.66.2021.08.26.01.00.31\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 26 Aug 2021 01:00:32 -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=\"YS5oVT3v\"; 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=yGO7hdszu0loHkLXpQ+gtTaw/bY/r+07vfYg6W0bFDY=;\n\tb=YS5oVT3vzpcIZr+FYXze0Yy/Px47K0YYpF3QmDGAlxPdYceXoZZ5GgVkxNz5Nww46o\n\tKKIT79x7G1Glv9kcCcCSJZHPUx7kZWyUcIIDp/ICLHPq0HPmfHfSKJIgwK9h1Z6zX7P3\n\tkBb1g8SQMoNhSQ0Pes2dsJAgIeIRX4dznezh8=", "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=yGO7hdszu0loHkLXpQ+gtTaw/bY/r+07vfYg6W0bFDY=;\n\tb=JWqxl5jixl5U+V4S2BNuVcp/JbYG+/Ux7Y5Mj+aKCD5H7A3veE+1rhtZJ80KAU8UGQ\n\tt0gFE80xc8ElMDxM+TXtVQZJFEVtC2D1s4iS454aR563MzkshKSutwq3jn50LjZUFYwD\n\tsC3fZXDnQlag50hJLKAf8+/dyrAOZM1K5hEVfjtfMLR8s0qjKttXb3lax8EkmM/eAX1b\n\tT6qBSTNdmKnZqNRhnYNyrI0PHRfU84kFy1vT1gnImNsthLC1cmJTxMkSYwmvhZdupX/5\n\t0+dmQCU7nJGj9p+vV+wuGdSkDJv2LgrOEXa6J0BeGIQETWE74kFUB7YrvW8ee2tWUOCk\n\tpYeg==", "X-Gm-Message-State": "AOAM5329TFvXC9XyU5sWZ2ByHdlDJuKWCR/wL2GE7JXrnoixP7x8Xj4l\n\tXu2AqourHRj73vK0BdQ1krPR+TM/CU46Ow==", "X-Google-Smtp-Source": "ABdhPJwOjL9HFA5EiPsvGhgWoTWiAMcGhKRu3bu2F42JHwGoP4Afmkqp4KHY/GkhR6DqUgBXzaCkNA==", "X-Received": "by 2002:a17:902:bf4c:b0:137:b460:1349 with SMTP id\n\tu12-20020a170902bf4c00b00137b4601349mr2487503pls.23.1629964833171; \n\tThu, 26 Aug 2021 01:00:33 -0700 (PDT)", "From": "Hirokazu Honda <hiroh@chromium.org>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Thu, 26 Aug 2021 17:00:21 +0900", "Message-Id": "<20210826080021.3454520-4-hiroh@chromium.org>", "X-Mailer": "git-send-email 2.33.0.rc2.250.ged5fa647cd-goog", "In-Reply-To": "<20210826080021.3454520-1-hiroh@chromium.org>", "References": "<20210826080021.3454520-1-hiroh@chromium.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v3 3/3] android: camera_buffer: Add\n\tstride/offset/size function", "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 getter functions of stride, offset and size to CameraBuffer\ninterface.\n\nSigned-off-by: Hirokazu Honda <hiroh@chromium.org>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/android/camera_buffer.h | 16 +++++++++++++\n src/android/mm/cros_camera_buffer.cpp | 19 +++++++++++++++\n src/android/mm/generic_camera_buffer.cpp | 30 ++++++++++++++++++++++++\n 3 files changed, 65 insertions(+)", "diff": "diff --git a/src/android/camera_buffer.h b/src/android/camera_buffer.h\nindex 87df2570..226a8f5c 100644\n--- a/src/android/camera_buffer.h\n+++ b/src/android/camera_buffer.h\n@@ -31,6 +31,10 @@ public:\n \tlibcamera::Span<const uint8_t> plane(unsigned int plane) const;\n \tlibcamera::Span<uint8_t> plane(unsigned int plane);\n \n+\tunsigned int stride(unsigned int plane) const;\n+\tunsigned int offset(unsigned int plane) const;\n+\tunsigned int size(unsigned int plane) const;\n+\n \tsize_t jpegBufferSize(size_t maxJpegBufferSize) const;\n };\n \n@@ -62,6 +66,18 @@ Span<uint8_t> CameraBuffer::plane(unsigned int plane)\t\t\t\\\n {\t\t\t\t\t\t\t\t\t\\\n \treturn _d()->plane(plane);\t\t\t\t\t\\\n }\t\t\t\t\t\t\t\t\t\\\n+unsigned int CameraBuffer::stride(unsigned int plane) const\t\t\\\n+{\t\t\t\t\t\t\t\t\t\\\n+\treturn _d()->stride(plane);\t\t\t\t\t\\\n+}\t\t\t\t\t\t\t\t\t\\\n+unsigned int CameraBuffer::offset(unsigned int plane) const\t\t\\\n+{\t\t\t\t\t\t\t\t\t\\\n+\treturn _d()->offset(plane);\t\t\t\t\t\\\n+}\t\t\t\t\t\t\t\t\t\\\n+unsigned int CameraBuffer::size(unsigned int plane) const\t\t\\\n+{\t\t\t\t\t\t\t\t\t\\\n+\treturn _d()->size(plane);\t\t\t\t\t\\\n+}\t\t\t\t\t\t\t\t\t\\\n size_t CameraBuffer::jpegBufferSize(size_t maxJpegBufferSize) const\t\\\n {\t\t\t\t\t\t\t\t\t\\\n \treturn _d()->jpegBufferSize(maxJpegBufferSize);\t\t\t\\\ndiff --git a/src/android/mm/cros_camera_buffer.cpp b/src/android/mm/cros_camera_buffer.cpp\nindex ba6650cf..44993379 100644\n--- a/src/android/mm/cros_camera_buffer.cpp\n+++ b/src/android/mm/cros_camera_buffer.cpp\n@@ -31,6 +31,10 @@ public:\n \n \tSpan<uint8_t> plane(unsigned int plane);\n \n+\tunsigned int stride(unsigned int plane) const;\n+\tunsigned int offset(unsigned int plane) const;\n+\tunsigned int size(unsigned int plane) const;\n+\n \tsize_t jpegBufferSize(size_t maxJpegBufferSize) const;\n \n private:\n@@ -111,6 +115,21 @@ Span<uint8_t> CameraBuffer::Private::plane(unsigned int plane)\n \t\t bufferManager_->GetPlaneSize(handle_, plane) };\n }\n \n+unsigned int CameraBuffer::Private::stride(unsigned int plane) const\n+{\n+\treturn cros::CameraBufferManager::GetPlaneStride(handle_, plane);\n+}\n+\n+unsigned int CameraBuffer::Private::offset(unsigned int plane) const\n+{\n+\treturn cros::CameraBufferManager::GetPlaneOffset(handle_, plane);\n+}\n+\n+unsigned int CameraBuffer::Private::size(unsigned int plane) const\n+{\n+\treturn cros::CameraBufferManager::GetPlaneSize(handle_, plane);\n+}\n+\n size_t CameraBuffer::Private::jpegBufferSize([[maybe_unused]] size_t maxJpegBufferSize) const\n {\n \treturn bufferManager_->GetPlaneSize(handle_, 0);\ndiff --git a/src/android/mm/generic_camera_buffer.cpp b/src/android/mm/generic_camera_buffer.cpp\nindex cfe55b69..4f0a3207 100644\n--- a/src/android/mm/generic_camera_buffer.cpp\n+++ b/src/android/mm/generic_camera_buffer.cpp\n@@ -34,10 +34,15 @@ public:\n \n \tSpan<uint8_t> plane(unsigned int plane);\n \n+\tunsigned int stride(unsigned int plane) const;\n+\tunsigned int offset(unsigned int plane) const;\n+\tunsigned int size(unsigned int plane) const;\n+\n \tsize_t jpegBufferSize(size_t maxJpegBufferSize) const;\n \n private:\n \tstruct PlaneInfo {\n+\t\tunsigned int stride;\n \t\tunsigned int offset;\n \t\tunsigned int size;\n \t};\n@@ -114,6 +119,7 @@ CameraBuffer::Private::Private([[maybe_unused]] CameraBuffer *cameraBuffer,\n \t\tconst unsigned int planeSize =\n \t\t\tstride * ((size.height + vertSubSample - 1) / vertSubSample);\n \n+\t\tplaneInfo_[i].stride = stride;\n \t\tplaneInfo_[i].offset = offset;\n \t\tplaneInfo_[i].size = planeSize;\n \n@@ -148,6 +154,30 @@ Span<uint8_t> CameraBuffer::Private::plane(unsigned int plane)\n \treturn planes_[plane];\n }\n \n+unsigned int CameraBuffer::Private::stride(unsigned int plane) const\n+{\n+\tif (plane >= planeInfo_.size())\n+\t\treturn 0;\n+\n+\treturn planeInfo_[plane].stride;\n+}\n+\n+unsigned int CameraBuffer::Private::offset(unsigned int plane) const\n+{\n+\tif (plane >= planeInfo_.size())\n+\t\treturn 0;\n+\n+\treturn planeInfo_[plane].offset;\n+}\n+\n+unsigned int CameraBuffer::Private::size(unsigned int plane) const\n+{\n+\tif (plane >= planeInfo_.size())\n+\t\treturn 0;\n+\n+\treturn planeInfo_[plane].size;\n+}\n+\n size_t CameraBuffer::Private::jpegBufferSize(size_t maxJpegBufferSize) const\n {\n \tASSERT(bufferLength_ >= 0);\n", "prefixes": [ "libcamera-devel", "v3", "3/3" ] }