From patchwork Fri Oct 3 12:15:53 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 24559 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 7F286C324C for ; Fri, 3 Oct 2025 12:18:39 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 24E1C69318; Fri, 3 Oct 2025 14:18:37 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="b+TKvhOq"; dkim-atps=neutral Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 7E66769318 for ; Fri, 3 Oct 2025 14:18:32 +0200 (CEST) Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-46e38c21fafso4055465e9.2 for ; Fri, 03 Oct 2025 05:18:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1759493911; x=1760098711; 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=Nq0/DZ49evXH+3DtXg1iN+pSyMK/YaIlLQA5DCjVQTc=; b=b+TKvhOqhLHPbWh08GweF6ffedFh41wryOpEGJU33/FANE5g0w10JpSKwYzzKhM+tv JXDm9F6UarrzW/kFg3k/FHcjIyW/oj2n5tYfO7ni1fsUvT+oUBj34cWd0ukl90gpm2we daYJ7cEfJQZdlSOJqBRZ3RS+wu1NfgJUt2wC0zVzXoNcsSq92U67J0033BcG/+SoScum +DgGgZWO9awabAcgVfbDeWphHn2yokwZr1FM30r68hQuy5Dq/9ZBfl8HAwLBWnvjt1VW 64bWQN9WlfHTHs3SmVWkTAu2Pa1R8hNTI5/xPaxbR9C1X5r2klkaliTdJiVoXEjNnNUF jBAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1759493911; x=1760098711; 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=Nq0/DZ49evXH+3DtXg1iN+pSyMK/YaIlLQA5DCjVQTc=; b=oH7Oxh14iJ+I5GaAH6Ex/8EzQxKquN9tlHqgVHefFyPICvfO8Efid0W0kfTByUXzr2 ryG8n+i4S9FukXtYglQsCoKJCQkIepvxb/IGb+Eh+MfbH9jBGMgeLkjbh2NF0KeYMp3U AWX8tF7mCj6fbIJDbDh7yIRTc5MrheJESbsMn39/vRLp4O/xcHybAezcAc3u8DadfVmk JAqfkaBH0Xgw6io2dKOXvTMNnrEsXrRIWECX8t3AdKf38GXL0cpQAeJkoRli94NqR8WU RsQIp6lRsDfT2nVlXN+TCrHFy5tb23L5ACiToRNODEu19B0KUxicY7gqSRuMIxcMseMD J9fQ== X-Gm-Message-State: AOJu0YwB9YpQOIGhBXzea+oSkOcoPRMXLOcVDIbmwU3gS1hOoDuAYhrE yFfqToPFcMXAoFnCh/HYASckVEOBwZENU6ymHicr8sTr1/BB6gTHfmZ52jflgruIsJu5BL87/zg 9yp05 X-Gm-Gg: ASbGncskBFqF3TEqp4+vg9YpikOuprRsNvp7VE8mSbD8mgqxhASXLvr5js6m2cxVPAR VU55KesVwMX/5DZD0W4KXuMqNn719tKen6irJSD2HNX2mqWl4I5+sxGPzYF7+EOksKhDrIJzN59 LUjyBqiZd28SfUE46BJF7MlV8wBIsu6DBtYirp0t9w0ydchXmoFxVF30/4w2Ddp0cDWinafv7Wm PzIH/Ig7AEWqyrBjmwwAOggzl94Wb+mPZeLPEeY9kgztcpo0Y+UiguHseqqPZAyvj2HA0g2iAMf +B5SAT6HvpBhamGRl8Mu4ijpi8YJbUy8W4BTXNfg9sMpmiQtXzKEl2lB22kqtZtZmJQB3Jdx9No u+Of5BUCH9chXse0O28JjHji99J2ISlg4q1sQRICwQXLgP4vPof53oIshs1+k/Y1/2Q== X-Google-Smtp-Source: AGHT+IG/MRuO3c/3vs7C782o/jvFkkWLvIp5sE+Mes9wlaUMCtjILYhtUzCB5macOHoLbynRk85uew== X-Received: by 2002:a5d:5d13:0:b0:3f4:52d3:7a6a with SMTP id ffacd0b85a97d-425671d3e41mr812206f8f.10.1759493911336; Fri, 03 Oct 2025 05:18:31 -0700 (PDT) Received: from NAUSH-P-DELL.pitowers.org ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4255d8f02a8sm7812529f8f.39.2025.10.03.05.18.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Oct 2025 05:18:31 -0700 (PDT) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Cc: David Plowman , Nick Hollinghurst , Naushir Patuck Subject: [PATCH v2 2/4] ipa: rpi: Add FE globals as a parameter to applyDecompand() Date: Fri, 3 Oct 2025 13:15:53 +0100 Message-ID: <20251003121821.659081-3-naush@raspberrypi.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251003121821.659081-1-naush@raspberrypi.com> References: <20251003121821.659081-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" Don't let applyDecompand() directly change the FE global enables. Instead pass the global mask into the function and set it in the caller. This will be needed when a future commit will add setting the decompand initial values. Signed-off-by: Naushir Patuck Tested-by: Nick Hollinghurst Reviewed-by: David Plowman --- src/ipa/rpi/pisp/pisp.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/ipa/rpi/pisp/pisp.cpp b/src/ipa/rpi/pisp/pisp.cpp index 14ece12b0895..f5be39aca5ee 100644 --- a/src/ipa/rpi/pisp/pisp.cpp +++ b/src/ipa/rpi/pisp/pisp.cpp @@ -256,7 +256,7 @@ private: void applyLensShading(const AlscStatus *alscStatus, pisp_be_global_config &global); void applyDPC(const DpcStatus *dpcStatus, pisp_be_global_config &global); - void applyDecompand(const DecompandStatus *decompandStatus); + void applyDecompand(const DecompandStatus *decompandStatus, pisp_fe_global_config &feGlobal); void applySdn(const SdnStatus *sdnStatus, pisp_be_global_config &global); void applyTdn(const TdnStatus *tdnStatus, const DeviceStatus *deviceStatus, pisp_be_global_config &global); @@ -368,6 +368,9 @@ void IpaPiSP::platformPrepareIsp([[maybe_unused]] const PrepareParams ¶ms, { /* All Frontend config goes first, we do not want to hold the FE lock for long! */ std::scoped_lock lf(*fe_); + pisp_fe_global_config feGlobal; + + fe_->GetGlobal(feGlobal); if (noiseStatus) applyFocusStats(noiseStatus); @@ -375,13 +378,14 @@ void IpaPiSP::platformPrepareIsp([[maybe_unused]] const PrepareParams ¶ms, DecompandStatus *decompandStatus = rpiMetadata.getLocked("decompand.status"); if (decompandStatus) - applyDecompand(decompandStatus); + applyDecompand(decompandStatus, feGlobal); BlackLevelStatus *blackLevelStatus = rpiMetadata.getLocked("black_level.status"); if (blackLevelStatus) applyBlackLevel(blackLevelStatus, global); + fe_->SetGlobal(feGlobal); } CacStatus *cacStatus = rpiMetadata.getLocked("cac.status"); @@ -728,16 +732,15 @@ void IpaPiSP::applyDPC(const DpcStatus *dpcStatus, pisp_be_global_config &global be_->SetDpc(dpc); } -void IpaPiSP::applyDecompand(const DecompandStatus *decompandStatus) +void IpaPiSP::applyDecompand(const DecompandStatus *decompandStatus, pisp_fe_global_config &feGlobal) { - pisp_fe_global_config feGlobal; pisp_fe_decompand_config decompand = {}; if (!generateDecompandLut(decompandStatus->decompandCurve, decompand.lut)) { fe_->SetDecompand(decompand); feGlobal.enables |= PISP_FE_ENABLE_DECOMPAND; - fe_->SetGlobal(feGlobal); - } + } else + feGlobal.enables &= ~PISP_FE_ENABLE_DECOMPAND; } void IpaPiSP::applySdn(const SdnStatus *sdnStatus, pisp_be_global_config &global)