From patchwork Tue Mar 7 11:48: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: 18354 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 EB4E9BDE17 for ; Tue, 7 Mar 2023 11:48:25 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 9CEBE626C3; Tue, 7 Mar 2023 12:48:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1678189705; bh=v+WGKwdwfLN7Z5/CqAoChHKxkVfoQXG8rWoPfrM3qqw=; 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=jyhF2Ko7D7YUHYssPU0JmALH3JHCRNjJG6fwvNT2ZBftR9XQnLacgXPKmglff1XBb BeZ/ns2j/BWDDX0HN2/FzlkhxODlIIW9l6wDFuwPgrSmOkRVm+OTNmCuBCaWv52k+W ovlf0w82ySiaA9luyLkbYoM+ID3kzzj3hduB6yOiJlL7YmV4pi3ikCYEUX6JEctnxN S98L4gtmHWuv5ZcpjB39s9XOradrM0AvNUm9I+w4WxLqhoxiGsjw9TzTEVxI8ap1ER nLD3ekwDBDCmqfxLwZ2NyHH4SN7G+3iZnpqIq1WwuzzwbLK7dMSOBR5/ndBn1NuV5F 0k8WacODQ5KCQ== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 416B5626BC for ; Tue, 7 Mar 2023 12:48:22 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="oeaKUbYx"; dkim-atps=neutral Received: from uno.homenet.telecomitalia.it (host-79-47-54-87.retail.telecomitalia.it [79.47.54.87]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 798246D5; Tue, 7 Mar 2023 12:48:21 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1678189702; bh=v+WGKwdwfLN7Z5/CqAoChHKxkVfoQXG8rWoPfrM3qqw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oeaKUbYx2Lw7D1VtoKlhlWSrs76XfjM7g2JPYl899fJWJtD7QW8gtHafGl4ZDzpgb GaeQ9X06KswSzI97Hg4ZlmSHQOITApc/V6CCm4VJPNZdaB7d38mGDqb6iPn5xmyhlI ippEt3wavZbXAOmINHlTI+0dFa+E/7TXTPfB3FdA= To: libcamera-devel@lists.libcamera.org Date: Tue, 7 Mar 2023 12:48:04 +0100 Message-Id: <20230307114804.42291-5-jacopo.mondi@ideasonboard.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230307114804.42291-1-jacopo.mondi@ideasonboard.com> References: <20230307114804.42291-1-jacopo.mondi@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 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