From patchwork Tue Mar 21 17:20:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 18426 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 06D28C329D for ; Tue, 21 Mar 2023 17:20:18 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 850166270F; Tue, 21 Mar 2023 18:20:18 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1679419218; bh=SvlGingAbuAk31teNuj37mbGpJeg0IqJ0mjlriIz96k=; 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=CimfvsJtBPQnMmH0+ekXxk2idiLzRnTb1ZRRnWepi1H4fyVVUXRPJEJoDGqhvsjwH SddSugu1QrVQSAOYT/MePZWDfejxEWDVVw+89BHpoNFjfnQ2MzPQgNcEJoeR2fTQA3 lHMXa35a8iADs6inEZaBRHqLKlGGpRkmVstQ19EB77mcnG99SfMRWizPCz2UgnveEf prjb7iPBmMrNt2E/vo8kJzgmW0ic7N3bp1fZFHT7xZ/PatT3QGQTQSSPqxFuogbh95 becnVYpF3yCIQgzWFNYoQxMxJz5CJS/3TTTstw23hOB0Ob3OONQXCsnR1DVp7xY9YR lDY4597JzH0IQ== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id CBC6D62718 for ; Tue, 21 Mar 2023 18:20:14 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="TUikQCqH"; dkim-atps=neutral Received: from uno.homenet.telecomitalia.it (host-87-18-61-243.retail.telecomitalia.it [87.18.61.243]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 17ED61207; Tue, 21 Mar 2023 18:20:14 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1679419214; bh=SvlGingAbuAk31teNuj37mbGpJeg0IqJ0mjlriIz96k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TUikQCqHsBDrRN+3G3XEscG/1OheljUEK2a51pPSEJruFws16B0vkbGttFZ9fS8Q1 b2jR+53xgCNZtJKnGZRXY3lurBTXl4FfDi3MZAkGco0vlYLYCtMEGhVj3p+YB+fINz jZkw4YLpxov6UsCrhqSVg9g0V+Yy58uAV5MNXB68= To: libcamera-devel@lists.libcamera.org Date: Tue, 21 Mar 2023 18:20:04 +0100 Message-Id: <20230321172004.176852-5-jacopo.mondi@ideasonboard.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230321172004.176852-1-jacopo.mondi@ideasonboard.com> References: <20230321172004.176852-1-jacopo.mondi@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 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 Before this patch, a single RAW size was enumerated in stream formats * Pixelformat: SRGGB10 (4208x3120)-(4208x3120)/(+1,+1) - 4208x3120 With this patch applied all sensor's supported resolutions are enumerated but only when the stream role RAW is explicitly requested * Pixelformat: SRGGB10 (1048x780)-(4208x3120)/(+0,+0) - 1048x780 - 2104x1560 - 4032x3024 - 4208x3120 Signed-off-by: Jacopo Mondi Reviewed-by: Paul Elder Reviewed-by: Umang Jain --- 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 cca593b84260..8d606de7880f 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