SHA256
1
0
forked from pool/Mesa
Mesa/n_Revert-glx-Only-compute-client-GL-extensions-for-ind.patch
Stefan Dirsch bbeac4f3fa Accepting request 1068140 from home:favogt:branches:X11:XOrg
- Add patch to fix GLX with indirect rendering:
  * n_Revert-glx-Only-compute-client-GL-extensions-for-ind.patch

OBS-URL: https://build.opensuse.org/request/show/1068140
OBS-URL: https://build.opensuse.org/package/show/X11:XOrg/Mesa?expand=0&rev=1196
2023-02-28 10:02:28 +00:00

246 lines
9.0 KiB
Diff

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