[{"id":27286,"web_url":"https://patchwork.libcamera.org/comment/27286/","msgid":"<20230606153932.GB25679@pendragon.ideasonboard.com>","date":"2023-06-06T15:39:32","subject":"Re: [libcamera-devel] [PATCH v5 4/4] libcamera: rkisp1: Fix\n\tenumeration of RAW formats","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Jacopo,\n\nThank you for the patch.\n\nOn Tue, Jun 06, 2023 at 12:33:36PM +0200, Jacopo Mondi via libcamera-devel wrote:\n> The current implementation enumerates a single RAW format (the sensor's\n> resolution) and does that regardless of what role the\n> CameraConfiguration has been generated for.\n> \n> Fix this by:\n> - Enumerate RAW StreamFormats only when the requested role is\n>   StreamRole::Raw\n> - Add all the sensor's provided resolutions that fit the video device\n>   output maximum size\n> \n> Before this patch, a single RAW size was enumerated in stream formats\n> \n>  * Pixelformat: SRGGB10 (4208x3120)-(4208x3120)/(+1,+1)\n>   - 4208x3120\n> \n> With this patch applied all sensor's supported resolutions are\n> enumerated but only when the stream role RAW is explicitly requested\n> \n>  * Pixelformat: SRGGB10 (1048x780)-(4208x3120)/(+0,+0)\n>   - 1048x780\n>   - 2104x1560\n>   - 4032x3024\n>   - 4208x3120\n> \n> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> ---\n>  src/libcamera/pipeline/rkisp1/rkisp1_path.cpp | 20 +++++++++++++++++--\n>  1 file changed, 18 insertions(+), 2 deletions(-)\n> \n> diff --git a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp\n> index 89fb6596b0be..b62b645cae24 100644\n> --- a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp\n> +++ b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp\n> @@ -149,18 +149,34 @@ RkISP1Path::generateConfiguration(const CameraSensor *sensor, const Size &size,\n>  \tfor (const auto &format : streamFormats_) {\n>  \t\tconst PixelFormatInfo &info = PixelFormatInfo::info(format);\n>  \n> +\t\t/* Populate stream formats for non-RAW configurations. */\n>  \t\tif (info.colourEncoding != PixelFormatInfo::ColourEncodingRAW) {\n> +\t\t\tif (role == StreamRole::Raw)\n> +\t\t\t\tcontinue;\n> +\n>  \t\t\tstreamFormats[format] = { { minResolution, maxResolution } };\n>  \t\t\tcontinue;\n>  \t\t}\n>  \n> -\t\t/* Skip raw formats not supported by the sensor. */\n> +\t\t/* Skip RAW formats for non-raw roles. */\n> +\t\tif (role != StreamRole::Raw)\n> +\t\t\tcontinue;\n> +\n> +\t\t/* Populate stream formats for RAW configurations. */\n>  \t\tuint32_t mbusCode = formatToMediaBus.at(format);\n>  \t\tif (std::find(mbusCodes.begin(), mbusCodes.end(), mbusCode) ==\n>  \t\t    mbusCodes.end())\n> +\t\t\t/* Skip formats not supported by sensor. */\n>  \t\t\tcontinue;\n>  \n> -\t\tstreamFormats[format] = { { resolution, resolution } };\n> +\t\t/* Add all the RAW sizes the sensor can produce for this code. */\n> +\t\tfor (const auto &rawSize : sensor->sizes(mbusCode)) {\n> +\t\t\tif (rawSize.width > maxResolution_.width ||\n> +\t\t\t    rawSize.height > maxResolution_.height)\n> +\t\t\t\tcontinue;\n> +\n> +\t\t\tstreamFormats[format].push_back({ rawSize, rawSize });\n> +\t\t}\n>  \n>  \t\t/*\n>  \t\t * Store the raw format with the highest bits per pixel for","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id D1F59C31E9\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  6 Jun 2023 15:39:37 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 915516287E;\n\tTue,  6 Jun 2023 17:39:37 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 0F71162722\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  6 Jun 2023 17:39:36 +0200 (CEST)","from pendragon.ideasonboard.com (om126253223039.31.openmobile.ne.jp\n\t[126.253.223.39])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id B73EEAB;\n\tTue,  6 Jun 2023 17:39:09 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1686065977;\n\tbh=uXwISW6kP6ugKz7YEioGY/0KlAbW1LD1dG2IkPzzDnA=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=v/n7qqHNID9A+VgnizcgCP+T2FDnvCn/4a8L9YYd/LZHIlGjqZtaJB9gUFIS1mLJG\n\tTr98X/ouszuPpYIPsl6ZB/+7wpGojHrpukz9K/Pix8GySKrY/FkZN2AFbr0nTDYpwW\n\tGfZgST53DsDquojUC0UtD7tjzBzK+z8nWBFKC+g070FIw+SV3Tg35LHyeunxgtUwuM\n\tTwF4Onj0sc4u0hBWT4ROpPoKCeBo8AMFdmX5l3knc2xUOwvdGwmm7ek7jAH9zIGYlq\n\t9pitRZXrk7D/tWV+3AC3HSmBRJal7zpXLXCoT/DvJIfbMHrr06JW/nS6HJuwXsk1tQ\n\tyG31SDDPR1GQA==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1686065950;\n\tbh=uXwISW6kP6ugKz7YEioGY/0KlAbW1LD1dG2IkPzzDnA=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=RIXjX0QONNHWlP4hpI9JVYjOYLBu2adG7ZRl6vU+RLXVvplfuM5mel89k84DikCCa\n\tN3DlZQYkKeFyxggAJ4V2eAgssh+CmUPLgf0zdN9x4Sts6YM5N7x/kdfOkig0JjcB4J\n\tAhPdf2apFF6oq3iCJNDcx8NP42gp/hoArRXxiBiE="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"RIXjX0QO\"; dkim-atps=neutral","Date":"Tue, 6 Jun 2023 18:39:32 +0300","To":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","Message-ID":"<20230606153932.GB25679@pendragon.ideasonboard.com>","References":"<20230606103336.17782-1-jacopo.mondi@ideasonboard.com>\n\t<20230606103336.17782-5-jacopo.mondi@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20230606103336.17782-5-jacopo.mondi@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH v5 4/4] libcamera: rkisp1: Fix\n\tenumeration of RAW formats","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org, libcamera@luigi311.com","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]