From patchwork Thu Oct 3 07:47:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 21487 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id BC12ABD80A for ; Thu, 3 Oct 2024 07:53:53 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 4C00263525; Thu, 3 Oct 2024 09:53:49 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="JNn33N0H"; dkim-atps=neutral Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 3B6A76351F for ; Thu, 3 Oct 2024 09:53:45 +0200 (CEST) Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-42cae563348so1105805e9.0 for ; Thu, 03 Oct 2024 00:53:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1727942024; x=1728546824; darn=lists.libcamera.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ZtSclxseLGwOqhwBSFiuoCXZTAi6XcvSaWhU/rWpZxA=; b=JNn33N0Hw2+F4dL2mARu3s1d9CguTuERusaVTTb3WXQcM9ELpQpEZsjPkvgHqb1QVy OmqQHfzIPH1pZivnuKjH2BZRgxaYA95+Zs2wpOTM3GkM2dNsXITspyVwlqmlmW4MKErM RnFaao19smnIqPhXQaeDX815Gm3xs1asoEKo5vrGcteDY6lQDamaRNGQmLWh2u+scUO2 w+i+5QqSDxa1RktKfvCYua/AJXab1xe+aSja4Nn6XRFRl3PiIG0xi2tkU6CiVoanRqH3 h4ay8qHTY+DM9yxfqQ+A5Ba0dzJC34nGlSBiqZ9FetfroqpqFxMewIlrblsb9I2pJrkN DinA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727942024; x=1728546824; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZtSclxseLGwOqhwBSFiuoCXZTAi6XcvSaWhU/rWpZxA=; b=kVBLWQIuasMZCdrKgXL4dkI2TgijWYxPbIJomgA7QzDJhtj71HEjl3xXmhKcZOeVnX rkn0oWCmcaRGrhP9KmSyrUnSM60sAVO4jiZ/IBIbXc4/1zyM+kkCTEXpMObi91LUWhmP QGLFe3iDerDiGs4MILYPuNeAZIAB35ZjgVqXVIJvCYRAzKM+kjuqxJZsk4Lvvf8Ql0Q0 OiN84eluNTCUhJQ35DB9Fo49UIydhU6uyTu0/B5f6jYyzRRzv5kn5GHKtem4DARAWbTb 1fqVaWRHW4mSX/yfOpjLzfWGh9akwICdL/RU+6aMR/OKpuHwXL88HKQibo/QeKy+85VH Qjuw== X-Gm-Message-State: AOJu0YxQn0cNc0Prb48nmMeWFsHi7V0QJDC2MUTLpNogZC9c67mqUbS9 734hu8/xAoN31IvI/LGRhb5Poh78Q+Gx7Bke8W4R6arMXuaGaIaOZFaJ75pNmm3MmPobFuFBG4D 4 X-Google-Smtp-Source: AGHT+IGHbhyeUhy2i0DU+Q55Izhudb6iapOCwvyBF6movKh6pu3HlLyKisSsCawNYUxqmX1TvB3Cmg== X-Received: by 2002:a05:600c:3c93:b0:42c:bb35:b6d0 with SMTP id 5b1f17b1804b1-42f777b0043mr19815525e9.1.1727942024294; Thu, 03 Oct 2024 00:53:44 -0700 (PDT) Received: from naush-laptop.pitowers.org ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42f8025b583sm8740825e9.12.2024.10.03.00.53.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Oct 2024 00:53:43 -0700 (PDT) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Cc: Naushir Patuck , Jacopo Mondi 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 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Add a vendor control rpi::ScalerCrops that is analogous to the current core::ScalerCrop, but can apply a different crop to each configured stream. This control takes a span of Rectangle structures - the order of rectangles must match the order of streams configured by the application. Signed-off-by: Naushir Patuck Reviewed-by: Jacopo Mondi Reviewed-by: Laurent Pinchart --- src/ipa/rpi/common/ipa_base.cpp | 14 ++++++++++++++ src/libcamera/control_ids_rpi.yaml | 25 +++++++++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/src/ipa/rpi/common/ipa_base.cpp b/src/ipa/rpi/common/ipa_base.cpp index ee3848b54f21..d408cdb74255 100644 --- a/src/ipa/rpi/common/ipa_base.cpp +++ b/src/ipa/rpi/common/ipa_base.cpp @@ -96,6 +96,15 @@ const ControlInfoMap::Map ipaAfControls{ { &controls::LensPosition, ControlInfo(0.0f, 32.0f, 1.0f) } }; +/* Platform specific controls */ +const std::map platformControls { + { "pisp", + { + { &controls::rpi::ScalerCrops, ControlInfo(Rectangle{}, Rectangle(65535, 65535, 65535, 65535), Rectangle{}) } + } + }, +}; + } /* namespace */ LOG_DEFINE_CATEGORY(IPARPI) @@ -159,6 +168,10 @@ int32_t IpaBase::init(const IPASettings &settings, const InitParams ¶ms, Ini if (lensPresent_) ctrlMap.merge(ControlInfoMap::Map(ipaAfControls)); + auto platformCtrlsIt = platformControls.find(controller_.getTarget()); + if (platformCtrlsIt != platformControls.end()) + ctrlMap.merge(ControlInfoMap::Map(platformCtrlsIt->second)); + monoSensor_ = params.sensorInfo.cfaPattern == properties::draft::ColorFilterArrangementEnum::MONO; if (!monoSensor_) ctrlMap.merge(ControlInfoMap::Map(ipaColourControls)); @@ -1070,6 +1083,7 @@ void IpaBase::applyControls(const ControlList &controls) break; } + case controls::rpi::SCALER_CROPS: case controls::SCALER_CROP: { /* We do nothing with this, but should avoid the warning below. */ break; diff --git a/src/libcamera/control_ids_rpi.yaml b/src/libcamera/control_ids_rpi.yaml index 42c4bf5d408f..34bbdfc863c5 100644 --- a/src/libcamera/control_ids_rpi.yaml +++ b/src/libcamera/control_ids_rpi.yaml @@ -30,4 +30,29 @@ controls: \sa StatsOutputEnable + - ScalerCrops: + type: Rectangle + size: [n] + description: | + An array of rectangles, where each singular value has identical + functionality to the ScalerCrop control. This control allows the + Raspberry Pi pipeline handler to control individual scaler crops per + output stream. + + The order of rectangles passed into the control must match the order of + streams configured by the application. The pipeline handler will only + configure crop retangles up-to the number of output streams configured. + All subsequent rectangles passed into this control are ignored by the + pipeline handler. + + If both rpi::ScalerCrops and ScalerCrop controls are present in a + ControlList, the latter is discarded, and crops are obtained from this + control. + + Note that using different crop rectangles for each output stream with + this control is only applicable on the Pi5/PiSP platform. This control + should also be considered temporary/draft and will be replaced with + official libcamera API support for per-stream controls in the future. + + \sa ScalerCrop ...