From patchwork Tue Jun 6 10:33:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 18712 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 ADDA1C32AA for ; Tue, 6 Jun 2023 10:33:58 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 438306289B; Tue, 6 Jun 2023 12:33:58 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1686047638; bh=996YIff6sc44emvGZn/JSjG5uaRBA99VXNCAIIBveF0=; 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=VUhLiWlBhu7rWvLxyvUSbZWG+N9xS3QEEhX75o1Eky3PgDCQ+WdQrsM5wuR898//E eUra4gLC2xlkUsDRbrter1QK0eUa4pFz6hpJtjHM/Ztt2axh3z9lwrPbdtYfYrt/z7 dLYjJ8msyOFQzLEUbTN6isfMHLAQH+atUxcBkX89qkh3BDPE+/AV/mjjnmbF3MFBA5 kzhB1eFUyltbKTLxFmDILX48cdE/MZwFvN0hlyY77BhcJzcjUUZCOzlXMfYcJ9EfLg TGRjLDIdBMIe+CGBaEbxGOI1JcuBd/LyviVYp+mNVmMsxcsweHBGecW/E2HMmrMvjO Qb3enBRCkgEFw== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 1D9F46289F for ; Tue, 6 Jun 2023 12:33:54 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="N+ly4Je1"; dkim-atps=neutral Received: from uno.LocalDomain (93-61-96-190.ip145.fastwebnet.it [93.61.96.190]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 9159DA38; Tue, 6 Jun 2023 12:33:28 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1686047608; bh=996YIff6sc44emvGZn/JSjG5uaRBA99VXNCAIIBveF0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N+ly4Je1myDyCbj8UdS+m0IvSxZwaHyWguCgfd6fkQhw7R+/BV43ReHpjTXJjMjrD 9ZMg7YPPBmB7M0YK7ZhpK/LU5FbX0FOR1ew5dzDvnjoSI7RfeI1Xup9MYoyM/e+FMr RFtpdOvRp/ZxZqqcR/9FS6FC9NlHlDurEYeYjlMI= To: libcamera-devel@lists.libcamera.org Date: Tue, 6 Jun 2023 12:33:36 +0200 Message-Id: <20230606103336.17782-5-jacopo.mondi@ideasonboard.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230606103336.17782-1-jacopo.mondi@ideasonboard.com> References: <20230606103336.17782-1-jacopo.mondi@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v5 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 Reviewed-by: Laurent Pinchart --- src/libcamera/pipeline/rkisp1/rkisp1_path.cpp | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp index 89fb6596b0be..b62b645cae24 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp @@ -149,18 +149,34 @@ RkISP1Path::generateConfiguration(const CameraSensor *sensor, const Size &size, 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.width > maxResolution_.width || + rawSize.height > maxResolution_.height) + continue; + + streamFormats[format].push_back({ rawSize, rawSize }); + } /* * Store the raw format with the highest bits per pixel for