Show a patch.

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

{
    "id": 8664,
    "url": "https://patchwork.libcamera.org/api/patches/8664/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/8664/",
    "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": "<20200706230240.2482100-5-kieran.bingham@ideasonboard.com>",
    "date": "2020-07-06T23:02:36",
    "name": "[libcamera-devel,v5,4/8] android: camera_device: Simplify FrameBuffer construction from a buffer_handle_t",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "4a74969bb15b507bb06d997dbb4a750fa19cd96b",
    "submitter": {
        "id": 4,
        "url": "https://patchwork.libcamera.org/api/people/4/?format=api",
        "name": "Kieran Bingham",
        "email": "kieran.bingham@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/8664/mbox/",
    "series": [
        {
            "id": 1089,
            "url": "https://patchwork.libcamera.org/api/series/1089/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1089",
            "date": "2020-07-06T23:02:32",
            "name": "android: Multi-stream support",
            "version": 5,
            "mbox": "https://patchwork.libcamera.org/series/1089/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/8664/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/8664/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 E8DB9BD792\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  6 Jul 2020 23:02:50 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 95E9B60E8D;\n\tTue,  7 Jul 2020 01:02:50 +0200 (CEST)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id DC15160E0D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  7 Jul 2020 01:02:47 +0200 (CEST)",
            "from Q.local (cpc89242-aztw30-2-0-cust488.18-1.cable.virginm.net\n\t[86.31.129.233])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 68587D6E;\n\tTue,  7 Jul 2020 01:02:47 +0200 (CEST)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"GXo0ylAJ\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1594076567;\n\tbh=FIgZ7tdHmAgZPdqa+5fkin4TBMksUd11jEpciokXp24=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=GXo0ylAJsBaHH3nBuQ5ZudqlDSxlynZwRmNsvF1my1GyhvJuaAKkzW66WZU+O9Nae\n\t9Pl5WVeFPmcDRjtbqhhkYMiNTUdf2M0y4UYw1uMuOgx1NRT4zHQYYgAxDy8hi67AWs\n\t8pkWMxv0v5oOa71Qmrbro+ZXtEkBXYgY0ATfPn70=",
        "From": "Kieran Bingham <kieran.bingham@ideasonboard.com>",
        "To": "libcamera devel <libcamera-devel@lists.libcamera.org>",
        "Date": "Tue,  7 Jul 2020 00:02:36 +0100",
        "Message-Id": "<20200706230240.2482100-5-kieran.bingham@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20200706230240.2482100-1-kieran.bingham@ideasonboard.com>",
        "References": "<20200706230240.2482100-1-kieran.bingham@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Subject": "[libcamera-devel] [PATCH v5 4/8] android: camera_device: Simplify\n\tFrameBuffer construction from a buffer_handle_t",
        "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>",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "Move the code which constructs a FrameBuffer from the Android buffer handle\nto it's own function to simplify the code flow and readability.\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/android/camera_device.cpp | 35 +++++++++++++++++++----------------\n src/android/camera_device.h   |  1 +\n 2 files changed, 20 insertions(+), 16 deletions(-)",
    "diff": "diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\nindex 03dcdd520794..73cfab532cf5 100644\n--- a/src/android/camera_device.cpp\n+++ b/src/android/camera_device.cpp\n@@ -1011,6 +1011,24 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)\n \treturn 0;\n }\n \n+FrameBuffer *CameraDevice::createFrameBuffer(const buffer_handle_t camera3buffer)\n+{\n+\tstd::vector<FrameBuffer::Plane> planes;\n+\tfor (unsigned int i = 0; i < 3; i++) {\n+\t\tFrameBuffer::Plane plane;\n+\t\tplane.fd = FileDescriptor(camera3buffer->data[i]);\n+\t\t/*\n+\t\t * Setting length to zero here is OK as the length is only used\n+\t\t * to map the memory of the plane. Libcamera do not need to poke\n+\t\t * at the memory content queued by the HAL.\n+\t\t */\n+\t\tplane.length = 0;\n+\t\tplanes.push_back(std::move(plane));\n+\t}\n+\n+\treturn new FrameBuffer(std::move(planes));\n+}\n+\n int CameraDevice::processCaptureRequest(camera3_capture_request_t *camera3Request)\n {\n \tStreamConfiguration *streamConfiguration = &config_->at(0);\n@@ -1064,22 +1082,7 @@ int CameraDevice::processCaptureRequest(camera3_capture_request_t *camera3Reques\n \t * Create a libcamera buffer using the dmabuf descriptors of the first\n \t * and (currently) only supported request buffer.\n \t */\n-\tconst buffer_handle_t camera3Handle = *camera3Buffers[0].buffer;\n-\n-\tstd::vector<FrameBuffer::Plane> planes;\n-\tfor (int i = 0; i < 3; i++) {\n-\t\tFrameBuffer::Plane plane;\n-\t\tplane.fd = FileDescriptor(camera3Handle->data[i]);\n-\t\t/*\n-\t\t * Setting length to zero here is OK as the length is only used\n-\t\t * to map the memory of the plane. Libcamera do not need to poke\n-\t\t * at the memory content queued by the HAL.\n-\t\t */\n-\t\tplane.length = 0;\n-\t\tplanes.push_back(std::move(plane));\n-\t}\n-\n-\tFrameBuffer *buffer = new FrameBuffer(std::move(planes));\n+\tFrameBuffer *buffer = createFrameBuffer(*camera3Buffers[0].buffer);\n \tif (!buffer) {\n \t\tLOG(HAL, Error) << \"Failed to create buffer\";\n \t\tdelete descriptor;\ndiff --git a/src/android/camera_device.h b/src/android/camera_device.h\nindex 5bd6cf416156..d7834d94f439 100644\n--- a/src/android/camera_device.h\n+++ b/src/android/camera_device.h\n@@ -70,6 +70,7 @@ private:\n \n \tint initializeStreamConfigurations();\n \tstd::tuple<uint32_t, uint32_t> calculateStaticMetadataSize();\n+\tlibcamera::FrameBuffer *createFrameBuffer(const buffer_handle_t camera3buffer);\n \tvoid notifyShutter(uint32_t frameNumber, uint64_t timestamp);\n \tvoid notifyError(uint32_t frameNumber, camera3_stream_t *stream);\n \tlibcamera::PixelFormat toPixelFormat(int format);\n",
    "prefixes": [
        "libcamera-devel",
        "v5",
        "4/8"
    ]
}