Show a patch.

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

{
    "id": 13304,
    "url": "https://patchwork.libcamera.org/api/patches/13304/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/13304/",
    "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": "<20210811124015.2116188-4-hiroh@chromium.org>",
    "date": "2021-08-11T12:40:13",
    "name": "[libcamera-devel,RFC,3/5] android: camera_device: Fills the size of plane to FrameBuffer::Plane::length",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "2999060ff975f7de1adc66a4e67c3cdd84bad232",
    "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/13304/mbox/",
    "series": [
        {
            "id": 2339,
            "url": "https://patchwork.libcamera.org/api/series/2339/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2339",
            "date": "2021-08-11T12:40:10",
            "name": "MappedFrameBuffer::maps() returns the plane address",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/2339/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/13304/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/13304/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 81698C3240\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 11 Aug 2021 12:40:32 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3B5BD68855;\n\tWed, 11 Aug 2021 14:40:32 +0200 (CEST)",
            "from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com\n\t[IPv6:2607:f8b0:4864:20::62d])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id CD02868887\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 11 Aug 2021 14:40:29 +0200 (CEST)",
            "by mail-pl1-x62d.google.com with SMTP id d17so2496299plr.12\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 11 Aug 2021 05:40:29 -0700 (PDT)",
            "from hiroh2.tok.corp.google.com\n\t([2401:fa00:8f:203:ba11:c25e:242c:485d])\n\tby smtp.gmail.com with ESMTPSA id\n\tp30sm15722876pfh.116.2021.08.11.05.40.26\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 11 Aug 2021 05:40:27 -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=\"K3f0lco7\"; 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=HiIbadVkUYWpBSWximDdu0NkuYjyYDssTrmu7Q5oHf0=;\n\tb=K3f0lco7ifLXjpNIKrcvTI5ecZGaQJr2IfOhEOPUkrMwishWKiPfe6jJb++lNtxDwU\n\tD9DJ+0Qla1hQPb/NnoL8uAHxsa6NhMT6SCE3Shi4EsJxgGKQAOvHHMTEGsn5QhpMBW+B\n\t2l7td3F30QPxFIhhVb2A1ASJ+cxMaeoDrOWmE=",
        "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=HiIbadVkUYWpBSWximDdu0NkuYjyYDssTrmu7Q5oHf0=;\n\tb=s8zOuJcRReWqAyHKRY4BZDnRyXBCFc0nzDqRskgCmEa075DQxz6Uuxm9O0gZ+eVw3m\n\t93Kv8+jqk9KtTefaWQ1haLU9JXtXygUkRFig61GTIfAxRX3HauPSsVWdZF1CP8WhwHJt\n\tRZmyUdzF9Bv7+ipQw0a4BAyo4DDh0xEGI5KqgHm3/us8rRc9hIb/CLG85HGigLgXMj1I\n\tmCIWCgSt+v7sbRyE+NUPiRbudGhGxkr0nhdtU1cFQRcFCZObQLPBVtMufKm6Nv83Tcw5\n\ttzBuIqE8n9AFjLho/F5a0HJ6T38YSzc61vNdBSLwk0GKUQRNrCA7+ITgHp60jXWhqdLA\n\t0Uuw==",
        "X-Gm-Message-State": "AOAM530LqCn3NQL+UTHkgZQ+6RKuiFIuzkdsB3ezKrOM9ZDb034B7iEJ\n\teWkLjfkxkT8wAD3lfiv7yNL6boe7u8c/Lg==",
        "X-Google-Smtp-Source": "ABdhPJw09cPcpvWfcgNWE/onk1Z9GrXuA8x9kpcYNd0xm/CPMwCY8osWxa+T8J58o6BVXCFLRKO7tw==",
        "X-Received": "by 2002:aa7:8b07:0:b029:3c7:c29f:9822 with SMTP id\n\tf7-20020aa78b070000b02903c7c29f9822mr27449149pfd.33.1628685627993; \n\tWed, 11 Aug 2021 05:40:27 -0700 (PDT)",
        "From": "Hirokazu Honda <hiroh@chromium.org>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Wed, 11 Aug 2021 21:40:13 +0900",
        "Message-Id": "<20210811124015.2116188-4-hiroh@chromium.org>",
        "X-Mailer": "git-send-email 2.32.0.605.g8dce9f2422-goog",
        "In-Reply-To": "<20210811124015.2116188-1-hiroh@chromium.org>",
        "References": "<20210811124015.2116188-1-hiroh@chromium.org>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [RFC PATCH 3/5] android: camera_device: Fills the\n\tsize of plane to FrameBuffer::Plane::length",
        "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 fills the size of a buffer to FrameBuffer::Plane::length.\nIt should rather fill the size of a plane to it.\n\nSigned-off-by: Hirokazu Honda <hiroh@chromium.org>\n---\n src/android/camera_device.cpp | 37 +++++++++++++++++++----------------\n 1 file changed, 20 insertions(+), 17 deletions(-)",
    "diff": "diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\nindex a69b687a..f10f27b7 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,31 @@ 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 \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+\tif (!fd.isValid()) {\n+\t\tLOG(HAL, Fatal) << \"No valid fd\";\n+\t\treturn nullptr;\n+\t}\n+\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].length = buf.plane(i).size();\n \t}\n \n \treturn new FrameBuffer(std::move(planes));\n",
    "prefixes": [
        "libcamera-devel",
        "RFC",
        "3/5"
    ]
}