{"id":27035,"url":"https://patchwork.libcamera.org/api/patches/27035/?format=json","web_url":"https://patchwork.libcamera.org/patch/27035/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20260624085849.873784-10-bryan.odonoghue@linaro.org>","date":"2026-06-24T08:58:48","name":"[09/10] libcamera: software_isp: debayer_egl: Flag dmabuf use once per session not for every frame","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"321250085fb82dd7a408d3172ade7a6674caba8d","submitter":{"id":175,"url":"https://patchwork.libcamera.org/api/people/175/?format=json","name":"Bryan O'Donoghue","email":"bryan.odonoghue@linaro.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/27035/mbox/","series":[{"id":6015,"url":"https://patchwork.libcamera.org/api/series/6015/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=6015","date":"2026-06-24T08:58:39","name":"libcamera: software_isp: gpu: Add go faster stripes","version":1,"mbox":"https://patchwork.libcamera.org/series/6015/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/27035/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/27035/checks/","tags":{},"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 24CC5C3306\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 24 Jun 2026 08:59:21 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id CDAD065881;\n\tWed, 24 Jun 2026 10:59:20 +0200 (CEST)","from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com\n\t[IPv6:2a00:1450:4864:20::32e])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 1FA5E6588E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 24 Jun 2026 10:59:07 +0200 (CEST)","by mail-wm1-x32e.google.com with SMTP id\n\t5b1f17b1804b1-490c0c92cffso5300535e9.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 24 Jun 2026 01:59:07 -0700 (PDT)","from inspiron14p-linux ([109.76.100.231])\n\tby smtp.gmail.com with ESMTPSA id\n\t5b1f17b1804b1-49261063d6esm25128375e9.2.2026.06.24.01.59.05\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 24 Jun 2026 01:59:06 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=linaro.org header.i=@linaro.org\n\theader.b=\"KXl0itHz\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=linaro.org; s=google; t=1782291547; x=1782896347;\n\tdarn=lists.libcamera.org; \n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=2bIZGrUQwPgXcjdXPjamqzwXBECgXjVAW95gyrhVmes=;\n\tb=KXl0itHzw+rjGwLg81Y/8UfoM5OiPf8dPAGqpKWavfJiVAHOXQRel4WGGooPDid6xw\n\t2i4uJ4PNaf+XYAY3748U7GM3KMFhMQTjQcpFUdcvfcBh4XNTXbtgeUYZWE/LnBJRSdwO\n\t2ImbXmLYEtDv1G3jskaB7bbvAKxgsiY1Xsgwh8ObsCp+zRvaoTD6wZgK/sByC9yAutVt\n\tFxXQ6fb63cfzogKh4b9poKTPwZ4ya0e8M5jWWmpNN3zY8GQXGOX/QyMYpPogiJn0e/Tk\n\tJo2WnUG7L2uU8Gctp11AFx/Bm3S9S70+MxCTX1cG/t4x0ZWns5csA6n5sf8rnJ0UXeEG\n\tV0kg==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20251104; t=1782291547; x=1782896347;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n\t:to:cc:subject:date:message-id:reply-to;\n\tbh=2bIZGrUQwPgXcjdXPjamqzwXBECgXjVAW95gyrhVmes=;\n\tb=mETINXcuxptrwXBhl4kZI/ooyUx23bgeAVSTvg1TYAmLELGxRsKdKa8JRbGzqNwzJd\n\t+I9Kx9VlbcDvbTPLvmNAgr7PY7Z51su4dutfdwLh396EoEMXgTG5RazUDwjTz6X0N8st\n\tyihWlK+wR6BZVBYwwOZO8MBJcS0VUn/KhhfE6+0Yz0B1Op8jyrsInPJaDR3ORwlXoRfl\n\tK3tWSt3USHZztQ/aZUh1cNaJ9QQ9mwpH3Dh/FUFffw0YE+k2dgMes9pbxAdzTaXmJr/y\n\tjX0q2fXFraD1l4DzANuy3dQ17Km0PSZwbgBnhZNnCCMR100iMNY5YWG0Wn95/jgxtv/1\n\tuI8w==","X-Gm-Message-State":"AOJu0YxaQt2T1zykUNl+DwkBQgSygyxC6FnQJfco2nXJzNBMzrDYym8R\n\tSm6XMb5c0Xvmh5S0G7r3qKLwS99FF2JFTPNxoE9nRMwdMzyLXktFpSfbbbfw4bmwFPLigp4dJvp\n\tE4wpwCMU=","X-Gm-Gg":"AfdE7cl3TV99NbKvWYxQNu8w7yrY59/OgCnM+Eu1KS4Wddo5SGRqTvLCDWmSmWKxjI3\n\tBgtOgFXB9gfhXp6g6upgsyayZnUfmMurhPJOKu30VWKZIINW/Z8Dk0kImz0pG3lD3J2rQjCiX5+\n\tCkldsdXa13kKvgpeMGdQJFHNaURb6jgS/mGjhulR8d6emdyYGAUR2uavbM+la9S3FB9DXFVSEMP\n\t15F1gWf3asJyO/PaRHb5Rxh918mUCok7SJtAhnOM+obWWfg9dA1np2MxHjXPA9FggtedzvQDV8a\n\tV4kg39BkwQCZRsyrYpKotc5ttgCpficG9IkAmzlLJWlVKG3kDbQida07CMuPJz6oKz8S79OL8N2\n\t403jBv3AgFA8LajWGPDsoByGu5ck6SNz5xhFn8ar36U0Yr3JpZShLvO7Dyx85JRohCBwDzN8wAb\n\tpfLDUn90ieRIV1ozhnCgYdVWF6mSea","X-Received":"by 2002:a05:600c:4443:b0:491:8043:5c4a with SMTP id\n\t5b1f17b1804b1-49260879105mr30625795e9.31.1782291546594; \n\tWed, 24 Jun 2026 01:59:06 -0700 (PDT)","From":"Bryan O'Donoghue <bryan.odonoghue@linaro.org>","To":"libcamera-devel@lists.libcamera.org","Cc":"bryan.odonoghue@linaro.org,\n\tpavel@ucw.cz","Subject":"[PATCH 09/10] libcamera: software_isp: debayer_egl: Flag dmabuf use\n\tonce per session not for every frame","Date":"Wed, 24 Jun 2026 09:58:48 +0100","Message-ID":"<20260624085849.873784-10-bryan.odonoghue@linaro.org>","X-Mailer":"git-send-email 2.54.0","In-Reply-To":"<20260624085849.873784-1-bryan.odonoghue@linaro.org>","References":"<20260624085849.873784-1-bryan.odonoghue@linaro.org>","MIME-Version":"1.0","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>"},"content":"Once we get as far a streaming if we have one dmabuf import failure, take\nthat failure as canonical and do not try further imports. Add a flag to\ndebayer_egl which gets reset on any configure() to control this logic, flip\nthe dmabuf bit on the first failure for all subsequent frames.\n\nSigned-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(-)","diff":"diff --git a/src/libcamera/software_isp/debayer_egl.cpp b/src/libcamera/software_isp/debayer_egl.cpp\nindex 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()) {\ndiff --git a/src/libcamera/software_isp/debayer_egl.h b/src/libcamera/software_isp/debayer_egl.h\nindex 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;\n","prefixes":["09/10"]}