[{"id":22015,"web_url":"https://patchwork.libcamera.org/comment/22015/","msgid":"<CAO5uPHOQ+ygp+qvYKQAh5BKkU1BCSpufXG4m=uXj-a2Ku68fRQ@mail.gmail.com>","date":"2022-01-12T07:32:44","subject":"Re: [libcamera-devel] [PATCH 4/5] android: camera_device: Use YUV\n\tpost-processor","submitter":{"id":63,"url":"https://patchwork.libcamera.org/api/people/63/","name":"Hirokazu Honda","email":"hiroh@chromium.org"},"content":"Hi Jacopo,\n\nOn Tue, Jan 11, 2022 at 1:54 AM Jacopo Mondi <jacopo@jmondi.org> wrote:\n>\n> From: Hirokazu Honda <hiroh@chromium.org>\n>\n> When creating the list of StreamConfiguration to be requested to the camera,\n> map NV12 streams of equal size and format together, so that they will be\n> generated by using the YUV post-processor.\n>\n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n\nWould you mind adding Signed-off-by: Hirokazu Honda <hiroh@chromium.org>?\n\nBest Regards,\n-Hiro\n\n> ---\n>  src/android/camera_device.cpp | 32 +++++++++++++++++++++++++++++---\n>  1 file changed, 29 insertions(+), 3 deletions(-)\n>\n> diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\n> index a44f199d25d8..4e44bcfa0852 100644\n> --- a/src/android/camera_device.cpp\n> +++ b/src/android/camera_device.cpp\n> @@ -605,14 +605,40 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)\n>                         continue;\n>                 }\n>\n> +               /*\n> +                * While gralloc usage flags are supposed to report usage\n> +                * patterns to select a suitable buffer allocation strategy, in\n> +                * practice they're also used to make other decisions, such as\n> +                * selecting the actual format for the IMPLEMENTATION_DEFINED\n> +                * HAL pixel format. To avoid issues, we thus have to set the\n> +                * GRALLOC_USAGE_HW_CAMERA_WRITE flag unconditionally, even for\n> +                * streams that will be produced in software.\n> +                */\n> +               stream->usage |= GRALLOC_USAGE_HW_CAMERA_WRITE;\n> +\n> +               /*\n> +                * If a CameraStream with the same size and format of the\n> +                * current stream has already been requested, associate the two.\n> +                */\n> +               auto iter = std::find_if(\n> +                       streamConfigs.begin(), streamConfigs.end(),\n> +                       [&size, &format](const Camera3StreamConfig &streamConfig) {\n> +                               return streamConfig.config.size == size &&\n> +                                      streamConfig.config.pixelFormat == format;\n> +                       });\n> +               if (iter != streamConfigs.end()) {\n> +                       /* Add usage to copy the buffer in streams[0] to stream. */\n> +                       iter->streams[0].stream->usage |= GRALLOC_USAGE_SW_READ_OFTEN;\n> +                       stream->usage |= GRALLOC_USAGE_SW_WRITE_OFTEN;\n> +                       iter->streams.push_back({ stream, CameraStream::Type::Mapped });\n> +                       continue;\n> +               }\n> +\n>                 Camera3StreamConfig streamConfig;\n>                 streamConfig.streams = { { stream, CameraStream::Type::Direct } };\n>                 streamConfig.config.size = size;\n>                 streamConfig.config.pixelFormat = format;\n>                 streamConfigs.push_back(std::move(streamConfig));\n> -\n> -               /* This stream will be produced by hardware. */\n> -               stream->usage |= GRALLOC_USAGE_HW_CAMERA_WRITE;\n>         }\n>\n>         /* Now handle the MJPEG streams, adding a new stream if required. */\n> --\n> 2.34.1\n>","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 03312BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 12 Jan 2022 07:32:56 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B36F06021A;\n\tWed, 12 Jan 2022 08:32:56 +0100 (CET)","from mail-ed1-x534.google.com (mail-ed1-x534.google.com\n\t[IPv6:2a00:1450:4864:20::534])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5DE9E60217\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 12 Jan 2022 08:32:55 +0100 (CET)","by mail-ed1-x534.google.com with SMTP id a18so6234154edj.7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 11 Jan 2022 23:32:55 -0800 (PST)"],"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=\"dPLv93CH\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; \n\th=mime-version:references:in-reply-to:from:date:message-id:subject:to\n\t:cc; bh=uCVo7DnPMLVPR7dxypEhiRCvsdoIuviy/0lickkvtgQ=;\n\tb=dPLv93CHBf4GhfVNxJbN7zLW1qIjzRPyoj1yyXevUfuSzkfvK260rBcwGNKxbfMMsc\n\tWx5lhf9g07MHdaC0OF4FA/7XRd9rroQgJlJsrHbhhh4Ior1HJc7YwSO7mmFVTc7REiW3\n\tjobsCK9LkxaW+LRHYF0M9b34tVXoOJb+AKJIw=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:mime-version:references:in-reply-to:from:date\n\t:message-id:subject:to:cc;\n\tbh=uCVo7DnPMLVPR7dxypEhiRCvsdoIuviy/0lickkvtgQ=;\n\tb=h5p/fsC5PLzUlOV0gW9kTHfSIz9LSC/iMUCQ1UL8n7eaFwLxM7gbXeIts3p+hyQF5k\n\t4610hUdqh4UY6J4/8PJwGNsd/MiEPmPn1siWTICzA2XiaO707BdLCZ6YEsLAe79Yk5Y7\n\tewxo7U97jkDrsAoqRn9RiXQOaIhzFgpaS4PmzyBE6VsGKL4eWuAQ96rA97IcRcdX9pmM\n\tdji/ebtQ2nKq9vstIrPU8JvmbVl/BB0/hQC2UehvYvwpqJm6eykO+H3gdRRw20k9ZpCY\n\tK0SQ5Cenv2tWva3CqrJMtqoPwrnpbgajxM6uYDAZ6xOxCz+EOw+3tU8JiMmzFvBbNx/u\n\twDrQ==","X-Gm-Message-State":"AOAM531WRimnhY6n6DUs5N4JPvB/kCCvTt2r4HJlkqW7KxMWTAwTM8jo\n\t1IKPaWtIInGt2KRiWARQcU9q/Vr/Lq0tu1t7FFeRGqyZ5u0=","X-Google-Smtp-Source":"ABdhPJw1jlVk64MlYH0GW4VRB0wDF5s6i92GWnTdeNdQZYJyarrVZ/kaYuHkmxiuABBou1P4XWS/fxitxLtqJUvlq0g=","X-Received":"by 2002:a17:906:2a48:: with SMTP id\n\tk8mr6926381eje.758.1641972775055; \n\tTue, 11 Jan 2022 23:32:55 -0800 (PST)","MIME-Version":"1.0","References":"<20220110165524.72978-1-jacopo@jmondi.org>\n\t<20220110165524.72978-5-jacopo@jmondi.org>","In-Reply-To":"<20220110165524.72978-5-jacopo@jmondi.org>","From":"Hirokazu Honda <hiroh@chromium.org>","Date":"Wed, 12 Jan 2022 16:32:44 +0900","Message-ID":"<CAO5uPHOQ+ygp+qvYKQAh5BKkU1BCSpufXG4m=uXj-a2Ku68fRQ@mail.gmail.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Content-Type":"text/plain; charset=\"UTF-8\"","Subject":"Re: [libcamera-devel] [PATCH 4/5] android: camera_device: Use YUV\n\tpost-processor","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>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]