From patchwork Mon Sep 30 14:14:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 21426 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 C91AFC0F1B for ; Mon, 30 Sep 2024 14:14:05 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 11C976351B; Mon, 30 Sep 2024 16:14:01 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="T8wsFsMY"; dkim-atps=neutral Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id B209B63502 for ; Mon, 30 Sep 2024 16:13:58 +0200 (CEST) Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-37cd2cb5615so273078f8f.2 for ; Mon, 30 Sep 2024 07:13:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1727705638; x=1728310438; 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=EQFExxm0qpcWemMa3lAXV5NHRANGRK2YCcMz0z9hqDc=; b=T8wsFsMYP0zOxr5dKr4bvMkHry4K5jdCD1MXurm8Z8J73X5GVn6aOzMcxZT4JLYmto XGqzLzzoFtzQ5ovbcSu5taViFQRreyik+LuyuOcJwOgpUmPQerRoIFnytTTHpDbkKGlB 5yBA9COMDPgCIcNWwP3cWgbGI7dGQEYT/Bewy3XCgonwEfRBxezSEgGDxFWkywvDIGiO 8ea68Xflgj4yHzhcrnxP4ko++qzmgvV8omynDeRwBo1zlTbQ/P1IBEJ88BnRBgsORBxd /vp7JfQwWdR8JUi3hlWzkXp9FPypSOKgC0zrOyt83ejBVVEyA709si7KFwCmFLm9qJpM OIHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727705638; x=1728310438; 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=EQFExxm0qpcWemMa3lAXV5NHRANGRK2YCcMz0z9hqDc=; b=kCPjtkKQ7O3vfY3OXctShnrinGQnmqv07Nl0ZybeBNYsv72WIKl7xfQZrFM3WRwhdf 9Th45mNoIC3dFJ6Y6b9q/1iL00CkoBMVQppBBJaIBCf0StVK/A4uszpgNvQSjj+YtipJ tSPo4QkE0BQofS1/uvjo787GvP7b8cDdIC8rbKOGgfu2mXASyNX8qi4Z1wtnJ+g+KXDU bM00KsjHVmTGou8K6AhzK7zdnH8AJvuMTA4tPNOM/7Mp1yAjyWvsNiuqUTp8aG0q04Sa OlqK98+zlSlThP9oakPeV6frWKJ+ACziz3H+XpXNXjsufJWs0T6o2ASou90bBonCxVLR 5uhw== X-Gm-Message-State: AOJu0YyUbFw5VVRHvLdTxqUTbiJsPuHnuImtKhB1bNq5q41vMqhb1iMn cYQ6kyvmj67IA49uJxbqfb42vhgcKCQ/aRneeJW2MNv2/LHR8P3NZzvyd8H71nI54/QlnfCYCPQ m X-Google-Smtp-Source: AGHT+IGFhJxmx27aC/ao+Fd9llOgog8QyIp6ToM9Wtp6+6bWPJ69Fs0qZpn6bAV9GE8aGu2+7Nsydg== X-Received: by 2002:a5d:64ec:0:b0:376:3ef8:61ab with SMTP id ffacd0b85a97d-37cde3f79famr2503105f8f.8.1727705637789; Mon, 30 Sep 2024 07:13:57 -0700 (PDT) Received: from naush-laptop.pitowers.org ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37cd56e65c3sm9142524f8f.60.2024.09.30.07.13.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Sep 2024 07:13:57 -0700 (PDT) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Cc: Naushir Patuck 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 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 --- src/ipa/rpi/common/ipa_base.cpp | 14 ++++++++++++++ src/libcamera/control_ids_rpi.yaml | 21 +++++++++++++++++++++ 2 files changed, 35 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 cb097f887e16..a0fc1cd897b5 100644 --- a/src/libcamera/control_ids_rpi.yaml +++ b/src/libcamera/control_ids_rpi.yaml @@ -26,4 +26,25 @@ 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. + + 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 ...