Patch Detail
Show a patch.
GET /api/1.1/patches/13366/?format=api
{ "id": 13366, "url": "https://patchwork.libcamera.org/api/1.1/patches/13366/?format=api", "web_url": "https://patchwork.libcamera.org/patch/13366/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/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": "<20210816043138.957984-9-hiroh@chromium.org>", "date": "2021-08-16T04:31:36", "name": "[libcamera-devel,RFC,08/10] libcamera: v4l2_videodevice: Create color-format planes in CreateBuffer()", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "b4901408c7d7e1f416c2c680ab1d2dfae3541eb7", "submitter": { "id": 63, "url": "https://patchwork.libcamera.org/api/1.1/people/63/?format=api", "name": "Hirokazu Honda", "email": "hiroh@chromium.org" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/13366/mbox/", "series": [ { "id": 2359, "url": "https://patchwork.libcamera.org/api/1.1/series/2359/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2359", "date": "2021-08-16T04:31:28", "name": "Add offset to FrameBuffer::Plane", "version": 1, "mbox": "https://patchwork.libcamera.org/series/2359/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/13366/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/13366/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 1270AC3241\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 16 Aug 2021 04:32:03 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id CFC13688A2;\n\tMon, 16 Aug 2021 06:32:02 +0200 (CEST)", "from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com\n\t[IPv6:2607:f8b0:4864:20::102d])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6DA5D6888A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 16 Aug 2021 06:32:00 +0200 (CEST)", "by mail-pj1-x102d.google.com with SMTP id\n\tu21-20020a17090a8915b02901782c36f543so30382725pjn.4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 15 Aug 2021 21:32:00 -0700 (PDT)", "from hiroh2.tok.corp.google.com\n\t([2401:fa00:8f:203:6f5f:1479:a6ab:4229])\n\tby smtp.gmail.com with ESMTPSA id\n\tu10sm2767417pgj.48.2021.08.15.21.31.57\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tSun, 15 Aug 2021 21:31:58 -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=\"Ai1Ghl5X\"; 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=FsWpdqKw6TMEtZZ057bMVlcaK+oi5l0g77pu+9nPVwU=;\n\tb=Ai1Ghl5XvjCssy3QWXHJOeWM06Eas8kttZenRR+pYIoEjr9JRfsZbB7IM0OzNcRCMz\n\txpg94cTxkyaFWUqthxVR9w6q9UB19LKRGstFZdKFGDrPAG9DlU6ghGDVSjaIbMdK3cM6\n\tPeNOIsaMPjn3FIL9wwkCqF7dIRDYBK8rLeYRQ=", "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=FsWpdqKw6TMEtZZ057bMVlcaK+oi5l0g77pu+9nPVwU=;\n\tb=cNDVOByA/utEBEhXUUQf9NeKs05m/+lskFQyxLbBqbu1t50LLDCjrzWFGEp973hlNy\n\tDUwxA0XknN50y29tNMSTL4dQNajemWwKTSIpEU3GTAEc+SMRCwJBltwThAyO8y4Z7oHi\n\t0rK1U499wsxS0GHtSqTTcTMNZFx6rc+lqi42k9XuGfOH0SpnT4q2QIDpmdGHmvCyI+qs\n\t9S3vtxND7hC1nd8Ku6szIXqOEbGOeSmUckQ5F5BwIipiWHRgGgqDEbxsvR7pAkX+dxee\n\tV54l3ISgRMmGeiA6ov73JQv5rvJVZNHTENtDvaxk2V+Kgt+KaUDC2qVmllnl7PzSXFPS\n\tkZuw==", "X-Gm-Message-State": "AOAM53099oIOgri0HGEShJPAVwELFjaS9If9skW/Xr65LgmROnFa/w6l\n\t9KxQP+RmLd0FhsGU7ypFaIuSoPLb0gx3fQ==", "X-Google-Smtp-Source": "ABdhPJx1c/GOOfJm7hI5owshTMQpqTBNXpoTZ49tcfzYTJBURoM8VRt9fb+FpTIr+wzYv+800wJ9eg==", "X-Received": "by 2002:a17:902:b095:b029:12c:de88:7d3b with SMTP id\n\tp21-20020a170902b095b029012cde887d3bmr11629356plr.15.1629088318684; \n\tSun, 15 Aug 2021 21:31:58 -0700 (PDT)", "From": "Hirokazu Honda <hiroh@chromium.org>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Mon, 16 Aug 2021 13:31:36 +0900", "Message-Id": "<20210816043138.957984-9-hiroh@chromium.org>", "X-Mailer": "git-send-email 2.33.0.rc1.237.g0d66db33f3-goog", "In-Reply-To": "<20210816043138.957984-1-hiroh@chromium.org>", "References": "<20210816043138.957984-1-hiroh@chromium.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [RFC PATCH 08/10] libcamera: v4l2_videodevice:\n\tCreate color-format planes in CreateBuffer()", "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": "V4L2VideDevice::CreateBuffer() creates the same number of\nFrameBuffer::Planes as V4L2 format planes. Therefore, if the v4l2\nformat single is single-planar format, the created number of\nFrameBuffer::Planes is 1.\nIt should rather create the same number of FrameBuffer::Planes as the\ncolor format planes.\n\nSigned-off-by: Hirokazu Honda <hiroh@chromium.org>\n---\n include/libcamera/internal/v4l2_videodevice.h | 4 ++-\n src/libcamera/v4l2_videodevice.cpp | 28 +++++++++++++++++--\n 2 files changed, 29 insertions(+), 3 deletions(-)", "diff": "diff --git a/include/libcamera/internal/v4l2_videodevice.h b/include/libcamera/internal/v4l2_videodevice.h\nindex e767ec84..d0aeb614 100644\n--- a/include/libcamera/internal/v4l2_videodevice.h\n+++ b/include/libcamera/internal/v4l2_videodevice.h\n@@ -136,11 +136,13 @@ private:\n \tprivate:\n \t\tstruct Plane {\n \t\t\tPlane(const FrameBuffer::Plane &plane)\n-\t\t\t\t: fd(plane.fd.fd()), length(plane.length)\n+\t\t\t\t: fd(plane.fd.fd()), offset(plane.offset),\n+\t\t\t\t length(plane.length)\n \t\t\t{\n \t\t\t}\n \n \t\t\tint fd;\n+\t\t\tunsigned int offset;\n \t\t\tunsigned int length;\n \t\t};\n \ndiff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp\nindex ce60dff6..549418c8 100644\n--- a/src/libcamera/v4l2_videodevice.cpp\n+++ b/src/libcamera/v4l2_videodevice.cpp\n@@ -25,6 +25,7 @@\n \n #include <libcamera/file_descriptor.h>\n \n+#include \"libcamera/internal/formats.h\"\n #include \"libcamera/internal/media_device.h\"\n #include \"libcamera/internal/media_object.h\"\n \n@@ -273,6 +274,7 @@ bool V4L2BufferCache::Entry::operator==(const FrameBuffer &buffer) const\n \n \tfor (unsigned int i = 0; i < planes.size(); i++)\n \t\tif (planes_[i].fd != planes[i].fd.fd() ||\n+\t\t planes_[i].offset != planes_[i].offset ||\n \t\t planes_[i].length != planes[i].length)\n \t\t\treturn false;\n \treturn true;\n@@ -1283,12 +1285,34 @@ std::unique_ptr<FrameBuffer> V4L2VideoDevice::createBuffer(unsigned int index)\n \n \t\tFrameBuffer::Plane plane;\n \t\tplane.fd = std::move(fd);\n-\t\tplane.length = multiPlanar ?\n-\t\t\tbuf.m.planes[nplane].length : buf.length;\n+\t\tplane.offset = multiPlanar ? buf.m.planes[nplane].data_offset : 0;\n+\t\tplane.length = multiPlanar ? buf.m.planes[nplane].length : buf.length;\n \n \t\tplanes.push_back(std::move(plane));\n \t}\n \n+\tV4L2DeviceFormat format{};\n+\tret = getFormat(&format);\n+\tif (ret < 0) {\n+\t\tLOG(V4L2, Error)\n+\t\t\t<< \"Failed to get format: \" << strerror(-ret);\n+\t\treturn nullptr;\n+\t}\n+\n+\tconst auto &info = PixelFormatInfo::info(format.fourcc);\n+\tif (info.isValid() && info.numPlanes() != numPlanes) {\n+\t\tASSERT(numPlanes == 1u);\n+\t\tplanes.resize(info.numPlanes());\n+\t\tconst FileDescriptor &fd = planes[0].fd;\n+\t\tsize_t offset = 0;\n+\t\tfor (size_t i = 0; i < info.numPlanes(); ++i) {\n+\t\t\tplanes[i].fd = fd;\n+\t\t\tplanes[i].offset = offset;\n+\t\t\tplanes[i].length = info.frameSize(format.size);\n+\t\t\toffset += planes[i].length;\n+\t\t}\n+\t}\n+\n \treturn std::make_unique<FrameBuffer>(std::move(planes));\n }\n \n", "prefixes": [ "libcamera-devel", "RFC", "08/10" ] }