From patchwork Tue Dec 2 13:31:46 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: 25301 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 EFDEEC32F2 for ; Tue, 2 Dec 2025 13:32:30 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 2511160D13; Tue, 2 Dec 2025 14:32:30 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="a0malalK"; dkim-atps=neutral Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id EAD3F60D17 for ; Tue, 2 Dec 2025 14:32:18 +0100 (CET) Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-4779cc419b2so56870815e9.3 for ; Tue, 02 Dec 2025 05:32:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1764682338; x=1765287138; 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=lfymFnUumpfpGi9F2+IbOl+GrSQcUmyE43/IcLR2ZZQ=; b=a0malalK5Zn03YF/lBGb/mHhPlN3ohKxRHBhkhQJ1Q/xnCGs/YPc4tVbjwiKR/Q0qT GuFIl8qnDTz80EmMuPDXCVQhx5Sj0x9XwrjY8TGO8ydWKku5Dtl4WvNgwpVFe6pQbOCX fJycNAJ4JmcWgRBJoKoxwYX+cLGXxaiSXng40IqKsf6cCogEnH5gaOIC4ljqy7EyftZn B7tB0PkiK1zrYlgSAQ9URA7hpC2CYjwGcGCldFL7lR7/vxanHeyKLqhyxVZK+TqrX4md 4osM00lylDyNCAAAMFSZFCoUIiUl7jrj6m+TOaB+bzy2glNzq6s5RyeHMaGRyrba96Yi pFdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764682338; x=1765287138; 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=lfymFnUumpfpGi9F2+IbOl+GrSQcUmyE43/IcLR2ZZQ=; b=bQ9ItdlsEJDB6wJJgLvk3SOJP3rgObKetVtk6VKFagTH8PhuRgJHY9gcL7vjAD0ugk IXHuzJ04WM+M/OaT9t3QYtDMbhn6fnhqj2BtSi7zh+JTpW7ku8Zdw7QxI6TDMwEl4E+k 1uch7ym60NgsP69ITxtJJHGERN6Gs35/jDhO/HLAcNYsFx8/183Y3JneILsRAxU7PQC9 G+7zjhdYERefJhZF6CzedcyTstDgN1oaXCDjsV54YmbzfHsqfIM91OmlqpcaF0FuW6yP iBJOxQin3kbUcfpvkorKCreFhrhk2Y//xE+uQ+v6WXBaR50eYzhctP7o8aEHzVN111sL 9ryQ== X-Gm-Message-State: AOJu0YwhyHraLgOMDws9QnTTYKHFUwrwfsX/aTPhceOYg8yul8yNw8Ga F4PmV+nqJFfIe+zXy4HLL6KriRfjhEm12087kEvc4tnHJmgzeHALgBnqSojoBI3zPB1BFHQUyV1 wL+fW X-Gm-Gg: ASbGncsc9zVp3bxF68Rnw/gkeBu0vzzg/ebtxnbE1QndsGhqPXd+vXzpD97Ov52K/6N VUIauDqufPrxQtw1igKqYP094VCQ5+1myOjJz+f1sS8ZLCO49Xq4/rAdl1/NWCP9ZcJo+s6Z0jZ gbNyV6wcL3BVXS/DotHnYJx4ph3998ciHmVsZneNa9+X0zS52LfAtd2De3AwTn5Nk8sCpZf0n7i a71xE31OVhKlm5uPPwqUMbZu54wkxs0u4++rknxpRWJBmtzYXGFue25mtaUeqrN5/7Ouf0eK5Ln 6bsVMwsk8fj1/icC7Xf6eydk0Isp3cXUP7b63bihFdGY/8HMy4KPWxeFBUVYneegc7FOXy74Nuu 9iM+AaLOXxbdOH+Q1zBe73yL08qRwv1Tvm7vn3DZj2Husm2PXgXVyfbD44EAORhCDACYVcY8roB uu//it5rfaE2breR+lgllGut5Tm2lkgvkUkyLbH1Fbl2UB85qLF9AYdnkZSOPLCz/W1eo= X-Google-Smtp-Source: AGHT+IH+u5UkfLTD9xyGDNV4Vr/D2Np+eYCZBJLLkM0HPhUDxAbZVf4EkSZbJyFJjDy1CCVKbMTbVQ== X-Received: by 2002:a05:600c:5252:b0:477:582e:7a81 with SMTP id 5b1f17b1804b1-477c110328amr424495355e9.4.1764682338008; Tue, 02 Dec 2025 05:32:18 -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 ffacd0b85a97d-42e1c5c30c4sm33363322f8f.9.2025.12.02.05.32.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Dec 2025 05:32:17 -0800 (PST) From: Bryan O'Donoghue To: libcamera-devel@lists.libcamera.org Cc: pavel@ucw.cz, Bryan O'Donoghue , Robert Mader , Kieran Bingham Subject: [PATCH v3 15/22] libcamera: software_isp: Start the ISP thread in configure Date: Tue, 2 Dec 2025 13:31:46 +0000 Message-ID: <20251202133157.661407-16-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251202133157.661407-1-bryan.odonoghue@linaro.org> References: <20251202133157.661407-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 Reviewed-by: Kieran Bingham Signed-off-by: Bryan O'Donoghue --- 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; }