[{"id":38373,"web_url":"https://patchwork.libcamera.org/comment/38373/","msgid":"<ac4dc1cf-e6eb-4a2f-9d94-576bea4b01f4@ideasonboard.com>","date":"2026-03-20T22:32:54","subject":"Re: [PATCH] libcamera: software_isp: debayer_egl: Teardown the\n\toutput texture","submitter":{"id":216,"url":"https://patchwork.libcamera.org/api/people/216/","name":"Barnabás Pőcze","email":"barnabas.pocze@ideasonboard.com"},"content":"Hi\n\n2026. 03. 20. 22:41 keltezéssel, Gianfranco Mariotti írta:\n> Destroy the EGL image associated with the output DMA-BUF texture\n> after processing the frame.\n> \n> Without this change memory can be seen building up while running\n> a gstreamer pipeline using GPUISP, and on end of available memory\n> the stream freezes and the error message `eglCreateImageKHR fail`\n> is reported repeatedly.\n> \n> Signed-off-by: Gianfranco Mariotti <gianfranco.mariotti94@gmail.com>\n> ---\n>   src/libcamera/software_isp/debayer_egl.cpp | 8 ++++++--\n>   1 file changed, 6 insertions(+), 2 deletions(-)\n> \n> diff --git a/src/libcamera/software_isp/debayer_egl.cpp b/src/libcamera/software_isp/debayer_egl.cpp\n> index 8147eca1..db7e35e5 100644\n> --- a/src/libcamera/software_isp/debayer_egl.cpp\n> +++ b/src/libcamera/software_isp/debayer_egl.cpp\n> @@ -498,6 +498,8 @@ void DebayerEGL::setShaderVariableValues(const DebayerParams &params)\n>   \n>   int DebayerEGL::debayerGPU(MappedFrameBuffer &in, int out_fd, const DebayerParams &params)\n>   {\n> +\tint ret = 0;\n> +\n>   \t/* eGL context switch */\n>   \tegl_.makeCurrent();\n>   \n> @@ -515,12 +517,14 @@ int DebayerEGL::debayerGPU(MappedFrameBuffer &in, int out_fd, const DebayerParam\n>   \tGLenum err = glGetError();\n>   \tif (err != GL_NO_ERROR) {\n>   \t\tLOG(eGL, Error) << \"Drawing scene fail \" << err;\n> -\t\treturn -ENODEV;\n> +\t\tret = -ENODEV;\n>   \t} else {\n>   \t\tegl_.syncOutput();\n>   \t}\n>   \n> -\treturn 0;\n> +\t/* Teardown the output texture */\n> +\tegl_.destroyDMABufTexture(*eglImageBayerOut_);\n\nThanks for the patch. I brought this up as well some time ago: https://lists.libcamera.org/pipermail/libcamera-devel/2026-January/056455.html\nPlease see the proposed change, and send a v2 that uses `utils::scope_exit`.\n\n\nRegards,\nBarnabás Pőcze\n\n\n> +\treturn ret;\n>   }\n>   \n>   void DebayerEGL::process(uint32_t frame, FrameBuffer *input, FrameBuffer *output, const DebayerParams &params)","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 5D418BE086\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 20 Mar 2026 22:33:19 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8DEB262738;\n\tFri, 20 Mar 2026 23:33:18 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 015F962655\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 20 Mar 2026 23:33:16 +0100 (CET)","from [192.168.33.22] (185.221.143.129.nat.pool.zt.hu\n\t[185.221.143.129])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id C6FE68D4;\n\tFri, 20 Mar 2026 23:31:59 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"ZrByKB5I\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1774045922;\n\tbh=3aqm+HS5Bk9QEds0dmRCpXWEAMAL0z39G0drxtDtjsU=;\n\th=Date:Subject:To:References:From:In-Reply-To:From;\n\tb=ZrByKB5IsdXb8QOAx9EU7/Y7P9zI5BlYi5ZykV0VVqX5gbijBRGErFkwTDboPaTeM\n\t3qTaUXw7AqF0ZOWJ9onFQZWJN65Crjnw4D9Ua/yAGZT+lpExtPB3GwTuK+04Bqsu3M\n\tiAKzQzgOEvXqyKozC5sztrn2KYvsgGhg3GSN9yQ0=","Message-ID":"<ac4dc1cf-e6eb-4a2f-9d94-576bea4b01f4@ideasonboard.com>","Date":"Fri, 20 Mar 2026 23:32:54 +0100","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH] libcamera: software_isp: debayer_egl: Teardown the\n\toutput texture","To":"Gianfranco Mariotti <gianfranco.mariotti94@gmail.com>,\n\tlibcamera-devel@lists.libcamera.org","References":"<20260320214102.11844-1-gianfranco.mariotti94@gmail.com>","From":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>","Content-Language":"en-US, hu-HU","In-Reply-To":"<20260320214102.11844-1-gianfranco.mariotti94@gmail.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"8bit","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":38389,"web_url":"https://patchwork.libcamera.org/comment/38389/","msgid":"<CAAX85RtYPj3XGnvk=mkVXprs2Obdqtp2RNc47x_hAZWNzNLmrg@mail.gmail.com>","date":"2026-03-23T20:22:18","subject":"Re: [PATCH] libcamera: software_isp: debayer_egl: Teardown the\n\toutput texture","submitter":{"id":262,"url":"https://patchwork.libcamera.org/api/people/262/","name":"Gianfranco Mariotti","email":"gianfranco.mariotti94@gmail.com"},"content":"Hello, thanks for the suggestion.\n\nIl giorno ven 20 mar 2026 alle ore 23:33 Barnabás Pőcze\n<barnabas.pocze@ideasonboard.com> ha scritto:\n>\n> Hi\n>\n> 2026. 03. 20. 22:41 keltezéssel, Gianfranco Mariotti írta:\n> > Destroy the EGL image associated with the output DMA-BUF texture\n> > after processing the frame.\n> >\n> > Without this change memory can be seen building up while running\n> > a gstreamer pipeline using GPUISP, and on end of available memory\n> > the stream freezes and the error message `eglCreateImageKHR fail`\n> > is reported repeatedly.\n> >\n> > Signed-off-by: Gianfranco Mariotti <gianfranco.mariotti94@gmail.com>\n> > ---\n> >   src/libcamera/software_isp/debayer_egl.cpp | 8 ++++++--\n> >   1 file changed, 6 insertions(+), 2 deletions(-)\n> >\n> > diff --git a/src/libcamera/software_isp/debayer_egl.cpp b/src/libcamera/software_isp/debayer_egl.cpp\n> > index 8147eca1..db7e35e5 100644\n> > --- a/src/libcamera/software_isp/debayer_egl.cpp\n> > +++ b/src/libcamera/software_isp/debayer_egl.cpp\n> > @@ -498,6 +498,8 @@ void DebayerEGL::setShaderVariableValues(const DebayerParams &params)\n> >\n> >   int DebayerEGL::debayerGPU(MappedFrameBuffer &in, int out_fd, const DebayerParams &params)\n> >   {\n> > +     int ret = 0;\n> > +\n> >       /* eGL context switch */\n> >       egl_.makeCurrent();\n> >\n> > @@ -515,12 +517,14 @@ int DebayerEGL::debayerGPU(MappedFrameBuffer &in, int out_fd, const DebayerParam\n> >       GLenum err = glGetError();\n> >       if (err != GL_NO_ERROR) {\n> >               LOG(eGL, Error) << \"Drawing scene fail \" << err;\n> > -             return -ENODEV;\n> > +             ret = -ENODEV;\n> >       } else {\n> >               egl_.syncOutput();\n> >       }\n> >\n> > -     return 0;\n> > +     /* Teardown the output texture */\n> > +     egl_.destroyDMABufTexture(*eglImageBayerOut_);\n>\n> Thanks for the patch. I brought this up as well some time ago: https://lists.libcamera.org/pipermail/libcamera-devel/2026-January/056455.html\n> Please see the proposed change, and send a v2 that uses `utils::scope_exit`.\n>\nTested the version with utils::scope_exit and it works just as well,\nsent the update.\n\n>\n> Regards,\n> Barnabás Pőcze\n>\n>\n> > +     return ret;\n> >   }\n> >\n> >   void DebayerEGL::process(uint32_t frame, FrameBuffer *input, FrameBuffer *output, const DebayerParams &params)\n>\n\nRegards,\nGianfranco Mariotti.","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 461E8BE086\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 23 Mar 2026 20:22:33 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 99C8162778;\n\tMon, 23 Mar 2026 21:22:32 +0100 (CET)","from mail-vk1-xa2e.google.com (mail-vk1-xa2e.google.com\n\t[IPv6:2607:f8b0:4864:20::a2e])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5196C62647\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 23 Mar 2026 21:22:31 +0100 (CET)","by mail-vk1-xa2e.google.com with SMTP id\n\t71dfb90a1353d-56739adfa1aso3346339e0c.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 23 Mar 2026 13:22:31 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"cOrvWkR7\"; dkim-atps=neutral","ARC-Seal":"i=1; a=rsa-sha256; t=1774297350; cv=none;\n\td=google.com; s=arc-20240605;\n\tb=k+vfBaK1IMjoogWkSiYfmyGTbLaQQHavNJplQZkK7qjtvViGVZkN10YQHkeASCzQTk\n\t3tGGNgrXPHf0z87WmioHEe2OMYqleZG8cigMRbrryuwhzdRiZpzVnex+aH/UHqrGBWGD\n\tsH5PlKSA5HbB0ajjvRZGsvWABtMbyVAbjrCfxEriRpDhaFU3bavsplbN9YuRmr822gnM\n\tyQYgp1DSifZqb1fNDlA+lxrN2lKSIt1+6KqLfmZubxbCg/ZPa60ap08h6Zc0AKA+rKoI\n\tyW8h0mnoNdJHiFG+UEE5ZnA4V6yXVzdO7LgA0RXo/PVcFYkH6D7rgIv603g7/+nuW7/B\n\tx7bw==","ARC-Message-Signature":"i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;\n\ts=arc-20240605; \n\th=content-transfer-encoding:cc:to:subject:message-id:date:from\n\t:in-reply-to:references:mime-version:dkim-signature;\n\tbh=mTCbGY7wuo7jSLgm03LPytLyMZLTnt0e5moqkSqL4rw=;\n\tfh=6eMZ9Peh5oKJMXVlU5do7GxLXGl0cSCd64pkjvWpyo4=;\n\tb=AyU3+9F2aZjmsXJPKzRQ6iv+v1XpTIfKvnzVi1vL6kUbcQukjrSHYXR483S00k6FS4\n\tveV/tampa5hm6CJuSy421MyVpuNhrfxbtsnkdUdalcGNcXFWoxYRXa1anfyBSehfRNgB\n\tdytuM4rYYAeTgJ92t7VZ6m6sLvFuXqX0VbrCSweu/yta50TcQWmZ3QHVWmlwwpe6BpUn\n\t7ios+E3mvJx1iUH/LB+gOY0iZkga1a0qJEOWBW0L1DzAD+tRDKFUR25OJ5TdMHPJTIW4\n\tmOKRLoMf76vaas7H2YyPIdxDfTbdV35uN/iSfNT9BSj1hF1t2T3AmfSzXQnzNqL4vEQ9\n\tgpcQ==; darn=lists.libcamera.org","ARC-Authentication-Results":"i=1; mx.google.com; arc=none","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=gmail.com; s=20251104; t=1774297350; x=1774902150;\n\tdarn=lists.libcamera.org; \n\th=content-transfer-encoding:cc:to:subject:message-id:date:from\n\t:in-reply-to:references:mime-version:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=mTCbGY7wuo7jSLgm03LPytLyMZLTnt0e5moqkSqL4rw=;\n\tb=cOrvWkR7RvPgMseRXPSCzBj+IU6BPvDDqEmjAOOBGGwe5Qulizwt/DE0SdDBj/L8W4\n\tmgKGLZ0buxBkxhIRj3nZg8J9kcmxlzJvYZguBzNJlNuoGDW5uGcM7W0y5vHVL6/NDvuL\n\tcN9PxRxZAfYD+zblBdsXX5/VU3UMFy/8JhHYGS/86sAwto3RVz1bmQGh7hpqqNPU5pcD\n\tlTX2QINgFXH6tSOGo4tPtNKcsgsiyCddUdHjoJiviRGlsEqRVVU8dUodXOzDDYIemMcX\n\tRKGlg8lqqPXRV9Z6toXinCJ7WA2xUvkgLph6zt5px0XZVtYnr9zY4DKEFFIg6qf4nhWT\n\tpxKA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20251104; t=1774297350; x=1774902150;\n\th=content-transfer-encoding:cc:to:subject:message-id:date:from\n\t:in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from\n\t:to:cc:subject:date:message-id:reply-to;\n\tbh=mTCbGY7wuo7jSLgm03LPytLyMZLTnt0e5moqkSqL4rw=;\n\tb=OQmAVPYlN+Qciir0nnJKL0F2+j/PsPa+86MGac2rKnkHGBH8AlmC5iYTRvicJq0F5X\n\tU8TinQxA16xpw45VtOV46ELtJ3GgeQJvjR0PNPOtIMlGelytI5A77jbp8wRPWth6tIlt\n\tBJHRJCwq1f+ZGY3Q731qwxbIgyZDBJiRjv48AsBmYPTYGz25i8gEyfmkfBVh3j5WStj8\n\tk+Xh1euaeokA5vWcsdfw6yilYX0OC/7DQCSi4wEoX32gRzbCZLHd9IcLYlt/jzHI6WWl\n\t3Lchz49H3bvY7px6AGNQ80u9qWax4y3JFwwDle4pgjoao2h3ZGW6a67DEK8KY3LnMimU\n\tGEBw==","X-Gm-Message-State":"AOJu0YwgWKpL0/ausHVhnkzXyzori7yzlrlsr8iKIUVtnfK2IBGSGtq1\n\tpAAU1CZBN9u70JFFrXlRJZq5HFKvfrltQQmG0rmSw1ZcGjh6caTXKNP5wM74AYvclxYZCFUDggC\n\trtEmktngZNwS5d8rBOUb4pXYiezxMjeACkn0=","X-Gm-Gg":"ATEYQzx56Glp76wTH4OCF5neXhG0Abm1hqWHmpc6+m8HaTOsxBFuyep02/ZjvTk4hz2\n\t45N6/A5YGz5uyEsLk1db+ZeXJJG9lIjAjpMne9pUNCHvU4z/G2YslEwf1xcMHzHVdccHXorA2eo\n\thoKRLkbpAle6Z6OC3XJT79WMMZgEaH3sxLa6llgjhxG5IaJQV01Gn8QI7iy5LLpYoYhaTl8rx10\n\t9TCAwgKvmEplK7cQvvyaBtb2u4QphmQAWowDobfoMv9+7eKZzrTc1n+w3mJ3nJCmNr3aNV3J2TI\n\tlp7fMwdfEyA96Mc/pNaES6jqb2opRAXN2mHSkGn3K2/jB2sfUULSkZimhK8Tn8JY","X-Received":"by 2002:a05:6102:f97:b0:5ff:de16:369a with SMTP id\n\tada2fe7eead31-602aecb758bmr6407949137.22.1774297349940;\n\tMon, 23 Mar 2026 13:22:29 -0700 (PDT)","MIME-Version":"1.0","References":"<20260320214102.11844-1-gianfranco.mariotti94@gmail.com>\n\t<ac4dc1cf-e6eb-4a2f-9d94-576bea4b01f4@ideasonboard.com>","In-Reply-To":"<ac4dc1cf-e6eb-4a2f-9d94-576bea4b01f4@ideasonboard.com>","From":"Gianfranco Mariotti <gianfranco.mariotti94@gmail.com>","Date":"Mon, 23 Mar 2026 21:22:18 +0100","X-Gm-Features":"AQROBzCJWYg83m_dowdhpUhePcjPQa9zs2BnxwrlkmeyeuIuQt8fhAL5Ls_bLW0","Message-ID":"<CAAX85RtYPj3XGnvk=mkVXprs2Obdqtp2RNc47x_hAZWNzNLmrg@mail.gmail.com>","Subject":"Re: [PATCH] libcamera: software_isp: debayer_egl: Teardown the\n\toutput texture","To":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Content-Type":"text/plain; charset=\"UTF-8\"","Content-Transfer-Encoding":"quoted-printable","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]