[{"id":14621,"web_url":"https://patchwork.libcamera.org/comment/14621/","msgid":"<CAHW6GYLtiQ_+AJ2EJu0M3JjfTVW_p6U805jwCq+45V1vruvh9A@mail.gmail.com>","date":"2021-01-20T09:40:59","subject":"Re: [libcamera-devel] [PATCH 1/5] pipeline: raspberrypi: Refactor\n\tstream configuration routine","submitter":{"id":42,"url":"https://patchwork.libcamera.org/api/people/42/","name":"David Plowman","email":"david.plowman@raspberrypi.com"},"content":"Hi Naush\n\nThanks for this patch. No issues with this from me!\n\nOn Wed, 20 Jan 2021 at 08:34, Naushir Patuck <naush@raspberrypi.com> wrote:\n>\n> Refactor the high/low resolution stream format and output selection\n> routine. This change is in preparation of adding 1/4 resolution output\n> for fast colour denoise.\n>\n> Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n\nReviewed-by: David Plowman <david.plowman@raspberrypi.com>\n\nBest regards\nDavid\n\n> ---\n>  .../pipeline/raspberrypi/raspberrypi.cpp      | 57 ++++++-------------\n>  1 file changed, 16 insertions(+), 41 deletions(-)\n>\n> diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> index f121328ee9a9..e03bcb036f9f 100644\n> --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> @@ -624,52 +624,27 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config)\n>                         continue;\n>                 }\n>\n> -               if (i == maxIndex) {\n> -                       /* ISP main output format. */\n> -                       V4L2VideoDevice *dev = data->isp_[Isp::Output0].dev();\n> -                       V4L2PixelFormat fourcc = dev->toV4L2PixelFormat(cfg.pixelFormat);\n> -                       format.size = cfg.size;\n> -                       format.fourcc = fourcc;\n> -\n> -                       ret = dev->setFormat(&format);\n> -                       if (ret)\n> -                               return -EINVAL;\n> -\n> -                       if (format.size != cfg.size || format.fourcc != fourcc) {\n> -                               LOG(RPI, Error)\n> -                                       << \"Failed to set format on ISP capture0 device: \"\n> -                                       << format.toString();\n> -                               return -EINVAL;\n> -                       }\n> -\n> -                       cfg.setStream(&data->isp_[Isp::Output0]);\n> -                       data->isp_[Isp::Output0].setExternal(true);\n> -               }\n> +               /* The largest resolution gets routed to the ISP Output 0 node. */\n> +               RPi::Stream *stream = (i == maxIndex) ? &data->isp_[Isp::Output0] :\n> +                                                       &data->isp_[Isp::Output1];\n>\n> -               /*\n> -                * ISP second output format. This fallthrough means that if a\n> -                * second output stream has not been configured, we simply use\n> -                * the Output0 configuration.\n> -                */\n> -               V4L2VideoDevice *dev = data->isp_[Isp::Output1].dev();\n> -               format.fourcc = dev->toV4L2PixelFormat(cfg.pixelFormat);\n> +               V4L2PixelFormat fourcc = stream->dev()->toV4L2PixelFormat(cfg.pixelFormat);\n>                 format.size = cfg.size;\n> +               format.fourcc = fourcc;\n>\n> -               ret = dev->setFormat(&format);\n> -               if (ret) {\n> +               ret = stream->dev()->setFormat(&format);\n> +               if (ret)\n> +                       return -EINVAL;\n> +\n> +               if (format.size != cfg.size || format.fourcc != fourcc) {\n>                         LOG(RPI, Error)\n> -                               << \"Failed to set format on ISP capture1 device: \"\n> -                               << format.toString();\n> -                       return ret;\n> -               }\n> -               /*\n> -                * If we have not yet provided a stream for this config, it\n> -                * means this is to be routed from Output1.\n> -                */\n> -               if (!cfg.stream()) {\n> -                       cfg.setStream(&data->isp_[Isp::Output1]);\n> -                       data->isp_[Isp::Output1].setExternal(true);\n> +                               << \"Failed to set format on \" << stream->name()\n> +                               << \" to \" << format.toString();\n> +                       return -EINVAL;\n>                 }\n> +\n> +               cfg.setStream(stream);\n> +               stream->setExternal(true);\n>         }\n>\n>         /* ISP statistics output format. */\n> --\n> 2.25.1\n>\n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","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 9B17CC0F2A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 20 Jan 2021 09:41:14 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1FED768183;\n\tWed, 20 Jan 2021 10:41:14 +0100 (CET)","from mail-ot1-x334.google.com (mail-ot1-x334.google.com\n\t[IPv6:2607:f8b0:4864:20::334])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A9B3368177\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 20 Jan 2021 10:41:11 +0100 (CET)","by mail-ot1-x334.google.com with SMTP id f6so13584163ots.9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 20 Jan 2021 01:41:11 -0800 (PST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"ejT64PTp\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=mime-version:references:in-reply-to:from:date:message-id:subject:to\n\t:cc; bh=tgM7n19SgLIlDb9Nl6RzABx6/X8MPA1nscD5fbn5/VA=;\n\tb=ejT64PTpCqAjYBvTSCRRDPs4ivy+Bf7RcXvL9p6O5BIrR5nje9qgU5DxmprHrkitZc\n\tIzLIKfVeCG9FILvPB7Z52XfGdZBvNDYjO5Q83QZS9x94Zqm+a/AlUzgInYrnwKnOkBMD\n\tYgbb+IyXr8tT4JoLMYSAlalQmqqaR6gd+JdUJc+yrYIAw/fuRQ5K08vowzQXtdqm+Ouf\n\t0Dhzw5P4Cor3cqLlqOmoi5pKVsDR7x+OEcDK3zBmT+0B3TKm/leshIEReA4QKhzo1K5z\n\t8rrJnqRR6nKcznLgY+DZkalYVxII00ummZBrrJk9cG3WKtKhj6rGBoWtesgnPhewWYk6\n\t8s8w==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:references:in-reply-to:from:date\n\t:message-id:subject:to:cc;\n\tbh=tgM7n19SgLIlDb9Nl6RzABx6/X8MPA1nscD5fbn5/VA=;\n\tb=j/cDvSfxMB0Um7toAXcG8SQaV6LcwPOTo88qBRhe7bAZkuafK8LuThnlyNNjLQ2or2\n\twkMeYPjrwGjqS32cPhVf7dTHc+oN2H2pAUB4n1JnaynZGb1uSF4MmJ7rWhgma7cxxbym\n\tNHp+9BGdfFiblBn9jK7zodZNV7ifG9glKKNPO0bL+1wzSTXXnhNKKPnwoSI9gLAhJ6q0\n\tLX64hMhrcqS7n4nyalzuzh0Ss3y1/QFrZJhsDG56upwwGXzH0ZtEOlMY7wY+JsPdPZpS\n\tSxDEKHlhMDzbnANkeQws5v7P5npAXmHery+Wgs3J3fgFdUSo6+tzjudnU5N8wSf72YdV\n\ttS1A==","X-Gm-Message-State":"AOAM533hUAoyLc2hWmKBm3V/hZABepftsDWaMALIx9uYcSANA9znHvk/\n\tC2s/qAAmoiU18UdtmWcqYOjxVc70RXa/wAMlgG4Pjg==","X-Google-Smtp-Source":"ABdhPJwMt8CEzSmTDM8yrDW96FhcE8Vor8SCKgbQOQiIOdZYjAPRvKsIHlAh6cXSJMmon+SnucfDcWE+PiXZylDm1VY=","X-Received":"by 2002:a05:6830:1e7b:: with SMTP id\n\tm27mr4004950otr.317.1611135670254; \n\tWed, 20 Jan 2021 01:41:10 -0800 (PST)","MIME-Version":"1.0","References":"<20210120083449.642418-1-naush@raspberrypi.com>\n\t<20210120083449.642418-2-naush@raspberrypi.com>","In-Reply-To":"<20210120083449.642418-2-naush@raspberrypi.com>","From":"David Plowman <david.plowman@raspberrypi.com>","Date":"Wed, 20 Jan 2021 09:40:59 +0000","Message-ID":"<CAHW6GYLtiQ_+AJ2EJu0M3JjfTVW_p6U805jwCq+45V1vruvh9A@mail.gmail.com>","To":"Naushir Patuck <naush@raspberrypi.com>","Subject":"Re: [libcamera-devel] [PATCH 1/5] pipeline: raspberrypi: Refactor\n\tstream configuration routine","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 <libcamera-devel@lists.libcamera.org>","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>"}}]