diff --git a/debian/changelog b/debian/changelog
index 1a34044..ab1f238 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+mesa (7.7.1-5) UNRELEASED; urgency=low
+
+  * glx: suppress BadRequest from DRI2Connect (which is expected for non-local
+    clients).
+
+ -- Julien Cristau <jcristau@debian.org>  Tue, 31 May 2011 15:08:18 +0200
+
 mesa (7.7.1-4) unstable; urgency=low
 
   [ Brice Goglin ]
diff --git a/src/glx/x11/dri2.c b/src/glx/x11/dri2.c
index dad0447..cbf5e0b 100644
--- a/src/glx/x11/dri2.c
+++ b/src/glx/x11/dri2.c
@@ -54,6 +54,8 @@
 static char dri2ExtensionName[] = DRI2_NAME;
 static XExtensionInfo *dri2Info;
 static XEXT_GENERATE_CLOSE_DISPLAY (DRI2CloseDisplay, dri2Info)
+static int
+DRI2Error(Display *dpy, xError *err, XExtCodes *codes, int *ret_code);
 
 static /* const */ XExtensionHooks dri2ExtensionHooks = {
   NULL,                   /* create_gc */
@@ -65,7 +67,7 @@ static /* const */ XExtensionHooks dri2ExtensionHooks = {
   DRI2CloseDisplay,       /* close_display */
   NULL,                   /* wire_to_event */
   NULL,                   /* event_to_wire */
-  NULL,                   /* error */
+  DRI2Error,              /* error */
   NULL,                   /* error_string */
 };
 
@@ -75,6 +77,16 @@ static XEXT_GENERATE_FIND_DISPLAY (DRI2FindDisplay,
                                    &dri2ExtensionHooks,
                                    0, NULL)
 
+static int
+DRI2Error(Display *dpy, xError *err, XExtCodes *codes, int *ret_code)
+{
+    if (err->majorCode == codes->major_opcode &&
+	err->errorCode == BadRequest &&
+	err->minorCode == X_DRI2Connect)
+	return True;
+    return False;
+}
+
 Bool
 DRI2QueryExtension(Display * dpy, int *eventBase, int *errorBase)
 {
