From patchwork Sat Aug 29 14:27:09 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Mader X-Patchwork-Id: 28147 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 87C75C3341 for ; Sat, 29 Aug 2026 14:27:35 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 1AF83684A8; Sat, 29 Aug 2026 16:27:34 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=collabora.com header.i=robert.mader@collabora.com header.b="STkgTG/K"; dkim-atps=neutral Received: from sender4-op-o11.zoho.com (sender4-op-o11.zoho.com [136.143.188.11]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id C40D968244 for ; Sat, 29 Aug 2026 16:27:31 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; t=1788013647; cv=none; d=zohomail.com; s=zohoarc; b=NbCOuogItZOsomMAzX4q40KPrTj3DU5DK7VER/LjQKTkPIlIt3PPCedwWlhsrMz8CBbOU94V6LpRsjMYTOSEWl4rRcm5+Taz0n+M/JowPl8EisLPpmbmRvrIZn8iX7YprDNmNy38R9r1xnu1UQNTDFVTjQpeWuLFtgZ9pJ0veuw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1788013647; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To; bh=Sjxd+OO7N7SqP/p/lcbyOuKGI5bi7KbGo6cqEL7zdmM=; b=mgfPGZZXnVD6J0q2uj8q7zTtENJW197Sr3GPVK5lVTnrkqXiPR10axeYbSaZ4jnrqmq6Xzgmpn7Opl24INTXVEhgBEPSdUdHu2Ad7Iq+p1T/vfvaSJarmCoMEy5TIJ0tjmWMDTnBIY8nRaELDXPjuK0CDlX3dyjYMxiUrKrGui0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=collabora.com; spf=pass smtp.mailfrom=robert.mader@collabora.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1788013647; s=zohomail; d=collabora.com; i=robert.mader@collabora.com; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Reply-To; bh=Sjxd+OO7N7SqP/p/lcbyOuKGI5bi7KbGo6cqEL7zdmM=; b=STkgTG/KElv+378Jlt2y6GUCLXaReZdmA1EdY343JxvOtbY//byQ6hWpFmyoWUjx SDCJ8QBPEL0g7dgz8hsFDxaOmXF88Ye2nJjDgoEkoHJQ9UeoZZeXDCqXE9W/o15fCgI KtFOO/+0DBVUtpBKHl9RoHSaVodkxaixnjyPQoFQ= Received: by mx.zohomail.com with SMTPS id 1788013645980104.56823952632408; Sat, 29 Aug 2026 07:27:25 -0700 (PDT) From: Robert Mader To: libcamera-devel@lists.libcamera.org Cc: Robert Mader Subject: [PATCH v2] debayer_egl: Use untransposed matrix to fix GLES 2.0 Date: Sat, 29 Aug 2026 16:27:09 +0200 Message-ID: <20260829142709.222649-1-robert.mader@collabora.com> X-Mailer: git-send-email 2.55.0 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" The softISP curently fails on Mali-400 on Mesa. It turns out that transposed matrices are not allowed by the spec: > The UniformMatrix{234}fv commands will load count 2 × 2, 3 × 3, or 4 × 4 > matrices (corresponding to 2, 3, or 4 in the command name) of floating-point values > into a uniform location defined as a matrix or an array of matrices. The matrix is > specified in column-major order. transpose must be FALSE. Thus partially revert the commit mentioned below and manually transpose the matrix. Fixes: d780e285b593 ("shaders: bayer: Use native matrix multiplication") Closes: https://gitlab.freedesktop.org/camera/libcamera/-/work_items/342 Signed-off-by: Robert Mader --- Changes in v2: - Actually transpose the matrix to not re-introduce issues with CCMs - Add comment about GLES 2.0 - Add "Closes:" link --- src/libcamera/software_isp/debayer_egl.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/libcamera/software_isp/debayer_egl.cpp b/src/libcamera/software_isp/debayer_egl.cpp index 97aa03793574..6df1ce1a8fb6 100644 --- a/src/libcamera/software_isp/debayer_egl.cpp +++ b/src/libcamera/software_isp/debayer_egl.cpp @@ -460,8 +460,21 @@ void DebayerEGL::setShaderVariableValues(eGLImage &eglImageIn, const DebayerPara << " textureUniformStep_.y " << Step[1] << " textureUniformStrideFactor_ " << Stride << " textureUniformProjMatrix_ " << textureUniformProjMatrix_; - - glUniformMatrix3fv(ccmUniformDataIn_, 1, GL_TRUE, params.combinedMatrix.data().data()); + /* + * Pre-transpose matrix for GLES 2.0 + */ + GLfloat ccm[9] = { + params.combinedMatrix[0][0], + params.combinedMatrix[1][0], + params.combinedMatrix[2][0], + params.combinedMatrix[0][1], + params.combinedMatrix[1][1], + params.combinedMatrix[2][1], + params.combinedMatrix[0][2], + params.combinedMatrix[1][2], + params.combinedMatrix[2][2], + }; + glUniformMatrix3fv(ccmUniformDataIn_, 1, GL_FALSE, ccm); LOG(Debayer, Debug) << " ccmUniformDataIn_ " << ccmUniformDataIn_ << " data " << params.combinedMatrix; /*