Backport fixes for cogl OpenGL conformance

Resolves: RHEL-4521
This commit is contained in:
Jonas Ådahl 2025-06-03 16:58:11 +02:00
parent 3fa3a3a33a
commit 4ef08d3f7d
2 changed files with 303 additions and 1 deletions

View File

@ -0,0 +1,295 @@
From 03c65a2bce1f021c8c387cc5ed7e8c14c18a29f5 Mon Sep 17 00:00:00 2001
From: Olivier Fourdan <ofourdan@redhat.com>
Date: Fri, 2 Jun 2023 14:42:51 +0200
Subject: [PATCH 1/5] cogl/gl-framebuffer: Fix spurious trailing spaces
Purely cosmetic fix, no functional change.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3047>
(cherry picked from commit 5a83e8ef8250526a40e8e69c6398f990ab482b2f)
---
cogl/cogl/driver/gl/cogl-gl-framebuffer-back.c | 12 ++++++------
cogl/cogl/driver/gl/cogl-gl-framebuffer-fbo.c | 12 ++++++------
2 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/cogl/cogl/driver/gl/cogl-gl-framebuffer-back.c b/cogl/cogl/driver/gl/cogl-gl-framebuffer-back.c
index d6609bb207..8d76f1578b 100644
--- a/cogl/cogl/driver/gl/cogl-gl-framebuffer-back.c
+++ b/cogl/cogl/driver/gl/cogl-gl-framebuffer-back.c
@@ -72,32 +72,32 @@ ensure_bits_initialized (CoglGlFramebufferBack *gl_framebuffer_back)
GLenum attachment, pname;
size_t offset;
} params[] = {
- {
+ {
.attachment = GL_BACK_LEFT,
.pname = GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE,
.offset = offsetof (CoglFramebufferBits, red),
},
- {
+ {
.attachment = GL_BACK_LEFT,
.pname = GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE,
.offset = offsetof (CoglFramebufferBits, green),
},
- {
+ {
.attachment = GL_BACK_LEFT,
.pname = GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE,
.offset = offsetof (CoglFramebufferBits, blue),
},
- {
+ {
.attachment = GL_BACK_LEFT,
.pname = GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE,
.offset = offsetof (CoglFramebufferBits, alpha),
},
- {
+ {
.attachment = GL_DEPTH,
.pname = GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE,
.offset = offsetof (CoglFramebufferBits, depth),
},
- {
+ {
.attachment = GL_STENCIL,
.pname = GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE,
.offset = offsetof (CoglFramebufferBits, stencil),
diff --git a/cogl/cogl/driver/gl/cogl-gl-framebuffer-fbo.c b/cogl/cogl/driver/gl/cogl-gl-framebuffer-fbo.c
index c8db6a23a2..1ffc1d5350 100644
--- a/cogl/cogl/driver/gl/cogl-gl-framebuffer-fbo.c
+++ b/cogl/cogl/driver/gl/cogl-gl-framebuffer-fbo.c
@@ -82,32 +82,32 @@ ensure_bits_initialized (CoglGlFramebufferFbo *gl_framebuffer_fbo)
GLenum attachment, pname;
size_t offset;
} params[] = {
- {
+ {
.attachment = GL_COLOR_ATTACHMENT0,
.pname = GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE,
.offset = offsetof (CoglFramebufferBits, red),
},
- {
+ {
.attachment = GL_COLOR_ATTACHMENT0,
.pname = GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE,
.offset = offsetof (CoglFramebufferBits, green),
},
- {
+ {
.attachment = GL_COLOR_ATTACHMENT0,
.pname = GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE,
.offset = offsetof (CoglFramebufferBits, blue),
},
- {
+ {
.attachment = GL_COLOR_ATTACHMENT0,
.pname = GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE,
.offset = offsetof (CoglFramebufferBits, alpha),
},
- {
+ {
.attachment = GL_DEPTH_ATTACHMENT,
.pname = GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE,
.offset = offsetof (CoglFramebufferBits, depth),
},
- {
+ {
.attachment = GL_STENCIL_ATTACHMENT,
.pname = GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE,
.offset = offsetof (CoglFramebufferBits, stencil),
--
2.49.0
From deee9d15b7f8e9595e10e43e815c585b42396f07 Mon Sep 17 00:00:00 2001
From: Olivier Fourdan <ofourdan@redhat.com>
Date: Fri, 2 Jun 2023 11:54:58 +0200
Subject: [PATCH 2/5] cogl/gl-framebuffer: Fix inverted test in
ensure_bits_initialized()
Cogl's feature COGL_PRIVATE_FEATURE_QUERY_FRAMEBUFFER_BITS is required
to use the GL_FRAMEBUFFER_ATTACHMENT_* queries.
Unfortunately, the test for the availability of the private feature is
actually inverted in ensure_bits_initialized() which causes that whole
portion of code to be ignored, falling back to the glGetIntegerv()
method which isn't supported in core profiles.
As Mesa has recently started to be more strict about these, this causes
the CI tests to fail in mutter.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3047>
(cherry picked from commit a2203df9f43b9e501a972d23b3d5584005c03ce6)
---
cogl/cogl/driver/gl/cogl-gl-framebuffer-fbo.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cogl/cogl/driver/gl/cogl-gl-framebuffer-fbo.c b/cogl/cogl/driver/gl/cogl-gl-framebuffer-fbo.c
index 1ffc1d5350..75a8b0c1fe 100644
--- a/cogl/cogl/driver/gl/cogl-gl-framebuffer-fbo.c
+++ b/cogl/cogl/driver/gl/cogl-gl-framebuffer-fbo.c
@@ -76,7 +76,7 @@ ensure_bits_initialized (CoglGlFramebufferFbo *gl_framebuffer_fbo)
COGL_FRAMEBUFFER_STATE_BIND);
#ifdef HAVE_COGL_GL
- if (!_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_QUERY_FRAMEBUFFER_BITS))
+ if (_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_QUERY_FRAMEBUFFER_BITS))
{
const struct {
GLenum attachment, pname;
--
2.49.0
From a40d29a51382591d8e319af0b448d57510dacc86 Mon Sep 17 00:00:00 2001
From: Olivier Fourdan <ofourdan@redhat.com>
Date: Mon, 5 Jun 2023 10:31:38 +0200
Subject: [PATCH 3/5] cogl/gl-framebuffer: Match testing features
The function ensure_bits_initialized() in cogl-gl-framebuffer-fbo.c
checks for COGL_PRIVATE_FEATURE_QUERY_FRAMEBUFFER_BITS whereas the same
in cogl-gl-framebuffer-back.c simply checks for the driver being
COGL_DRIVER_GL3.
Change the later to use the COGL_PRIVATE_FEATURE_QUERY_FRAMEBUFFER_BITS
flag as well.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3047>
(cherry picked from commit fad240f437d6b11f664c9c09aecabe5f5e703eca)
---
cogl/cogl/driver/gl/cogl-gl-framebuffer-back.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cogl/cogl/driver/gl/cogl-gl-framebuffer-back.c b/cogl/cogl/driver/gl/cogl-gl-framebuffer-back.c
index 8d76f1578b..f6a17e8f07 100644
--- a/cogl/cogl/driver/gl/cogl-gl-framebuffer-back.c
+++ b/cogl/cogl/driver/gl/cogl-gl-framebuffer-back.c
@@ -66,7 +66,7 @@ ensure_bits_initialized (CoglGlFramebufferBack *gl_framebuffer_back)
COGL_FRAMEBUFFER_STATE_BIND);
#ifdef HAVE_COGL_GL
- if (ctx->driver == COGL_DRIVER_GL3)
+ if (_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_QUERY_FRAMEBUFFER_BITS))
{
const struct {
GLenum attachment, pname;
--
2.49.0
From 2d183a8254fb3de388db78d53c282416add20905 Mon Sep 17 00:00:00 2001
From: Olivier Fourdan <ofourdan@redhat.com>
Date: Fri, 2 Jun 2023 14:27:29 +0200
Subject: [PATCH 4/5] cogl/gl-framebuffer: Fail without QUERY_FRAMEBUFFER_BITS
glGetIntegerv() with GL_RED_BITS/GL_GREEN_BITS/GL_BLUE_BITS/etc. is not
supported with the GL core context, so there is no point in falling back
to that without supporting COGL_PRIVATE_FEATURE_QUERY_FRAMEBUFFER_BITS,
as this will cause an GL error.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3047>
(cherry picked from commit c3af4c1b1571b05f67d48b90d9ea7313f3ca6003)
---
cogl/cogl/driver/gl/cogl-gl-framebuffer-back.c | 7 +------
cogl/cogl/driver/gl/cogl-gl-framebuffer-fbo.c | 7 +------
2 files changed, 2 insertions(+), 12 deletions(-)
diff --git a/cogl/cogl/driver/gl/cogl-gl-framebuffer-back.c b/cogl/cogl/driver/gl/cogl-gl-framebuffer-back.c
index f6a17e8f07..0ccd232407 100644
--- a/cogl/cogl/driver/gl/cogl-gl-framebuffer-back.c
+++ b/cogl/cogl/driver/gl/cogl-gl-framebuffer-back.c
@@ -119,12 +119,7 @@ ensure_bits_initialized (CoglGlFramebufferBack *gl_framebuffer_back)
else
#endif /* HAVE_COGL_GL */
{
- GE (ctx, glGetIntegerv (GL_RED_BITS, &bits->red));
- GE (ctx, glGetIntegerv (GL_GREEN_BITS, &bits->green));
- GE (ctx, glGetIntegerv (GL_BLUE_BITS, &bits->blue));
- GE (ctx, glGetIntegerv (GL_ALPHA_BITS, &bits->alpha));
- GE (ctx, glGetIntegerv (GL_DEPTH_BITS, &bits->depth));
- GE (ctx, glGetIntegerv (GL_STENCIL_BITS, &bits->stencil));
+ return FALSE;
}
COGL_NOTE (FRAMEBUFFER,
diff --git a/cogl/cogl/driver/gl/cogl-gl-framebuffer-fbo.c b/cogl/cogl/driver/gl/cogl-gl-framebuffer-fbo.c
index 75a8b0c1fe..524196207f 100644
--- a/cogl/cogl/driver/gl/cogl-gl-framebuffer-fbo.c
+++ b/cogl/cogl/driver/gl/cogl-gl-framebuffer-fbo.c
@@ -129,12 +129,7 @@ ensure_bits_initialized (CoglGlFramebufferFbo *gl_framebuffer_fbo)
else
#endif /* HAVE_COGL_GL */
{
- GE (ctx, glGetIntegerv (GL_RED_BITS, &bits->red));
- GE (ctx, glGetIntegerv (GL_GREEN_BITS, &bits->green));
- GE (ctx, glGetIntegerv (GL_BLUE_BITS, &bits->blue));
- GE (ctx, glGetIntegerv (GL_ALPHA_BITS, &bits->alpha));
- GE (ctx, glGetIntegerv (GL_DEPTH_BITS, &bits->depth));
- GE (ctx, glGetIntegerv (GL_STENCIL_BITS, &bits->stencil));
+ return FALSE;
}
if (!_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_ALPHA_TEXTURES) &&
--
2.49.0
From 9b91892b5a14cc975e8f219fbad0548e017535b7 Mon Sep 17 00:00:00 2001
From: Olivier Fourdan <ofourdan@redhat.com>
Date: Mon, 5 Jun 2023 10:38:41 +0200
Subject: [PATCH 5/5] cogl/gl-framebuffer: Remove conditional on HAVE_COGL_GL
By testing the features flag, we can get rid of the conditional build
on HAVE_COGL_GL entirely.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3047>
(cherry picked from commit d65883e0d7d70987e3888b86222b109c35f5a7a2)
---
cogl/cogl/driver/gl/cogl-gl-framebuffer-back.c | 2 --
cogl/cogl/driver/gl/cogl-gl-framebuffer-fbo.c | 2 --
2 files changed, 4 deletions(-)
diff --git a/cogl/cogl/driver/gl/cogl-gl-framebuffer-back.c b/cogl/cogl/driver/gl/cogl-gl-framebuffer-back.c
index 0ccd232407..94154d48ef 100644
--- a/cogl/cogl/driver/gl/cogl-gl-framebuffer-back.c
+++ b/cogl/cogl/driver/gl/cogl-gl-framebuffer-back.c
@@ -65,7 +65,6 @@ ensure_bits_initialized (CoglGlFramebufferBack *gl_framebuffer_back)
framebuffer,
COGL_FRAMEBUFFER_STATE_BIND);
-#ifdef HAVE_COGL_GL
if (_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_QUERY_FRAMEBUFFER_BITS))
{
const struct {
@@ -117,7 +116,6 @@ ensure_bits_initialized (CoglGlFramebufferBack *gl_framebuffer_back)
}
}
else
-#endif /* HAVE_COGL_GL */
{
return FALSE;
}
diff --git a/cogl/cogl/driver/gl/cogl-gl-framebuffer-fbo.c b/cogl/cogl/driver/gl/cogl-gl-framebuffer-fbo.c
index 524196207f..3ea133d314 100644
--- a/cogl/cogl/driver/gl/cogl-gl-framebuffer-fbo.c
+++ b/cogl/cogl/driver/gl/cogl-gl-framebuffer-fbo.c
@@ -75,7 +75,6 @@ ensure_bits_initialized (CoglGlFramebufferFbo *gl_framebuffer_fbo)
framebuffer,
COGL_FRAMEBUFFER_STATE_BIND);
-#ifdef HAVE_COGL_GL
if (_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_QUERY_FRAMEBUFFER_BITS))
{
const struct {
@@ -127,7 +126,6 @@ ensure_bits_initialized (CoglGlFramebufferFbo *gl_framebuffer_fbo)
}
}
else
-#endif /* HAVE_COGL_GL */
{
return FALSE;
}
--
2.49.0

View File

@ -10,7 +10,7 @@
Name: mutter
Version: 40.9
Release: 26%{?dist}
Release: 27%{?dist}
Summary: Window and compositing manager based on Clutter
License: GPLv2+
@ -162,6 +162,9 @@ Patch69: 0001-xwayland-Relax-the-ownership-requirements-of-tmp-.X1.patch
Patch70: 0002-Be-more-verbose-about-permissions-of-tmp-.X11-unix.patch
Patch71: 0003-Use-access-instead-of-checking-permission-modes-for-.patch
# RHEL-4521
Patch72: fix-cogl-framebuffer-get-bits-test.patch
BuildRequires: chrpath
BuildRequires: pango-devel
BuildRequires: startup-notification-devel
@ -309,6 +312,10 @@ desktop-file-validate %{buildroot}/%{_datadir}/applications/%{name}.desktop
%{_datadir}/mutter-%{mutter_api_version}/tests
%changelog
* Fri Jun 27 2025 Jonas Ådahl <jadahl@redhat.com> - 40.9-27
- Backport fixes for cogl OpenGL conformance
Resolves: RHEL-4521
* Mon May 12 2025 Olivier Fourdan <ofourdan@redhat.com> - 40.9-26
- Fix polyinstantiation preventing Xwayland to start
Resolves: RHEL-90588