Show a patch.

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

{
    "id": 11503,
    "url": "https://patchwork.libcamera.org/api/patches/11503/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/11503/",
    "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": "<20210305115628.19811-1-laurent.pinchart@ideasonboard.com>",
    "date": "2021-03-05T11:56:28",
    "name": "[libcamera-devel] android: camera_device: Update gralloc usage flags for streams",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "72523165f1cad79c435e3356a8fe5d3d14e6259b",
    "submitter": {
        "id": 2,
        "url": "https://patchwork.libcamera.org/api/people/2/?format=api",
        "name": "Laurent Pinchart",
        "email": "laurent.pinchart@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/11503/mbox/",
    "series": [
        {
            "id": 1764,
            "url": "https://patchwork.libcamera.org/api/series/1764/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1764",
            "date": "2021-03-05T11:56:28",
            "name": "[libcamera-devel] android: camera_device: Update gralloc usage flags for streams",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/1764/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/11503/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/11503/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 A5FFABD1F1\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  5 Mar 2021 11:57:04 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1436868A69;\n\tFri,  5 Mar 2021 12:57:04 +0100 (CET)",
            "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 27690602EC\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  5 Mar 2021 12:57:02 +0100 (CET)",
            "from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 87914CC;\n\tFri,  5 Mar 2021 12:57:01 +0100 (CET)"
        ],
        "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=\"vRWCeIJb\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1614945421;\n\tbh=FpcdAOHgzdSvKYleEcBulohexki2r86kVdZAKkPrBK8=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=vRWCeIJb28IAJQe0e4UwNBoNzwfrRzWvq0nCoLADUZnRNCbbMYPm+UnROJUXnGB8/\n\t/NS1S2bvsZBNgBJq4jEoSLiEuUPNN3Te95vi4GjtTwfZl1JV2Hhc6E9zwT1ohlsMKX\n\tTp3K4LK+8BvGC8w0OhUoHdcr6bAFV03sBQ/mBioE=",
        "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Fri,  5 Mar 2021 13:56:28 +0200",
        "Message-Id": "<20210305115628.19811-1-laurent.pinchart@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.28.0",
        "MIME-Version": "1.0",
        "Subject": "[libcamera-devel] [PATCH] android: camera_device: Update gralloc\n\tusage flags for streams",
        "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": "When configuring streams, the camera HAL is supposed to update the\ngralloc usage flags to reflect the operations it will need to do on the\nstream buffers. Failure to do so leads to incorrect format selection by\ngralloc for the HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED format, as\ngralloc will not take into consideration the need of the camera to\naccess the buffers.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/android/camera_device.cpp | 16 +++++++++++++++-\n 1 file changed, 15 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\nindex ae01c362559e..3ee683705d00 100644\n--- a/src/android/camera_device.cpp\n+++ b/src/android/camera_device.cpp\n@@ -1539,6 +1539,9 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)\n \t\tstreamConfig.config.size = size;\n \t\tstreamConfig.config.pixelFormat = format;\n \t\tstreamConfigs.push_back(std::move(streamConfig));\n+\n+\t\t/* This stream will be produced by hardware. */\n+\t\tstream->usage |= GRALLOC_USAGE_HW_CAMERA_WRITE;\n \t}\n \n \t/* Now handle the MJPEG streams, adding a new stream if required. */\n@@ -1548,7 +1551,8 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)\n \n \t\t/* Search for a compatible stream in the non-JPEG ones. */\n \t\tfor (size_t i = 0; i < streamConfigs.size(); ++i) {\n-\t\t\tconst auto &cfg = streamConfigs[i].config;\n+\t\t\tCamera3StreamConfig &streamConfig = streamConfigs[i];\n+\t\t\tconst auto &cfg = streamConfig.config;\n \n \t\t\t/*\n \t\t\t * \\todo The PixelFormat must also be compatible with\n@@ -1563,6 +1567,13 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)\n \n \t\t\ttype = CameraStream::Type::Mapped;\n \t\t\tindex = i;\n+\n+\t\t\t/*\n+\t\t\t * The source stream will be read by software to\n+\t\t\t * produce the JPEG stream.\n+\t\t\t */\n+\t\t\tcamera3_stream_t *stream = streamConfig.streams[0].stream;\n+\t\t\tstream->usage |= GRALLOC_USAGE_SW_READ_OFTEN;\n \t\t\tbreak;\n \t\t}\n \n@@ -1590,6 +1601,9 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)\n \t\t\tindex = streamConfigs.size() - 1;\n \t\t}\n \n+\t\t/* The JPEG stream will be produced by software. */\n+\t\tjpegStream->usage |= GRALLOC_USAGE_SW_WRITE_OFTEN;\n+\n \t\tstreamConfigs[index].streams.push_back({ jpegStream, type });\n \t}\n \n",
    "prefixes": [
        "libcamera-devel"
    ]
}