From patchwork Wed Jun 24 08:58:48 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: 27035 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 24CC5C3306 for ; Wed, 24 Jun 2026 08:59:21 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id CDAD065881; Wed, 24 Jun 2026 10:59:20 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="KXl0itHz"; dkim-atps=neutral Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 1FA5E6588E for ; Wed, 24 Jun 2026 10:59:07 +0200 (CEST) Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-490c0c92cffso5300535e9.2 for ; Wed, 24 Jun 2026 01:59:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1782291547; x=1782896347; 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=2bIZGrUQwPgXcjdXPjamqzwXBECgXjVAW95gyrhVmes=; b=KXl0itHzw+rjGwLg81Y/8UfoM5OiPf8dPAGqpKWavfJiVAHOXQRel4WGGooPDid6xw 2i4uJ4PNaf+XYAY3748U7GM3KMFhMQTjQcpFUdcvfcBh4XNTXbtgeUYZWE/LnBJRSdwO 2ImbXmLYEtDv1G3jskaB7bbvAKxgsiY1Xsgwh8ObsCp+zRvaoTD6wZgK/sByC9yAutVt FxXQ6fb63cfzogKh4b9poKTPwZ4ya0e8M5jWWmpNN3zY8GQXGOX/QyMYpPogiJn0e/Tk Jo2WnUG7L2uU8Gctp11AFx/Bm3S9S70+MxCTX1cG/t4x0ZWns5csA6n5sf8rnJ0UXeEG V0kg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782291547; x=1782896347; 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=2bIZGrUQwPgXcjdXPjamqzwXBECgXjVAW95gyrhVmes=; b=mETINXcuxptrwXBhl4kZI/ooyUx23bgeAVSTvg1TYAmLELGxRsKdKa8JRbGzqNwzJd +I9Kx9VlbcDvbTPLvmNAgr7PY7Z51su4dutfdwLh396EoEMXgTG5RazUDwjTz6X0N8st yihWlK+wR6BZVBYwwOZO8MBJcS0VUn/KhhfE6+0Yz0B1Op8jyrsInPJaDR3ORwlXoRfl K3tWSt3USHZztQ/aZUh1cNaJ9QQ9mwpH3Dh/FUFffw0YE+k2dgMes9pbxAdzTaXmJr/y jX0q2fXFraD1l4DzANuy3dQ17Km0PSZwbgBnhZNnCCMR100iMNY5YWG0Wn95/jgxtv/1 uI8w== X-Gm-Message-State: AOJu0YxaQt2T1zykUNl+DwkBQgSygyxC6FnQJfco2nXJzNBMzrDYym8R Sm6XMb5c0Xvmh5S0G7r3qKLwS99FF2JFTPNxoE9nRMwdMzyLXktFpSfbbbfw4bmwFPLigp4dJvp E4wpwCMU= X-Gm-Gg: AfdE7cl3TV99NbKvWYxQNu8w7yrY59/OgCnM+Eu1KS4Wddo5SGRqTvLCDWmSmWKxjI3 BgtOgFXB9gfhXp6g6upgsyayZnUfmMurhPJOKu30VWKZIINW/Z8Dk0kImz0pG3lD3J2rQjCiX5+ CkldsdXa13kKvgpeMGdQJFHNaURb6jgS/mGjhulR8d6emdyYGAUR2uavbM+la9S3FB9DXFVSEMP 15F1gWf3asJyO/PaRHb5Rxh918mUCok7SJtAhnOM+obWWfg9dA1np2MxHjXPA9FggtedzvQDV8a V4kg39BkwQCZRsyrYpKotc5ttgCpficG9IkAmzlLJWlVKG3kDbQida07CMuPJz6oKz8S79OL8N2 403jBv3AgFA8LajWGPDsoByGu5ck6SNz5xhFn8ar36U0Yr3JpZShLvO7Dyx85JRohCBwDzN8wAb pfLDUn90ieRIV1ozhnCgYdVWF6mSea X-Received: by 2002:a05:600c:4443:b0:491:8043:5c4a with SMTP id 5b1f17b1804b1-49260879105mr30625795e9.31.1782291546594; Wed, 24 Jun 2026 01:59:06 -0700 (PDT) Received: from inspiron14p-linux ([109.76.100.231]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49261063d6esm25128375e9.2.2026.06.24.01.59.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jun 2026 01:59:06 -0700 (PDT) From: Bryan O'Donoghue To: libcamera-devel@lists.libcamera.org Cc: bryan.odonoghue@linaro.org, pavel@ucw.cz Subject: [PATCH 09/10] libcamera: software_isp: debayer_egl: Flag dmabuf use once 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 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 --- 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 f6b7b11e1..0568c413b 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;