From patchwork Thu Nov 27 02:22:47 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 25229 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 32A38C3260 for ; Thu, 27 Nov 2025 02:23:40 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id D656460AD2; Thu, 27 Nov 2025 03:23:39 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="A9xC+dQo"; dkim-atps=neutral Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 8ECED60AA3 for ; Thu, 27 Nov 2025 03:23:37 +0100 (CET) Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-477a2ab455fso2941725e9.3 for ; Wed, 26 Nov 2025 18:23:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1764210217; x=1764815017; 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=0FUA8kH36pvKSfSDc4qeO8M3Vhl+74knCB5rIoM7BX0=; b=A9xC+dQozvbrpzXsyAcNh/gUWCffMhaHJlaoMsaXU5KZLa9eQqbe06PrDNoNz4zLTK VpL4m/OZXyAERMtJmDVAuDbGf5LlSfrRYhpQ3T8VJYrleIC1QeYlaGASc4hN7DAbsUvc RiH/7RxnMHJB1WfOI+fycmXFqH+0P0emLkva0E1tkR145MCMJnNQa1iKViaUjD9pXNsz 5iscxetofMpxADHxQyxAfR8qhCgOzsn46Dr3MCX+Xy474eSsadPeUniOUkQIF0aXH5nO rY3QSbeuQqKkvcBdKIG1gYWGiodPuOyTuAkc89b8xW9Md0nHB5KOqDC3z9yDNBUej9U5 Ra+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764210217; x=1764815017; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=0FUA8kH36pvKSfSDc4qeO8M3Vhl+74knCB5rIoM7BX0=; b=pYHHE9zfip/yaD0dC3tuJNbBccrAv1inXNyyJPeDX3JU4z1pzAMDC0wDd46FQfFVwF 6/aaeaEKBuo70sqh0LRt/P5ouPMVmLJXxB/HF8j2lcYnsFfh7EhGBzOgeSiy94b2z2FA 20LU03mcL7J+QjGp59s6WzDvCa9Rh5c8MC6d7SW3QkpTmyxzh25szPrMj6j6mzK4Jiux L2Iqe3/B1j/mnpZltpuiTlmaYVsk1oSqpXzhvxVVTbNVOPLnxxNYx8JU/CpJiN/FblXh +P1oB+Fsv0rlRRmoDnaFTcvxI4vdHDtHbBs0LTUo0xrHt/66lKpNtrmyNnh2zuZURDKb zKFQ== X-Gm-Message-State: AOJu0Yz26NTMtL7CSmkCgoSPb6ZmQ40aeyY/Yp68wQOvqvPoj5VKG3h4 lPpBaWERrMosBqWZv3rcWRy8g/+iXADZrj1lTmHhw18mtg3G25p/8StLGnV1epj75+SQ480TzXc vGo/xj+4= X-Gm-Gg: ASbGncsTPoSa1gbaoL+Hsr9IuJUjW7kjdaMeagrrcJAwWo0gPfHmuTY8OWMcJQ8AEy2 3KDPfdnH9+Ybzda7YaoKI0NxxQeucAuNCGtkMXoI33l2tBTCxGSbC+8LTo7G35Qv20GHrrEX2Fj oj8z3E6lMp/xH/1bebsWa2jpU5MDJOVIlXf7D5KUyHFOGh2Gnw4e+/Kb9X/TsU7nwupICuYSsfo gS+nb+UFXQ8yoqIhghnoj1UHvunuIrkRF9eD4ttp8r8xxr7ZGt0MFs+H5XDXn8xk4KBDL1ZWieq gwHafud3OoR53aHPzSkVzfowCd6Ps6dHCXUSyn/uzMgwYlmXDr13L2NDdDj66nCNQ63JdCta2/k DMwxTQcq/Y+0DYdlPPwTkKodXIef434W5izcWuLeIXSHdClwGf0g+1xCujNXQP8XGKavLgxSbQJ 9BRWy5P3VxsIB0AIo76Xaij4Fp9+IcvgPdi/6Abeo8uPkw03n6D1GlS301+nCbLFJ6hvU= X-Google-Smtp-Source: AGHT+IHbonNS6BrdZt7W27wiLka/XPeOw0PAfe9byA2FgpSbXzuJVW1AdGr6rL9zLJ2sRGT9kCEWVA== X-Received: by 2002:a05:600c:4591:b0:477:b642:9dbf with SMTP id 5b1f17b1804b1-477c1132adbmr212090575e9.32.1764210216983; Wed, 26 Nov 2025 18:23:36 -0800 (PST) Received: from inspiron14p-linux.ht.home (188-141-3-146.dynamic.upc.ie. [188.141.3.146]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4790b0e21e8sm71549495e9.15.2025.11.26.18.23.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Nov 2025 18:23:35 -0800 (PST) From: Bryan O'Donoghue To: libcamera-devel@lists.libcamera.org Cc: pavel@ucw.cz, Bryan O'Donoghue , Robert Mader Subject: [PATCH v2 15/22] libcamera: software_isp: Start the ISP thread in configure Date: Thu, 27 Nov 2025 02:22:47 +0000 Message-ID: <20251127022256.178929-16-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.51.2 In-Reply-To: <20251127022256.178929-1-bryan.odonoghue@linaro.org> References: <20251127022256.178929-1-bryan.odonoghue@linaro.org> 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" EGL is not thread-safe and in fact associates invisible handles with the threadid of the calling context. As a result we need to make Deabyer::configure() and Debayer::process() in SoftISP execute on the same thread. When we call Debayer::configure() in the egl class this will setup and egl context for us which is associated with the calling thread context. Hence when Debayer::process(); runs it must run in the same thread as Debayer::configure() or the hidden Gegl context handles will not point to the same place. Move start thread into configure() as a first step towards this. Co-developed-by: Robert Mader Signed-off-by: Robert Mader Signed-off-by: Bryan O'Donoghue Reviewed-by: Kieran Bingham --- src/libcamera/software_isp/software_isp.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libcamera/software_isp/software_isp.cpp b/src/libcamera/software_isp/software_isp.cpp index 928a2520c..afa4eb7a8 100644 --- a/src/libcamera/software_isp/software_isp.cpp +++ b/src/libcamera/software_isp/software_isp.cpp @@ -265,6 +265,8 @@ int SoftwareIsp::configure(const StreamConfiguration &inputCfg, if (ret < 0) return ret; + ispWorkerThread_.start(); + return debayer_->configure(inputCfg, outputCfgs, ccmEnabled_); } @@ -346,7 +348,6 @@ int SoftwareIsp::start() if (ret) return ret; - ispWorkerThread_.start(); return 0; }