| Message ID | 20260829094104.191433-1-robert.mader@collabora.com |
|---|---|
| State | New |
| Headers | show |
| Series |
|
| Related | show |
2026. 08. 29. 11:41 keltezéssel, Robert Mader írta: > 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. > > Fixes: d780e285b593 ("shaders: bayer: Use native matrix multiplication") > Signed-off-by: Robert Mader <robert.mader@collabora.com> > --- Closes: https://gitlab.freedesktop.org/camera/libcamera/-/work_items/342 > src/libcamera/software_isp/debayer_egl.cpp | 13 ++++++++++++- > 1 file changed, 12 insertions(+), 1 deletion(-) > > diff --git a/src/libcamera/software_isp/debayer_egl.cpp b/src/libcamera/software_isp/debayer_egl.cpp > index 97aa03793574..0d32cfab32aa 100644 > --- a/src/libcamera/software_isp/debayer_egl.cpp > +++ b/src/libcamera/software_isp/debayer_egl.cpp > @@ -461,7 +461,18 @@ void DebayerEGL::setShaderVariableValues(eGLImage &eglImageIn, const DebayerPara > << " textureUniformStrideFactor_ " << Stride > << " textureUniformProjMatrix_ " << textureUniformProjMatrix_; > > - glUniformMatrix3fv(ccmUniformDataIn_, 1, GL_TRUE, params.combinedMatrix.data().data()); > + GLfloat ccm[9] = { > + params.combinedMatrix[0][0], > + params.combinedMatrix[0][1], > + params.combinedMatrix[0][2], > + params.combinedMatrix[1][0], > + params.combinedMatrix[1][1], > + params.combinedMatrix[1][2], > + params.combinedMatrix[2][0], > + params.combinedMatrix[2][1], > + params.combinedMatrix[2][2], > + }; Maybe there should be a `transpose()` method in the `Matrix` type. > + glUniformMatrix3fv(ccmUniformDataIn_, 1, GL_FALSE, ccm); > LOG(Debayer, Debug) << " ccmUniformDataIn_ " << ccmUniformDataIn_ << " data " << params.combinedMatrix; > > /*
Hi, On 29.08.26 13:15, Barnabás Pőcze wrote: > 2026. 08. 29. 11:41 keltezéssel, Robert Mader írta: >> 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. >> >> Fixes: d780e285b593 ("shaders: bayer: Use native matrix multiplication") >> Signed-off-by: Robert Mader <robert.mader@collabora.com> >> --- > > Closes: https://gitlab.freedesktop.org/camera/libcamera/-/work_items/342 oh, right, added in v2! > > >> src/libcamera/software_isp/debayer_egl.cpp | 13 ++++++++++++- >> 1 file changed, 12 insertions(+), 1 deletion(-) >> >> diff --git a/src/libcamera/software_isp/debayer_egl.cpp >> b/src/libcamera/software_isp/debayer_egl.cpp >> index 97aa03793574..0d32cfab32aa 100644 >> --- a/src/libcamera/software_isp/debayer_egl.cpp >> +++ b/src/libcamera/software_isp/debayer_egl.cpp >> @@ -461,7 +461,18 @@ void >> DebayerEGL::setShaderVariableValues(eGLImage &eglImageIn, const >> DebayerPara >> << " textureUniformStrideFactor_ " << Stride >> << " textureUniformProjMatrix_ " << >> textureUniformProjMatrix_; >> - glUniformMatrix3fv(ccmUniformDataIn_, 1, GL_TRUE, >> params.combinedMatrix.data().data()); >> + GLfloat ccm[9] = { >> + params.combinedMatrix[0][0], >> + params.combinedMatrix[0][1], >> + params.combinedMatrix[0][2], >> + params.combinedMatrix[1][0], >> + params.combinedMatrix[1][1], >> + params.combinedMatrix[1][2], >> + params.combinedMatrix[2][0], >> + params.combinedMatrix[2][1], >> + params.combinedMatrix[2][2], >> + }; > > Maybe there should be a `transpose()` method in the `Matrix` type. Possibly. I didn't look into for now to keep the patch small and backportable. > > >> + glUniformMatrix3fv(ccmUniformDataIn_, 1, GL_FALSE, ccm); >> LOG(Debayer, Debug) << " ccmUniformDataIn_ " << >> ccmUniformDataIn_ << " data " << params.combinedMatrix; >> /* >
diff --git a/src/libcamera/software_isp/debayer_egl.cpp b/src/libcamera/software_isp/debayer_egl.cpp index 97aa03793574..0d32cfab32aa 100644 --- a/src/libcamera/software_isp/debayer_egl.cpp +++ b/src/libcamera/software_isp/debayer_egl.cpp @@ -461,7 +461,18 @@ void DebayerEGL::setShaderVariableValues(eGLImage &eglImageIn, const DebayerPara << " textureUniformStrideFactor_ " << Stride << " textureUniformProjMatrix_ " << textureUniformProjMatrix_; - glUniformMatrix3fv(ccmUniformDataIn_, 1, GL_TRUE, params.combinedMatrix.data().data()); + GLfloat ccm[9] = { + params.combinedMatrix[0][0], + params.combinedMatrix[0][1], + params.combinedMatrix[0][2], + params.combinedMatrix[1][0], + params.combinedMatrix[1][1], + params.combinedMatrix[1][2], + params.combinedMatrix[2][0], + params.combinedMatrix[2][1], + params.combinedMatrix[2][2], + }; + glUniformMatrix3fv(ccmUniformDataIn_, 1, GL_FALSE, ccm); LOG(Debayer, Debug) << " ccmUniformDataIn_ " << ccmUniformDataIn_ << " data " << params.combinedMatrix; /*