From patchwork Tue Aug 11 13:00:40 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= X-Patchwork-Id: 27756 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 78D7CC3303 for ; Tue, 11 Aug 2026 13:00:58 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 3E86468269; Tue, 11 Aug 2026 15:00:57 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="BUKVqpcL"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 15C2868263 for ; Tue, 11 Aug 2026 15:00:47 +0200 (CEST) Received: from pb-laptop.local (185.221.141.208.nat.pool.zt.hu [185.221.141.208]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 3CE5F20A4 for ; Tue, 11 Aug 2026 14:59:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1786453172; bh=rN3DA/7nB+j9UW01VKrB7vPGFHnxv0wJkWsgS7YsG9M=; h=From:To:Subject:Date:In-Reply-To:References:From; b=BUKVqpcLnXgStdZq7F+HG3mGRq0W01Rfcca+WwnicKUiwV27OFt0GDucpyaahHRup WhU6F/+uHTXR8xrNwkwigkKpPdKPGJe6HZJQhwex1YH9HPpHeGnwm/mrGkbq9vTSCq oWWVnyoa0caDlCfv11//CtmSA1/G5UoDK8qxdj2A= From: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= To: libcamera-devel@lists.libcamera.org Subject: [PATCH v3 6/8] libcamera: software_isp: debayer_egl: Remove EGL context switch Date: Tue, 11 Aug 2026 15:00:40 +0200 Message-ID: <20260811130042.213139-7-barnabas.pocze@ideasonboard.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260811130042.213139-1-barnabas.pocze@ideasonboard.com> References: <20260811130042.213139-1-barnabas.pocze@ideasonboard.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" `eGL::initEGLContext()`, which is called from the worker thread already includes a call to `eGL::makeCurrent()`, so calling it for each `process()` is not necessary, so skip it. Instead call `eGL::assertThread()` in `process()` to ensure that the thread is correct. And lastly, make `eGL::makeCurrent()` a private function as now there are no external calleras. Signed-off-by: Barnabás Pőcze asd Reviewed-by: Milan Zamazal Reviewed-by: Jacopo Mondi --- include/libcamera/internal/egl.h | 3 ++- src/libcamera/software_isp/debayer_egl.cpp | 4 +--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/include/libcamera/internal/egl.h b/include/libcamera/internal/egl.h index 13df65e6b2..608d53151c 100644 --- a/include/libcamera/internal/egl.h +++ b/include/libcamera/internal/egl.h @@ -116,7 +116,6 @@ public: void activateBindTexture(eGLImage &eglImage); void pushEnv(std::vector &shaderEnv, const char *str); - void makeCurrent(); int compileVertexShader(GLuint &shaderId, Span shaderData, Span shaderEnv); @@ -145,6 +144,8 @@ private: int createDMABufTexture2D(eGLImage &eglImage, int fd, bool output); + void makeCurrent(); + struct VTable { PFNGLEGLIMAGETARGETTEXTURE2DOESPROC glEGLImageTargetTexture2DOES; PFNEGLCREATEIMAGEKHRPROC eglCreateImageKHR; diff --git a/src/libcamera/software_isp/debayer_egl.cpp b/src/libcamera/software_isp/debayer_egl.cpp index ede3be2352..7b2b367305 100644 --- a/src/libcamera/software_isp/debayer_egl.cpp +++ b/src/libcamera/software_isp/debayer_egl.cpp @@ -578,9 +578,6 @@ int DebayerEGL::debayerGPU(FrameBuffer *input, FrameBuffer *output, const Debaye eGLImage *eglImageIn; eGLImage *eglImageOut; - /* eGL context switch */ - egl_.makeCurrent(); - eglImageIn = getCachedInputFrameBuffer(input, inMapped, inDmaSyncer); if (!eglImageIn) return -ENOMEM; @@ -608,6 +605,7 @@ int DebayerEGL::debayerGPU(FrameBuffer *input, FrameBuffer *output, const Debaye void DebayerEGL::process(uint32_t frame, FrameBuffer *input, FrameBuffer *output, const DebayerParams ¶ms) { + egl_.assertThread(); bench_.startFrame(); /* Copy metadata from the input buffer */