From patchwork Wed Feb 22 15:19:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 18298 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 33E4AC329D for ; Wed, 22 Feb 2023 15:19:35 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id CEE6A62653; Wed, 22 Feb 2023 16:19:34 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1677079174; bh=Et2NTSDfUNPx5FFsms1sFNkh90eZg5g0TlDuO4bW2AA=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=Gbx2uLy6rqhRpIx+Tgy9wYaRiPLJxYx3mBJOo8D0QDDliVG760bKaZUtgWxdnIR17 G8H4x+5OgjKClDdgfBjjUj4vuceIhKOZDekN6tQyC7TjmYZmXbjFRXNNpNbGY945dt gfPMrPH0eEfaLOTIRWp01uHT8HITyxR1auJxyotlppVMx2oOAOxirtiqEQckXwwdVx VD5HFKWGObyvhjFnjKkuH5xNPH64oyQdhnzltQrAmBG1bLtDW1UQDX2edZEBTC0d/O MPR/CjWZK15w6tJj/QgQbx5Hs0qDSVo0bniYAo66G/FTfcbSmhUFm469qRjU/X2JOY Aq7ew2i1lfphg== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 4A0BE62661 for ; Wed, 22 Feb 2023 16:19:31 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="MJ/ZXLJh"; dkim-atps=neutral Received: from uno.homenet.telecomitalia.it (host-87-16-53-160.retail.telecomitalia.it [87.16.53.160]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id AAE022A4D; Wed, 22 Feb 2023 16:19:30 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1677079171; bh=Et2NTSDfUNPx5FFsms1sFNkh90eZg5g0TlDuO4bW2AA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MJ/ZXLJhRhzBzDcnN00VZ/85xNhpe1fdSVzLhpXeTnjMv9MrkFRCbnuLAHdX2evKK oOe5Ot4ECvy4cT09deVftCxv99VBIMF0YGIiQ+LXV65nTWtnuS0YRM07I/bZu/m5Jn k5BkTR4ktD0tWCeAN69diXgssjFW/wfpWLCh6jdc= To: libcamera-devel@lists.libcamera.org Date: Wed, 22 Feb 2023 16:19:17 +0100 Message-Id: <20230222151917.669526-5-jacopo.mondi@ideasonboard.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230222151917.669526-1-jacopo.mondi@ideasonboard.com> References: <20230222151917.669526-1-jacopo.mondi@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 4/4] libcamera: rkisp1: Fix enumeration of RAW formats 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: , X-Patchwork-Original-From: Jacopo Mondi via libcamera-devel From: Jacopo Mondi Reply-To: Jacopo Mondi Cc: Jacopo Mondi , libcamera@luigi311.com Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The current implementation enumerates a single RAW format (the sensor's resolution) and does that regardless of what role the CameraConfiguration has been generated for. Fix this by: - Enumerate RAW StreamFormats only when the requested role is StreamRole::Raw - Add all the sensor's provided resolutions that fit the video device output maximum size Signed-off-by: Jacopo Mondi Reviewed-by: Paul Elder --- src/libcamera/pipeline/rkisp1/rkisp1_path.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp index a27ac6fc35cb..0e4d76677732 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp @@ -150,18 +150,33 @@ RkISP1Path::generateConfiguration(const CameraSensor *sensor, for (const auto &format : streamFormats_) { const PixelFormatInfo &info = PixelFormatInfo::info(format); + /* Populate stream formats for non-RAW configurations. */ if (info.colourEncoding != PixelFormatInfo::ColourEncodingRAW) { + if (role == StreamRole::Raw) + continue; + streamFormats[format] = { { minResolution, maxResolution } }; continue; } - /* Skip raw formats not supported by the sensor. */ + /* Skip RAW formats for non-raw roles. */ + if (role != StreamRole::Raw) + continue; + + /* Populate stream formats for RAW configurations. */ uint32_t mbusCode = formatToMediaBus.at(format); if (std::find(mbusCodes.begin(), mbusCodes.end(), mbusCode) == mbusCodes.end()) + /* Skip formats not supported by sensor. */ continue; - streamFormats[format] = { { resolution, resolution } }; + /* Add all the RAW sizes the sensor can produce for this code. */ + for (const auto &rawSize : sensor->sizes(mbusCode)) { + if (rawSize > maxResolution_) + continue; + + streamFormats[format].push_back({ rawSize, rawSize }); + } /* * Store the raw format with the highest bits per pixel for