mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-21 18:00:13 +01:00
glx: Only compute client GL extensions for indirect contexts
This is sort of a spiky way to do it, but the effect is to send the appropriate SetClientInfo twice for indirect screens, where the second one fills in the GL extensions. We can get away with this because the only place the string is used is when the server computes the reply for glGetString(GL_EXTENSIONS), which never matters for direct contexts. Acked-by: David Heidelberg <david.heidelberg@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20300>
This commit is contained in:
parent
4ccd253588
commit
b090246ad2
7 changed files with 25 additions and 26 deletions
|
|
@ -28,8 +28,8 @@
|
|||
#include <xcb/glx.h>
|
||||
#include <X11/Xlib-xcb.h>
|
||||
|
||||
_X_HIDDEN void
|
||||
__glX_send_client_info(struct glx_display *glx_dpy)
|
||||
void
|
||||
glxSendClientInfo(struct glx_display *glx_dpy, int screen)
|
||||
{
|
||||
const unsigned ext_length = strlen("GLX_ARB_create_context");
|
||||
const unsigned prof_length = strlen("_profile");
|
||||
|
|
@ -152,11 +152,7 @@ __glX_send_client_info(struct glx_display *glx_dpy)
|
|||
}
|
||||
}
|
||||
|
||||
gl_extension_string = __glXGetClientGLExtensionString();
|
||||
if (gl_extension_string == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
gl_extension_string = __glXGetClientGLExtensionString(screen);
|
||||
gl_extension_length = strlen(gl_extension_string) + 1;
|
||||
|
||||
c = XGetXCBConnection(glx_dpy->dpy);
|
||||
|
|
|
|||
|
|
@ -706,8 +706,7 @@ extern void __glEmptyImage(struct glx_context *, GLint, GLint, GLint, GLint, GLe
|
|||
extern void __glXInitVertexArrayState(struct glx_context *);
|
||||
extern void __glXFreeVertexArrayState(struct glx_context *);
|
||||
|
||||
_X_HIDDEN void
|
||||
__glX_send_client_info(struct glx_display *glx_dpy);
|
||||
extern void glxSendClientInfo(struct glx_display *glx_dpy, int screen);
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
|
|
|
|||
|
|
@ -929,7 +929,7 @@ __glXInitialize(Display * dpy)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
__glX_send_client_info(dpyPriv);
|
||||
glxSendClientInfo(dpyPriv, -1);
|
||||
|
||||
/* Grab the lock again and add the dispay private, unless somebody
|
||||
* beat us to initializing on this display in the meantime. */
|
||||
|
|
|
|||
|
|
@ -763,7 +763,10 @@ __glXCalculateUsableGLExtensions(struct glx_context * gc,
|
|||
* supported by the client to the server.
|
||||
*/
|
||||
char *
|
||||
__glXGetClientGLExtensionString(void)
|
||||
__glXGetClientGLExtensionString(int screen)
|
||||
{
|
||||
if (screen < 0)
|
||||
return strdup("");
|
||||
|
||||
return __glXGetStringFromTable(known_gl_extensions, NULL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -270,7 +270,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(void);
|
||||
extern char *__glXGetClientGLExtensionString(int screen);
|
||||
|
||||
extern GLboolean __glExtensionBitIsEnabled(struct glx_context *gc,
|
||||
unsigned bit);
|
||||
|
|
|
|||
|
|
@ -383,6 +383,7 @@ 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;
|
||||
|
|
|
|||
|
|
@ -210,7 +210,7 @@ xcb_glx_set_client_info_2arb(xcb_connection_t *c,
|
|||
}
|
||||
|
||||
extern "C" char *
|
||||
__glXGetClientGLExtensionString()
|
||||
__glXGetClientGLExtensionString(int screen)
|
||||
{
|
||||
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);
|
||||
__glX_send_client_info(this->glx_dpy);
|
||||
glxSendClientInfo(this->glx_dpy, -1);
|
||||
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);
|
||||
__glX_send_client_info(this->glx_dpy);
|
||||
glxSendClientInfo(this->glx_dpy, -1);
|
||||
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, "");
|
||||
__glX_send_client_info(this->glx_dpy);
|
||||
glxSendClientInfo(this->glx_dpy, -1);
|
||||
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, "");
|
||||
__glX_send_client_info(this->glx_dpy);
|
||||
glxSendClientInfo(this->glx_dpy, -1);
|
||||
|
||||
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");
|
||||
__glX_send_client_info(this->glx_dpy);
|
||||
glxSendClientInfo(this->glx_dpy, -1);
|
||||
|
||||
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");
|
||||
__glX_send_client_info(this->glx_dpy);
|
||||
glxSendClientInfo(this->glx_dpy, -1);
|
||||
|
||||
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, "");
|
||||
__glX_send_client_info(this->glx_dpy);
|
||||
glxSendClientInfo(this->glx_dpy, -1);
|
||||
|
||||
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, "");
|
||||
__glX_send_client_info(this->glx_dpy);
|
||||
glxSendClientInfo(this->glx_dpy, -1);
|
||||
|
||||
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");
|
||||
__glX_send_client_info(this->glx_dpy);
|
||||
glxSendClientInfo(this->glx_dpy, -1);
|
||||
|
||||
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");
|
||||
__glX_send_client_info(this->glx_dpy);
|
||||
glxSendClientInfo(this->glx_dpy, -1);
|
||||
|
||||
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, "");
|
||||
__glX_send_client_info(this->glx_dpy);
|
||||
glxSendClientInfo(this->glx_dpy, -1);
|
||||
|
||||
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");
|
||||
__glX_send_client_info(this->glx_dpy);
|
||||
glxSendClientInfo(this->glx_dpy, -1);
|
||||
|
||||
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");
|
||||
__glX_send_client_info(this->glx_dpy);
|
||||
glxSendClientInfo(this->glx_dpy, -1);
|
||||
|
||||
ASSERT_NE(0, glx_ext_length);
|
||||
ASSERT_NE((char *) 0, glx_ext_string);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue