From patchwork Fri Jun 26 11:33:19 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 27049 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 E468BC3302 for ; Fri, 26 Jun 2026 11:33:43 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 351E465ED5; Fri, 26 Jun 2026 13:33:43 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="NBYyOzp0"; dkim-atps=neutral Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 97777658FB for ; Fri, 26 Jun 2026 13:33:39 +0200 (CEST) Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-4926fe5be4bso691325e9.0 for ; Fri, 26 Jun 2026 04:33:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1782473619; x=1783078419; darn=lists.libcamera.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=lwy1OBNeUsMVfQ9YO3r6PrYvUXJ8It2Sz/tQewNmuR4=; b=NBYyOzp0P+w0omeSMQF4nxFKE7+h1D1xpgFcedChpddJllK2uCyZQDfwP2Ppv6twY2 VU4Eqv4dg/X1/0X4kn0SPHPI/CXmexXwnXwkBlNc4qmhwO58jtPM8ssw2jbGipnctUXE igXE/aO8GHbyBkOiVw+HG0MxYExoNi0w9tfpJTjpuCJRuz+1EaCojjsYZMTLNVDsZLcK gg9zn6tmNO1oVrhTx8riQgaOXaVmmVt9x8f6lJBHzqQHSJmu46BpAzVYif9HgSRk/BtC xm8K8FJMBy3PHO1e1VU+2mBVg2g+WgTtcs4z995LqHDulIKPWxXIg2Y9umEcHjU/67/+ c1qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782473619; x=1783078419; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=lwy1OBNeUsMVfQ9YO3r6PrYvUXJ8It2Sz/tQewNmuR4=; b=r0A2z3MoThrM47ogULOyCFqvfYfy54lkHfm1bg7/yhS1X8fzqKo0lFDhwqdqhbvx8u evpC88gXuLwRN4l/y8+oHvmh6kES65IIkIJfd8Oh7zHYpGdrKYQUKuDFRix1chZrbJWy DEcLcvkTNnBmWPo2cmhSZ6oXK5oqjM33eunq0q1GILRQDf2f6c4iUAGrLTRNpdRle8Op pa1hVhY0HIqpu8c0mqGZBijP0GIcr6oGWedkQvUiyWDdsUTuaI4yRSqef5ppeex+nqyV SB60MhjfKcCvp7UFgZ5568E2PIgLbx+QGztd1ZAtUb9ATnQF9C8RYbn6Hdld7oKtBzdl owxg== X-Gm-Message-State: AOJu0YyYoRKng8VaMaplDUrQ6h9vuiMCneQEurqmHF8kqKcIFDBIPn1c bv1y7jgG9ct5PUQzB8kdkAHyrNFyECKc9Dc2bcLSU+pUMi1gqEjuv+M+GbSO/KQh+G9UZUa1UWj qXGWKOxE= X-Gm-Gg: AfdE7ckABwPtsN8/17n3+9UspI/rpcx8RH30Vnln7nqUTxbc7xfNXScyRYWqcmspTPw b81ndW98pCUYF8wdeU8bR5vaed0AdyN+ad1h1IxrHg4CXuyWPUy/xrM3RfpHBaD3vPlErmlGs50 J8G+DS0jQLX0Nf+Rb6GYp5d4AfjAiKFtxNjQrXdeFPOL6MRSPCiIRejlbHxZ3Jld5MHwIql6SSN uoQ7tFx1admP/7gM4tLbV6062TginmkSbENZBqgbIiZ1CloTnyBL/WtjR3IRwrRWEyz/hf5kAS9 4UGD9nnQNI+IYrGI273Q+EiR0KQ0Tb04KNYkIzcQ2LKir5yRaN3KJJRKDCwbfs3Pl7k087kFNxh afnvgUVV51PEj0htx7yjlVQQrZbQr/tCTxiRb3jC3UJOeqzfFhi0FwHCP5GdHRzIIzJz7Qps9k+ 75mxFUQD5bAJHpoXtcaQkyg7bBWQ== X-Received: by 2002:a05:600c:83c9:b0:492:379c:32ee with SMTP id 5b1f17b1804b1-4926fc2f61dmr6292335e9.6.1782473619029; Fri, 26 Jun 2026 04:33:39 -0700 (PDT) Received: from inspiron14p-linux ([109.76.78.98]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49268fe31b0sm79265985e9.4.2026.06.26.04.33.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jun 2026 04:33:38 -0700 (PDT) From: Bryan O'Donoghue To: libcamera-devel@lists.libcamera.org Cc: bryan.odonoghue@linaro.org, pavel@ucw.cz Subject: [PATCH v3 2/8] libcamera: software_isp: debayer_egl: Flag dmabuf use once per session not for every frame Date: Fri, 26 Jun 2026 12:33:19 +0100 Message-ID: <20260626113325.3218045-3-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260626113325.3218045-1-bryan.odonoghue@linaro.org> References: <20260626113325.3218045-1-bryan.odonoghue@linaro.org> 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" Once we get as far a streaming if we have one dmabuf import failure, take that failure as canonical and do not try further imports. Add a flag to debayer_egl which gets reset on any configure() to control this logic, flip the dmabuf bit on the first failure for all subsequent frames. Signed-off-by: Bryan O'Donoghue Reviewed-by: Robert Mader Reviewed-by: Milan Zamazal --- src/libcamera/software_isp/debayer_egl.cpp | 13 ++++++------- src/libcamera/software_isp/debayer_egl.h | 2 ++ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/libcamera/software_isp/debayer_egl.cpp b/src/libcamera/software_isp/debayer_egl.cpp index 14eeb9a29..53bb67c17 100644 --- a/src/libcamera/software_isp/debayer_egl.cpp +++ b/src/libcamera/software_isp/debayer_egl.cpp @@ -316,6 +316,7 @@ int DebayerEGL::configure(const StreamConfiguration &inputCfg, inputPixelFormat_ = inputCfg.pixelFormat; width_ = inputCfg.size.width; height_ = inputCfg.size.height; + use_dmabuf_ = true; if (outputCfgs.size() != 1) { LOG(Debayer, Error) @@ -515,21 +516,19 @@ void DebayerEGL::setShaderVariableValues(eGLImage &eglImageIn, const DebayerPara int DebayerEGL::debayerGPU(FrameBuffer *input, FrameBuffer *output, const DebayerParams ¶ms, std::optional *inMapped, std::optional *inDmaSyncer) { - bool dmabuf_import_succeeded = false; - /* eGL context switch */ egl_.makeCurrent(); /* Try to create texture for input buffer via dmabuf import */ - if (!eglImageBayerIn_->dmabuf_import_failed_) { - if (egl_.createInputDMABufTexture2D(*eglImageBayerIn_, input->planes()[0].fd.get()) == 0) - dmabuf_import_succeeded = true; - else + if (use_dmabuf_) { + if (egl_.createInputDMABufTexture2D(*eglImageBayerIn_, input->planes()[0].fd.get()) != 0) { + use_dmabuf_ = false; LOG(Debayer, Info) << "Importing input buffer with DMABuf import failed, falling back to upload"; + } } /* Otherwise create texture for input buffer via upload from CPU */ - if (!dmabuf_import_succeeded) { + if (!use_dmabuf_) { inDmaSyncer->emplace(input->planes()[0].fd, DmaSyncer::SyncType::Read); inMapped->emplace(input, MappedFrameBuffer::MapFlag::Read); if (!inMapped->value().isValid()) { diff --git a/src/libcamera/software_isp/debayer_egl.h b/src/libcamera/software_isp/debayer_egl.h index 348d7305b..d8509e9f2 100644 --- a/src/libcamera/software_isp/debayer_egl.h +++ b/src/libcamera/software_isp/debayer_egl.h @@ -68,6 +68,8 @@ private: void setShaderVariableValues(eGLImage &eGLImageIn, const DebayerParams ¶ms); int debayerGPU(FrameBuffer *input, FrameBuffer *output, const DebayerParams ¶ms, std::optional *mappedInputBuffer, std::optional *inputBufferDmaSyncer); + bool use_dmabuf_; + /* Shader program identifiers */ GLuint vertexShaderId_ = 0; GLuint fragmentShaderId_ = 0;