[{"id":31948,"web_url":"https://patchwork.libcamera.org/comment/31948/","msgid":"<20241028213026.GA22600@pendragon.ideasonboard.com>","date":"2024-10-28T21:30:26","subject":"Re: [PATCH v3 1/7] controls: rpi: Add a vendor rpi::ScalerCrops\n\tcontrol","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Naush,\n\nThank you for the patch.\n\nOn Thu, Oct 03, 2024 at 08:47:14AM +0100, Naushir Patuck wrote:\n> Add a vendor control rpi::ScalerCrops that is analogous to the current\n> core::ScalerCrop, but can apply a different crop to each configured\n> stream.\n> \n> This control takes a span of Rectangle structures - the order of\n> rectangles must match the order of streams configured by the application.\n> \n> Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n> ---\n>  src/ipa/rpi/common/ipa_base.cpp    | 14 ++++++++++++++\n>  src/libcamera/control_ids_rpi.yaml | 25 +++++++++++++++++++++++++\n>  2 files changed, 39 insertions(+)\n> \n> diff --git a/src/ipa/rpi/common/ipa_base.cpp b/src/ipa/rpi/common/ipa_base.cpp\n> index ee3848b54f21..d408cdb74255 100644\n> --- a/src/ipa/rpi/common/ipa_base.cpp\n> +++ b/src/ipa/rpi/common/ipa_base.cpp\n> @@ -96,6 +96,15 @@ const ControlInfoMap::Map ipaAfControls{\n>  \t{ &controls::LensPosition, ControlInfo(0.0f, 32.0f, 1.0f) }\n>  };\n>  \n> +/* Platform specific controls */\n\ns/Platform specific/Platform-specific/\n\n> +const std::map<const std::string, ControlInfoMap::Map> platformControls {\n> +\t{ \"pisp\",\n> +\t  {\n> +\t\t{ &controls::rpi::ScalerCrops, ControlInfo(Rectangle{}, Rectangle(65535, 65535, 65535, 65535), Rectangle{}) }\n> +\t  }\n\nTwo spaces is a weird indentation. You can write\n\n\t{ \"pisp\", {\n\t\t{ &controls::rpi::ScalerCrops, ControlInfo(Rectangle{}, Rectangle(65535, 65535, 65535, 65535), Rectangle{}) }\n\t} },\n\nI'll make those modifications when applying.\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> +\t},\n> +};\n> +\n>  } /* namespace */\n>  \n>  LOG_DEFINE_CATEGORY(IPARPI)\n> @@ -159,6 +168,10 @@ int32_t IpaBase::init(const IPASettings &settings, const InitParams &params, Ini\n>  \tif (lensPresent_)\n>  \t\tctrlMap.merge(ControlInfoMap::Map(ipaAfControls));\n>  \n> +\tauto platformCtrlsIt = platformControls.find(controller_.getTarget());\n> +\tif (platformCtrlsIt != platformControls.end())\n> +\t\tctrlMap.merge(ControlInfoMap::Map(platformCtrlsIt->second));\n> +\n>  \tmonoSensor_ = params.sensorInfo.cfaPattern == properties::draft::ColorFilterArrangementEnum::MONO;\n>  \tif (!monoSensor_)\n>  \t\tctrlMap.merge(ControlInfoMap::Map(ipaColourControls));\n> @@ -1070,6 +1083,7 @@ void IpaBase::applyControls(const ControlList &controls)\n>  \t\t\tbreak;\n>  \t\t}\n>  \n> +\t\tcase controls::rpi::SCALER_CROPS:\n>  \t\tcase controls::SCALER_CROP: {\n>  \t\t\t/* We do nothing with this, but should avoid the warning below. */\n>  \t\t\tbreak;\n> diff --git a/src/libcamera/control_ids_rpi.yaml b/src/libcamera/control_ids_rpi.yaml\n> index 42c4bf5d408f..34bbdfc863c5 100644\n> --- a/src/libcamera/control_ids_rpi.yaml\n> +++ b/src/libcamera/control_ids_rpi.yaml\n> @@ -30,4 +30,29 @@ controls:\n>  \n>          \\sa StatsOutputEnable\n>  \n> +  - ScalerCrops:\n> +      type: Rectangle\n> +      size: [n]\n> +      description: |\n> +        An array of rectangles, where each singular value has identical\n> +        functionality to the ScalerCrop control. This control allows the\n> +        Raspberry Pi pipeline handler to control individual scaler crops per\n> +        output stream.\n> +\n> +        The order of rectangles passed into the control must match the order of\n> +        streams configured by the application. The pipeline handler will only\n> +        configure crop retangles up-to the number of output streams configured.\n> +        All subsequent rectangles passed into this control are ignored by the\n> +        pipeline handler.\n> +\n> +        If both rpi::ScalerCrops and ScalerCrop controls are present in a\n> +        ControlList, the latter is discarded, and crops are obtained from this\n> +        control.\n> +\n> +        Note that using different crop rectangles for each output stream with\n> +        this control is only applicable on the Pi5/PiSP platform. This control\n> +        should also be considered temporary/draft and will be replaced with\n> +        official libcamera API support for per-stream controls in the future.\n> +\n> +        \\sa ScalerCrop\n>  ...","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 C319DBDE6B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 28 Oct 2024 21:30:36 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 5762E6539E;\n\tMon, 28 Oct 2024 22:30:35 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9E7C960367\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 28 Oct 2024 22:30:33 +0100 (CET)","from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi\n\t[81.175.209.231])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 488AF1BF5;\n\tMon, 28 Oct 2024 22:30:30 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"vYxfv26T\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1730151030;\n\tbh=r1rcf88DDyw4z7Iz4QohyekoTYnQuRgKrsGPBbd3fS4=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=vYxfv26TAaCiqSjobcHCSkbW21EuAh6SM4UivQ50oyk7sgOQb8lSsGZuVGbXDgLde\n\tFHv3DmkGLQ8sVxNrKRuk3Iz9nbhERuu3RcI/V5BB96Q+wYqHdOlLCHKKpEQMwaedVV\n\tSTyeiaB5Nk8/L+SellH5NuyC8WljJ32wu99ktWbk=","Date":"Mon, 28 Oct 2024 23:30:26 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Naushir Patuck <naush@raspberrypi.com>","Cc":"libcamera-devel@lists.libcamera.org,\n\tJacopo Mondi <jacopo.mondi@ideasonboard.com>","Subject":"Re: [PATCH v3 1/7] controls: rpi: Add a vendor rpi::ScalerCrops\n\tcontrol","Message-ID":"<20241028213026.GA22600@pendragon.ideasonboard.com>","References":"<20241003074720.18882-1-naush@raspberrypi.com>\n\t<20241003074720.18882-2-naush@raspberrypi.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20241003074720.18882-2-naush@raspberrypi.com>","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]