[{"id":36536,"web_url":"https://patchwork.libcamera.org/comment/36536/","msgid":"<85cy65ale0.fsf@mzamazal-thinkpadp1gen7.tpbc.csb>","date":"2025-10-29T13:27:19","subject":"Re: [PATCH v2] pipeline: simple: Consider output sizes when\n\tchoosing pipe config","submitter":{"id":177,"url":"https://patchwork.libcamera.org/api/people/177/","name":"Milan Zamazal","email":"mzamazal@redhat.com"},"content":"Hi Robert,\n\nthank you for the update.\n\nRobert Mader <robert.mader@collabora.com> writes:\n\n> When a converter or the software ISP is used, output sizes do not equal\n> input sizes - they notably can be smaller.\n>\n> Previous to this patch only capture sizes were considered, in some cases\n> resulting in configs with too small maximum output sizes being selected,\n> such as 1912x1080 for stream sizes of 1920x1080.\n>\n> Check that the maximum output sizes are big enough instead, while continuing\n> to minimize capture sizes.\n>\n> Closes https://gitlab.freedesktop.org/camera/libcamera/-/issues/236\n>\n> Signed-off-by: Robert Mader <robert.mader@collabora.com>\n\nLooks reasonable to me now.\n\nReviewed-by: Milan Zamazal <mzamazal@redhat.com>\n\n> ---\n>  src/libcamera/pipeline/simple/simple.cpp | 11 ++++++-----\n>  1 file changed, 6 insertions(+), 5 deletions(-)\n>\n> diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp\n> index 7b0783cdb..91715b7f8 100644\n> --- a/src/libcamera/pipeline/simple/simple.cpp\n> +++ b/src/libcamera/pipeline/simple/simple.cpp\n> @@ -1164,15 +1164,16 @@ CameraConfiguration::Status SimpleCameraConfiguration::validate()\n>  \tpipeConfig_ = nullptr;\n>  \n>  \tfor (const SimpleCameraData::Configuration *pipeConfig : *configs) {\n> -\t\tconst Size &size = pipeConfig->captureSize;\n> +\t\tconst Size &captureSize = pipeConfig->captureSize;\n> +\t\tconst Size &maxOutputSize = pipeConfig->outputSizes.max;\n>  \n> -\t\tif (size.width >= maxStreamSize.width &&\n> -\t\t    size.height >= maxStreamSize.height) {\n> -\t\t\tif (!pipeConfig_ || size < pipeConfig_->captureSize)\n> +\t\tif (maxOutputSize.width >= maxStreamSize.width &&\n> +\t\t    maxOutputSize.height >= maxStreamSize.height) {\n> +\t\t\tif (!pipeConfig_ || captureSize < pipeConfig_->captureSize)\n>  \t\t\t\tpipeConfig_ = pipeConfig;\n>  \t\t}\n>  \n> -\t\tif (!maxPipeConfig || maxPipeConfig->captureSize < size)\n> +\t\tif (!maxPipeConfig || maxPipeConfig->captureSize < captureSize)\n>  \t\t\tmaxPipeConfig = pipeConfig;\n>  \t}","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 C77D9BE080\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 29 Oct 2025 13:27:31 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B643E6082E;\n\tWed, 29 Oct 2025 14:27:30 +0100 (CET)","from us-smtp-delivery-124.mimecast.com\n\t(us-smtp-delivery-124.mimecast.com [170.10.129.124])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C809E60453\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 29 Oct 2025 14:27:28 +0100 (CET)","from mail-ed1-f71.google.com (mail-ed1-f71.google.com\n\t[209.85.208.71]) by relay.mimecast.com with ESMTP with STARTTLS\n\t(version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n\tus-mta-259-VsYecOJSON2lU9MNQ2As6Q-1; Wed, 29 Oct 2025 09:27:25 -0400","by mail-ed1-f71.google.com with SMTP id\n\t4fb4d7f45d1cf-63c13013adeso6133147a12.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 29 Oct 2025 06:27:24 -0700 (PDT)","from mzamazal-thinkpadp1gen7.tpbc.csb\n\t(ip-77-48-47-2.net.vodafone.cz. [77.48.47.2])\n\tby smtp.gmail.com with ESMTPSA id\n\t4fb4d7f45d1cf-63e7ef82b6esm11971274a12.11.2025.10.29.06.27.19\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 29 Oct 2025 06:27:22 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=redhat.com header.i=@redhat.com\n\theader.b=\"LrBogViV\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1761744447;\n\th=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n\tto:to:cc:cc:mime-version:mime-version:content-type:content-type:\n\tin-reply-to:in-reply-to:references:references;\n\tbh=NSh/wChc6bh+4eougkeB6UjWNilkKZiIqtBNoecXgeI=;\n\tb=LrBogViVgLtvGWGF7CHUi2mAmJDo1zcqwwCvHli2DAsStIaNL50NGQ6tqUKwpVgvy3jE5q\n\t1Ue2zWFryTU+d6kKJx4JkZXBd7lJqmU1Qg2aD5iKqUKTplXCns5VF0jo4vMSCfSSJlENNE\n\trDkgBmo/vl5CRl1rrT3EOpvSFir7Y3E=","X-MC-Unique":"VsYecOJSON2lU9MNQ2As6Q-1","X-Mimecast-MFC-AGG-ID":"VsYecOJSON2lU9MNQ2As6Q_1761744444","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1761744443; x=1762349243;\n\th=mime-version:user-agent:message-id:date:references:in-reply-to\n\t:subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=NSh/wChc6bh+4eougkeB6UjWNilkKZiIqtBNoecXgeI=;\n\tb=kPxhOz1STdiNrRyDKqgUr8YX4kmXyW1ThgK39hEx/S4UEkZrfHYUb1O1ePXSm6McHu\n\t+kbhuvat2gTippacmpuM6hC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cf-640441bc6a6mr2438451a12.16.1761744443290; \n\tWed, 29 Oct 2025 06:27:23 -0700 (PDT)","by 2002:a05:6402:4311:b0:63c:489f:df1 with SMTP id\n\t4fb4d7f45d1cf-640441bc6a6mr2438427a12.16.1761744442781; \n\tWed, 29 Oct 2025 06:27:22 -0700 (PDT)"],"X-Google-Smtp-Source":"AGHT+IFUtAJ5pqS0D3WhQE8gFbBIsMlzS54K8EG4LrK1eg5UR5ZENAMkqegoYzzSNvqXaSq28vVoqw==","From":"Milan Zamazal <mzamazal@redhat.com>","To":"Robert Mader <robert.mader@collabora.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH v2] pipeline: simple: Consider output sizes when\n\tchoosing pipe config","In-Reply-To":"<20251027232047.192357-1-robert.mader@collabora.com> (Robert\n\tMader's message of \"Tue, 28 Oct 2025 00:20:47 +0100\")","References":"<20251027232047.192357-1-robert.mader@collabora.com>","Date":"Wed, 29 Oct 2025 14:27:19 +0100","Message-ID":"<85cy65ale0.fsf@mzamazal-thinkpadp1gen7.tpbc.csb>","User-Agent":"Gnus/5.13 (Gnus v5.13)","MIME-Version":"1.0","X-Mimecast-Spam-Score":"0","X-Mimecast-MFC-PROC-ID":"dEvN0448EJfiyMUwm_GBE2wQ5RunYSRifCLpGbqpNWA_1761744444","X-Mimecast-Originator":"redhat.com","Content-Type":"text/plain","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>"}},{"id":36551,"web_url":"https://patchwork.libcamera.org/comment/36551/","msgid":"<2grhifs2mcu4egcicmlspyfikh66gk5eu4ykd2rtwbl2zqgkps@zneqt7yrw2b4>","date":"2025-10-30T11:35:31","subject":"Re: [PATCH v2] pipeline: simple: Consider output sizes when choosing\n\tpipe config","submitter":{"id":232,"url":"https://patchwork.libcamera.org/api/people/232/","name":"Umang Jain","email":"uajain@igalia.com"},"content":"Hi Robert,\n\nOn Tue, Oct 28, 2025 at 12:20:47AM +0100, Robert Mader wrote:\n> When a converter or the software ISP is used, output sizes do not equal\n> input sizes - they notably can be smaller.\n> \n> Previous to this patch only capture sizes were considered, in some cases\n> resulting in configs with too small maximum output sizes being selected,\n> such as 1912x1080 for stream sizes of 1920x1080.\n> \n> Check that the maximum output sizes are big enough instead, while continuing\n> to minimize capture sizes.\n> \n> Closes https://gitlab.freedesktop.org/camera/libcamera/-/issues/236\n> \n\nAs per the recent discussion on the issue, this probably closes the\nspecific issue for your platform but doesn't address the underlying issue of\nmaxStreamSize being adjusted after the pipeConfig is selected, which I\nbelieve should be fixed to ensure this doesn't happen on other platforms\nresolutions combinations.\n\n> Signed-off-by: Robert Mader <robert.mader@collabora.com>\n\nAnyway, I think the patch is reasonable for now, I will try to look at\nvalidate() logic to address the underlying issue,\n\nAcked-by: Umang Jain <uajain@igalia.com>\n\n> ---\n>  src/libcamera/pipeline/simple/simple.cpp | 11 ++++++-----\n>  1 file changed, 6 insertions(+), 5 deletions(-)\n> \n> diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp\n> index 7b0783cdb..91715b7f8 100644\n> --- a/src/libcamera/pipeline/simple/simple.cpp\n> +++ b/src/libcamera/pipeline/simple/simple.cpp\n> @@ -1164,15 +1164,16 @@ CameraConfiguration::Status SimpleCameraConfiguration::validate()\n>  \tpipeConfig_ = nullptr;\n>  \n>  \tfor (const SimpleCameraData::Configuration *pipeConfig : *configs) {\n> -\t\tconst Size &size = pipeConfig->captureSize;\n> +\t\tconst Size &captureSize = pipeConfig->captureSize;\n> +\t\tconst Size &maxOutputSize = pipeConfig->outputSizes.max;\n>  \n> -\t\tif (size.width >= maxStreamSize.width &&\n> -\t\t    size.height >= maxStreamSize.height) {\n> -\t\t\tif (!pipeConfig_ || size < pipeConfig_->captureSize)\n> +\t\tif (maxOutputSize.width >= maxStreamSize.width &&\n> +\t\t    maxOutputSize.height >= maxStreamSize.height) {\n> +\t\t\tif (!pipeConfig_ || captureSize < pipeConfig_->captureSize)\n>  \t\t\t\tpipeConfig_ = pipeConfig;\n>  \t\t}\n>  \n> -\t\tif (!maxPipeConfig || maxPipeConfig->captureSize < size)\n> +\t\tif (!maxPipeConfig || maxPipeConfig->captureSize < captureSize)\n>  \t\t\tmaxPipeConfig = pipeConfig;\n>  \t}\n>  \n> -- \n> 2.51.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 1C0D3C3259\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 30 Oct 2025 11:35:04 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9464D608C3;\n\tThu, 30 Oct 2025 12:35:02 +0100 (CET)","from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 36218603ED\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 30 Oct 2025 12:35:00 +0100 (CET)","from [62.254.186.174] (helo=uajain)\n\tby fanzine2.igalia.com with esmtpsa \n\t(Cipher TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256)\n\t(Exim) id 1vEQvj-00H2Fo-7R; Thu, 30 Oct 2025 12:34:59 +0100"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=igalia.com header.i=@igalia.com\n\theader.b=\"hM1Y95uR\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com;\n\ts=20170329;\n\th=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:\n\tSubject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID:\n\tContent-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc\n\t:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe:\n\tList-Post:List-Owner:List-Archive;\n\tbh=jG4gtsF4SiNNz7VZnMLECnipg5H4yy2d1Wl3nvwu/5I=;\n\tb=hM1Y95uR0LnvtCQSdLBs777wqT\n\tmrwj9hrp3GL7xIhESqaYPQRtaXIX7M2TqmUN/i0T88Yy6ArGa8sUt4cKkBy81Elpp8LZ4Gx40QIua\n\tmV1jaG1EC9fzXRYarArg/AdSEhLo8jXxk2KfLfEcMM36NKr2Im69YnAQUuJC/MO6vB1AWeWp8hxje\n\tIhcKQsbJTpPRtoN0mQZblW54gm/i+RCBAdV6lHt4UDG8atGIpaYxyseDovlggL9RGlnEDb4ddPMOt\n\tFAt+A6KungObJKovvS/w6wqFrqinqrDUnmyJ3D4sZ13QGSvLGIux1qeDQDSjXHNz6vQjgYoLE3nFF\n\tnbzdZXEQ==;","Date":"Thu, 30 Oct 2025 11:35:31 +0000","From":"Umang Jain <uajain@igalia.com>","To":"Robert Mader <robert.mader@collabora.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH v2] pipeline: simple: Consider output sizes when choosing\n\tpipe config","Message-ID":"<2grhifs2mcu4egcicmlspyfikh66gk5eu4ykd2rtwbl2zqgkps@zneqt7yrw2b4>","References":"<20251027232047.192357-1-robert.mader@collabora.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20251027232047.192357-1-robert.mader@collabora.com>","User-Agent":"NeoMutt/20250905-dirty","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>"}}]