{"id":21782,"url":"https://patchwork.libcamera.org/api/patches/21782/?format=json","web_url":"https://patchwork.libcamera.org/patch/21782/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20241031094957.18471-2-naush@raspberrypi.com>","date":"2024-10-31T09:49:51","name":"[v4,1/7] controls: rpi: Add a vendor rpi::ScalerCrops control","commit_ref":"dbcf6123a0a6aae2a3a61aca09b20675ce09fd20","pull_url":null,"state":"accepted","archived":false,"hash":"2c89055df492b3b16b7636d27758830d14abb36c","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/people/34/?format=json","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/21782/mbox/","series":[{"id":4760,"url":"https://patchwork.libcamera.org/api/series/4760/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4760","date":"2024-10-31T09:49:50","name":"Raspberry Pi: Add controls::rpi::ScalerCrops","version":4,"mbox":"https://patchwork.libcamera.org/series/4760/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/21782/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/21782/checks/","tags":{},"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 335C5C31E9\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 31 Oct 2024 09:52:51 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 526A6653B0;\n\tThu, 31 Oct 2024 10:52:46 +0100 (CET)","from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com\n\t[IPv6:2a00:1450:4864:20::32e])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 01BFD618BF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 31 Oct 2024 10:52:43 +0100 (CET)","by mail-wm1-x32e.google.com with SMTP id\n\t5b1f17b1804b1-4314ff68358so1142265e9.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 31 Oct 2024 02:52:43 -0700 (PDT)","from naush-laptop.pitowers.org ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\t5b1f17b1804b1-4327d6983c2sm19789835e9.42.2024.10.31.02.52.41\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 31 Oct 2024 02:52:41 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"LppGKVfi\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1730368362; x=1730973162;\n\tdarn=lists.libcamera.org; \n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=8/ci8H8fsu9Yoc9n9x2IcuZezTp6fDZVQyj4WcMUPxU=;\n\tb=LppGKVfigT60et+TPLytYaFzFXjh5zOcwTTD6p/WRCu8tgIe/GHAT5bBejO3mQvNzJ\n\tkiWBdnd/0dfX8BkLTgUoksdvkY24I2/4EBOK/w0eMDWz0HOUeEPm5Tb+VYmVlAfaUNIx\n\teYdoapogdUGI14bYhQuGPPNslJGY/lqlf/ivZpibIWKM50jOQPHh3VX7Y9OsI9SKTUbs\n\tB5wpq7A7Z/891q2xo6UI5CdJMtPtshTmSFxnPIbkquoh4sV4EbUe28iSnSfCzxhqGd9B\n\tNMKi6P1J2rbvCw9F+O1m/2XonaygZq1rlz7o08Z8+x2zHIvcEUPgqilGnV60IFfPQC+0\n\tf9oQ==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1730368362; x=1730973162;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n\t:subject:date:message-id:reply-to;\n\tbh=8/ci8H8fsu9Yoc9n9x2IcuZezTp6fDZVQyj4WcMUPxU=;\n\tb=aIdVU62af75xjSPo9Lcdz1SDIgdTHZA3BjkBYq2LVPymZanSrMrv80bmjxLAXv7Oh4\n\tmAGTcfQlLjI6aeYvclhkfSVs15If5BKd389mdmmSFiz+P/1a66u4DI7N2CwKueoRDAC4\n\tf1e6A7NYwtusFJocONIa34wzgaVZdCBFgZfcS7aqCia/f+3bLSY9X0zGGmZrhf0W4CcZ\n\tL3wn/VEGkJ4HpNSnOKJ5fsa88M9Nw9Y9xGSfyI3sndxl629vKmzzCJ9CV+BnVzyknfvN\n\tug+jAGLkSGVa+8gpJ8689wvY/+y0vNn1dcM8K+rEehlJgbBS7WGravoiMLjVfqSLNRsQ\n\tLfIA==","X-Gm-Message-State":"AOJu0YyOx6gc72uDPGr+rUOXJKlpqQhPi9E9afxLnF5vyhpQmZC2pJN2\n\tOAywsZKPJ/rXRngZb1IowLBi22T8xmc/LJEFE+QvNVkfwg/XnV/8JRCvgIST6cxWiQsLEl3euDT\n\tO","X-Google-Smtp-Source":"AGHT+IHM+uNXgDWRhfJGYPQMhJ0Z5bsNMBQlbqUtSVgl39pmAWyU7hFN+JcAQynmwUyVjswMO7lySw==","X-Received":"by 2002:a05:600c:4449:b0:42c:b870:c52e with SMTP id\n\t5b1f17b1804b1-4319ac85e9amr69282405e9.1.1730368362196; \n\tThu, 31 Oct 2024 02:52:42 -0700 (PDT)","From":"Naushir Patuck <naush@raspberrypi.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Naushir Patuck <naush@raspberrypi.com>,\n\tJacopo Mondi <jacopo.mondi@ideasonboard.com>,\n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>","Subject":"[PATCH v4 1/7] controls: rpi: Add a vendor rpi::ScalerCrops control","Date":"Thu, 31 Oct 2024 09:49:51 +0000","Message-Id":"<20241031094957.18471-2-naush@raspberrypi.com>","X-Mailer":"git-send-email 2.34.1","In-Reply-To":"<20241031094957.18471-1-naush@raspberrypi.com>","References":"<20241031094957.18471-1-naush@raspberrypi.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","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>"},"content":"Add a vendor control rpi::ScalerCrops that is analogous to the current\ncore::ScalerCrop, but can apply a different crop to each configured\nstream.\n\nThis control takes a span of Rectangle structures - the order of\nrectangles must match the order of streams configured by the application.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\nReviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/ipa/rpi/common/ipa_base.cpp    | 12 ++++++++++++\n src/libcamera/control_ids_rpi.yaml | 25 +++++++++++++++++++++++++\n 2 files changed, 37 insertions(+)","diff":"diff --git a/src/ipa/rpi/common/ipa_base.cpp b/src/ipa/rpi/common/ipa_base.cpp\nindex ee3848b54f21..468f36a82ab2 100644\n--- a/src/ipa/rpi/common/ipa_base.cpp\n+++ b/src/ipa/rpi/common/ipa_base.cpp\n@@ -96,6 +96,13 @@ const ControlInfoMap::Map ipaAfControls{\n \t{ &controls::LensPosition, ControlInfo(0.0f, 32.0f, 1.0f) }\n };\n \n+/* Platform specific controls */\n+const std::map<const std::string, ControlInfoMap::Map> platformControls {\n+\t{ \"pisp\", {\n+\t\t{ &controls::rpi::ScalerCrops, ControlInfo(Rectangle{}, Rectangle(65535, 65535, 65535, 65535), Rectangle{}) }\n+\t} },\n+};\n+\n } /* namespace */\n \n LOG_DEFINE_CATEGORY(IPARPI)\n@@ -159,6 +166,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 +1081,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;\ndiff --git a/src/libcamera/control_ids_rpi.yaml b/src/libcamera/control_ids_rpi.yaml\nindex 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 ...\n","prefixes":["v4","1/7"]}