[{"id":39388,"web_url":"https://patchwork.libcamera.org/comment/39388/","msgid":"<3c00d2eb-ad2a-46e6-a66b-52c398bb4fd0@collabora.com>","date":"2026-06-24T12:23:35","subject":"Re: [PATCH 09/10] libcamera: software_isp: debayer_egl: Flag dmabuf\n\tuse once per session not for every frame","submitter":{"id":140,"url":"https://patchwork.libcamera.org/api/people/140/","name":"Robert Mader","email":"robert.mader@collabora.com"},"content":"On 24.06.26 10:58, Bryan O'Donoghue wrote:\n> Once we get as far a streaming if we have one dmabuf import failure, take\n> that failure as canonical and do not try further imports. Add a flag to\n> debayer_egl which gets reset on any configure() to control this logic, flip\n> the dmabuf bit on the first failure for all subsequent frames.\n\nPrevious to this commit we already used eGLImage::dmabuf_import_failed_ \nfor that - i.e. we didn't try importing every frame (need commit \ntitle/message adoption), but as long as that eGLImage was used, i.e. \nalso only once per session as there was only one of them for input. Now \nthat we're preparing to use one eGLImage per buffer this change \nperfectly makes sense - however please remove the leftover \neGLImage::dmabuf_import_failed_ while on it.\n\nOtherwise LGTM!\n\n>\n> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>\n> ---\n>   src/libcamera/software_isp/debayer_egl.cpp | 13 ++++++-------\n>   src/libcamera/software_isp/debayer_egl.h   |  2 ++\n>   2 files changed, 8 insertions(+), 7 deletions(-)\n>\n> diff --git a/src/libcamera/software_isp/debayer_egl.cpp b/src/libcamera/software_isp/debayer_egl.cpp\n> index f6b7b11e1..0568c413b 100644\n> --- a/src/libcamera/software_isp/debayer_egl.cpp\n> +++ b/src/libcamera/software_isp/debayer_egl.cpp\n> @@ -316,6 +316,7 @@ int DebayerEGL::configure(const StreamConfiguration &inputCfg,\n>   \tinputPixelFormat_ = inputCfg.pixelFormat;\n>   \twidth_ = inputCfg.size.width;\n>   \theight_ = inputCfg.size.height;\n> +\tuse_dmabuf_ = true;\n>   \n>   \tif (outputCfgs.size() != 1) {\n>   \t\tLOG(Debayer, Error)\n> @@ -515,21 +516,19 @@ void DebayerEGL::setShaderVariableValues(eGLImage &eglImageIn, const DebayerPara\n>   \n>   int DebayerEGL::debayerGPU(FrameBuffer *input, FrameBuffer *output, const DebayerParams &params, std::optional<MappedFrameBuffer> *inMapped, std::optional<DmaSyncer> *inDmaSyncer)\n>   {\n> -\tbool dmabuf_import_succeeded = false;\n> -\n>   \t/* eGL context switch */\n>   \tegl_.makeCurrent();\n>   \n>   \t/* Try to create texture for input buffer via dmabuf import */\n> -\tif (!eglImageBayerIn_->dmabuf_import_failed_) {\n> -\t\tif (egl_.createInputDMABufTexture2D(*eglImageBayerIn_, input->planes()[0].fd.get()) == 0)\n> -\t\t\tdmabuf_import_succeeded = true;\n> -\t\telse\n> +\tif (use_dmabuf_) {\n> +\t\tif (egl_.createInputDMABufTexture2D(*eglImageBayerIn_, input->planes()[0].fd.get()) != 0) {\n> +\t\t\tuse_dmabuf_ = false;\n>   \t\t\tLOG(Debayer, Info) << \"Importing input buffer with DMABuf import failed, falling back to upload\";\n> +\t\t}\n>   \t}\n>   \n>   \t/* Otherwise create texture for input buffer via upload from CPU */\n> -\tif (!dmabuf_import_succeeded) {\n> +\tif (!use_dmabuf_) {\n>   \t\tinDmaSyncer->emplace(input->planes()[0].fd, DmaSyncer::SyncType::Read);\n>   \t\tinMapped->emplace(input, MappedFrameBuffer::MapFlag::Read);\n>   \t\tif (!inMapped->value().isValid()) {\n> diff --git a/src/libcamera/software_isp/debayer_egl.h b/src/libcamera/software_isp/debayer_egl.h\n> index 348d7305b..d8509e9f2 100644\n> --- a/src/libcamera/software_isp/debayer_egl.h\n> +++ b/src/libcamera/software_isp/debayer_egl.h\n> @@ -68,6 +68,8 @@ private:\n>   \tvoid setShaderVariableValues(eGLImage &eGLImageIn, const DebayerParams &params);\n>   \tint debayerGPU(FrameBuffer *input, FrameBuffer *output, const DebayerParams &params, std::optional<MappedFrameBuffer> *mappedInputBuffer, std::optional<DmaSyncer> *inputBufferDmaSyncer);\n>   \n> +\tbool use_dmabuf_;\n> +\n>   \t/* Shader program identifiers */\n>   \tGLuint vertexShaderId_ = 0;\n>   \tGLuint fragmentShaderId_ = 0;","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 3FA5BC3308\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 24 Jun 2026 12:23:45 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 833CF658A9;\n\tWed, 24 Jun 2026 14:23:44 +0200 (CEST)","from sender4-op-o12.zoho.com (sender4-op-o12.zoho.com\n\t[136.143.188.12])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id CBB29658A5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 24 Jun 2026 14:23:42 +0200 (CEST)","by mx.zohomail.com with SMTPS id 1782303818019535.3798566753389;\n\tWed, 24 Jun 2026 05:23:38 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=collabora.com\n\theader.i=robert.mader@collabora.com header.b=\"DaDQ/Hd2\"; \n\tdkim-atps=neutral","ARC-Seal":"i=1; a=rsa-sha256; t=1782303820; cv=none; \n\td=zohomail.com; s=zohoarc; \n\tb=YFLzpuokR/V6/y2Pxlc0YHr85YVSXie3v3aHxY9AzMBOFd2UhG7gNFaYztJ5ts3uyteODX+d+ta5jeK8TsG0finXYtsf61UW4PQouQXwKEDh62tbicMTaKlxOBwVkN1BrCpW7tQJSWC54loOCfnk7q5yiIY7WpTnLaHk+IaX4Ag=","ARC-Message-Signature":"i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; \n\ts=zohoarc; t=1782303820;\n\th=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To:Cc;\n\tbh=IwBmgAhiwXDvR7AAbkrw0XuDm8uM07fAXS8cQ0VCzvg=; \n\tb=Xm/MFIzRGsjNSx2PofpzWhAB/sbUdJXzO34+LH/7K0uW1Bvoj+pRbbro26Gm6ghOgQnYHDHJ6BVmxaz3kSkt9TpmvJWv3otWUpbjgLwsy+SD/0I3lLEQspwJPYJtmpI8tzhoyiuuaBHGoWkdd7lNxHsNDXDpfFAgif/oPqAyUf4=","ARC-Authentication-Results":"i=1; mx.zohomail.com;\n\tdkim=pass  header.i=collabora.com;\n\tspf=pass  smtp.mailfrom=robert.mader@collabora.com;\n\tdmarc=pass header.from=<robert.mader@collabora.com>","DKIM-Signature":"v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1782303820;\n\ts=zohomail; d=collabora.com; i=robert.mader@collabora.com;\n\th=Message-ID:Date:Date:MIME-Version:Subject:Subject:To:To:References:From:From:In-Reply-To:Content-Type:Content-Transfer-Encoding:Message-Id:Reply-To:Cc;\n\tbh=IwBmgAhiwXDvR7AAbkrw0XuDm8uM07fAXS8cQ0VCzvg=;\n\tb=DaDQ/Hd2iZpVL7RHEuSunj7yhx5q/ejjYDZ0u3YQthzUaboi/uEvrDYLbjyNZWk2\n\t94Fvp4VUUhoZO9rVrKJj3awl5PsakuzBOuHpcLCSgKxNjWd9a3kGJDU/CMMJ8DMo4o9\n\tB/DA8nJm2kxWRomaOmTdBzQ/ejbwvW8aH8eMi2Oc=","Message-ID":"<3c00d2eb-ad2a-46e6-a66b-52c398bb4fd0@collabora.com>","Date":"Wed, 24 Jun 2026 14:23:35 +0200","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH 09/10] libcamera: software_isp: debayer_egl: Flag dmabuf\n\tuse once per session not for every frame","To":"libcamera-devel@lists.libcamera.org","References":"<20260624085849.873784-1-bryan.odonoghue@linaro.org>\n\t<20260624085849.873784-10-bryan.odonoghue@linaro.org>","Content-Language":"en-US, de-DE, en-GB","From":"Robert Mader <robert.mader@collabora.com>","In-Reply-To":"<20260624085849.873784-10-bryan.odonoghue@linaro.org>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"7bit","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>"}}]