Bug 22561

Summary: psc->ext_list_first_time is not set correctly if LIBGL_ALWAYS_INDIRECT is forced
Product: Mesa Reporter: Jon Turney <jon.turney>
Component: GLXAssignee: mesa-dev
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: Patch which (incorrectly) removes the problematic calls to __glXExtensionBitIsEnabled()
Patch to move initialization of ext_list_first_time out of DRI driver
Patch to move initialization of ext_list_first_time out of DRI driver
Patch to move initialization of ext_list_first_time to where it's storage is allocated

Description Jon Turney 2009-06-30 13:32:22 UTC
Created attachment 27273 [details] [review]
Patch which (incorrectly) removes the problematic calls to __glXExtensionBitIsEnabled()

I'm using a Cygwin/X X server (which I'm writing some code for), which announces GLX version 1.2 and the GLX_SGIX_fbconfig extension

Indirect rendering is forced for the client using LIBGL_ALWAYS_INDIRECT

glxgears_fbconfig demo fails due to glXCreateContextWithConfigSGIX failing.

The cause of this seems to be that the mesa implementation of glXGetFBConfigFromVisualSGIX() uses __glXExtensionBitIsEnabled() to check if the GLX_SGIX_fbconfig extension is available, but that function only checks if the extension is supported for direct rendering.

Nothing else apart from these 3 functions from GLX_SGIX_fbconfig seems to use __glXExtensionBitIsEnabled, so I'm not sure exactly what the bug is here, or what the solution is.

Attached is a patch which removes those checks, and allows glxgears_fbconfig to run successfully, but that's probably incorrect for the direct path.
Comment 1 Jon Turney 2009-07-03 03:54:28 UTC
Created attachment 27364 [details] [review]
Patch to  move initialization of ext_list_first_time out of DRI driver

After a bit more staring at the code, the attached patch may be a more correct way to fix this: 

ext_list_first_time is only set in the DRI driver loader CreateScreen routine at the moment, so never gets set if DRI drivers are disabled by setting LIBGL_ALWAYS_INDIRECT.

If ext_list_first_time isn't set, the screen's direct_support flags (which seems to be a bit misnamed as it actually reflects the extensions supported by the client/server combination when direct rendering isn't available) are never intialized, so when __glXExtensionBitIsEnabled() is used to check them, they are always false.

So, this patch moves the initialization of ext_list_first_time out of the DRI driver loaders and up to where the screen config is allocated and initalized.
Comment 2 Jon Turney 2009-10-01 06:26:12 UTC
Created attachment 29975 [details] [review]
Patch to move initialization of ext_list_first_time out of DRI driver

Refreshed patch for git master
Comment 3 Jon Turney 2009-10-01 06:28:22 UTC
Retitled the bug to reflect the more correct analysis of what's wrong in comment #1
Comment 4 Jon Turney 2010-03-05 11:31:33 UTC
Created attachment 33793 [details] [review]
Patch to move initialization of ext_list_first_time to where it's storage is allocated

Refreshed patch for git master
Comment 5 Brian Paul 2010-03-05 13:59:47 UTC
Committed. Thanks.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.