From patchwork Wed Mar 25 10:56:18 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 26333 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 657F1BE086 for ; Wed, 25 Mar 2026 10:56:29 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 547CD627A7; Wed, 25 Mar 2026 11:56:28 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=qualcomm.com header.i=@qualcomm.com header.b="OIhU+07b"; dkim=pass (2048-bit key; unprotected) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="aqyx5dAh"; dkim-atps=neutral Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 38B9C62788 for ; Wed, 25 Mar 2026 11:56:27 +0100 (CET) Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 62PACSQ51208841 for ; Wed, 25 Mar 2026 10:56:25 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:message-id:mime-version :subject:to; s=qcppdkim1; bh=TxCZUFccIS6YcY0XBlTwm7GOvkHh3fFB7Wc xPaIVN5c=; b=OIhU+07b3+hEYjNN99yFcXEjjfkmjkAha51a6EjV8dNr2n4ARyh VNHmBw5ytU2x3VI9bbyVORfCnhnuMP9cvf4Putgzd0HsrOLNQ93KFKz8yHx7rJAr LVn0CGolGxPDqpt6ZtvBK6KJW6Hs1fXg+eBdKvvKU0FqD3AV8Kkb4NYQYonX3Mni 59K/qh+RtkFVh8MVIB9ny8BAagGhq8X/iHUiuAwlgvuZcdZJH8c2LJRlIGv4R+cB 5ui2U01LvMEEEHJNE9pjCUV+wLRAWlZR4CwH3pIWxYUqhl7Z43Pcol+vjPjdR8W/ fRfY6tFYeHUP3nXLikL4Rn9D4/N+dTMIpoQ== Received: from mail-qt1-f198.google.com (mail-qt1-f198.google.com [209.85.160.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4d48599f3y-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 25 Mar 2026 10:56:21 +0000 (GMT) Received: by mail-qt1-f198.google.com with SMTP id d75a77b69052e-50b6f869676so74904391cf.2 for ; Wed, 25 Mar 2026 03:56:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1774436181; x=1775040981; darn=lists.libcamera.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=TxCZUFccIS6YcY0XBlTwm7GOvkHh3fFB7WcxPaIVN5c=; b=aqyx5dAhc1oSNlj81wC7yjcE1VU5fKtbeqYI4h2P5saqPYdLEeXuZfS9MJnnsmulR5 MTGQ6ddYAOV+mZptmQ54PUwO+fsCJvgbdFAZSuDAP0kr7PWSa9E3AoZu/loJ4y3D2JNe 5+HS7duos+foN9rRw3U79EyDd9G6g+8+FTFjX5W2Qh5nkRFDBc69oFdi7k97+F2ERnmq 27xxy1rtEIBLEznoHgQhdAVIvJeLCiB5ig2G+70mCnphl3J/QLL/uZJmXgUn5TIRVr4n cygH+CDgt3YnEX7d1Lo8aNf92z0X+zC79T32alDcFbhAYRon+g1s+b+04omoumuwI0y7 PaxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774436181; x=1775040981; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=TxCZUFccIS6YcY0XBlTwm7GOvkHh3fFB7WcxPaIVN5c=; b=oSuTQ4dyT11RYpSCOV6h46g1we5neg4DzAmXFPxdm5w0+6Z4fghYQMsXriHQwh1Ntm tJb6XVSMTlVQrk6O39MppQ9A5mD5vJruMVXeyJ9d8pG8zRELfs7mK9cODeX6QTMld0me Tx4VABMr466XrPp5hIbXKPwvpkkUzZEzLC0KR5t/gSyfpHeKu35t0nFBixcx+LS69EMy Axj55XkPcIBT+m9aHRVlD8TE8YjNklHVXc02zFgAWWUw+khPEtUBBgsEOiCxVcKzH0Qu In+3IHuipC/D0Inmjkgu0/XcCnluCvqntf3StzPjIzpMYfGwQPoGHadOn4+mdiysZTFZ slHQ== X-Gm-Message-State: AOJu0Yw2zvnlyloUZTOJrTdWHkwzqT9hVfHkVRvbcgOst348GbmNBjNw HhZTU8gd4M80IxQtFxxjCq9YBs3vgxZCpekwaet86ybyCqLufHHcNLmJ1Vt2kNq/mw1ZcsQqTQN ruipEdMUkkLxak4yxGy7Jl5uowtoZzz1LJ7QLePSmwnhjlPaeNF1oqAI2cJqjjLl+O3O46aqRLU 1vhZs/DbOH X-Gm-Gg: ATEYQzzanP4rLkNzYAplX1eMllqTLhQK23ELx3G/oBHdGoqG/w82X+opmiV6rjQquKu zg76EbrH+2yq0FxHp4Yojp+aKVP9DMp0Pw83sdLPCSqw0q1ggE6jfrJJ1NqbIyKIP00g1lhfrob 1Rz4VE2EhdZ3617UyZfYiWXwwHo1tSSGtjJgkYf7GuwtcZ/Q3r9YVA4sPWUiduvk5ZX+W72VDCv VWyV9NooZKwT0yz2URbpLesjfSwwd/8gs0bLSV5FkEDWLI0mY9KUsopUuosDODJGCus+WvMZnIv IQmBnHCKVAqm1t8mLVyzz4auk0uOYmeSm8mblnAoczBMcWmcJ1pbq/uJqXqCMW6s6ce964kVAIc qBaWvShzk2aFL+XWKFiauo1UK2qsu35i2/XXPlbRtBDCba7e7PVpqqzx1k5f8zXR7212p9v4J1m +rBco4CgCNyyLgIOg7PqI5es3QQYiQ8e3vlg== X-Received: by 2002:ac8:4f03:0:b0:509:31bd:3de4 with SMTP id d75a77b69052e-50b80e65ecbmr31080851cf.56.1774436181091; Wed, 25 Mar 2026 03:56:21 -0700 (PDT) X-Received: by 2002:ac8:4f03:0:b0:509:31bd:3de4 with SMTP id d75a77b69052e-50b80e65ecbmr31080681cf.56.1774436180559; Wed, 25 Mar 2026 03:56:20 -0700 (PDT) Received: from t14s (2001-1c00-0c32-7800-beb3-9058-f5fe-3f2e.cable.dynamic.v6.ziggo.nl. [2001:1c00:c32:7800:beb3:9058:f5fe:3f2e]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b983365a159sm753770566b.44.2026.03.25.03.56.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Mar 2026 03:56:19 -0700 (PDT) From: Hans de Goede To: libcamera-devel@lists.libcamera.org Cc: Milan Zamazal , Hans de Goede Subject: [PATCH] libcamera: Make converter/softISP configure()'s outputCfgs argument really const Date: Wed, 25 Mar 2026 11:56:18 +0100 Message-ID: <20260325105618.8601-1-johannes.goede@oss.qualcomm.com> X-Mailer: git-send-email 2.53.0 MIME-Version: 1.0 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzI1MDA3NyBTYWx0ZWRfX/3wlhgUQc2oN vmKqSZi9hrIjxFiHiaJcj/h0kkeVnxge5j4gBhjbA/JULE9QuLfjFKUSFDM35jVjL3fj820XAlf PFAceOH8O/JylQEBrNkOOgpLQRCDzc8xQXoDcChxyCwD4BDXby6OSf3rF9v3UU++4ZmU1UZr+BD Gnpwd6cV3HaRfOwRzLL1mqOp7YhMJXufiMs2bHOJi99mOgLRoPXAxWOHDSdC1szKQ16sVDzoJ+K bPosBXvn1XBTU5pMESl58BFd1LC8yQWUcsAs0n78Gkc9dz1dboE/yVzuayf4yYuWDfnGkKcGBj1 09RCTQ043wWXb8BrBRk7hK3A8xQ8oKufL+ZQvKAI2d05FSGTfr6yiutNKay2CJBCHCRvlE77Jjg NnkQ6kRvdL+4UhJIxkYwO2PTJGY4PgQFW82ImRojBnBV59OE3r+UrlFLydianjd5kV1/Qpmr8vF LZWHCJI5AUzDvshw3BQ== X-Authority-Analysis: v=2.4 cv=VODQXtPX c=1 sm=1 tr=0 ts=69c3bf55 cx=c_pps a=mPf7EqFMSY9/WdsSgAYMbA==:117 a=xqWC_Br6kY4A:10 a=Yq5XynenixoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=_glEPmIy2e8OvE2BGh3C:22 a=EUspDBNiAAAA:8 a=pt1EKlqNxKOWZmuetCEA:9 a=dawVfQjAaf238kedN5IG:22 X-Proofpoint-GUID: TtjbUDq7FKhATiy6RtnmRDxEmRFgO5tP X-Proofpoint-ORIG-GUID: TtjbUDq7FKhATiy6RtnmRDxEmRFgO5tP X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293, Aquarius:18.0.1143, Hydra:6.1.51, FMLib:17.12.100.49 definitions=2026-03-25_03,2026-03-24_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 lowpriorityscore=0 malwarescore=0 phishscore=0 priorityscore=1501 spamscore=0 impostorscore=0 clxscore=1015 adultscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2603050001 definitions=main-2603250077 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" The intent of the outputCfgs argument to the configure() function of converter classes and the softISP is to allow the passed in stream-configs to not be changed. But only the vector is const, the reference inside the vector are not const, which allows modifying the stream-configs as can be seen inside DebayerEGL::configure() which was using a non const reference outputCfg helper variable. Fix this by making the references inside the vector const. Signed-off-by: Hans de Goede --- include/libcamera/internal/converter.h | 2 +- include/libcamera/internal/converter/converter_dw100.h | 2 +- include/libcamera/internal/converter/converter_v4l2_m2m.h | 2 +- include/libcamera/internal/software_isp/software_isp.h | 2 +- src/libcamera/converter/converter_dw100.cpp | 2 +- src/libcamera/converter/converter_v4l2_m2m.cpp | 2 +- src/libcamera/pipeline/rkisp1/rkisp1.cpp | 2 +- src/libcamera/pipeline/simple/simple.cpp | 2 +- src/libcamera/software_isp/debayer.h | 2 +- src/libcamera/software_isp/debayer_cpu.cpp | 2 +- src/libcamera/software_isp/debayer_cpu.h | 2 +- src/libcamera/software_isp/debayer_egl.cpp | 4 ++-- src/libcamera/software_isp/debayer_egl.h | 2 +- src/libcamera/software_isp/software_isp.cpp | 2 +- 14 files changed, 15 insertions(+), 15 deletions(-) diff --git a/include/libcamera/internal/converter.h b/include/libcamera/internal/converter.h index 4b811686f..08e80a22f 100644 --- a/include/libcamera/internal/converter.h +++ b/include/libcamera/internal/converter.h @@ -71,7 +71,7 @@ public: Alignment align = Alignment::Down) = 0; virtual int configure(const StreamConfiguration &inputCfg, - const std::vector> &outputCfgs) = 0; + const std::vector> &outputCfgs) = 0; virtual bool isConfigured(const Stream *stream) const = 0; virtual int exportBuffers(const Stream *stream, unsigned int count, std::vector> *buffers) = 0; diff --git a/include/libcamera/internal/converter/converter_dw100.h b/include/libcamera/internal/converter/converter_dw100.h index d70c8fe76..0a41b180a 100644 --- a/include/libcamera/internal/converter/converter_dw100.h +++ b/include/libcamera/internal/converter/converter_dw100.h @@ -34,7 +34,7 @@ public: int init(const YamlObject ¶ms); int configure(const StreamConfiguration &inputCfg, - const std::vector> + const std::vector> &outputCfg); bool isConfigured(const Stream *stream) const; diff --git a/include/libcamera/internal/converter/converter_v4l2_m2m.h b/include/libcamera/internal/converter/converter_v4l2_m2m.h index 6d2453bb9..63cea6b08 100644 --- a/include/libcamera/internal/converter/converter_v4l2_m2m.h +++ b/include/libcamera/internal/converter/converter_v4l2_m2m.h @@ -54,7 +54,7 @@ public: const Size &size, Alignment align = Alignment::Down) override; int configure(const StreamConfiguration &inputCfg, - const std::vector> + const std::vector> &outputCfg) override; bool isConfigured(const Stream *stream) const override; int exportBuffers(const Stream *stream, unsigned int count, diff --git a/include/libcamera/internal/software_isp/software_isp.h b/include/libcamera/internal/software_isp/software_isp.h index ad89c9b3c..585e0d6d9 100644 --- a/include/libcamera/internal/software_isp/software_isp.h +++ b/include/libcamera/internal/software_isp/software_isp.h @@ -64,7 +64,7 @@ public: strideAndFrameSize(const PixelFormat &outputFormat, const Size &size); int configure(const StreamConfiguration &inputCfg, - const std::vector> &outputCfgs, + const std::vector> &outputCfgs, const ipa::soft::IPAConfigInfo &configInfo); int exportBuffers(const Stream *stream, unsigned int count, diff --git a/src/libcamera/converter/converter_dw100.cpp b/src/libcamera/converter/converter_dw100.cpp index df5155cfd..7899fe8c2 100644 --- a/src/libcamera/converter/converter_dw100.cpp +++ b/src/libcamera/converter/converter_dw100.cpp @@ -142,7 +142,7 @@ int ConverterDW100Module::init(const YamlObject ¶ms) * \copydoc libcamera::V4L2M2MConverter::configure */ int ConverterDW100Module::configure(const StreamConfiguration &inputCfg, - const std::vector> + const std::vector> &outputCfgs) { int ret; diff --git a/src/libcamera/converter/converter_v4l2_m2m.cpp b/src/libcamera/converter/converter_v4l2_m2m.cpp index 4427a37c6..ffba0434e 100644 --- a/src/libcamera/converter/converter_v4l2_m2m.cpp +++ b/src/libcamera/converter/converter_v4l2_m2m.cpp @@ -548,7 +548,7 @@ Size V4L2M2MConverter::adjustSizes(const Size &cfgSize, * \copydoc libcamera::Converter::configure */ int V4L2M2MConverter::configure(const StreamConfiguration &inputCfg, - const std::vector> &outputCfgs) + const std::vector> &outputCfgs) { int ret = 0; diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp index 320a4dc5a..faeeecd96 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp @@ -1037,7 +1037,7 @@ int PipelineHandlerRkISP1::configure(Camera *camera, CameraConfiguration *c) data->properties_.set(properties::ScalerCropMaximum, sensorCrop); std::map streamConfig; - std::vector> outputCfgs; + std::vector> outputCfgs; for (const StreamConfiguration &cfg : *config) { if (cfg.stream() == &data->mainPathStream_) { diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp index 4a0b9f58d..9497ac13b 100644 --- a/src/libcamera/pipeline/simple/simple.cpp +++ b/src/libcamera/pipeline/simple/simple.cpp @@ -1562,7 +1562,7 @@ int SimplePipelineHandler::configure(Camera *camera, CameraConfiguration *c) } /* Configure the converter if needed. */ - std::vector> outputCfgs; + std::vector> outputCfgs; data->useConversion_ = config->needConversion(); data->rawStream_ = nullptr; diff --git a/src/libcamera/software_isp/debayer.h b/src/libcamera/software_isp/debayer.h index ce9350b7b..ea1ec6dcf 100644 --- a/src/libcamera/software_isp/debayer.h +++ b/src/libcamera/software_isp/debayer.h @@ -39,7 +39,7 @@ public: virtual ~Debayer() = 0; virtual int configure(const StreamConfiguration &inputCfg, - const std::vector> &outputCfgs, + const std::vector> &outputCfgs, bool ccmEnabled) = 0; virtual std::vector formats(PixelFormat inputFormat) = 0; diff --git a/src/libcamera/software_isp/debayer_cpu.cpp b/src/libcamera/software_isp/debayer_cpu.cpp index 1de70b3b7..dd0fff871 100644 --- a/src/libcamera/software_isp/debayer_cpu.cpp +++ b/src/libcamera/software_isp/debayer_cpu.cpp @@ -540,7 +540,7 @@ int DebayerCpu::setDebayerFunctions(PixelFormat inputFormat, } int DebayerCpu::configure(const StreamConfiguration &inputCfg, - const std::vector> &outputCfgs, + const std::vector> &outputCfgs, bool ccmEnabled) { if (getInputConfig(inputCfg.pixelFormat, inputConfig_) != 0) diff --git a/src/libcamera/software_isp/debayer_cpu.h b/src/libcamera/software_isp/debayer_cpu.h index a96998e92..c6f263e1b 100644 --- a/src/libcamera/software_isp/debayer_cpu.h +++ b/src/libcamera/software_isp/debayer_cpu.h @@ -35,7 +35,7 @@ public: ~DebayerCpu(); int configure(const StreamConfiguration &inputCfg, - const std::vector> &outputCfgs, + const std::vector> &outputCfgs, bool ccmEnabled); Size patternSize(PixelFormat inputFormat); std::vector formats(PixelFormat input); diff --git a/src/libcamera/software_isp/debayer_egl.cpp b/src/libcamera/software_isp/debayer_egl.cpp index 9a0606b5a..547b3c3bd 100644 --- a/src/libcamera/software_isp/debayer_egl.cpp +++ b/src/libcamera/software_isp/debayer_egl.cpp @@ -277,7 +277,7 @@ int DebayerEGL::initBayerShaders(PixelFormat inputFormat, PixelFormat outputForm } int DebayerEGL::configure(const StreamConfiguration &inputCfg, - const std::vector> &outputCfgs, + const std::vector> &outputCfgs, [[maybe_unused]] bool ccmEnabled) { if (getInputConfig(inputCfg.pixelFormat, inputConfig_) != 0) @@ -307,7 +307,7 @@ int DebayerEGL::configure(const StreamConfiguration &inputCfg, return -EINVAL; } - StreamConfiguration &outputCfg = outputCfgs[0]; + const StreamConfiguration &outputCfg = outputCfgs[0]; SizeRange outSizeRange = sizes(inputCfg.pixelFormat, inputCfg.size); std::tie(outputConfig_.stride, outputConfig_.frameSize) = strideAndFrameSize(outputCfg.pixelFormat, outputCfg.size); diff --git a/src/libcamera/software_isp/debayer_egl.h b/src/libcamera/software_isp/debayer_egl.h index 3abff1ad2..6bbe487a3 100644 --- a/src/libcamera/software_isp/debayer_egl.h +++ b/src/libcamera/software_isp/debayer_egl.h @@ -42,7 +42,7 @@ public: ~DebayerEGL(); int configure(const StreamConfiguration &inputCfg, - const std::vector> &outputCfgs, + const std::vector> &outputCfgs, bool ccmEnabled); Size patternSize(PixelFormat inputFormat); diff --git a/src/libcamera/software_isp/software_isp.cpp b/src/libcamera/software_isp/software_isp.cpp index 4cf5639d9..60228369f 100644 --- a/src/libcamera/software_isp/software_isp.cpp +++ b/src/libcamera/software_isp/software_isp.cpp @@ -262,7 +262,7 @@ SoftwareIsp::strideAndFrameSize(const PixelFormat &outputFormat, const Size &siz * \return 0 on success, a negative errno on failure */ int SoftwareIsp::configure(const StreamConfiguration &inputCfg, - const std::vector> &outputCfgs, + const std::vector> &outputCfgs, const ipa::soft::IPAConfigInfo &configInfo) { ASSERT(ipa_ && debayer_);