From patchwork Thu Oct 31 09:49:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 21782 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 335C5C31E9 for ; Thu, 31 Oct 2024 09:52:51 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 526A6653B0; Thu, 31 Oct 2024 10:52:46 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="LppGKVfi"; dkim-atps=neutral Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 01BFD618BF for ; Thu, 31 Oct 2024 10:52:43 +0100 (CET) Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-4314ff68358so1142265e9.1 for ; Thu, 31 Oct 2024 02:52:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1730368362; x=1730973162; 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=8/ci8H8fsu9Yoc9n9x2IcuZezTp6fDZVQyj4WcMUPxU=; b=LppGKVfigT60et+TPLytYaFzFXjh5zOcwTTD6p/WRCu8tgIe/GHAT5bBejO3mQvNzJ kiWBdnd/0dfX8BkLTgUoksdvkY24I2/4EBOK/w0eMDWz0HOUeEPm5Tb+VYmVlAfaUNIx eYdoapogdUGI14bYhQuGPPNslJGY/lqlf/ivZpibIWKM50jOQPHh3VX7Y9OsI9SKTUbs B5wpq7A7Z/891q2xo6UI5CdJMtPtshTmSFxnPIbkquoh4sV4EbUe28iSnSfCzxhqGd9B NMKi6P1J2rbvCw9F+O1m/2XonaygZq1rlz7o08Z8+x2zHIvcEUPgqilGnV60IFfPQC+0 f9oQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730368362; x=1730973162; 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=8/ci8H8fsu9Yoc9n9x2IcuZezTp6fDZVQyj4WcMUPxU=; b=aIdVU62af75xjSPo9Lcdz1SDIgdTHZA3BjkBYq2LVPymZanSrMrv80bmjxLAXv7Oh4 mAGTcfQlLjI6aeYvclhkfSVs15If5BKd389mdmmSFiz+P/1a66u4DI7N2CwKueoRDAC4 f1e6A7NYwtusFJocONIa34wzgaVZdCBFgZfcS7aqCia/f+3bLSY9X0zGGmZrhf0W4CcZ L3wn/VEGkJ4HpNSnOKJ5fsa88M9Nw9Y9xGSfyI3sndxl629vKmzzCJ9CV+BnVzyknfvN ug+jAGLkSGVa+8gpJ8689wvY/+y0vNn1dcM8K+rEehlJgbBS7WGravoiMLjVfqSLNRsQ LfIA== X-Gm-Message-State: AOJu0YyOx6gc72uDPGr+rUOXJKlpqQhPi9E9afxLnF5vyhpQmZC2pJN2 OAywsZKPJ/rXRngZb1IowLBi22T8xmc/LJEFE+QvNVkfwg/XnV/8JRCvgIST6cxWiQsLEl3euDT O X-Google-Smtp-Source: AGHT+IHM+uNXgDWRhfJGYPQMhJ0Z5bsNMBQlbqUtSVgl39pmAWyU7hFN+JcAQynmwUyVjswMO7lySw== X-Received: by 2002:a05:600c:4449:b0:42c:b870:c52e with SMTP id 5b1f17b1804b1-4319ac85e9amr69282405e9.1.1730368362196; Thu, 31 Oct 2024 02:52:42 -0700 (PDT) Received: from naush-laptop.pitowers.org ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4327d6983c2sm19789835e9.42.2024.10.31.02.52.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Oct 2024 02:52:41 -0700 (PDT) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Cc: Naushir Patuck , Jacopo Mondi , Laurent Pinchart 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 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 | 12 ++++++++++++ src/libcamera/control_ids_rpi.yaml | 25 +++++++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/src/ipa/rpi/common/ipa_base.cpp b/src/ipa/rpi/common/ipa_base.cpp index ee3848b54f21..468f36a82ab2 100644 --- a/src/ipa/rpi/common/ipa_base.cpp +++ b/src/ipa/rpi/common/ipa_base.cpp @@ -96,6 +96,13 @@ 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 +166,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 +1081,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 ...