{"id":21426,"url":"https://patchwork.libcamera.org/api/patches/21426/?format=json","web_url":"https://patchwork.libcamera.org/patch/21426/","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":"<20240930141415.8857-2-naush@raspberrypi.com>","date":"2024-09-30T14:14:09","name":"[v2,1/7] controls: rpi: Add a vendor rpi::ScalerCrops control","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"b3a3b771528eae345cb11f8c710f7a0aa19a2e32","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/21426/mbox/","series":[{"id":4639,"url":"https://patchwork.libcamera.org/api/series/4639/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4639","date":"2024-09-30T14:14:08","name":"Raspberry Pi: Add controls::rpi::ScalerCrops","version":2,"mbox":"https://patchwork.libcamera.org/series/4639/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/21426/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/21426/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 C91AFC0F1B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 30 Sep 2024 14:14:05 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 11C976351B;\n\tMon, 30 Sep 2024 16:14:01 +0200 (CEST)","from mail-wr1-x434.google.com (mail-wr1-x434.google.com\n\t[IPv6:2a00:1450:4864:20::434])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B209B63502\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 30 Sep 2024 16:13:58 +0200 (CEST)","by mail-wr1-x434.google.com with SMTP id\n\tffacd0b85a97d-37cd2cb5615so273078f8f.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 30 Sep 2024 07:13:58 -0700 (PDT)","from naush-laptop.pitowers.org ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\tffacd0b85a97d-37cd56e65c3sm9142524f8f.60.2024.09.30.07.13.57\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 30 Sep 2024 07:13:57 -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=\"T8wsFsMY\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1727705638; x=1728310438;\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=EQFExxm0qpcWemMa3lAXV5NHRANGRK2YCcMz0z9hqDc=;\n\tb=T8wsFsMYP0zOxr5dKr4bvMkHry4K5jdCD1MXurm8Z8J73X5GVn6aOzMcxZT4JLYmto\n\tXGqzLzzoFtzQ5ovbcSu5taViFQRreyik+LuyuOcJwOgpUmPQerRoIFnytTTHpDbkKGlB\n\t5yBA9COMDPgCIcNWwP3cWgbGI7dGQEYT/Bewy3XCgonwEfRBxezSEgGDxFWkywvDIGiO\n\t8ea68Xflgj4yHzhcrnxP4ko++qzmgvV8omynDeRwBo1zlTbQ/P1IBEJ88BnRBgsORBxd\n\t/vp7JfQwWdR8JUi3hlWzkXp9FPypSOKgC0zrOyt83ejBVVEyA709si7KFwCmFLm9qJpM\n\tOIHA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1727705638; x=1728310438;\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=EQFExxm0qpcWemMa3lAXV5NHRANGRK2YCcMz0z9hqDc=;\n\tb=kCPjtkKQ7O3vfY3OXctShnrinGQnmqv07Nl0ZybeBNYsv72WIKl7xfQZrFM3WRwhdf\n\t9Th45mNoIC3dFJ6Y6b9q/1iL00CkoBMVQppBBJaIBCf0StVK/A4uszpgNvQSjj+YtipJ\n\ttSPo4QkE0BQofS1/uvjo787GvP7b8cDdIC8rbKOGgfu2mXASyNX8qi4Z1wtnJ+g+KXDU\n\tbM00KsjHVmTGou8K6AhzK7zdnH8AJvuMTA4tPNOM/7Mp1yAjyWvsNiuqUTp8aG0q04Sa\n\tOlqK98+zlSlThP9oakPeV6frWKJ+ACziz3H+XpXNXjsufJWs0T6o2ASou90bBonCxVLR\n\t5uhw==","X-Gm-Message-State":"AOJu0YyUbFw5VVRHvLdTxqUTbiJsPuHnuImtKhB1bNq5q41vMqhb1iMn\n\tcYQ6kyvmj67IA49uJxbqfb42vhgcKCQ/aRneeJW2MNv2/LHR8P3NZzvyd8H71nI54/QlnfCYCPQ\n\tm","X-Google-Smtp-Source":"AGHT+IGFhJxmx27aC/ao+Fd9llOgog8QyIp6ToM9Wtp6+6bWPJ69Fs0qZpn6bAV9GE8aGu2+7Nsydg==","X-Received":"by 2002:a5d:64ec:0:b0:376:3ef8:61ab with SMTP id\n\tffacd0b85a97d-37cde3f79famr2503105f8f.8.1727705637789; \n\tMon, 30 Sep 2024 07:13:57 -0700 (PDT)","From":"Naushir Patuck <naush@raspberrypi.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Naushir Patuck <naush@raspberrypi.com>","Subject":"[PATCH v2 1/7] controls: rpi: Add a vendor rpi::ScalerCrops control","Date":"Mon, 30 Sep 2024 15:14:09 +0100","Message-Id":"<20240930141415.8857-2-naush@raspberrypi.com>","X-Mailer":"git-send-email 2.34.1","In-Reply-To":"<20240930141415.8857-1-naush@raspberrypi.com>","References":"<20240930141415.8857-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>\n---\n src/ipa/rpi/common/ipa_base.cpp    | 14 ++++++++++++++\n src/libcamera/control_ids_rpi.yaml | 21 +++++++++++++++++++++\n 2 files changed, 35 insertions(+)","diff":"diff --git a/src/ipa/rpi/common/ipa_base.cpp b/src/ipa/rpi/common/ipa_base.cpp\nindex 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+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+\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;\ndiff --git a/src/libcamera/control_ids_rpi.yaml b/src/libcamera/control_ids_rpi.yaml\nindex cb097f887e16..a0fc1cd897b5 100644\n--- a/src/libcamera/control_ids_rpi.yaml\n+++ b/src/libcamera/control_ids_rpi.yaml\n@@ -26,4 +26,25 @@ 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+        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":["v2","1/7"]}