diff options
author | Aaron Plattner <[email protected]> | 2011-12-06 10:20:30 -0800 |
---|---|---|
committer | Brian Paul <[email protected]> | 2011-12-07 17:20:10 -0700 |
commit | 63a6fd6603574c1c01324fbeb0863e39d3864c16 (patch) | |
tree | 6f3a16af090ac108351d009fde1166864258c26b /src/glx/dri_glx.c | |
parent | 4558987818e1ff36e86592e9c5c0b5e181be9ec1 (diff) |
glx: Fix indirect fallback when a non-Mesa GLX extension is present.
When driCreateScreen calls driConvertConfigs to try to convert the
configs for swrast, it fails and returns NULL. Instead of checking,
it just clobbers psc->base.configs. Then, when the application asks
for the FBconfigs, there aren't any.
Instead, make the caller responsible for freeing the old modes lists
if both calls to driConvertConfigs succeed.
Without the second fix, glxinfo fails unless you run it with
LIBGL_ALWAYS_INDIRECT:
$ glxinfo
name of display: :0.0
Error: couldn't find RGB GLX visual or fbconfig
$ LIBGL_ALWAYS_INDIRECT=1 glxinfo
name of display: :0.0
display: :0 screen: 0
direct rendering: No (LIBGL_ALWAYS_INDIRECT set)
server glx vendor string: NVIDIA Corporation
server glx version string: 1.4
[...]
Signed-off-by: Aaron Plattner <[email protected]>
Reviewed-and-tested-by: Ian Romanick <[email protected]>
Signed-off-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/glx/dri_glx.c')
-rw-r--r-- | src/glx/dri_glx.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/glx/dri_glx.c b/src/glx/dri_glx.c index a52159c0657..666423a7b15 100644 --- a/src/glx/dri_glx.c +++ b/src/glx/dri_glx.c @@ -336,7 +336,7 @@ CallCreateNewScreen(Display *dpy, int scrn, struct dri_screen *psc, drm_handle_t hFB; int junk; const __DRIconfig **driver_configs; - struct glx_config *visual; + struct glx_config *visual, *configs = NULL, *visuals = NULL; /* DRI protocol version. */ dri_version.major = driDpy->driMajor; @@ -446,10 +446,16 @@ CallCreateNewScreen(Display *dpy, int scrn, struct dri_screen *psc, goto handle_error; } - psc->base.configs = - driConvertConfigs(psc->core, psc->base.configs, driver_configs); - psc->base.visuals = - driConvertConfigs(psc->core, psc->base.visuals, driver_configs); + configs = driConvertConfigs(psc->core, psc->base.configs, driver_configs); + visuals = driConvertConfigs(psc->core, psc->base.visuals, driver_configs); + + if (!configs || !visuals) + goto handle_error; + + glx_config_destroy_list(psc->base.configs); + psc->base.configs = configs; + glx_config_destroy_list(psc->base.visuals); + psc->base.visuals = visuals; psc->driver_configs = driver_configs; @@ -478,6 +484,11 @@ CallCreateNewScreen(Display *dpy, int scrn, struct dri_screen *psc, return psp; handle_error: + if (configs) + glx_config_destroy_list(configs); + if (visuals) + glx_config_destroy_list(visuals); + if (pSAREA != MAP_FAILED) drmUnmap(pSAREA, SAREA_MAX); |