Mesa (master): glx: Perform check for valid fbconfig against proper X-Screen.

Emil Velikov evelikov at kemper.freedesktop.org
Fri Oct 14 09:12:05 UTC 2016


Module: Mesa
Branch: master
Commit: 0c94ed0987fd948a7ff4bef401e25319171917c4
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=0c94ed0987fd948a7ff4bef401e25319171917c4

Author: Mario Kleiner <mario.kleiner.de at gmail.com>
Date:   Tue Oct 11 20:42:03 2016 +0200

glx: Perform check for valid fbconfig against proper X-Screen.

Commit cf804b4455fac9e585b3600a8318caaced9c23de
('glx: fix crash with bad fbconfig') introduced a check
in glXCreateNewContext() if the given config is a valid
fbconfig.

Unfortunately the check always checks the given config against
the fbconfigs of the DefaultScreen(dpy), instead of the
actual X-Screen specified in the config config->screen.

This leads to failure whenever a GL context is created
on a non-DefaultScreen(dpy), e.g., on X-Screen 1 of
a multi-x-screen setup, where the default screen is
typically 0.

Fix this by using config->screen instead of DefaultScreen(dpy).

Tested to fix context creation failure on a dual-x-screen setup.

Signed-off-by: Mario Kleiner <mario.kleiner.de at gmail.com>
Cc: "11.2 12.0" <mesa-stable at lists.freedesktop.org>
Reviewed-by: Emil Velikov <emil.velikov at collabora.com>

---

 src/glx/glxcmds.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c
index b0a1cb0..6abe0b9 100644
--- a/src/glx/glxcmds.c
+++ b/src/glx/glxcmds.c
@@ -1626,7 +1626,6 @@ glXCreateNewContext(Display * dpy, GLXFBConfig fbconfig,
                     int renderType, GLXContext shareList, Bool allowDirect)
 {
    struct glx_config *config = (struct glx_config *) fbconfig;
-   int screen = DefaultScreen(dpy);
    struct glx_config **config_list;
    int list_size;
    unsigned i;
@@ -1637,7 +1636,7 @@ glXCreateNewContext(Display * dpy, GLXFBConfig fbconfig,
    }
 
    config_list = (struct glx_config **)
-      glXGetFBConfigs(dpy, screen, &list_size);
+      glXGetFBConfigs(dpy, config->screen, &list_size);
 
    for (i = 0; i < list_size; i++) {
        if (config_list[i] == config)




More information about the mesa-commit mailing list