[{"id":37059,"web_url":"https://patchwork.libcamera.org/comment/37059/","msgid":"<176409237435.567526.5898257841793440122@ping.linuxembedded.co.uk>","date":"2025-11-25T17:39:34","subject":"Re: [PATCH v3 18/29] pipeline: rksip1: Move isRaw up in scope","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Stefan Klug (2025-11-25 16:28:30)\n> In raw mode the number of configurations is actively limited to 1. It is\n> therefore safe to move isRaw up one level to simplify the code and\n> prepare for later use.\n> \n> During that rework it was noticed that the old code actually has a bug\n> in that it reduces the number of configurations to 1 in case a raw\n> config is found, but it doesn't reduce the config vector to that raw\n> config, but the first config.\n> \n> Change that behavior to check the first config and either remove all\n> remaining configs if the first is raw or drop all raw configs if the\n> first is non-raw.\n> \n> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n> \n> ---\n> \n> Changes in v3:\n> - Added fix for cases where only one stream is requested\n> - Fix adjustment in case of multiple configs\n> - Small code cleanup\n> ---\n>  src/libcamera/pipeline/rkisp1/rkisp1.cpp | 35 ++++++++++++------------\n>  1 file changed, 17 insertions(+), 18 deletions(-)\n> \n> diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n> index 6256a67bc31e..a11d70849121 100644\n> --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n> +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n> @@ -551,31 +551,30 @@ CameraConfiguration::Status RkISP1CameraConfiguration::validate()\n>                 status = Adjusted;\n>  \n>         /*\n> -        * Simultaneous capture of raw and processed streams isn't possible. If\n> -        * there is any raw stream, cap the number of streams to one.\n> +        * Simultaneous capture of raw and processed streams isn't possible.\n> +        * Let the first stream decide on the type.\n>          */\n> -       if (config_.size() > 1) {\n> -               for (const auto &cfg : config_) {\n> -                       if (PixelFormatInfo::info(cfg.pixelFormat).colourEncoding ==\n> +       bool isRaw = (PixelFormatInfo::info(config_[0].pixelFormat).colourEncoding ==\n> +                     PixelFormatInfo::ColourEncodingRAW);\n> +       if (isRaw) {\n> +               if (config_.size() > 1) {\n> +                       config_.resize(1);\n> +                       status = Adjusted;\n> +               }\n> +       } else {\n> +               /* Drop all raw configs. */\n> +               for (auto it = config_.begin(); it != config_.end();) {\n> +                       if (PixelFormatInfo::info(it->pixelFormat).colourEncoding ==\n>                             PixelFormatInfo::ColourEncodingRAW) {\n> -                               config_.resize(1);\n> +                               it = config_.erase(it);\n\nYes, this seems more reasonable\n\n>                                 status = Adjusted;\n> -                               break;\n> +                               continue;\n>                         }\n> +                       ++it;\n>                 }\n>         }\n>  \n> -       bool useDewarper = false;\n> -       if (pipe->dewarper_) {\n> -               /*\n> -                * Platforms with dewarper support, such as i.MX8MP, support\n> -                * only a single stream. We can inspect config_[0] only here.\n> -                */\n> -               bool isRaw = PixelFormatInfo::info(config_[0].pixelFormat).colourEncoding ==\n> -                            PixelFormatInfo::ColourEncodingRAW;\n> -               if (!isRaw)\n> -                       useDewarper = true;\n> -       }\n> +       bool useDewarper = (pipe->dewarper_ && !isRaw);\n\nAck.\n\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n>  \n>         /*\n>          * If there are more than one stream in the configuration figure out the\n> -- \n> 2.51.0\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 A961DC0F2A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 25 Nov 2025 17:39:40 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C830760A85;\n\tTue, 25 Nov 2025 18:39:39 +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 3D68A609D8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 25 Nov 2025 18:39:38 +0100 (CET)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 27FE943;\n\tTue, 25 Nov 2025 18:37:29 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"AUjP2fmv\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1764092249;\n\tbh=RP22aG129EdreAhsexLA+nRLVLmmHRMqWAnJxGt0vsU=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=AUjP2fmvzGvTPTvZ/U1tdh/pP+Adj3YfJARV2e+vJpUTXyN1B7ITDi1EqAcQ/J84Q\n\tnuCkUT8/HyXrZMOwICqZ3Wdym/LtUZZYo2Pmx27dfHEjNzAfr/t6qsFF+DrWRt+411\n\tNCRBwL267r4qlIf8+s7CJniP+EHcx18/FiwbNdTY=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20251125162851.2301793-19-stefan.klug@ideasonboard.com>","References":"<20251125162851.2301793-1-stefan.klug@ideasonboard.com>\n\t<20251125162851.2301793-19-stefan.klug@ideasonboard.com>","Subject":"Re: [PATCH v3 18/29] pipeline: rksip1: Move isRaw up in scope","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"Stefan Klug <stefan.klug@ideasonboard.com>","To":"Stefan Klug <stefan.klug@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Tue, 25 Nov 2025 17:39:34 +0000","Message-ID":"<176409237435.567526.5898257841793440122@ping.linuxembedded.co.uk>","User-Agent":"alot/0.9.1","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>"}}]