Show a patch.

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

{
    "id": 8663,
    "url": "https://patchwork.libcamera.org/api/patches/8663/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/8663/",
    "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-4-kieran.bingham@ideasonboard.com>",
    "date": "2020-07-06T23:02:35",
    "name": "[libcamera-devel,v5,3/8] android: camera_device: Support multiple stream configurations",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "201d56f8f788fd08b0c2b8111f5a38b4b8b444cb",
    "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/8663/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/8663/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/8663/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 6FEFEBD792\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 2E011603AD;\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 7F731603AD\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 BA9D0AC6;\n\tTue,  7 Jul 2020 01:02:46 +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=\"B1Mk8mUH\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1594076567;\n\tbh=Ptc5zwAay6Z3ejmiQwbWhpduyqCOONZtcScINP8ZE9Y=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=B1Mk8mUHAdOmqrH5B/HW1IwIAbDpxrIPUmuOwi0ocQz+lWb+yR0lgURe3+nuxX6ZH\n\txOWgiYJzYQg2ERZ1HHyI66CLJHZ2rypE3YsiIQVUhdiXicWKWdi81pThXH1iVapxZK\n\tMIoUyUqnDLEj6YvrnoKmxZEJ8Rj5qpTWRfcevzRI=",
        "From": "Kieran Bingham <kieran.bingham@ideasonboard.com>",
        "To": "libcamera devel <libcamera-devel@lists.libcamera.org>",
        "Date": "Tue,  7 Jul 2020 00:02:35 +0100",
        "Message-Id": "<20200706230240.2482100-4-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 3/8] android: camera_device: Support\n\tmultiple stream configurations",
        "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=\"utf-8\"",
        "Content-Transfer-Encoding": "base64",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "Create an initial Camera Configuration using an empty role set, and\npopulate the StreamConfigurations manually from each of the streams\ngiven by the Android camera3_stream_configuration_t stream_list.\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/android/camera_device.cpp | 51 +++++++++++++++++------------------\n 1 file changed, 25 insertions(+), 26 deletions(-)",
    "diff": "diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\nindex b9031ff0c2a4..03dcdd520794 100644\n--- a/src/android/camera_device.cpp\n+++ b/src/android/camera_device.cpp\n@@ -942,6 +942,16 @@ PixelFormat CameraDevice::toPixelFormat(int format)\n  */\n int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)\n {\n+\t/*\n+\t * Generate an empty configuration, and construct a StreamConfiguration\n+\t * for each camera3_stream to add to it.\n+\t */\n+\tconfig_ = camera_->generateConfiguration();\n+\tif (!config_) {\n+\t\tLOG(HAL, Error) << \"Failed to generate camera configuration\";\n+\t\treturn -EINVAL;\n+\t}\n+\n \tfor (unsigned int i = 0; i < stream_list->num_streams; ++i) {\n \t\tcamera3_stream_t *stream = stream_list->streams[i];\n \n@@ -953,35 +963,18 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)\n \t\t\t       << \", height: \" << stream->height\n \t\t\t       << \", format: \" << utils::hex(stream->format)\n \t\t\t       << \" (\" << format.toString() << \")\";\n-\t}\n \n-\t/* Only one stream is supported. */\n-\tif (stream_list->num_streams != 1) {\n-\t\tLOG(HAL, Error) << \"Only one stream supported\";\n-\t\treturn -EINVAL;\n-\t}\n-\tcamera3_stream_t *camera3Stream = stream_list->streams[0];\n+\t\tif (!format.isValid())\n+\t\t\treturn -EINVAL;\n \n-\t/* Translate Android format code to libcamera pixel format. */\n-\tPixelFormat format = toPixelFormat(camera3Stream->format);\n-\tif (!format.isValid())\n-\t\treturn -EINVAL;\n+\t\tStreamConfiguration streamConfiguration;\n \n-\t/*\n-\t * Hardcode viewfinder role, replacing the generated configuration\n-\t * parameters with the ones requested by the Android framework.\n-\t */\n-\tStreamRoles roles = { StreamRole::Viewfinder };\n-\tconfig_ = camera_->generateConfiguration(roles);\n-\tif (!config_ || config_->empty()) {\n-\t\tLOG(HAL, Error) << \"Failed to generate camera configuration\";\n-\t\treturn -EINVAL;\n-\t}\n+\t\tstreamConfiguration.size.width = stream->width;\n+\t\tstreamConfiguration.size.height = stream->height;\n+\t\tstreamConfiguration.pixelFormat = format;\n \n-\tStreamConfiguration *streamConfiguration = &config_->at(0);\n-\tstreamConfiguration->size.width = camera3Stream->width;\n-\tstreamConfiguration->size.height = camera3Stream->height;\n-\tstreamConfiguration->pixelFormat = format;\n+\t\tconfig_->addConfiguration(streamConfiguration);\n+\t}\n \n \tswitch (config_->validate()) {\n \tcase CameraConfiguration::Valid:\n@@ -996,7 +989,13 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)\n \t\treturn -EINVAL;\n \t}\n \n-\tcamera3Stream->max_buffers = streamConfiguration->bufferCount;\n+\tfor (unsigned int i = 0; i < stream_list->num_streams; ++i) {\n+\t\tcamera3_stream_t *stream = stream_list->streams[i];\n+\t\tStreamConfiguration &streamConfiguration = config_->at(i);\n+\n+\t\t/* Use the bufferCount confirmed by the validation process. */\n+\t\tstream->max_buffers = streamConfiguration.bufferCount;\n+\t}\n \n \t/*\n \t * Once the CameraConfiguration has been adjusted/validated\n",
    "prefixes": [
        "libcamera-devel",
        "v5",
        "3/8"
    ]
}