{"id":21487,"url":"https://patchwork.libcamera.org/api/1.1/patches/21487/?format=json","web_url":"https://patchwork.libcamera.org/patch/21487/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/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":"<20241003074720.18882-2-naush@raspberrypi.com>","date":"2024-10-03T07:47:14","name":"[v3,1/7] controls: rpi: Add a vendor rpi::ScalerCrops control","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"b6b3d8e09db77a3153375b3436b9be8f6a8153ed","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/1.1/people/34/?format=json","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/21487/mbox/","series":[{"id":4651,"url":"https://patchwork.libcamera.org/api/1.1/series/4651/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4651","date":"2024-10-03T07:47:13","name":"Raspberry Pi: Add controls::rpi::ScalerCrops","version":3,"mbox":"https://patchwork.libcamera.org/series/4651/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/21487/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/21487/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 BC12ABD80A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  3 Oct 2024 07:53:53 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 4C00263525;\n\tThu,  3 Oct 2024 09:53:49 +0200 (CEST)","from mail-wm1-x335.google.com (mail-wm1-x335.google.com\n\t[IPv6:2a00:1450:4864:20::335])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3B6A76351F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  3 Oct 2024 09:53:45 +0200 (CEST)","by mail-wm1-x335.google.com with SMTP id\n\t5b1f17b1804b1-42cae563348so1105805e9.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 03 Oct 2024 00:53:45 -0700 (PDT)","from naush-laptop.pitowers.org ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\t5b1f17b1804b1-42f8025b583sm8740825e9.12.2024.10.03.00.53.43\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 03 Oct 2024 00:53:43 -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=\"JNn33N0H\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1727942024; x=1728546824;\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=ZtSclxseLGwOqhwBSFiuoCXZTAi6XcvSaWhU/rWpZxA=;\n\tb=JNn33N0Hw2+F4dL2mARu3s1d9CguTuERusaVTTb3WXQcM9ELpQpEZsjPkvgHqb1QVy\n\tOmqQHfzIPH1pZivnuKjH2BZRgxaYA95+Zs2wpOTM3GkM2dNsXITspyVwlqmlmW4MKErM\n\tRnFaao19smnIqPhXQaeDX815Gm3xs1asoEKo5vrGcteDY6lQDamaRNGQmLWh2u+scUO2\n\tw+i+5QqSDxa1RktKfvCYua/AJXab1xe+aSja4Nn6XRFRl3PiIG0xi2tkU6CiVoanRqH3\n\th4ay8qHTY+DM9yxfqQ+A5Ba0dzJC34nGlSBiqZ9FetfroqpqFxMewIlrblsb9I2pJrkN\n\tDinA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1727942024; x=1728546824;\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=ZtSclxseLGwOqhwBSFiuoCXZTAi6XcvSaWhU/rWpZxA=;\n\tb=kVBLWQIuasMZCdrKgXL4dkI2TgijWYxPbIJomgA7QzDJhtj71HEjl3xXmhKcZOeVnX\n\trkn0oWCmcaRGrhP9KmSyrUnSM60sAVO4jiZ/IBIbXc4/1zyM+kkCTEXpMObi91LUWhmP\n\tQGLFe3iDerDiGs4MILYPuNeAZIAB35ZjgVqXVIJvCYRAzKM+kjuqxJZsk4Lvvf8Ql0Q0\n\tOiN84eluNTCUhJQ35DB9Fo49UIydhU6uyTu0/B5f6jYyzRRzv5kn5GHKtem4DARAWbTb\n\t1fqVaWRHW4mSX/yfOpjLzfWGh9akwICdL/RU+6aMR/OKpuHwXL88HKQibo/QeKy+85VH\n\tQjuw==","X-Gm-Message-State":"AOJu0YxQn0cNc0Prb48nmMeWFsHi7V0QJDC2MUTLpNogZC9c67mqUbS9\n\t734hu8/xAoN31IvI/LGRhb5Poh78Q+Gx7Bke8W4R6arMXuaGaIaOZFaJ75pNmm3MmPobFuFBG4D\n\t4","X-Google-Smtp-Source":"AGHT+IGHbhyeUhy2i0DU+Q55Izhudb6iapOCwvyBF6movKh6pu3HlLyKisSsCawNYUxqmX1TvB3Cmg==","X-Received":"by 2002:a05:600c:3c93:b0:42c:bb35:b6d0 with SMTP id\n\t5b1f17b1804b1-42f777b0043mr19815525e9.1.1727942024294; \n\tThu, 03 Oct 2024 00:53:44 -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>","Subject":"[PATCH v3 1/7] controls: rpi: Add a vendor rpi::ScalerCrops control","Date":"Thu,  3 Oct 2024 08:47:14 +0100","Message-Id":"<20241003074720.18882-2-naush@raspberrypi.com>","X-Mailer":"git-send-email 2.34.1","In-Reply-To":"<20241003074720.18882-1-naush@raspberrypi.com>","References":"<20241003074720.18882-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>\n---\n src/ipa/rpi/common/ipa_base.cpp    | 14 ++++++++++++++\n src/libcamera/control_ids_rpi.yaml | 25 +++++++++++++++++++++++++\n 2 files changed, 39 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 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":["v3","1/7"]}