Bug 40437

Summary: libGL should give some indication when DRI2 fails
Product: Mesa Reporter: Andrew Deason <adeason+freedesktop>
Component: GLXAssignee: mesa-dev
Status: RESOLVED FIXED QA Contact:
Severity: minor    
Priority: low    
Version: 7.11   
Hardware: All   
OS: All   
URL: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=639617
Whiteboard:
i915 platform: i915 features:
Attachments: Add some debug about DRI2 failing and if a driver does not support DRI1

Description Andrew Deason 2011-08-28 11:32:46 UTC
See Debian bug 639617. Currently libGL fails pretty silently if DRI2 isn't enabled on the X server:

$ LIBGL_DEBUG=verbose glxinfo -b
libGL: OpenDriver: trying /usr/lib/i386-linux-gnu/dri/tls/r300_dri.so
libGL: OpenDriver: trying /usr/lib/i386-linux-gnu/dri/r300_dri.so
drmOpenDevice: node name is /dev/dri/card0
drmOpenDevice: open result is 4, (OK)
drmOpenByBusid: Searching for BusID pci:0000:01:00.0
drmOpenDevice: node name is /dev/dri/card0
drmOpenDevice: open result is 4, (OK)
drmOpenByBusid: drmOpenMinor returns 4
drmOpenByBusid: Interface 1.4 failed, trying 1.1
drmOpenByBusid: drmGetBusid reports pci:0000:01:00.0
libGL error: Calling driver entry point failedlibGL error: reverting to software direct rendering
libGL: OpenDriver: trying /usr/lib/i386-linux-gnu/dri/tls/swrast_dri.so
libGL: OpenDriver: trying /usr/lib/i386-linux-gnu/dri/swrast_dri.so
33

That "entry point failed" is because the installed r300_dri.so is the Gallium driver, and doesn't support legacy DRI. So libGL tried to load DRI2, failed, and fell back to DRI, which fails in r300_dri.so. Attached is a patch (modifies libGL, and the *_dri.so drivers) to print out some more info when this happens, which would have saved me some time in figuring out what was going on. With this applied, I get this output (this is with 7.11-4 in Debian):

$ LIBGL_DEBUG=verbose /usr/bin/glxinfo -b
libGL: screen 0 does not appear to be DRI2 capable
libGL: XF86DRIGetClientDriverName: 5.3.0 r300 (screen 0)
libGL: OpenDriver: trying /usr/lib/i386-linux-gnu/dri/tls/r300_dri.so
libGL: OpenDriver: trying /usr/lib/i386-linux-gnu/dri/r300_dri.so
drmOpenDevice: node name is /dev/dri/card0
drmOpenDevice: open result is 4, (OK)
drmOpenByBusid: Searching for BusID pci:0000:01:00.0
drmOpenDevice: node name is /dev/dri/card0
drmOpenDevice: open result is 4, (OK)
drmOpenByBusid: drmOpenMinor returns 4
drmOpenByBusid: Interface 1.4 failed, trying 1.1
drmOpenByBusid: drmGetBusid reports pci:0000:01:00.0
libGL: driver does not support DRI1
libGL error: Calling driver entry point failedlibGL error: reverting to software direct rendering
libGL: OpenDriver: trying /usr/lib/i386-linux-gnu/dri/tls/swrast_dri.so
libGL: OpenDriver: trying /usr/lib/i386-linux-gnu/dri/swrast_dri.so
33

I don't know how you feel about whether there should be more/less messages there, etc, but what's there is enough for me.
Comment 1 Andrew Deason 2011-08-28 11:33:36 UTC
Created attachment 50635 [details] [review]
Add some debug about DRI2 failing and if a driver does not support DRI1
Comment 2 Michel Dänzer 2011-08-31 09:28:25 UTC
Please provide your Signed-off-by:

Ideally, submit the patches to the mesa-dev mailing list with git send-email.
Comment 3 Michel Dänzer 2011-09-14 10:45:59 UTC
Patches pushed to Mesa Git, 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.