Show a patch.

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

{
    "id": 8514,
    "url": "https://patchwork.libcamera.org/api/patches/8514/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/8514/",
    "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": "<20200629163916.1815321-5-kieran.bingham@ideasonboard.com>",
    "date": "2020-06-29T16:39:16",
    "name": "[libcamera-devel,4/4] android: camera_device: support multiple stream configurations",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "cce6ffe2ef563b766464a633e5e3a6168d155a1a",
    "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/8514/mbox/",
    "series": [
        {
            "id": 1060,
            "url": "https://patchwork.libcamera.org/api/series/1060/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1060",
            "date": "2020-06-29T16:39:12",
            "name": "Android HAL multi-stream support",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/1060/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/8514/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/8514/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 C423EBFFE2\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 29 Jun 2020 16:39:26 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8B9E360AFF;\n\tMon, 29 Jun 2020 18:39:26 +0200 (CEST)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id CF9C6609DB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 29 Jun 2020 18:39:21 +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 69AC3734;\n\tMon, 29 Jun 2020 18:39:21 +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=\"M3qo4M/b\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1593448761;\n\tbh=2diS92rUVzZmaoS2xhsb+2exXlUEV3EBcAhvWMDMEEs=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=M3qo4M/b8uKaENRl3irwHmKgizEd3qyWxn6s56Vb9+kxQzqM5BPSvnNgCCqYwBSOa\n\tsB9uBPaALonlnE7OXHjVR0Peqp0ttXZd+b0mhTuvgH9yZEgKwKK2Jmv0e5wL3ipk1i\n\trrXWoBUpdyCHQrBChhau+2uieLGmrqJfdOa+45p8=",
        "From": "Kieran Bingham <kieran.bingham@ideasonboard.com>",
        "To": "libcamera devel <libcamera-devel@lists.libcamera.org>",
        "Date": "Mon, 29 Jun 2020 17:39:16 +0100",
        "Message-Id": "<20200629163916.1815321-5-kieran.bingham@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20200629163916.1815321-1-kieran.bingham@ideasonboard.com>",
        "References": "<20200629163916.1815321-1-kieran.bingham@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Subject": "[libcamera-devel] [PATCH 4/4] 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=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "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>\n---\n src/android/camera_device.cpp | 72 ++++++++++++++++++-----------------\n 1 file changed, 38 insertions(+), 34 deletions(-)",
    "diff": "diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\nindex a6410f42fee8..568ba28067d0 100644\n--- a/src/android/camera_device.cpp\n+++ b/src/android/camera_device.cpp\n@@ -956,48 +956,52 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)\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-\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-\n \t/*\n-\t * Hardcode viewfinder role, replacing the generated configuration\n-\t * parameters with the ones requested by the Android framework.\n+\t * Generate an empty configuration, and construct a StreamConfiguration\n+\t * for each camera3_stream to add to it.\n \t */\n-\tStreamRoles roles = { StreamRole::Viewfinder };\n-\tconfig_ = camera_->generateConfiguration(roles);\n-\tif (!config_ || config_->empty()) {\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-\tStreamConfiguration *streamConfiguration = &config_->at(0);\n-\tstreamConfiguration->size.width = camera3Stream->width;\n-\tstreamConfiguration->size.height = camera3Stream->height;\n-\tstreamConfiguration->pixelFormat = format;\n+\tfor (unsigned int i = 0; i < stream_list->num_streams; ++i) {\n+\t\tcamera3_stream_t *stream = stream_list->streams[i];\n \n-\tswitch (config_->validate()) {\n-\tcase CameraConfiguration::Valid:\n-\t\tbreak;\n-\tcase CameraConfiguration::Adjusted:\n-\t\tLOG(HAL, Info) << \"Camera configuration adjusted\";\n-\t\tconfig_.reset();\n-\t\treturn -EINVAL;\n-\tcase CameraConfiguration::Invalid:\n-\t\tLOG(HAL, Info) << \"Camera configuration invalid\";\n-\t\tconfig_.reset();\n-\t\treturn -EINVAL;\n-\t}\n+\t\tPixelFormat format = toPixelFormat(stream->format);\n+\t\tif (!format.isValid())\n+\t\t\treturn -EINVAL;\n+\n+\t\tStreamConfiguration streamConfiguration;\n+\n+\t\tstreamConfiguration.size.width = stream->width;\n+\t\tstreamConfiguration.size.height = stream->height;\n+\t\tstreamConfiguration.pixelFormat = format;\n+\n+\t\tStreamConfiguration &cfg = config_->addConfiguration(streamConfiguration);\n+\n+\t\t/* 'cfg' can be modifed during the validation process */\n+\t\tCameraConfiguration::Status status = config_->validate();\n+\n+\t\tLOG(HAL, Info) << \"Stream #\" << i << \" (validated): \" << cfg.toString();\n \n-\tcamera3Stream->max_buffers = streamConfiguration->bufferCount;\n+\t\tswitch (status) {\n+\t\tcase CameraConfiguration::Valid:\n+\t\t\tbreak;\n+\t\tcase CameraConfiguration::Adjusted:\n+\t\t\tLOG(HAL, Info) << \"Camera configuration adjusted\";\n+\t\t\tconfig_.reset();\n+\t\t\treturn -EINVAL;\n+\t\tcase CameraConfiguration::Invalid:\n+\t\t\tLOG(HAL, Info) << \"Camera configuration invalid\";\n+\t\t\tconfig_.reset();\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\n+\t\t/* Use the bufferCount confirmed by the validation process. */\n+\t\tstream->max_buffers = cfg.bufferCount;\n+\t}\n \n \t/*\n \t * Once the CameraConfiguration has been adjusted/validated\n",
    "prefixes": [
        "libcamera-devel",
        "4/4"
    ]
}