From patchwork Mon Oct 27 23:20:47 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Mader X-Patchwork-Id: 24836 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 1F886BE080 for ; Mon, 27 Oct 2025 23:21:24 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 473326077C; Tue, 28 Oct 2025 00:21:23 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=collabora.com header.i=robert.mader@collabora.com header.b="h+viFDqA"; dkim-atps=neutral Received: from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com [136.143.188.112]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 600E6606A0 for ; Tue, 28 Oct 2025 00:21:21 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; t=1761607278; cv=none; d=zohomail.com; s=zohoarc; b=MUU2nuW3StQyZjnCaDvBWvlW7brekl0UCaXGoj9eLYOrSHWL27E966ITDPYIg53KfuAjcqw4pLjoW/bdeWXW7EReq21DFK8Fa6Z4fa+41z0qtGsVT1djzsNAGeOXPPR/E7xZZri07RSBDxl0SHVvdxJUCDzvRErqpm+0pi6HhAo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761607278; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To; bh=qlqe4jyZk+MOgPfT4LadH6NAWKJjA16lI8oG0TuUp7A=; b=mT8HU/xt+6Dnljt7U4SK1a4MZyx5NHIzDKKcJBUYLa1Vxmvh0DW58vuuCUew9A53+lTjYXl+XVyHFM2gjnoBBJ0hklBM9sFIXdSmIk4Xi98VY5giMyzI310nsHTUL8FXG2fzUYb4bdk3kQ9MHFSVARcmqWDO9GG8t21UPRdUpIc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=collabora.com; spf=pass smtp.mailfrom=robert.mader@collabora.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1761607278; s=zohomail; d=collabora.com; i=robert.mader@collabora.com; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-ID:MIME-Version:Content-Transfer-Encoding:Message-Id:Reply-To; bh=qlqe4jyZk+MOgPfT4LadH6NAWKJjA16lI8oG0TuUp7A=; b=h+viFDqApVRUBDLuSBAOYfHN4+cvs09fqlrk4KQn+ipNly29hh5FCmpqKcFJOydk vJwWuYPW40y1wuIs4WWZ+21fafWQ8Texes5ORTKOxy4K1MNBOsovTKoIgLBCO0I/Sne fRNy1C06WrJroRfa9gA8pJyNbCHSYJINnBf4novo= Received: by mx.zohomail.com with SMTPS id 1761607276440427.90727772249784; Mon, 27 Oct 2025 16:21:16 -0700 (PDT) From: Robert Mader To: libcamera-devel@lists.libcamera.org Cc: Robert Mader Subject: [PATCH v2] pipeline: simple: Consider output sizes when choosing pipe config Date: Tue, 28 Oct 2025 00:20:47 +0100 Message-ID: <20251027232047.192357-1-robert.mader@collabora.com> X-Mailer: git-send-email 2.51.1 MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" When a converter or the software ISP is used, output sizes do not equal input sizes - they notably can be smaller. Previous to this patch only capture sizes were considered, in some cases resulting in configs with too small maximum output sizes being selected, such as 1912x1080 for stream sizes of 1920x1080. Check that the maximum output sizes are big enough instead, while continuing to minimize capture sizes. Closes https://gitlab.freedesktop.org/camera/libcamera/-/issues/236 Signed-off-by: Robert Mader --- src/libcamera/pipeline/simple/simple.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp index 7b0783cdb..91715b7f8 100644 --- a/src/libcamera/pipeline/simple/simple.cpp +++ b/src/libcamera/pipeline/simple/simple.cpp @@ -1164,15 +1164,16 @@ CameraConfiguration::Status SimpleCameraConfiguration::validate() pipeConfig_ = nullptr; for (const SimpleCameraData::Configuration *pipeConfig : *configs) { - const Size &size = pipeConfig->captureSize; + const Size &captureSize = pipeConfig->captureSize; + const Size &maxOutputSize = pipeConfig->outputSizes.max; - if (size.width >= maxStreamSize.width && - size.height >= maxStreamSize.height) { - if (!pipeConfig_ || size < pipeConfig_->captureSize) + if (maxOutputSize.width >= maxStreamSize.width && + maxOutputSize.height >= maxStreamSize.height) { + if (!pipeConfig_ || captureSize < pipeConfig_->captureSize) pipeConfig_ = pipeConfig; } - if (!maxPipeConfig || maxPipeConfig->captureSize < size) + if (!maxPipeConfig || maxPipeConfig->captureSize < captureSize) maxPipeConfig = pipeConfig; }