Show a patch.

GET /api/patches/13367/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 13367,
    "url": "https://patchwork.libcamera.org/api/patches/13367/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/13367/",
    "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": "<20210816043138.957984-10-hiroh@chromium.org>",
    "date": "2021-08-16T04:31:37",
    "name": "[libcamera-devel,RFC,09/10] android: camera_device: Fill offset and right length in CreateFrameBuffer()",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "7ca07f7432458cdd88be406ca2c0d1ac95494435",
    "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/13367/mbox/",
    "series": [
        {
            "id": 2359,
            "url": "https://patchwork.libcamera.org/api/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/13367/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/13367/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 D768DC3242\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 16 Aug 2021 04:32:04 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 40C16688AC;\n\tMon, 16 Aug 2021 06:32:04 +0200 (CEST)",
            "from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com\n\t[IPv6:2607:f8b0:4864:20::62e])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 091626888C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 16 Aug 2021 06:32:02 +0200 (CEST)",
            "by mail-pl1-x62e.google.com with SMTP id e19so19380696pla.10\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 15 Aug 2021 21:32:01 -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.58\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tSun, 15 Aug 2021 21:32:00 -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=\"HwligxSW\"; 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=k7D8nd4mpOzgm8wgTT5iNwJlHKvqDfF85/MjYwtrNUU=;\n\tb=HwligxSWkJIAd28VBQvWZj3L1h3GvJDmRrehJHaGTooWWZvwPysO3/CNkQ7DcCZhlK\n\tBYGvxrvDtYetZKnx2mTwGIXUdPMOxOcIogiCkYJtcyskD0CnME7QR9y9Wb3TtksKJL/5\n\t+lZXUdqnlhPnlzqCaDmAwCG3o0nyC8AB46XoQ=",
        "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=k7D8nd4mpOzgm8wgTT5iNwJlHKvqDfF85/MjYwtrNUU=;\n\tb=iRS51KWBuOFusFUOCtaMWFFk9Hy7ptSNy7+UcVMLSSfv3NEpxFmNQLEo0QJlV+ebq4\n\tkhTNTFGeqNMl1N8FvEWGnKQQwyY4o2gx/JAG4i6w7hoYZYn//XStDMPXUdvM4DurYLoP\n\tnIc74UUiytDiREPBqIYXEU6bbVID8pwBlir7UQQ20XC3+bP8l9OmlTQ3JjPK+c2H0HZl\n\tGWvUG3EzbWhrjSppTg/+ikVW3SBWecHZg+eoY/Q8VP6jqZhOwB5ffG4kTsKH4kii75s4\n\tv4tO4qNXmGFkatK8NTVnIUctdkMBV5jnQ8io6L0MgTwV86whDQTYrmOjLce/O8w2Wluq\n\tQp5w==",
        "X-Gm-Message-State": "AOAM533rW19a4DYwcXfWl+IdhB97KZyvvsmU2xJcMrLu7gCDwC39Z4fm\n\tyHZOhWLEvRUTy/4QVJbpu96cAOkAMnRA8A==",
        "X-Google-Smtp-Source": "ABdhPJxEcr1S2Co9CSoFFvGgycT5moyngyr1H2O0cAY98XcmAzSCkhq3SqLY9HsIlAwrfQ57kU8f+g==",
        "X-Received": "by 2002:a17:90a:9b0b:: with SMTP id\n\tf11mr15062593pjp.120.1629088320411; \n\tSun, 15 Aug 2021 21:32:00 -0700 (PDT)",
        "From": "Hirokazu Honda <hiroh@chromium.org>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Mon, 16 Aug 2021 13:31:37 +0900",
        "Message-Id": "<20210816043138.957984-10-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 09/10] android: camera_device: Fill\n\toffset and right length in CreateFrameBuffer()",
        "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": "CameraDevice::CreateFrameBuffer() fills the length of the buffer to\neach FrameBuffer::Plane::length. It should rather be the length of\nplane. This also changes CreateFrameBuffer() to fill offset of\nFrameBuffer::Plane.\n\nSigned-off-by: Hirokazu Honda <hiroh@chromium.org>\n---\n src/android/camera_device.cpp | 38 ++++++++++++++++++-----------------\n 1 file changed, 20 insertions(+), 18 deletions(-)",
    "diff": "diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\nindex a69b687a..1ded5cb1 100644\n--- a/src/android/camera_device.cpp\n+++ b/src/android/camera_device.cpp\n@@ -12,6 +12,7 @@\n \n #include <algorithm>\n #include <fstream>\n+#include <sys/mman.h>\n #include <unistd.h>\n #include <vector>\n \n@@ -746,29 +747,30 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)\n \n FrameBuffer *CameraDevice::createFrameBuffer(const buffer_handle_t camera3buffer)\n {\n-\tstd::vector<FrameBuffer::Plane> planes;\n+\tFileDescriptor fd;\n+\t/* This assumes all the planes are in the same buffer. */\n \tfor (int i = 0; i < camera3buffer->numFds; i++) {\n-\t\t/* Skip unused planes. */\n-\t\tif (camera3buffer->data[i] == -1)\n+\t\tif (camera3buffer->data[i] != -1) {\n+\t\t\tfd = FileDescriptor(camera3buffer->data[i]);\n \t\t\tbreak;\n-\n-\t\tFrameBuffer::Plane plane;\n-\t\tplane.fd = FileDescriptor(camera3buffer->data[i]);\n-\t\tif (!plane.fd.isValid()) {\n-\t\t\tLOG(HAL, Error) << \"Failed to obtain FileDescriptor (\"\n-\t\t\t\t\t<< camera3buffer->data[i] << \") \"\n-\t\t\t\t\t<< \" on plane \" << i;\n-\t\t\treturn nullptr;\n \t\t}\n+\t}\n+\tif (!fd.isValid()) {\n+\t\tLOG(HAL, Fatal) << \"No valid fd\";\n+\t\treturn nullptr;\n+\t}\n \n-\t\toff_t length = lseek(plane.fd.fd(), 0, SEEK_END);\n-\t\tif (length == -1) {\n-\t\t\tLOG(HAL, Error) << \"Failed to query plane length\";\n-\t\t\treturn nullptr;\n-\t\t}\n+\tCameraBuffer buf(camera3buffer, PROT_READ);\n+\tif (!buf.isValid()) {\n+\t\tLOG(HAL, Fatal) << \"Failed mapping buffer\";\n+\t\treturn nullptr;\n+\t}\n \n-\t\tplane.length = length;\n-\t\tplanes.push_back(std::move(plane));\n+\tstd::vector<FrameBuffer::Plane> planes(buf.numPlanes());\n+\tfor (size_t i = 0; i < buf.numPlanes(); ++i) {\n+\t\tplanes[i].fd = fd;\n+\t\tplanes[i].offset = buf.plane(i).data() - buf.plane(0).data();\n+\t\tplanes[i].length = buf.plane(i).size();\n \t}\n \n \treturn new FrameBuffer(std::move(planes));\n",
    "prefixes": [
        "libcamera-devel",
        "RFC",
        "09/10"
    ]
}