From patchwork Fri Mar 20 21:41:02 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gianfranco Mariotti X-Patchwork-Id: 26301 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 33E09BD87C for ; Fri, 20 Mar 2026 22:10:31 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 613A662737; Fri, 20 Mar 2026 23:10:30 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="L1a13s37"; dkim-atps=neutral Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id B27FB62655 for ; Fri, 20 Mar 2026 22:42:56 +0100 (CET) Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-483487335c2so18296725e9.2 for ; Fri, 20 Mar 2026 14:42:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1774042976; x=1774647776; 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=0eSQ+9/mtz/KaVc41XsdyFRDyy9avfAKazRjtU+93/Y=; b=L1a13s37FpGEP3CexwC5R5DRL7X2E7pzqpIyzzwDW/wqaeOXKoudCtqsD3qhuAMNfB /q3pzdl9THAsnNNRAhtO+maCy4/mgLADlcioeAsROJ18dHsUtdX57q7/w626PpXbyp0v r7qJC20DFpgWgC4njnq7VARF5F1DF0lS55h/MzuTiKjTz9B9dsfop6HDaESdlhfcKPn5 VizeRrTgFkq5pigjU83AfCyIjg6lXMR4fhZBsKmfHrp2kuLxBx2Y8PdZZ7F9RDQ2amks SdMWRJpY+sTZiHg/FWtVXgdDrxNQ89cHL+qUEWEnSNzGtaHdpvN03gBlmKoZcIsX+d84 IEIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774042976; x=1774647776; 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=0eSQ+9/mtz/KaVc41XsdyFRDyy9avfAKazRjtU+93/Y=; b=Zoe/IUWZcAQ6sPv9tiRknG3I187DB4CdU4ucHkfhHaS9lAatESSZGD+GaJZQ4Zl/Ex HbDqAJsd8YUzoWJme0yp5f6kXvbuz9hcyOi0MpCXYz8TMsOH2vfTqT5KMAWzGWWR8Wro bb/RwNYfKKEmr0sWml49VzJY55iNNU0R+OOfV1ASCmaiTsTCbqEpORJCbn9dowMtsGOV JEqA5mBIOlBRH6nJyb+QynGiRPZglGpUClxfBsV5+gxFBFhl7cpub4BByEBee7NUmBRd NuuRQZiVmuFcs52z0jAypwEpEWSGPS1jOjU6vRFjNoUrGkfEHPw5gXVh1Tt/49tI2U5z pb9A== X-Gm-Message-State: AOJu0YzrXMBpnYxMtgEqMZKvW0Oyr4NMuEm8Rc25lAGtLF3uh3QH74vt 979DgcZvrE+AX/mtwrt/vIBUHYD3f9B+2ECdHsf1F5VBsgA+FIrTc+o4Eurk X-Gm-Gg: ATEYQzxaKZ3ydxXgPHbtLT/uI1i9162DJ6ox1aGWpBtpVs/S8kMjlVlWUfKs3ow3p/d JXx0om+KCLuilnvOLSpe5w8xDpWq0AXgxEpfoBwqh4eyz9ECftpnurhF2O8lYVb0ji1BarWqhjk WIpRkeXxPSHpq8xaFukgM9ZFvNF/viBCCnO78LOztkoEfaKQ5LYVQWZPWoR1aI9zlbDnknXW45v JzDJAFYYFhq+XB/1gIx7qEkariSyL7H9NXp16atwos1J5QFI+wDtF1qJXEWg6sB+n6mrad0UTeD mtvuZBKos4QJIQ1HepabCoywW7237L12Rs9d3bIllqL0XmtFr8VFgivi+jyrMexBPbHULEZmrEu ywIUmDCe38wfD5d2FlrNLt/WiYRA4Je5cnUiEBJIq3LMwaBoWiNIGfuywX9ywp6R+06QAANA/7A nnUrW2txlsButcIhfAhYKNeZjWAPAQ5GVU X-Received: by 2002:a05:600c:3549:b0:485:3fe6:21f5 with SMTP id 5b1f17b1804b1-486fedb5928mr65165035e9.10.1774042975813; Fri, 20 Mar 2026 14:42:55 -0700 (PDT) Received: from h7015t.. ([193.207.189.93]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-486fe68ec05sm149658275e9.0.2026.03.20.14.42.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Mar 2026 14:42:55 -0700 (PDT) From: Gianfranco Mariotti To: libcamera-devel@lists.libcamera.org Cc: Gianfranco Mariotti Subject: [PATCH] libcamera: software_isp: debayer_egl: Teardown the output texture Date: Fri, 20 Mar 2026 22:41:02 +0100 Message-Id: <20260320214102.11844-1-gianfranco.mariotti94@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Mailman-Approved-At: Fri, 20 Mar 2026 23:10:29 +0100 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" Destroy the EGL image associated with the output DMA-BUF texture after processing the frame. Without this change memory can be seen building up while running a gstreamer pipeline using GPUISP, and on end of available memory the stream freezes and the error message `eglCreateImageKHR fail` is reported repeatedly. Signed-off-by: Gianfranco Mariotti --- src/libcamera/software_isp/debayer_egl.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/libcamera/software_isp/debayer_egl.cpp b/src/libcamera/software_isp/debayer_egl.cpp index 8147eca1..db7e35e5 100644 --- a/src/libcamera/software_isp/debayer_egl.cpp +++ b/src/libcamera/software_isp/debayer_egl.cpp @@ -498,6 +498,8 @@ void DebayerEGL::setShaderVariableValues(const DebayerParams ¶ms) int DebayerEGL::debayerGPU(MappedFrameBuffer &in, int out_fd, const DebayerParams ¶ms) { + int ret = 0; + /* eGL context switch */ egl_.makeCurrent(); @@ -515,12 +517,14 @@ int DebayerEGL::debayerGPU(MappedFrameBuffer &in, int out_fd, const DebayerParam GLenum err = glGetError(); if (err != GL_NO_ERROR) { LOG(eGL, Error) << "Drawing scene fail " << err; - return -ENODEV; + ret = -ENODEV; } else { egl_.syncOutput(); } - return 0; + /* Teardown the output texture */ + egl_.destroyDMABufTexture(*eglImageBayerOut_); + return ret; } void DebayerEGL::process(uint32_t frame, FrameBuffer *input, FrameBuffer *output, const DebayerParams ¶ms)