[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#639617: libgl1-mesa-glx: libGL should give some indication when DRI2 fails



Package: libgl1-mesa-glx
Version: 7.11-4
Severity: minor
Tags: patch

Recently I was trying to figure out why 3d was getting rendered by
software on my radeon X1300. The reason was that the packaged
r300_dri.so is a gallium driver and appears to be DRI2-only, but I had
DRI2 disabled in X (deliberately, for other reasons). This was very
non-obvious, since libGL gives no indication that anything is going on
with DRI2:

$ 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

Arguably the "real" problem here is that DRI2 is disabled. So, after it
tried DRI2, libGL tried to use r300_dri.so with DRI, which doesn't work
(which is that 'Calling driver entry point failed' error). I spent a bit
of time trying to debug this, and it would have been easier if the debug
messages said a little more about what was happening.

Attached is a patch (which modifies libGL and the *_dri.so drivers) so
instead I get these messages:

$ 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

which to me seems a bit more clear.

Technically this affects both libgl1-mesa-glx and libgl1-mesa-dri, but
this is such a little thing, I didn't want to clutter both packages with
a bug report.

-- 
Andrew Deason
adeason@dson.org
>From dd7e72d7883c63884f37020c38f89fa4e8ecc45c Mon Sep 17 00:00:00 2001
From: Andrew Deason <adeason@dson.org>
Date: Sun, 28 Aug 2011 11:46:02 -0500
Subject: [PATCH 1/2] GLX: Say something if we cannot connect via DRI2

---
 src/glx/dri2_glx.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c
index 80e4da3..1adea98 100644
--- a/src/glx/dri2_glx.c
+++ b/src/glx/dri2_glx.c
@@ -832,6 +832,7 @@ dri2CreateScreen(int screen, struct glx_display * priv)
 		    &driverName, &deviceName)) {
       glx_screen_cleanup(&psc->base);
       XFree(psc);
+      InfoMessageF("screen %d does not appear to be DRI2 capable\n", screen);
       return NULL;
    }
 
-- 
1.7.5.4


>From 12aeb060d1d924ba9b9da8cda1210b96f52ff234 Mon Sep 17 00:00:00 2001
From: Andrew Deason <adeason@dson.org>
Date: Sun, 28 Aug 2011 12:14:46 -0500
Subject: [PATCH 2/2] DRI: Log something if we don't support legacy DRI

If we are called via the legacy DRI interface, and we don't support
legacy DRI (InitScreen is NULL), print a debug message, so it is easy
to see why the driver fails to initialize.
---
 src/mesa/drivers/dri/common/dri_util.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c
index 82638fa..725549b 100644
--- a/src/mesa/drivers/dri/common/dri_util.c
+++ b/src/mesa/drivers/dri/common/dri_util.c
@@ -806,8 +806,10 @@ driCreateNewScreen(int scrn,
     static const __DRIextension *emptyExtensionList[] = { NULL };
     __DRIscreen *psp;
 
-    if (driDriverAPI.InitScreen == NULL)
+    if (driDriverAPI.InitScreen == NULL) {
+	__driUtilMessage("driver does not support DRI1");
 	return NULL;
+    }
 
     psp = calloc(1, sizeof *psp);
     if (!psp)
-- 
1.7.5.4


Reply to: