Mesa (master): dri2: Track event mask in client code.

Jesse Barnes jbarnes at kemper.freedesktop.org
Wed Jul 14 17:23:32 UTC 2010


Module: Mesa
Branch: master
Commit: f8d81c31cee30821da3aab331a57f484f6a07a5d
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=f8d81c31cee30821da3aab331a57f484f6a07a5d

Author: Nick Bowler <nbowler at draconx.ca>
Date:   Wed Jul 14 12:01:49 2010 -0400

dri2: Track event mask in client code.

When direct rendering is being used, DRI2 BufferSwapComplete events are
sent unconditionally to clients, even if they haven't been requested.
This causes error messages to be printed by every freeglut application
of the form

  freeglut (./gears): Unknown X event type: 104

and might confuse other clients.

This is a fixed up version of the patch by Jesse Barnes, which drops
BufferSwapComplete events if they are not requested by clients.

Fixes fdo bug 27962.

Signed-off-by: Nick Bowler <nbowler at draconx.ca>
Signed-off-by: Jesse Barnes <jbarnes at virtuousgeek.org>

---

 src/glx/dri2.c        |    6 ++++++
 src/glx/glx_pbuffer.c |   11 +++++++++++
 src/glx/glxclient.h   |    1 +
 3 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/src/glx/dri2.c b/src/glx/dri2.c
index e4ff538..dbf3420 100644
--- a/src/glx/dri2.c
+++ b/src/glx/dri2.c
@@ -99,6 +99,12 @@ DRI2WireToEvent(Display *dpy, XEvent *event, xEvent *wire)
    {
       GLXBufferSwapComplete *aevent = (GLXBufferSwapComplete *)event;
       xDRI2BufferSwapComplete *awire = (xDRI2BufferSwapComplete *)wire;
+      __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, awire->drawable, NULL);
+
+      /* Ignore swap events if we're not looking for them */
+      if (!(pdraw->eventMask & GLX_BUFFER_SWAP_COMPLETE_INTEL_MASK))
+	 return False;
+
       aevent->serial = _XSetLastRequestRead(dpy, (xGenericReply *) wire);
       aevent->type = glx_info->codes->first_event + GLX_BufferSwapComplete;
       aevent->send_event = (awire->type & 0x80) != 0;
diff --git a/src/glx/glx_pbuffer.c b/src/glx/glx_pbuffer.c
index b8d0f21..c081836 100644
--- a/src/glx/glx_pbuffer.c
+++ b/src/glx/glx_pbuffer.c
@@ -86,8 +86,10 @@ ChangeDrawableAttribute(Display * dpy, GLXDrawable drawable,
                         const CARD32 * attribs, size_t num_attribs)
 {
    __GLXdisplayPrivate *priv = __glXInitialize(dpy);
+   __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable, NULL);
    CARD32 *output;
    CARD8 opcode;
+   int i;
 
    if ((dpy == NULL) || (drawable == 0)) {
       return;
@@ -129,6 +131,15 @@ ChangeDrawableAttribute(Display * dpy, GLXDrawable drawable,
    UnlockDisplay(dpy);
    SyncHandle();
 
+   for (i = 0; i < num_attribs; i++) {
+      switch(attribs[i * 2]) {
+      case GLX_EVENT_MASK:
+	 /* Keep a local copy for masking out DRI2 proto events as needed */
+	 pdraw->eventMask = attribs[i * 2 + 1];
+	 break;
+      }
+   }
+
    return;
 }
 
diff --git a/src/glx/glxclient.h b/src/glx/glxclient.h
index b41073f..49f31a1 100644
--- a/src/glx/glxclient.h
+++ b/src/glx/glxclient.h
@@ -176,6 +176,7 @@ struct __GLXDRIdrawableRec
    GLenum textureTarget;
    __DRIdrawable *driDrawable;
    GLenum textureFormat;        /* EXT_texture_from_pixmap support */
+   unsigned long eventMask;
 };
 
 /*




More information about the mesa-commit mailing list