From patchwork Tue Apr 22 21:59:15 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 23235 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 8D011C3322 for ; Tue, 22 Apr 2025 22:00:05 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id CC76768B3B; Wed, 23 Apr 2025 00:00:03 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="gzaVBkQD"; 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 E565C68B3C for ; Tue, 22 Apr 2025 23:59:44 +0200 (CEST) Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-43d0782d787so40757395e9.0 for ; Tue, 22 Apr 2025 14:59:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1745359184; x=1745963984; 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=iEIy8k+5TThGQoOX04wnJpO98XLgjGigWGAQBmfK/uY=; b=gzaVBkQDwsgj4uLoViMyC1syuDStEyqsYZtSQo1WE82nasaA+p/A1JmU4CNy530V7Y Sp8LmxP07rb023hficnNUjmiccK0sYtJ6b3Zos1aQOOoY0DXBOyw5qwMigSBtkR6SRHi 48LZy5zOunNolnERC07cvP197KebvWUF58rTIZ4PLMQ524WUAeMXZxkzdJMFJrghkws1 Ze3lIaw9S0C88Q6zwC/NYx3LQEkudx8v9ypKYLxuHnf2T9MIxA7/ppxVHZrl/RXct6fD ixp53vtJXNGfSNHSS42iUYDH9BgWGLyJxPKolkLKhrHLg6OSE9suEzOz2T8/LgSMtaF+ eH2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1745359184; x=1745963984; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iEIy8k+5TThGQoOX04wnJpO98XLgjGigWGAQBmfK/uY=; b=UGR9fzuxLKvRoRnNGd0HJEHPsandt7Rpa648KsSP5NJgIRBaqPEsL8ShKR+74Y8/mO Il9IzEycKhsdMDGGiWV+Ve6vZbXKzU+H0x9zSUXQDLGw9l/BBnNOrqUIk1eIS7tEVYpw ycZV2qGTHlfOwlpicrMqovK7K37c4dnrTwXmJScZyftcDbCEHKV31SyXNzKS3vNj7R6/ qjUyVAGRXQazhF9c5CANq5bqedZDqJsU6wJ2AfGtISNqRmXPSDbW0ACwatEIIznn5088 JApdbUV1V9RDL/QOoVB7heCTVK6Nx8QFDFW6Pvri7Qj5ACPmUvmXbv1tkLHj1+D/psZT AE2A== X-Gm-Message-State: AOJu0YzmbB3j82GWDyl+LaZoB/+/vxC9CN/vwOAy8Ic2LjDEIynVVIrl WfAzEFVIynOspx6Z7830gIoYiq9+ovThmcbOXdKu3Ss7OmIQq2jBQzzNXrnX0zFcnJ6p9xBkLbB a7/c= X-Gm-Gg: ASbGncvKgAZoKyVkHLfrSU+pgspMwzZXFr1kVfMCsSMaMAve5Li2zYWXZdZODK+Ed2w Jf3+V1U/QosZrkVvp9EGj/kv9MwU7z4vj5Lo6D9DnXU42FY1TFzVlhbrTJj2vwQALW9RRWCAzgI n0W0l+2hP8GPTezO8rR8TMMJrXwIp9s8RbiqGy1nLHo4PV1kvpfeMJoc/OSq9E2iFtOde31BvOb RycsNbqpq+IsWGG2wJRFA3HeZZUaS6Qxl34CIkmqusMvhwUVNpcFe6m91rtp1iQk7/5Ck57QN2h MVDvmCH+M/o6BvSPMnwnSQgvoV96WD+xJevmvD21Rtt2pXQosikWNveRiWpImrhpcyLF4YA8YSo uNQP7UbO309jjV6ake88r X-Google-Smtp-Source: AGHT+IHpsghOASku6uGLoJ3eU5orWbyf1WRAKi5yC6xNAAbGhjvbp8b/bSxAguL3ir2MxR35noNF1g== X-Received: by 2002:a05:600c:3107:b0:43c:f64c:447f with SMTP id 5b1f17b1804b1-4406ac163bemr115608335e9.29.1745359184323; Tue, 22 Apr 2025 14:59:44 -0700 (PDT) Received: from inspiron14p-linux.ht.home (188-141-3-146.dynamic.upc.ie. [188.141.3.146]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-44092d2eccesm2726615e9.20.2025.04.22.14.59.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Apr 2025 14:59:43 -0700 (PDT) From: Bryan O'Donoghue To: libcamera-devel@lists.libcamera.org Cc: hdegoede@redhat.com, mzamazal@redhat.com, bryan.odonoghue@linaro.org, bod.linux@nxsw.ie Subject: [PATCH 22/27] libcamera: software_isp: egl: Bind each eglImage to its own texture unit Date: Tue, 22 Apr 2025 22:59:15 +0100 Message-ID: <20250422215920.4297-23-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250422215920.4297-1-bryan.odonoghue@linaro.org> References: <20250422215920.4297-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" Signed-off-by: Bryan O'Donoghue --- src/libcamera/software_isp/egl.cpp | 1 + src/libcamera/software_isp/egl.h | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/libcamera/software_isp/egl.cpp b/src/libcamera/software_isp/egl.cpp index c3eb8290..885eaa84 100644 --- a/src/libcamera/software_isp/egl.cpp +++ b/src/libcamera/software_isp/egl.cpp @@ -85,6 +85,7 @@ void eGL::destroyDMABufTexture(eGLImage *eglImage) // Generate a 2D texture from an input buffer directly void eGL::createTexture2D(eGLImage *eglImage, uint32_t width, uint32_t height, void *data) { + glActiveTexture(eglImage->texture_unit_); glBindTexture(GL_TEXTURE_2D, eglImage->texture_); // Generate texture, bind, associate image to texture, configure, unbind diff --git a/src/libcamera/software_isp/egl.h b/src/libcamera/software_isp/egl.h index f3c5d50f..64cf2a87 100644 --- a/src/libcamera/software_isp/egl.h +++ b/src/libcamera/software_isp/egl.h @@ -29,13 +29,15 @@ LOG_DECLARE_CATEGORY(eGL) class eGLImage { public: - eGLImage(uint32_t width, uint32_t height, uint32_t bpp) { + eGLImage(uint32_t width, uint32_t height, uint32_t bpp, GLenum texture_unit, uint32_t texture_unit_uniform_id) { image_ = EGL_NO_IMAGE_KHR; width_ = width; height_ = height; bpp_ = bpp; stride_ = width_ * bpp_ / 4; framesize_ = stride_ * height_; + texture_unit_ = texture_unit; + texture_unit_uniform_id_ = texture_unit_uniform_id; glGenTextures(1, &texture_); } @@ -44,14 +46,16 @@ public: glDeleteTextures(1, &texture_); }; - GLuint texture_; - EGLImageKHR image_; uint32_t width_; uint32_t height_; uint32_t stride_; uint32_t offset_; uint32_t framesize_; uint32_t bpp_; + uint32_t texture_unit_uniform_id_; + GLenum texture_unit_; + GLuint texture_; + EGLImageKHR image_; }; class eGL