- U_glx-fix-indirect-initialization-crash.patch

* Fixes: b090246a ("glx: Only compute client GL extensions for
    indirect contexts")
  * Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/8393
- supersedes n_Revert-glx-Only-compute-client-GL-extensions-for-ind.patch

OBS-URL: https://build.opensuse.org/package/show/X11:XOrg/Mesa?expand=0&rev=1198
This commit is contained in:
Stefan Dirsch 2023-03-01 22:22:00 +00:00 committed by Git OBS Bridge
parent bbeac4f3fa
commit ad793f9e81
4 changed files with 65 additions and 246 deletions

View File

@ -1,3 +1,12 @@
-------------------------------------------------------------------
Wed Mar 1 21:55:02 UTC 2023 - Stefan Dirsch <sndirsch@suse.com>
- U_glx-fix-indirect-initialization-crash.patch
* Fixes: b090246a ("glx: Only compute client GL extensions for
indirect contexts")
* Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/8393
- supersedes n_Revert-glx-Only-compute-client-GL-extensions-for-ind.patch
-------------------------------------------------------------------
Tue Feb 28 09:49:37 UTC 2023 - Fabian Vogt <fvogt@suse.com>

View File

@ -139,7 +139,7 @@ Source6: Mesa-rpmlintrc
Source7: Mesa.keyring
Patch2: n_add-Mesa-headers-again.patch
# To address https://gitlab.freedesktop.org/mesa/mesa/-/issues/8393
Patch3: n_Revert-glx-Only-compute-client-GL-extensions-for-ind.patch
Patch3: U_glx-fix-indirect-initialization-crash.patch
# never to be upstreamed
Patch54: n_drirc-disable-rgb10-for-chromium-on-amd.patch
Patch58: u_dep_xcb.patch

View File

@ -0,0 +1,55 @@
From 1eab7e69e2ba84244f551f6901f4307a687a9504 Mon Sep 17 00:00:00 2001
From: Illia Polishchuk <illia.a.polishchuk@globallogic.com>
Date: Tue, 28 Feb 2023 16:07:59 +0200
Subject: [PATCH] glx: fix indirect initialization crash
Fixes: b090246a ("glx: Only compute client GL extensions for indirect contexts")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/8393
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Illia Polishchuk <illia.a.polishchuk@globallogic.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21591>
---
src/glx/glxext.c | 9 ++++++++-
src/glx/indirect_glx.c | 1 -
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/glx/glxext.c b/src/glx/glxext.c
index 755a75ab568..4b3496b5a14 100644
--- a/src/glx/glxext.c
+++ b/src/glx/glxext.c
@@ -813,10 +813,17 @@ AllocAndFetchScreenConfigs(Display * dpy, struct glx_display * priv)
if (psc == NULL)
psc = applegl_create_screen(i, priv);
#else
+ bool indirect = false;
if (psc == NULL)
- psc = indirect_create_screen(i, priv);
+ {
+ psc = indirect_create_screen(i, priv);
+ indirect = true;
+ }
#endif
priv->screens[i] = psc;
+
+ if(indirect) /* Load extensions required only for indirect glx */
+ glxSendClientInfo(priv, i);
}
SyncHandle();
return GL_TRUE;
diff --git a/src/glx/indirect_glx.c b/src/glx/indirect_glx.c
index dc3464fc99e..abe561f700b 100644
--- a/src/glx/indirect_glx.c
+++ b/src/glx/indirect_glx.c
@@ -365,7 +365,6 @@ indirect_create_screen(int screen, struct glx_display * priv)
return NULL;
glx_screen_init(psc, screen, priv);
- glxSendClientInfo(priv, screen);
psc->vtable = &indirect_screen_vtable;
return psc;
--
2.35.3

View File

@ -1,245 +0,0 @@
From b0a48acb467959be05008f0d2603c89d51a9c4c8 Mon Sep 17 00:00:00 2001
From: Fabian Vogt <fvogt@suse.de>
Date: Mon, 27 Feb 2023 16:17:29 +0100
Subject: [PATCH] Revert "glx: Only compute client GL extensions for indirect
contexts"
This reverts commit b090246ad27457bc48ea8f5dbe8213f5899efa22.
---
src/glx/clientinfo.c | 10 +++++++---
src/glx/glxclient.h | 3 ++-
src/glx/glxext.c | 2 +-
src/glx/glxextensions.c | 5 +----
src/glx/glxextensions.h | 2 +-
src/glx/indirect_glx.c | 1 -
src/glx/tests/clientinfo_unittest.cpp | 28 +++++++++++++--------------
7 files changed, 26 insertions(+), 25 deletions(-)
diff --git a/src/glx/clientinfo.c b/src/glx/clientinfo.c
index 31c62ad989f..a7853ff8aa3 100644
--- a/src/glx/clientinfo.c
+++ b/src/glx/clientinfo.c
@@ -28,8 +28,8 @@
#include <xcb/glx.h>
#include <X11/Xlib-xcb.h>
-void
-glxSendClientInfo(struct glx_display *glx_dpy, int screen)
+_X_HIDDEN void
+__glX_send_client_info(struct glx_display *glx_dpy)
{
const unsigned ext_length = strlen("GLX_ARB_create_context");
const unsigned prof_length = strlen("_profile");
@@ -152,7 +152,11 @@ glxSendClientInfo(struct glx_display *glx_dpy, int screen)
}
}
- gl_extension_string = __glXGetClientGLExtensionString(screen);
+ gl_extension_string = __glXGetClientGLExtensionString();
+ if (gl_extension_string == NULL) {
+ return;
+ }
+
gl_extension_length = strlen(gl_extension_string) + 1;
c = XGetXCBConnection(glx_dpy->dpy);
diff --git a/src/glx/glxclient.h b/src/glx/glxclient.h
index ad0f37b258a..8eda47988b4 100644
--- a/src/glx/glxclient.h
+++ b/src/glx/glxclient.h
@@ -706,7 +706,8 @@ extern void __glEmptyImage(struct glx_context *, GLint, GLint, GLint, GLint, GLe
extern void __glXInitVertexArrayState(struct glx_context *);
extern void __glXFreeVertexArrayState(struct glx_context *);
-extern void glxSendClientInfo(struct glx_display *glx_dpy, int screen);
+_X_HIDDEN void
+__glX_send_client_info(struct glx_display *glx_dpy);
/************************************************************************/
diff --git a/src/glx/glxext.c b/src/glx/glxext.c
index b1b98a9fadd..cc59004ccff 100644
--- a/src/glx/glxext.c
+++ b/src/glx/glxext.c
@@ -929,7 +929,7 @@ __glXInitialize(Display * dpy)
return NULL;
}
- glxSendClientInfo(dpyPriv, -1);
+ __glX_send_client_info(dpyPriv);
/* Grab the lock again and add the dispay private, unless somebody
* beat us to initializing on this display in the meantime. */
diff --git a/src/glx/glxextensions.c b/src/glx/glxextensions.c
index b731042cde7..cf2d9e04fef 100644
--- a/src/glx/glxextensions.c
+++ b/src/glx/glxextensions.c
@@ -762,10 +762,7 @@ __glXCalculateUsableGLExtensions(struct glx_context * gc,
* supported by the client to the server.
*/
char *
-__glXGetClientGLExtensionString(int screen)
+__glXGetClientGLExtensionString(void)
{
- if (screen < 0)
- return strdup("");
-
return __glXGetStringFromTable(known_gl_extensions, NULL);
}
diff --git a/src/glx/glxextensions.h b/src/glx/glxextensions.h
index 3523998babd..78658003fb4 100644
--- a/src/glx/glxextensions.h
+++ b/src/glx/glxextensions.h
@@ -269,7 +269,7 @@ extern void __IndirectGlParseExtensionOverride(struct glx_screen *psc,
const char *override);
extern void __glXCalculateUsableGLExtensions(struct glx_context *gc,
const char *server_string);
-extern char *__glXGetClientGLExtensionString(int screen);
+extern char *__glXGetClientGLExtensionString(void);
extern GLboolean __glExtensionBitIsEnabled(struct glx_context *gc,
unsigned bit);
diff --git a/src/glx/indirect_glx.c b/src/glx/indirect_glx.c
index 80e95f6754e..ffdfec48d8b 100644
--- a/src/glx/indirect_glx.c
+++ b/src/glx/indirect_glx.c
@@ -383,7 +383,6 @@ indirect_create_screen(int screen, struct glx_display * priv)
return NULL;
glx_screen_init(psc, screen, priv);
- glxSendClientInfo(priv, screen);
psc->vtable = &indirect_screen_vtable;
return psc;
diff --git a/src/glx/tests/clientinfo_unittest.cpp b/src/glx/tests/clientinfo_unittest.cpp
index f7a147e3f7a..0202768cf11 100644
--- a/src/glx/tests/clientinfo_unittest.cpp
+++ b/src/glx/tests/clientinfo_unittest.cpp
@@ -210,7 +210,7 @@ xcb_glx_set_client_info_2arb(xcb_connection_t *c,
}
extern "C" char *
-__glXGetClientGLExtensionString(int screen)
+__glXGetClientGLExtensionString()
{
char *str = (char *) malloc(sizeof(ext));
@@ -279,7 +279,7 @@ glX_send_client_info_test::common_protocol_expected_false_test(unsigned major,
bool *value)
{
create_single_screen_display(major, minor, glx_ext);
- glxSendClientInfo(this->glx_dpy, -1);
+ __glX_send_client_info(this->glx_dpy);
EXPECT_FALSE(*value);
}
@@ -290,7 +290,7 @@ glX_send_client_info_test::common_protocol_expected_true_test(unsigned major,
bool *value)
{
create_single_screen_display(major, minor, glx_ext);
- glxSendClientInfo(this->glx_dpy, -1);
+ __glX_send_client_info(this->glx_dpy);
EXPECT_TRUE(*value);
}
@@ -494,14 +494,14 @@ TEST_F(glX_send_client_info_test, does_send_SetClientInfo2ARB_for_1_4_with_both_
TEST_F(glX_send_client_info_test, uses_correct_connection)
{
create_single_screen_display(1, 1, "");
- glxSendClientInfo(this->glx_dpy, -1);
+ __glX_send_client_info(this->glx_dpy);
EXPECT_EQ((xcb_connection_t *) 0xdeadbeef, connection_used);
}
TEST_F(glX_send_client_info_test, sends_correct_gl_extension_string)
{
create_single_screen_display(1, 1, "");
- glxSendClientInfo(this->glx_dpy, -1);
+ __glX_send_client_info(this->glx_dpy);
ASSERT_EQ((int) sizeof(ext), gl_ext_length);
ASSERT_NE((char *) 0, gl_ext_string);
@@ -511,7 +511,7 @@ TEST_F(glX_send_client_info_test, sends_correct_gl_extension_string)
TEST_F(glX_send_client_info_test, gl_versions_are_sane)
{
create_single_screen_display(1, 4, "GLX_ARB_create_context");
- glxSendClientInfo(this->glx_dpy, -1);
+ __glX_send_client_info(this->glx_dpy);
ASSERT_NE(0, num_gl_versions);
@@ -552,7 +552,7 @@ TEST_F(glX_send_client_info_test, gl_versions_are_sane)
TEST_F(glX_send_client_info_test, gl_versions_and_profiles_are_sane)
{
create_single_screen_display(1, 4, "GLX_ARB_create_context_profile");
- glxSendClientInfo(this->glx_dpy, -1);
+ __glX_send_client_info(this->glx_dpy);
ASSERT_NE(0, num_gl_versions);
@@ -621,7 +621,7 @@ TEST_F(glX_send_client_info_test, gl_versions_and_profiles_are_sane)
TEST_F(glX_send_client_info_test, glx_version_is_1_4_for_1_1)
{
create_single_screen_display(1, 1, "");
- glxSendClientInfo(this->glx_dpy, -1);
+ __glX_send_client_info(this->glx_dpy);
EXPECT_EQ(1, glx_major);
EXPECT_EQ(4, glx_minor);
@@ -630,7 +630,7 @@ TEST_F(glX_send_client_info_test, glx_version_is_1_4_for_1_1)
TEST_F(glX_send_client_info_test, glx_version_is_1_4_for_1_4)
{
create_single_screen_display(1, 4, "");
- glxSendClientInfo(this->glx_dpy, -1);
+ __glX_send_client_info(this->glx_dpy);
EXPECT_EQ(1, glx_major);
EXPECT_EQ(4, glx_minor);
@@ -639,7 +639,7 @@ TEST_F(glX_send_client_info_test, glx_version_is_1_4_for_1_4)
TEST_F(glX_send_client_info_test, glx_version_is_1_4_for_1_4_with_ARB_create_context)
{
create_single_screen_display(1, 4, "GLX_ARB_create_context");
- glxSendClientInfo(this->glx_dpy, -1);
+ __glX_send_client_info(this->glx_dpy);
EXPECT_EQ(1, glx_major);
EXPECT_EQ(4, glx_minor);
@@ -648,7 +648,7 @@ TEST_F(glX_send_client_info_test, glx_version_is_1_4_for_1_4_with_ARB_create_con
TEST_F(glX_send_client_info_test, glx_version_is_1_4_for_1_4_with_ARB_create_context_profile)
{
create_single_screen_display(1, 4, "GLX_ARB_create_context_profile");
- glxSendClientInfo(this->glx_dpy, -1);
+ __glX_send_client_info(this->glx_dpy);
EXPECT_EQ(1, glx_major);
EXPECT_EQ(4, glx_minor);
@@ -657,7 +657,7 @@ TEST_F(glX_send_client_info_test, glx_version_is_1_4_for_1_4_with_ARB_create_con
TEST_F(glX_send_client_info_test, glx_version_is_1_4_for_1_5)
{
create_single_screen_display(1, 5, "");
- glxSendClientInfo(this->glx_dpy, -1);
+ __glX_send_client_info(this->glx_dpy);
EXPECT_EQ(1, glx_major);
EXPECT_EQ(4, glx_minor);
@@ -666,7 +666,7 @@ TEST_F(glX_send_client_info_test, glx_version_is_1_4_for_1_5)
TEST_F(glX_send_client_info_test, glx_extensions_has_GLX_ARB_create_context)
{
create_single_screen_display(1, 4, "GLX_ARB_create_context");
- glxSendClientInfo(this->glx_dpy, -1);
+ __glX_send_client_info(this->glx_dpy);
ASSERT_NE(0, glx_ext_length);
ASSERT_NE((char *) 0, glx_ext_string);
@@ -692,7 +692,7 @@ TEST_F(glX_send_client_info_test, glx_extensions_has_GLX_ARB_create_context)
TEST_F(glX_send_client_info_test, glx_extensions_has_GLX_ARB_create_context_profile)
{
create_single_screen_display(1, 4, "GLX_ARB_create_context_profile");
- glxSendClientInfo(this->glx_dpy, -1);
+ __glX_send_client_info(this->glx_dpy);
ASSERT_NE(0, glx_ext_length);
ASSERT_NE((char *) 0, glx_ext_string);
--
2.39.2