Show a patch.

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

{
    "id": 13407,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/13407/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/13407/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/1.1/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": "<20210819201214.1554322-4-hiroh@chromium.org>",
    "date": "2021-08-19T20:12:14",
    "name": "[libcamera-devel,v2,3/3] android: camera_device: Configure one stream for identical stream requests",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "76be107533379d93b150698fda58827d315d82b8",
    "submitter": {
        "id": 63,
        "url": "https://patchwork.libcamera.org/api/1.1/people/63/?format=api",
        "name": "Hirokazu Honda",
        "email": "hiroh@chromium.org"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/13407/mbox/",
    "series": [
        {
            "id": 2373,
            "url": "https://patchwork.libcamera.org/api/1.1/series/2373/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2373",
            "date": "2021-08-19T20:12:11",
            "name": "android: Request one stream for identica stream requests",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/2373/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/13407/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/13407/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 53C5BBD87C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 19 Aug 2021 20:12:30 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0E492688A2;\n\tThu, 19 Aug 2021 22:12:30 +0200 (CEST)",
            "from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com\n\t[IPv6:2607:f8b0:4864:20::52f])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 150D368895\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 19 Aug 2021 22:12:29 +0200 (CEST)",
            "by mail-pg1-x52f.google.com with SMTP id o2so6954383pgr.9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 19 Aug 2021 13:12:29 -0700 (PDT)",
            "from hiroh2.tok.corp.google.com\n\t([2401:fa00:8f:203:4298:71ae:6ebb:72eb])\n\tby smtp.gmail.com with ESMTPSA id\n\ti11sm4303695pfo.29.2021.08.19.13.12.25\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 19 Aug 2021 13:12:26 -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=\"HiZKte1X\"; 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=qt28LBirf9ReQ6Me/Hn5otA8Z0Hc0euI0EXahyjtYfo=;\n\tb=HiZKte1XRurdXyBXvVbZmhoNn51q+dLRhOY7UGCG3aPpEinOU0Cab/uxph0UQNgsH5\n\txNFw7aP3bnZho1o5RRwUfxJ2PehXgJlTiImlADMgOrDwsHJbx9lEKOoHqIUJ3EzQbnEG\n\tRlN5XHyvrLgroYknbr4D4XSvi/mOBoCgBGzIk=",
        "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=qt28LBirf9ReQ6Me/Hn5otA8Z0Hc0euI0EXahyjtYfo=;\n\tb=nC5icHV3zmeIbAaiBiyGhzrzLI8aHje0zLCgPROgaE2yuLT6Cdw/Lqqd4vFYFCga4c\n\talnE56R1nIiK9aXVonTLE/IMlBG/S6KQKHbsYzFczntX0NJJz00r9NWb4ytgKo8gPQxC\n\tvnJGDj65h9/pmHvSGNS5VjiyVP+JmVJE9rKWxunmqDk9ayvmFN37ePyDOqwv2D4N3eBK\n\t6ot0uHqJ5JMU1y8e5/ddO4b4ibIx2hJ5+sny79AfI0sD6eCp3gnrnYLDMuvZ+OQr36cv\n\tUjLzsONNmguRQHf6wiUivZOzw02+NkyrAxmTAD6k0+0D0Zu0O64emxh2TxzlWPkG2uHQ\n\t9Q0w==",
        "X-Gm-Message-State": "AOAM533SZBpGFKsmlNhNUYa+Ugx5k3IbXdbCcqg3ukgndS/DQmvMY54g\n\t+YaMfW0WAsA2fR/S2LLtaQAy4IC3TBusig==",
        "X-Google-Smtp-Source": "ABdhPJzXwkuP/oBddD3/WNogHhsiu4ZJF2PFoht4kog8StQV36dQ0Jr/jujQPUICYRp6Hlc9yIWeeQ==",
        "X-Received": "by 2002:a65:6658:: with SMTP id\n\tz24mr15441101pgv.266.1629403947369; \n\tThu, 19 Aug 2021 13:12:27 -0700 (PDT)",
        "From": "Hirokazu Honda <hiroh@chromium.org>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Fri, 20 Aug 2021 05:12:14 +0900",
        "Message-Id": "<20210819201214.1554322-4-hiroh@chromium.org>",
        "X-Mailer": "git-send-email 2.33.0.rc2.250.ged5fa647cd-goog",
        "In-Reply-To": "<20210819201214.1554322-1-hiroh@chromium.org>",
        "References": "<20210819201214.1554322-1-hiroh@chromium.org>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v2 3/3] android: camera_device: Configure\n\tone stream for identical stream requests",
        "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": "An Android HAL client may request identical stream requests. It is\nredundant that a native camera device produces a separate stream for\neach of the identical requests.\nConfigure camera one stream configuration for the identical stream\nrequests.\n\nSigned-off-by: Hirokazu Honda <hiroh@chromium.org>\n---\n src/android/camera_device.cpp | 28 +++++++++++++++++++++++-----\n 1 file changed, 23 insertions(+), 5 deletions(-)",
    "diff": "diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\nindex a69b687a..88cfd117 100644\n--- a/src/android/camera_device.cpp\n+++ b/src/android/camera_device.cpp\n@@ -617,14 +617,32 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)\n \t\t\tcontinue;\n \t\t}\n \n+\t\t/* This stream will be produced by hardware. */\n+\t\tstream->usage |= GRALLOC_USAGE_HW_CAMERA_WRITE;\n+\n+\t\t/*\n+\t\t * If a CameraStream with the same size and format of the\n+\t\t * current stream has already been requested, associate the two.\n+\t\t */\n+\t\tauto iter = std::find_if(\n+\t\t\tstreamConfigs.begin(), streamConfigs.end(),\n+\t\t\t[size, format](const Camera3StreamConfig &streamConfig) {\n+\t\t\t\treturn streamConfig.config.size == size &&\n+\t\t\t\t       streamConfig.config.pixelFormat == format;\n+\t\t\t});\n+\t\tif (iter != streamConfigs.end()) {\n+\t\t\t/* Add usage to copy the buffer in streams[0] to stream. */\n+\t\t\titer->streams[0].stream->usage |= GRALLOC_USAGE_SW_READ_OFTEN;\n+\t\t\tstream->usage |= GRALLOC_USAGE_SW_WRITE_OFTEN;\n+\t\t\titer->streams.push_back({ stream, CameraStream::Type::Mapped });\n+\t\t\tcontinue;\n+\t\t}\n+\n \t\tCamera3StreamConfig streamConfig;\n \t\tstreamConfig.streams = { { stream, CameraStream::Type::Direct } };\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@@ -1077,6 +1095,7 @@ void CameraDevice::requestComplete(Request *request)\n \tcamera3_capture_result_t captureResult = {};\n \tcaptureResult.frame_number = descriptor.frameNumber_;\n \tcaptureResult.num_output_buffers = descriptor.buffers_.size();\n+\t/* Handle post-processing. */\n \tfor (camera3_stream_buffer_t &buffer : descriptor.buffers_) {\n \t\tbuffer.acquire_fence = -1;\n \t\tbuffer.release_fence = -1;\n@@ -1132,12 +1151,11 @@ void CameraDevice::requestComplete(Request *request)\n \t\tresultMetadata = std::make_unique<CameraMetadata>(0, 0);\n \t}\n \n-\t/* Handle any JPEG compression. */\n \tfor (camera3_stream_buffer_t &buffer : descriptor.buffers_) {\n \t\tCameraStream *cameraStream =\n \t\t\tstatic_cast<CameraStream *>(buffer.stream->priv);\n \n-\t\tif (cameraStream->camera3Stream().format != HAL_PIXEL_FORMAT_BLOB)\n+\t\tif (cameraStream->type() == CameraStream::Type::Direct)\n \t\t\tcontinue;\n \n \t\tFrameBuffer *src = request->findBuffer(cameraStream->stream());\n",
    "prefixes": [
        "libcamera-devel",
        "v2",
        "3/3"
    ]
}