From patchwork Fri Oct 16 20:29:13 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ray Strode X-Patchwork-Id: 28488 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 F1027C3305 for ; Fri, 16 Oct 2026 20:29:34 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 9BA8968E7C; Fri, 16 Oct 2026 22:29:34 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="XuvoLmsu"; dkim-atps=neutral Received: from mail-vs1-xe31.google.com (mail-vs1-xe31.google.com [IPv6:2607:f8b0:4864:20::e31]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 91A5F68E61 for ; Fri, 16 Oct 2026 22:29:30 +0200 (CEST) Received: by mail-vs1-xe31.google.com with SMTP id ada2fe7eead31-745497ac8fcso148110137.0 for ; Fri, 16 Oct 2026 13:29:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1792182569; x=1792787369; 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:content-type; bh=jn4cUcqpLdZAExuB9UohVdcZKD+3flT4y6tTvORenP4=; b=XuvoLmsuVhbgl3WBqZp71ox6CmLWGwao0siXuQxAADl4rdaqGPmscviDaxitZO0Oqd y1E67Ne6BOxGbZIffpJCViBKQ35I0J3ivCkIwysO3Otp0zRS8C/b0HDkD2x5sB62hMBa 9A6gScZIfKR3Zzs7DyTqQssLmzReHGFT27dbaVbCCSq51ipGQMOhhCUMsqMkNcjs1vsC f2iWLSHI78j5NVlK0IkHEwlZKfz8ECk0neXjLPzP+H7s4y4XG4MUMNEOX16IujYJT/Wo RDPu4aSfhMyI49A8d/lQ6AZ0/+MBJMLcSZ2bLTvEhFxkYEIqL7ZSykcqYg49+M5El3K5 dAWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1792182569; x=1792787369; 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:content-type; bh=jn4cUcqpLdZAExuB9UohVdcZKD+3flT4y6tTvORenP4=; b=pCgr50EeR3DW9/Hnq9H8TdTzbJG/1wlbBVNbBjgmrWo8G4xdHlPMGlEx6KAfyNWgUy bzwpiOtEfbQlxWSL1B3fp0mlcosHbi550cvxRD54g4yjVQRjRNDHvLo/ua2Hsd11okuG EcZnQeP4rOpqTqJ3azrP9qIbRKMbJKV8RJKTMlQM713HNWxUNV66UmtRb00txUg8Wl6l 6h2b52OXcxUMDPO++0nHvMymFLNiYxVoBRWQqfE32pZj34vnQCXCc3fvaspKdCTCfchf wnQrhVj3oHbsLC2n7yHt4mvPoGdu6k40XGRXJHOaTKw6uaiY5fd59tKm3057NK1rnxMN v05A== X-Gm-Message-State: AFq9FYInKSwymhGDv14nc6HVHlJSY9VEP2x6Wd/2+/RxkkyNhYCwCoo9 iHexe7evCzIGFEK/xjBu2zoNCi7JctyApXpedFfU9xvFmQtyL7Rve9nMGuMRlYmU+sQ= X-Gm-Gg: AYBFou3uoX5b6s32spl5iOx7e9A/ZTF1FwBcgHn79v7LJNkJknCOYTbzX9NX6iIRYBS /M7fieWNktLmrzA6EXBxsvocosY8GkyHcKASsjadT/tFSgoOWvvBw7eaAM7PGzQztNf69+LybEc 6ZKK/Ew9VN6fwzsutpwBnw7+vl8T7qC5robIy7HfrfHfZU7R22Lzm8JDyCMddViLB2LIp+HlsRU dmG5OSa2Cl5M0xjBl7/JTpOWIc84a9OuFSEMfiXxjdJ3HO5r9wwDtFcsyG7O7Zw5e8uPvLolu8J aOf1nFWpiLw2YEQ+WFj6bjF74Cbwj+ra14VNtyo1US5KDyL7ACYwcM9/qBMSAIvnYKt4Sibz0wD kxsI7SUcofeizjSdHEUqvfmVvTdOI8XzfOYJOQajc9GJPqZwFjNncurlsi5AfcAuYJNIj+kJ6BK cEWeS03tBqSYg+XWgC7I6p/8ZR6Bs8B6btzWAskMoBHeu6nlnT4w/38mFqA2gqQ6lKYCbY29xxI lAfXNW5OwTUbL9S2LrahjV8QPfw X-Received: by 2002:a05:6102:3753:b0:7a7:c789:881 with SMTP id ada2fe7eead31-7cc368f6d1amr213287137.6.1792182569415; Fri, 16 Oct 2026 13:29:29 -0700 (PDT) Received: from localhost ([2601:19c:4a00:897d:3391:ed89:5571:41a8]) by smtp.gmail.com with ESMTPSA id a1e0cc1a2514c-990835c29eesm2271202241.4.2026.10.16.13.29.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Oct 2026 13:29:28 -0700 (PDT) From: Ray Strode To: libcamera-devel@lists.libcamera.org Cc: johannes.goede@oss.qualcomm.com, laurent.pinchart@ideasonboard.com, kieran.bingham@ideasonboard.com Subject: [PATCH 4/7] software-isp: Allow drawing into existing EGL textures Date: Fri, 16 Oct 2026 16:29:13 -0400 Message-ID: <20261016202916.1405813-5-halfline@gmail.com> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261016202916.1405813-1-halfline@gmail.com> References: <8fd58439-d19e-4539-962f-a6110be5c971@oss.qualcomm.com> <20261016202916.1405813-1-halfline@gmail.com> 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" From: Ray Strode This commit lets EGL debayering use textures supplied by the caller for its input and output. The drawing path currently obtains its textures from frame buffers, and the output requires DMA-BUF import. Integration tests need to exercise the same shaders, uniforms, projection and viewport with CPU-uploaded textures on software renderers that do not support that import path. The frame-processing path uses the same drawing operation after obtaining its textures. Buffer import, synchronization and statistics stay with frame processing. Drawing reports an incomplete output framebuffer as an error. Signed-off-by: Ray Strode --- src/libcamera/software_isp/debayer_egl.cpp | 25 ++++++++++++++++++++-- src/libcamera/software_isp/debayer_egl.h | 3 +++ 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/src/libcamera/software_isp/debayer_egl.cpp b/src/libcamera/software_isp/debayer_egl.cpp index cd9ad888..afe78384 100644 --- a/src/libcamera/software_isp/debayer_egl.cpp +++ b/src/libcamera/software_isp/debayer_egl.cpp @@ -573,8 +573,29 @@ int DebayerEGL::debayerGPU(FrameBuffer *input, FrameBuffer *output, const Debaye if (!eglImageOut) return -ENOMEM; - egl_.attachTextureToFBO(*eglImageOut); - setShaderVariableValues(*eglImageIn, params); + return render(*eglImageIn, *eglImageOut, params); +} + +/** + * \brief Render the configured debayer operation into existing textures + * \param[in] input Texture containing the configured Bayer input + * \param[in,out] output Texture receiving the configured output image + * \param[in] params Image processing parameters + * + * The caller owns the texture storage and must start the debayer before + * rendering. Textures must belong to the debayer's current EGL context. + * + * \return 0 on success or a negative error code otherwise + */ +int DebayerEGL::render(eGLImage &input, eGLImage &output, const DebayerParams ¶ms) +{ + egl_.assertThread(); + + int ret = egl_.attachTextureToFBO(output); + if (ret) + return ret; + + setShaderVariableValues(input, params); glViewport(0, 0, width_, height_); glClear(GL_COLOR_BUFFER_BIT); diff --git a/src/libcamera/software_isp/debayer_egl.h b/src/libcamera/software_isp/debayer_egl.h index 5a4cd2d8..d18dc3fb 100644 --- a/src/libcamera/software_isp/debayer_egl.h +++ b/src/libcamera/software_isp/debayer_egl.h @@ -62,6 +62,9 @@ public: SizeRange sizes(PixelFormat inputFormat, const Size &inputSize) override; Rectangle inputCrop() const override { return inputCrop_; } +protected: + int render(eGLImage &input, eGLImage &output, const DebayerParams ¶ms); + private: static int getInputConfig(PixelFormat inputFormat, DebayerInputConfig &config); int initBayerShaders(PixelFormat inputFormat, PixelFormat outputFormat);