All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC] swap complete event handling fixes
@ 2011-05-03 17:59 Jesse Barnes
       [not found] ` <1304445561-9910-1-git-send-email-jbarnes-Y1mF5jBUw70BENJcbMCuUQ@public.gmane.org>
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Jesse Barnes @ 2011-05-03 17:59 UTC (permalink / raw)
  To: dri-devel, xorg-devel, mesa-dev

Ended up moving over to generic events since the GLX type code is part
of the GLX namespace and larger than 8 bits.

Apparently no one had ever tried ChangeDrawableAttributes with indirect
clients, because simply going a glXSelectEvent causes a crash in that
case.  So this patch set includes a fix for that issue and has been
tested with both direct and indirect clients, both with and without
client and server support.

New clients with old servers should get a 0 sbc rather than garbage.
New servers will send old clients a 0 sbc, but the clients will still
copy garbage into the event actually sent to clients.  New servers with
new clients should work both in the direct and indirect cases and get
whatever values the server sends for each field.

As always, testing and review appreciated.  Piglit's glx-swap-event case
now checks for swap count sanity (i.e. increasing, nonzero value) and
allows you to dump the current values in verbose mode.  I also added a
few more return value checks to the test.

Thanks,
Jesse

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH] DRI2: fix swap complete event size by using a generic event
       [not found] ` <1304445561-9910-1-git-send-email-jbarnes-Y1mF5jBUw70BENJcbMCuUQ@public.gmane.org>
@ 2011-05-03 17:59   ` Jesse Barnes
  2011-05-03 17:59   ` [PATCH] GLX: fix broken swap " Jesse Barnes
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 9+ messages in thread
From: Jesse Barnes @ 2011-05-03 17:59 UTC (permalink / raw)
  To: dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	xorg-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	mesa-dev-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

The existing swap complete event is too large to fit in an XEvent, so
use a generic event instead.  New servers and clients can use this
structure to fully pass the swap count along with the media stamp
counter, swap complete type, and timestamp.

Signed-off-by: Jesse Barnes <jbarnes-Y1mF5jBUw70BENJcbMCuUQ@public.gmane.org>
---
 configure.ac |    2 +-
 dri2proto.h  |   22 ++++++++++++++++++++--
 2 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index 5b78d6b..9505f56 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
 AC_PREREQ([2.60])
-AC_INIT([DRI2Proto], [2.3], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg])
+AC_INIT([DRI2Proto], [2.4], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg])
 AM_INIT_AUTOMAKE([foreign dist-bzip2])
 AM_MAINTAINER_MODE
 
diff --git a/dri2proto.h b/dri2proto.h
index 9708a4a..5a7d3e1 100644
--- a/dri2proto.h
+++ b/dri2proto.h
@@ -35,7 +35,7 @@
 
 #define DRI2_NAME			"DRI2"
 #define DRI2_MAJOR			1
-#define DRI2_MINOR			3
+#define DRI2_MINOR			4
 
 #define DRI2NumberErrors		0
 #define DRI2NumberEvents		2
@@ -298,7 +298,25 @@ typedef struct {
     CARD32 sbc_hi B32;
     CARD32 sbc_lo B32;
 } xDRI2BufferSwapComplete;
-#define sz_xDRI2BufferSwapComplete 32
+#define sz_xDRI2BufferSwapComplete 32 /* This should have been 36 */
+
+/* Use a generic event so we can transmit the sbc_lo value as well */
+typedef struct {
+    BYTE type;
+    CARD8 extension;
+    CARD16 sequenceNumber B16;
+    CARD32 length B32; /* should always be 8 for this event */
+    CARD16 evtype B16;
+    CARD16 swap_event_type B16;
+    CARD32 drawable B32;
+    CARD32 ust_hi B32;
+    CARD32 ust_lo B32;
+    CARD32 msc_hi B32;
+    CARD32 msc_lo B32;
+    CARD32 sbc_hi B32;
+    CARD32 sbc_lo B32;
+} xDRI2BufferSwapComplete2;
+#define sz_xDRI2BufferSwapComplete2 38
 
 typedef struct {
     CARD8 type;
-- 
1.7.4.1

_______________________________________________
xorg-devel-go0+a7rfsptAfugRpC6u6w@public.gmane.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH] GLX: fix broken swap event size by using a generic event
       [not found] ` <1304445561-9910-1-git-send-email-jbarnes-Y1mF5jBUw70BENJcbMCuUQ@public.gmane.org>
  2011-05-03 17:59   ` [PATCH] DRI2: fix swap complete event size by using a generic event Jesse Barnes
@ 2011-05-03 17:59   ` Jesse Barnes
  2011-05-03 17:59   ` [PATCH 3/5] GLX: don't crash when indirect clients try to set an event mask Jesse Barnes
  2011-05-03 17:59   ` [PATCH 4/5] DRI2: support generic swap event handling Jesse Barnes
  3 siblings, 0 replies; 9+ messages in thread
From: Jesse Barnes @ 2011-05-03 17:59 UTC (permalink / raw)
  To: dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	xorg-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	mesa-dev-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

The existing event is too large for an XEvent meaning that the swap
count is never sent to clients.  Create a generic event instead for use
by new clients & servers.

Signed-off-by: Jesse Barnes <jbarnes-Y1mF5jBUw70BENJcbMCuUQ@public.gmane.org>
---
 configure.ac |    2 +-
 glxproto.h   |   18 ++++++++++++++++++
 2 files changed, 19 insertions(+), 1 deletions(-)

diff --git a/configure.ac b/configure.ac
index d88e6df..a3047e4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
 AC_PREREQ([2.60])
-AC_INIT([GLProto], [1.4.12], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg])
+AC_INIT([GLProto], [1.4.13], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg])
 AM_INIT_AUTOMAKE([foreign dist-bzip2])
 AM_MAINTAINER_MODE
 
diff --git a/glxproto.h b/glxproto.h
index 0ff44e3..d026d4d 100644
--- a/glxproto.h
+++ b/glxproto.h
@@ -1384,6 +1384,24 @@ typedef struct {
     CARD32 sbc_lo B32;
 } xGLXBufferSwapComplete;
 
+/* The above is actually too large to fit in an XEvent, so use a generic
+ * event so we can send the sbc count as well. */
+typedef struct {
+    BYTE type;
+    CARD8 extension;
+    CARD16 sequenceNumber B16;
+    CARD32 length B32; /* should always be 8 for this event */
+    CARD16 evtype B16;
+    CARD16 swap_event_type B16;
+    CARD32 drawable B32;
+    CARD32 ust_hi B32;
+    CARD32 ust_lo B32;
+    CARD32 msc_hi B32;
+    CARD32 msc_lo B32;
+    CARD32 sbc_hi B32;
+    CARD32 sbc_lo B32;
+} xGLXBufferSwapComplete2;
+
 /************************************************************************/
 
 /*
-- 
1.7.4.1

_______________________________________________
xorg-devel-go0+a7rfsptAfugRpC6u6w@public.gmane.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/5] GLX: don't crash when indirect clients try to set an event mask
       [not found] ` <1304445561-9910-1-git-send-email-jbarnes-Y1mF5jBUw70BENJcbMCuUQ@public.gmane.org>
  2011-05-03 17:59   ` [PATCH] DRI2: fix swap complete event size by using a generic event Jesse Barnes
  2011-05-03 17:59   ` [PATCH] GLX: fix broken swap " Jesse Barnes
@ 2011-05-03 17:59   ` Jesse Barnes
  2011-05-03 17:59   ` [PATCH 4/5] DRI2: support generic swap event handling Jesse Barnes
  3 siblings, 0 replies; 9+ messages in thread
From: Jesse Barnes @ 2011-05-03 17:59 UTC (permalink / raw)
  To: dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	xorg-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	mesa-dev-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

After sending the GLXChangeDrawableAttributes request, we also set a
local set of attributes on the DRI drawable.  But in the indirect case
this array won't be present, so skip the setting in that case to avoid a
crash.

Signed-off-by: Jesse Barnes <jbarnes-Y1mF5jBUw70BENJcbMCuUQ@public.gmane.org>
---
 src/glx/glx_pbuffer.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/glx/glx_pbuffer.c b/src/glx/glx_pbuffer.c
index 5f91bc6..ec54f1e 100644
--- a/src/glx/glx_pbuffer.c
+++ b/src/glx/glx_pbuffer.c
@@ -137,6 +137,9 @@ ChangeDrawableAttribute(Display * dpy, GLXDrawable drawable,
 #ifdef GLX_DIRECT_RENDERING
    pdraw = GetGLXDRIDrawable(dpy, drawable);
 
+   if (!pdraw)
+      return;
+
    for (i = 0; i < num_attribs; i++) {
       switch(attribs[i * 2]) {
       case GLX_EVENT_MASK:
-- 
1.7.4.1

_______________________________________________
xorg-devel-go0+a7rfsptAfugRpC6u6w@public.gmane.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 4/5] DRI2: support generic swap event handling
       [not found] ` <1304445561-9910-1-git-send-email-jbarnes-Y1mF5jBUw70BENJcbMCuUQ@public.gmane.org>
                     ` (2 preceding siblings ...)
  2011-05-03 17:59   ` [PATCH 3/5] GLX: don't crash when indirect clients try to set an event mask Jesse Barnes
@ 2011-05-03 17:59   ` Jesse Barnes
  3 siblings, 0 replies; 9+ messages in thread
From: Jesse Barnes @ 2011-05-03 17:59 UTC (permalink / raw)
  To: dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	xorg-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	mesa-dev-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

The existing swap event structure is too large to fit in an XEvent, so new
servers will send a generic event if the client supports it.  This
allows a valid swap count value to be sent along with the event type,
timestamp, and media stamp.  Check for server support based on the
advertised DRI2 version and look for generic events in the event stream
with DRI2 in the extension field.

Signed-off-by: Jesse Barnes <jbarnes-Y1mF5jBUw70BENJcbMCuUQ@public.gmane.org>
---
 configure.ac        |    2 +-
 src/glx/dri2.c      |  105 ++++++++++++++++++++++++++++++++++++--------------
 src/glx/dri2.h      |    3 +-
 src/glx/dri2_glx.c  |   31 +++++++++++++-
 src/glx/glxclient.h |    2 +
 5 files changed, 108 insertions(+), 35 deletions(-)

diff --git a/configure.ac b/configure.ac
index 3b05ca3..92d11af 100644
--- a/configure.ac
+++ b/configure.ac
@@ -21,7 +21,7 @@ dnl Versions for external dependencies
 LIBDRM_REQUIRED=2.4.24
 LIBDRM_RADEON_REQUIRED=2.4.24
 LIBDRM_INTEL_REQUIRED=2.4.24
-DRI2PROTO_REQUIRED=2.1
+DRI2PROTO_REQUIRED=2.4
 GLPROTO_REQUIRED=1.4.11
 LIBDRM_XORG_REQUIRED=2.4.24
 LIBKMS_XORG_REQUIRED=1.0.0
diff --git a/src/glx/dri2.c b/src/glx/dri2.c
index adfd3d1..9cab639 100644
--- a/src/glx/dri2.c
+++ b/src/glx/dri2.c
@@ -48,7 +48,7 @@
  */
 #if DRI2_MINOR < 1
 #undef DRI2_MINOR
-#define DRI2_MINOR 1
+#define DRI2_MINOR 4
 #define X_DRI2GetBuffersWithFormat 7
 #endif
 
@@ -88,43 +88,85 @@ static Bool
 DRI2WireToEvent(Display *dpy, XEvent *event, xEvent *wire)
 {
    XExtDisplayInfo *info = DRI2FindDisplay(dpy);
+   int type;
 
    XextCheckExtension(dpy, info, dri2ExtensionName, False);
 
-   switch ((wire->u.u.type & 0x7f) - info->codes->first_event) {
+   if (wire->u.u.type == GenericEvent &&
+       dri2ServerSupportsSBC(dpy)) {
+      xGenericEvent *wire2 = (xGenericEvent *)wire;
+      if (!dri2Event(dpy, wire2->extension))
+	  return False;
+      type = wire2->evtype;
+   } else {
+      type = (wire->u.u.type & 0x7f) - info->codes->first_event;
+   }
+
+   switch (type) {
 
 #ifdef X_DRI2SwapBuffers
    case DRI2_BufferSwapComplete:
    {
       GLXBufferSwapComplete *aevent = (GLXBufferSwapComplete *)event;
-      xDRI2BufferSwapComplete *awire = (xDRI2BufferSwapComplete *)wire;
-
-      /* Ignore swap events if we're not looking for them */
-      aevent->type = dri2GetSwapEventType(dpy, awire->drawable);
-      if(!aevent->type)
-         return False;
-
-      aevent->serial = _XSetLastRequestRead(dpy, (xGenericReply *) wire);
-      aevent->send_event = (awire->type & 0x80) != 0;
-      aevent->display = dpy;
-      aevent->drawable = awire->drawable;
-      switch (awire->event_type) {
-      case DRI2_EXCHANGE_COMPLETE:
-	 aevent->event_type = GLX_EXCHANGE_COMPLETE_INTEL;
-	 break;
-      case DRI2_BLIT_COMPLETE:
-	 aevent->event_type = GLX_COPY_COMPLETE_INTEL;
-	 break;
-      case DRI2_FLIP_COMPLETE:
-	 aevent->event_type = GLX_FLIP_COMPLETE_INTEL;
-	 break;
-      default:
-	 /* unknown swap completion type */
-	 return False;
+
+      if (dri2ServerSupportsSBC(dpy)) {
+	 xDRI2BufferSwapComplete2 *awire = (xDRI2BufferSwapComplete2 *)wire;
+
+	 /* Ignore swap events if we're not looking for them */
+	 aevent->type = dri2GetSwapEventType(dpy, awire->drawable);
+	 if(!aevent->type)
+	    return False;
+
+	 aevent->serial = _XSetLastRequestRead(dpy, (xGenericReply *) wire);
+	 aevent->send_event = (awire->type & 0x80) != 0;
+	 aevent->display = dpy;
+	 aevent->drawable = awire->drawable;
+	 switch (awire->swap_event_type) {
+	 case DRI2_EXCHANGE_COMPLETE:
+	    aevent->event_type = GLX_EXCHANGE_COMPLETE_INTEL;
+	    break;
+	 case DRI2_BLIT_COMPLETE:
+	    aevent->event_type = GLX_COPY_COMPLETE_INTEL;
+	    break;
+	 case DRI2_FLIP_COMPLETE:
+	    aevent->event_type = GLX_FLIP_COMPLETE_INTEL;
+	    break;
+	 default:
+	    /* unknown swap completion type */
+	    return False;
+	 }
+	 aevent->ust = ((CARD64)awire->ust_hi << 32) | awire->ust_lo;
+	 aevent->msc = ((CARD64)awire->msc_hi << 32) | awire->msc_lo;
+	 aevent->sbc = ((CARD64)awire->sbc_hi << 32) | awire->sbc_lo;
+      } else {
+	 xDRI2BufferSwapComplete *awire = (xDRI2BufferSwapComplete *)wire;
+	 /* Ignore swap events if we're not looking for them */
+	 aevent->type = dri2GetSwapEventType(dpy, awire->drawable);
+	 if(!aevent->type)
+	    return False;
+
+	 aevent->serial = _XSetLastRequestRead(dpy, (xGenericReply *) wire);
+	 aevent->send_event = (awire->type & 0x80) != 0;
+	 aevent->display = dpy;
+	 aevent->drawable = awire->drawable;
+	 switch (awire->event_type) {
+	 case DRI2_EXCHANGE_COMPLETE:
+	    aevent->event_type = GLX_EXCHANGE_COMPLETE_INTEL;
+	    break;
+	 case DRI2_BLIT_COMPLETE:
+	    aevent->event_type = GLX_COPY_COMPLETE_INTEL;
+	    break;
+	 case DRI2_FLIP_COMPLETE:
+	    aevent->event_type = GLX_FLIP_COMPLETE_INTEL;
+	    break;
+	 default:
+	    /* unknown swap completion type */
+	    return False;
+	 }
+	 aevent->ust = ((CARD64)awire->ust_hi << 32) | awire->ust_lo;
+	 aevent->msc = ((CARD64)awire->msc_hi << 32) | awire->msc_lo;
+	 aevent->sbc = 0;
       }
-      aevent->ust = ((CARD64)awire->ust_hi << 32) | awire->ust_lo;
-      aevent->msc = ((CARD64)awire->msc_hi << 32) | awire->msc_lo;
-      aevent->sbc = ((CARD64)awire->sbc_hi << 32) | awire->sbc_lo;
       return True;
    }
 #endif
@@ -184,11 +226,12 @@ DRI2Error(Display *display, xError *err, XExtCodes *codes, int *ret_code)
 }
 
 Bool
-DRI2QueryExtension(Display * dpy, int *eventBase, int *errorBase)
+DRI2QueryExtension(Display * dpy, int *extBase, int *eventBase, int *errorBase)
 {
    XExtDisplayInfo *info = DRI2FindDisplay(dpy);
 
    if (XextHasExtension(info)) {
+      *extBase = info->codes->major_opcode;
       *eventBase = info->codes->first_event;
       *errorBase = info->codes->first_error;
       return True;
@@ -241,6 +284,8 @@ DRI2QueryVersion(Display * dpy, int *major, int *minor)
        XESetEventToWire (dpy, info->codes->first_event + i, DRI2EventToWire);
    }
 
+   XESetWireToEvent(dpy, GenericEvent, DRI2WireToEvent);
+
    return True;
 }
 
diff --git a/src/glx/dri2.h b/src/glx/dri2.h
index 114e9f8..b3a9918 100644
--- a/src/glx/dri2.h
+++ b/src/glx/dri2.h
@@ -46,7 +46,8 @@ typedef struct
 } DRI2Buffer;
 
 extern Bool
-DRI2QueryExtension(Display * display, int *eventBase, int *errorBase);
+DRI2QueryExtension(Display * display, int *extBase, int *eventBase,
+		   int *errorBase);
 
 extern Bool
 DRI2QueryVersion(Display * display, int *major, int *minor);
diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c
index fc0237a..19be513 100644
--- a/src/glx/dri2_glx.c
+++ b/src/glx/dri2_glx.c
@@ -55,12 +55,14 @@
 #define DRI_CONF_VBLANK_ALWAYS_SYNC 3
 
 #undef DRI2_MINOR
-#define DRI2_MINOR 1
+#define DRI2_MINOR 4
 
 struct dri2_display
 {
    __GLXDRIdisplay base;
 
+   int majorOpcode;
+
    /*
     ** XFree86-DRI version information
     */
@@ -791,6 +793,28 @@ static const struct glx_screen_vtable dri2_screen_vtable = {
    dri2_create_context
 };
 
+int
+dri2ServerSupportsSBC(Display *dpy)
+{
+   struct glx_display *dpyPriv = __glXInitialize(dpy);
+   struct dri2_display *pdp =
+      (struct dri2_display *) dpyPriv->dri2Display;
+
+   if (pdp->driMajor > 1 || (pdp->driMajor == 1 && pdp->driMinor > 3))
+      return 1;
+
+   return 0;
+}
+
+int dri2Event(Display *dpy, int extension)
+{
+   struct glx_display *dpyPriv = __glXInitialize(dpy);
+   struct dri2_display *pdp =
+      (struct dri2_display *) dpyPriv->dri2Display;
+
+   return pdp->majorOpcode == extension;
+}
+
 static struct glx_screen *
 dri2CreateScreen(int screen, struct glx_display * priv)
 {
@@ -973,9 +997,9 @@ _X_HIDDEN __GLXDRIdisplay *
 dri2CreateDisplay(Display * dpy)
 {
    struct dri2_display *pdp;
-   int eventBase, errorBase, i;
+   int extBase, eventBase, errorBase, i;
 
-   if (!DRI2QueryExtension(dpy, &eventBase, &errorBase))
+   if (!DRI2QueryExtension(dpy, &extBase, &eventBase, &errorBase))
       return NULL;
 
    pdp = Xmalloc(sizeof *pdp);
@@ -987,6 +1011,7 @@ dri2CreateDisplay(Display * dpy)
       return NULL;
    }
 
+   pdp->majorOpcode = extBase;
    pdp->driPatch = 0;
    pdp->swapAvailable = (pdp->driMinor >= 2);
    pdp->invalidateAvailable = (pdp->driMinor >= 3);
diff --git a/src/glx/glxclient.h b/src/glx/glxclient.h
index 2b6966f..755a66d 100644
--- a/src/glx/glxclient.h
+++ b/src/glx/glxclient.h
@@ -149,6 +149,8 @@ extern __GLXDRIdisplay *driCreateDisplay(Display * dpy);
 extern __GLXDRIdisplay *dri2CreateDisplay(Display * dpy);
 extern void dri2InvalidateBuffers(Display *dpy, XID drawable);
 extern unsigned dri2GetSwapEventType(Display *dpy, XID drawable);
+extern int dri2ServerSupportsSBC(Display *dpy);
+extern int dri2Event(Display *dpy, int extension);
 
 
 /*
-- 
1.7.4.1

_______________________________________________
xorg-devel-go0+a7rfsptAfugRpC6u6w@public.gmane.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 5/5] GLX: support generic swap events
  2011-05-03 17:59 [RFC] swap complete event handling fixes Jesse Barnes
       [not found] ` <1304445561-9910-1-git-send-email-jbarnes-Y1mF5jBUw70BENJcbMCuUQ@public.gmane.org>
@ 2011-05-03 17:59 ` Jesse Barnes
  2011-05-03 17:59 ` [PATCH 6/8] GLX/DRI2: pass drawable correctly for indirect " Jesse Barnes
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Jesse Barnes @ 2011-05-03 17:59 UTC (permalink / raw)
  To: dri-devel, xorg-devel, mesa-dev

The existing swap event structure is too big to fit in an XEvent, so
support servers that send generic events instead.  Do this by
advertising the GLX proto version we support when connecting and check
for generic events in the event stream.  Convert any received events
into regular swap complete events for client compatibility.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
---
 configure.ac        |    2 +-
 src/glx/glxclient.h |    2 +-
 src/glx/glxext.c    |   55 ++++++++++++++++++++++++++++++++++++++++++++------
 3 files changed, 50 insertions(+), 9 deletions(-)

diff --git a/configure.ac b/configure.ac
index 92d11af..94fb6f7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -22,7 +22,7 @@ LIBDRM_REQUIRED=2.4.24
 LIBDRM_RADEON_REQUIRED=2.4.24
 LIBDRM_INTEL_REQUIRED=2.4.24
 DRI2PROTO_REQUIRED=2.4
-GLPROTO_REQUIRED=1.4.11
+GLPROTO_REQUIRED=1.4.13
 LIBDRM_XORG_REQUIRED=2.4.24
 LIBKMS_XORG_REQUIRED=1.0.0
 
diff --git a/src/glx/glxclient.h b/src/glx/glxclient.h
index 755a66d..cdef2a1 100644
--- a/src/glx/glxclient.h
+++ b/src/glx/glxclient.h
@@ -63,7 +63,7 @@
 #define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))
 
 #define GLX_MAJOR_VERSION 1       /* current version numbers */
-#define GLX_MINOR_VERSION 4
+#define GLX_MINOR_VERSION 5
 
 #define __GLX_MAX_TEXTURE_UNITS 32
 
diff --git a/src/glx/glxext.c b/src/glx/glxext.c
index 278c719..fb29711 100644
--- a/src/glx/glxext.c
+++ b/src/glx/glxext.c
@@ -104,14 +104,42 @@ XEXT_GENERATE_ERROR_STRING(__glXErrorString, __glXExtensionName,
  */
 
 static Bool
+__glXServerSupportsSBC(Display *dpy)
+{
+     struct glx_display *glx_dpy = __glXInitialize(dpy);
+
+     return (glx_dpy->majorVersion > 1 || (glx_dpy->majorVersion == 1 &&
+					   glx_dpy->minorVersion > 4));
+}
+
+static Bool
+__glXGenericEvent(Display *dpy, xGenericEvent *wire)
+{
+     struct glx_display *glx_dpy = __glXInitialize(dpy);
+
+     return wire->extension == glx_dpy->codes->major_opcode;
+}
+
+static Bool
 __glXWireToEvent(Display *dpy, XEvent *event, xEvent *wire)
 {
      struct glx_display *glx_dpy = __glXInitialize(dpy);
+     int type;
 
    if (glx_dpy == NULL)
       return False;
 
-   switch ((wire->u.u.type & 0x7f) - glx_dpy->codes->first_event) {
+   /* New extension will send generic events for some events */
+   if (wire->u.u.type == GenericEvent && __glXServerSupportsSBC(dpy)) {
+      xGenericEvent *wire2 = (xGenericEvent *)wire;
+      if (!__glXGenericEvent(dpy, wire2))
+	 return False;
+      type = wire2->evtype;
+   } else {
+      type = (wire->u.u.type & 0x7f) - glx_dpy->codes->first_event;
+   }
+
+   switch (type) {
    case GLX_PbufferClobber:
    {
       GLXPbufferClobberEvent *aevent = (GLXPbufferClobberEvent *)event;
@@ -133,12 +161,23 @@ __glXWireToEvent(Display *dpy, XEvent *event, xEvent *wire)
    case GLX_BufferSwapComplete:
    {
       GLXBufferSwapComplete *aevent = (GLXBufferSwapComplete *)event;
-      xGLXBufferSwapComplete *awire = (xGLXBufferSwapComplete *)wire;
-      aevent->event_type = awire->event_type;
-      aevent->drawable = awire->drawable;
-      aevent->ust = ((CARD64)awire->ust_hi << 32) | awire->ust_lo;
-      aevent->msc = ((CARD64)awire->msc_hi << 32) | awire->msc_lo;
-      aevent->sbc = ((CARD64)awire->sbc_hi << 32) | awire->sbc_lo;
+      if (__glXServerSupportsSBC(dpy)) {
+	 xGLXBufferSwapComplete2 *awire = (xGLXBufferSwapComplete2 *)wire;
+	 /* Make it look like a regular event to clients */
+	 aevent->type = glx_dpy->codes->first_event + awire->evtype;
+	 aevent->event_type = awire->swap_event_type;
+	 aevent->drawable = awire->drawable;
+	 aevent->ust = ((CARD64)awire->ust_hi << 32) | awire->ust_lo;
+	 aevent->msc = ((CARD64)awire->msc_hi << 32) | awire->msc_lo;
+ 	 aevent->sbc = ((CARD64)awire->sbc_hi << 32) | awire->sbc_lo;
+      } else {
+	 xGLXBufferSwapComplete *awire = (xGLXBufferSwapComplete *)wire;
+	 aevent->event_type = awire->event_type;
+	 aevent->drawable = awire->drawable;
+	 aevent->ust = ((CARD64)awire->ust_hi << 32) | awire->ust_lo;
+	 aevent->msc = ((CARD64)awire->msc_hi << 32) | awire->msc_lo;
+	 aevent->sbc = 0;
+      }
       return True;
    }
    default:
@@ -843,6 +882,8 @@ __glXInitialize(Display * dpy)
       XESetEventToWire(dpy, dpyPriv->codes->first_event + i, __glXEventToWire);
    }
 
+   XESetWireToEvent(dpy, GenericEvent, __glXWireToEvent);
+
    XESetCloseDisplay(dpy, dpyPriv->codes->extension, __glXCloseDisplay);
    XESetErrorString (dpy, dpyPriv->codes->extension,__glXErrorString);
 
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 6/8] GLX/DRI2: pass drawable correctly for indirect swap events
  2011-05-03 17:59 [RFC] swap complete event handling fixes Jesse Barnes
       [not found] ` <1304445561-9910-1-git-send-email-jbarnes-Y1mF5jBUw70BENJcbMCuUQ@public.gmane.org>
  2011-05-03 17:59 ` [PATCH 5/5] GLX: support generic swap events Jesse Barnes
@ 2011-05-03 17:59 ` Jesse Barnes
  2011-05-03 17:59 ` [PATCH 7/8] DRI2: support generic " Jesse Barnes
  2011-05-03 17:59 ` [PATCH 8/8] GLX: " Jesse Barnes
  4 siblings, 0 replies; 9+ messages in thread
From: Jesse Barnes @ 2011-05-03 17:59 UTC (permalink / raw)
  To: dri-devel, xorg-devel, mesa-dev

Pass the right drawable pointer as data to the swap complete function.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
---
 glx/glxdri2.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/glx/glxdri2.c b/glx/glxdri2.c
index d979717..93c5e5b 100644
--- a/glx/glxdri2.c
+++ b/glx/glxdri2.c
@@ -222,7 +222,7 @@ __glXDRIdrawableSwapBuffers(ClientPtr client, __GLXdrawable *drawable)
 #endif
 
     if (DRI2SwapBuffers(client, drawable->pDraw, 0, 0, 0, &unused,
-			__glXdriSwapEvent, drawable->pDraw) != Success)
+			__glXdriSwapEvent, drawable) != Success)
 	return FALSE;
 
     return TRUE;
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 7/8] DRI2: support generic swap events
  2011-05-03 17:59 [RFC] swap complete event handling fixes Jesse Barnes
                   ` (2 preceding siblings ...)
  2011-05-03 17:59 ` [PATCH 6/8] GLX/DRI2: pass drawable correctly for indirect " Jesse Barnes
@ 2011-05-03 17:59 ` Jesse Barnes
  2011-05-03 17:59 ` [PATCH 8/8] GLX: " Jesse Barnes
  4 siblings, 0 replies; 9+ messages in thread
From: Jesse Barnes @ 2011-05-03 17:59 UTC (permalink / raw)
  To: dri-devel, xorg-devel, mesa-dev

Send the new generic swap event type if the client supports it.  This
means checking the client's DRI2 proto version at connect time and then
constructing a new generic event at swap complete time.  To track the
client version, we need to add a new DRI2 client private type and track
it for the lifetime of the client.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
---
 configure.ac              |    2 +-
 glx/glxdri2.c             |   20 +++++++++++++++
 hw/xfree86/dri2/dri2.c    |   57 ++++++++++++++++++++++++++++++++++++++++++++-
 hw/xfree86/dri2/dri2.h    |    6 ++++
 hw/xfree86/dri2/dri2ext.c |   47 +++++++++++++++++++++++++++---------
 5 files changed, 118 insertions(+), 14 deletions(-)

diff --git a/configure.ac b/configure.ac
index 6eb780c..8e00fe7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -771,7 +771,7 @@ RECORDPROTO="recordproto >= 1.13.99.1"
 SCRNSAVERPROTO="scrnsaverproto >= 1.1"
 RESOURCEPROTO="resourceproto"
 DRIPROTO="xf86driproto >= 2.1.0"
-DRI2PROTO="dri2proto >= 2.3"
+DRI2PROTO="dri2proto >= 2.4"
 XINERAMAPROTO="xineramaproto"
 BIGFONTPROTO="xf86bigfontproto >= 1.2.0"
 DGAPROTO="xf86dgaproto >= 2.0.99.1"
diff --git a/glx/glxdri2.c b/glx/glxdri2.c
index 93c5e5b..a17b4d5 100644
--- a/glx/glxdri2.c
+++ b/glx/glxdri2.c
@@ -228,6 +228,23 @@ __glXDRIdrawableSwapBuffers(ClientPtr client, __GLXdrawable *drawable)
     return TRUE;
 }
 
+static void
+__glXDRIclientCallback(CallbackListPtr	*list,
+		   pointer		closure,
+		   pointer		data)
+{
+    NewClientInfoRec	*clientinfo = (NewClientInfoRec *) data;
+    ClientPtr		pClient = clientinfo->client;
+
+    switch (pClient->clientState) {
+    case ClientStateGone:
+	DRI2ClientGone(pClient);
+	break;
+    default:
+	break;
+    }
+}
+
 static int
 __glXDRIdrawableSwapInterval(__GLXdrawable *drawable, int interval)
 {
@@ -769,6 +786,9 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
     screen->leaveVT = pScrn->LeaveVT;
     pScrn->LeaveVT = glxDRILeaveVT;
 
+    if (!AddCallback (&ClientStateCallback, __glXDRIclientCallback, 0))
+	return NULL;
+
     LogMessage(X_INFO,
 	       "AIGLX: Loaded and initialized %s\n", driverName);
 
diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
index 5c42a51..9b5eab2 100644
--- a/hw/xfree86/dri2/dri2.c
+++ b/hw/xfree86/dri2/dri2.c
@@ -60,6 +60,9 @@ static DevPrivateKeyRec dri2WindowPrivateKeyRec;
 static DevPrivateKeyRec dri2PixmapPrivateKeyRec;
 #define dri2PixmapPrivateKey (&dri2PixmapPrivateKeyRec)
 
+static DevPrivateKeyRec dri2ClientPrivateKeyRec;
+#define dri2ClientPrivateKey (&dri2ClientPrivateKeyRec)
+
 static RESTYPE       dri2DrawableRes;
 
 typedef struct _DRI2Screen *DRI2ScreenPtr;
@@ -107,6 +110,11 @@ typedef struct _DRI2Screen {
     ConfigNotifyProcPtr		 ConfigNotify;
 } DRI2ScreenRec;
 
+typedef struct _DRI2Client {
+    CARD32 major;
+    CARD32 minor;
+} DRI2ClientRec, *DRI2ClientPtr;
+
 static DRI2ScreenPtr
 DRI2GetScreen(ScreenPtr pScreen)
 {
@@ -131,6 +139,12 @@ DRI2GetDrawable(DrawablePtr pDraw)
     }
 }
 
+static DRI2ClientPtr
+DRI2GetClient(ClientPtr client)
+{
+    return dixLookupPrivate(&client->devPrivates, dri2ClientPrivateKey);
+}
+
 static unsigned long
 DRI2DrawableSerial(DrawablePtr pDraw)
 {
@@ -190,6 +204,44 @@ DRI2AllocateDrawable(DrawablePtr pDraw)
     return pPriv;
 }
 
+void
+DRI2InitClient(ClientPtr client, CARD32 major, CARD32 minor)
+{
+    DRI2ClientPtr pPriv;
+
+    pPriv = malloc(sizeof *pPriv);
+    if (!pPriv)
+	return;
+
+    pPriv->major = major;
+    pPriv->minor = minor;
+
+    dixSetPrivate(&client->devPrivates, dri2ClientPrivateKey, pPriv);
+}
+
+void
+DRI2ClientGone(ClientPtr client)
+{
+    DRI2ClientPtr pPriv = DRI2GetClient(client);
+
+    if (pPriv)
+	free(pPriv);
+}
+
+Bool
+DRI2ClientSupportsSBC(ClientPtr client)
+{
+    DRI2ClientPtr pPriv = DRI2GetClient(client);
+
+    if (!pPriv)
+	return FALSE;
+
+    if (pPriv->major > 1 || (pPriv->major == 1 && pPriv->minor > 3))
+	return TRUE;
+
+    return FALSE;
+}
+
 typedef struct DRI2DrawableRefRec {
     XID		  id;
     XID		  dri2_id;
@@ -1097,6 +1149,9 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info)
     if (!dixRegisterPrivateKey(&dri2PixmapPrivateKeyRec, PRIVATE_PIXMAP, 0))
 	return FALSE;
 
+    if (!dixRegisterPrivateKey(&dri2ClientPrivateKeyRec, PRIVATE_CLIENT, 0))
+	return FALSE;
+
     ds = calloc(1, sizeof *ds);
     if (!ds)
 	return FALSE;
@@ -1114,7 +1169,7 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info)
 	ds->ScheduleSwap = info->ScheduleSwap;
 	ds->ScheduleWaitMSC = info->ScheduleWaitMSC;
 	ds->GetMSC = info->GetMSC;
-	cur_minor = 3;
+	cur_minor = 4;
     } else {
 	cur_minor = 1;
     }
diff --git a/hw/xfree86/dri2/dri2.h b/hw/xfree86/dri2/dri2.h
index fe0bf6c..97e8e86 100644
--- a/hw/xfree86/dri2/dri2.h
+++ b/hw/xfree86/dri2/dri2.h
@@ -192,6 +192,7 @@ typedef struct {
 }  DRI2InfoRec, *DRI2InfoPtr;
 
 extern _X_EXPORT int DRI2EventBase;
+extern _X_EXPORT int DRI2ExtCode;
 
 extern _X_EXPORT Bool DRI2ScreenInit(ScreenPtr	pScreen,
 		    DRI2InfoPtr info);
@@ -283,5 +284,10 @@ extern _X_EXPORT void DRI2SwapComplete(ClientPtr client, DrawablePtr pDraw,
 extern _X_EXPORT void DRI2WaitMSCComplete(ClientPtr client, DrawablePtr pDraw,
 					  int frame, unsigned int tv_sec,
 					  unsigned int tv_usec);
+extern _X_EXPORT Bool DRI2ClientSupportsSBC(ClientPtr client);
+extern _X_EXPORT void DRI2ClientGone(ClientPtr client);
+extern _X_EXPORT void DRI2InitClient(ClientPtr client, CARD32 major,
+				     CARD32 minor);
+
 
 #endif
diff --git a/hw/xfree86/dri2/dri2ext.c b/hw/xfree86/dri2/dri2ext.c
index 4e48e65..2dd65fb 100644
--- a/hw/xfree86/dri2/dri2ext.c
+++ b/hw/xfree86/dri2/dri2ext.c
@@ -77,6 +77,9 @@ ProcDRI2QueryVersion(ClientPtr client)
 	swaps(&stuff->length, n);
 
     REQUEST_SIZE_MATCH(xDRI2QueryVersionReq);
+
+    DRI2InitClient(client, stuff->majorVersion, stuff->minorVersion);
+
     rep.type = X_Reply;
     rep.length = 0;
     rep.sequenceNumber = client->sequence;
@@ -359,20 +362,38 @@ static void
 DRI2SwapEvent(ClientPtr client, void *data, int type, CARD64 ust, CARD64 msc,
 	      CARD64 sbc)
 {
-    xDRI2BufferSwapComplete event;
     DrawablePtr pDrawable = data;
 
-    event.type = DRI2EventBase + DRI2_BufferSwapComplete;
-    event.event_type = type;
-    event.drawable = pDrawable->id;
-    event.ust_hi = (CARD64)ust >> 32;
-    event.ust_lo = ust & 0xffffffff;
-    event.msc_hi = (CARD64)msc >> 32;
-    event.msc_lo = msc & 0xffffffff;
-    event.sbc_hi = (CARD64)sbc >> 32;
-    event.sbc_lo = sbc & 0xffffffff;
-
-    WriteEventsToClient(client, 1, (xEvent *)&event);
+    if (DRI2ClientSupportsSBC(client)) {
+	xDRI2BufferSwapComplete2 event;
+
+	event.type = GenericEvent;
+	event.extension = DRI2ExtCode;
+	event.evtype = DRI2_BufferSwapComplete;
+	event.swap_event_type = type;
+	event.drawable = pDrawable->id;
+	event.length = 8;
+	event.ust_hi = (CARD64)ust >> 32;
+	event.ust_lo = ust & 0xffffffff;
+	event.msc_hi = (CARD64)msc >> 32;
+	event.msc_lo = msc & 0xffffffff;
+	event.sbc_hi = (CARD64)sbc >> 32;
+	event.sbc_lo = sbc & 0xffffffff;
+	WriteEventsToClient(client, 1, (xEvent *)&event);
+    } else {
+	xDRI2BufferSwapComplete event;
+
+	event.type = DRI2EventBase + DRI2_BufferSwapComplete;
+	event.event_type = type;
+	event.drawable = pDrawable->id;
+	event.ust_hi = (CARD64)ust >> 32;
+	event.ust_lo = ust & 0xffffffff;
+	event.msc_hi = (CARD64)msc >> 32;
+	event.msc_lo = msc & 0xffffffff;
+	event.sbc_hi = 0;
+	event.sbc_lo = 0;
+	WriteEventsToClient(client, 1, (xEvent *)&event);
+    }
 }
 
 static int
@@ -624,6 +645,7 @@ SProcDRI2Dispatch (ClientPtr client)
 }
 
 int DRI2EventBase;
+int DRI2ExtCode;
 
 static void
 DRI2ExtensionInit(void)
@@ -637,6 +659,7 @@ DRI2ExtensionInit(void)
 				 StandardMinorOpcode);
 
     DRI2EventBase = dri2Extension->eventBase;
+    DRI2ExtCode = dri2Extension->base;
 }
 
 extern Bool noDRI2Extension;
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 8/8] GLX: support generic swap events
  2011-05-03 17:59 [RFC] swap complete event handling fixes Jesse Barnes
                   ` (3 preceding siblings ...)
  2011-05-03 17:59 ` [PATCH 7/8] DRI2: support generic " Jesse Barnes
@ 2011-05-03 17:59 ` Jesse Barnes
  4 siblings, 0 replies; 9+ messages in thread
From: Jesse Barnes @ 2011-05-03 17:59 UTC (permalink / raw)
  To: dri-devel, xorg-devel, mesa-dev

Send the new generic GLX swap event if supported by the client.  This
means checking the client GLX version at swap complete time and
constructing a new generic swap completion event at swap complete time.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
---
 configure.ac                |    2 +-
 glx/glxdri2.c               |   99 +++++++++++++++++++++++++++++++-----------
 glx/glxext.c                |    2 +
 glx/glxserver.h             |    1 +
 include/protocol-versions.h |    2 +-
 5 files changed, 78 insertions(+), 28 deletions(-)

diff --git a/configure.ac b/configure.ac
index 8e00fe7..87194a5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -775,7 +775,7 @@ DRI2PROTO="dri2proto >= 2.4"
 XINERAMAPROTO="xineramaproto"
 BIGFONTPROTO="xf86bigfontproto >= 1.2.0"
 DGAPROTO="xf86dgaproto >= 2.0.99.1"
-GLPROTO="glproto >= 1.4.10"
+GLPROTO="glproto >= 1.4.13"
 DMXPROTO="dmxproto >= 2.2.99.1"
 VIDMODEPROTO="xf86vidmodeproto >= 2.2.99.1"
 WINDOWSWMPROTO="windowswmproto"
diff --git a/glx/glxdri2.c b/glx/glxdri2.c
index a17b4d5..dc96f55 100644
--- a/glx/glxdri2.c
+++ b/glx/glxdri2.c
@@ -161,41 +161,88 @@ __glXDRIdrawableWaitGL(__GLXdrawable *drawable)
 		   DRI2BufferFrontLeft, DRI2BufferFakeFrontLeft);
 }
 
+static Bool
+__glXDRIclientSupportsSBC(ClientPtr client)
+{
+    __GLXclientState *cl = glxGetClient(client);
+
+    if (!cl)
+	return 0;
+
+    if (cl->GLClientmajorVersion > 1 ||
+	(cl->GLClientmajorVersion == 1 && cl->GLClientminorVersion > 4))
+	return TRUE;
+
+    return FALSE;
+}
+
 static void
 __glXdriSwapEvent(ClientPtr client, void *data, int type, CARD64 ust,
 		  CARD64 msc, CARD64 sbc)
 {
     __GLXdrawable *drawable = data;
-    xGLXBufferSwapComplete wire;
 
     if (!(drawable->eventMask & GLX_BUFFER_SWAP_COMPLETE_INTEL_MASK))
 	return;
 
-    wire.type = __glXEventBase + GLX_BufferSwapComplete;
-    switch (type) {
-    case DRI2_EXCHANGE_COMPLETE:
-	wire.event_type = GLX_EXCHANGE_COMPLETE_INTEL;
-	break;
-    case DRI2_BLIT_COMPLETE:
-	wire.event_type = GLX_BLIT_COMPLETE_INTEL;
-	break;
-    case DRI2_FLIP_COMPLETE:
-	wire.event_type = GLX_FLIP_COMPLETE_INTEL;
-	break;
-    default:
-	/* unknown swap completion type */
-	wire.event_type = 0;
-	break;
+    if (__glXDRIclientSupportsSBC(client)) {
+	xGLXBufferSwapComplete2 wire;
+
+	wire.type = GenericEvent;
+	wire.extension = __glXExtBase;
+	wire.evtype = GLX_BufferSwapComplete;
+	switch (type) {
+	case DRI2_EXCHANGE_COMPLETE:
+	    wire.swap_event_type = GLX_EXCHANGE_COMPLETE_INTEL;
+	    break;
+	case DRI2_BLIT_COMPLETE:
+	    wire.swap_event_type = GLX_BLIT_COMPLETE_INTEL;
+	    break;
+	case DRI2_FLIP_COMPLETE:
+	    wire.swap_event_type = GLX_FLIP_COMPLETE_INTEL;
+	    break;
+	default:
+	    /* unknown swap completion type */
+	    wire.swap_event_type = 0;
+	    break;
+	}
+	wire.drawable = drawable->drawId;
+	wire.length = 8;
+	wire.ust_hi = ust >> 32;
+	wire.ust_lo = ust & 0xffffffff;
+	wire.msc_hi = msc >> 32;
+	wire.msc_lo = msc & 0xffffffff;
+	wire.sbc_hi = sbc >> 32;
+	wire.sbc_lo = sbc & 0xffffffff;;
+	WriteEventsToClient(client, 1, (xEvent *) &wire);
+    } else {
+	xGLXBufferSwapComplete wire;
+
+	wire.type = __glXEventBase + GLX_BufferSwapComplete;
+	switch (type) {
+	case DRI2_EXCHANGE_COMPLETE:
+	    wire.event_type = GLX_EXCHANGE_COMPLETE_INTEL;
+	    break;
+	case DRI2_BLIT_COMPLETE:
+	    wire.event_type = GLX_BLIT_COMPLETE_INTEL;
+	    break;
+	case DRI2_FLIP_COMPLETE:
+	    wire.event_type = GLX_FLIP_COMPLETE_INTEL;
+	    break;
+	default:
+	    /* unknown swap completion type */
+	    wire.event_type = 0;
+	    break;
+	}
+	wire.drawable = drawable->drawId;
+	wire.ust_hi = ust >> 32;
+	wire.ust_lo = ust & 0xffffffff;
+	wire.msc_hi = msc >> 32;
+	wire.msc_lo = msc & 0xffffffff;
+	wire.sbc_hi = 0;
+	wire.sbc_lo = 0;
+	WriteEventsToClient(client, 1, (xEvent *) &wire);
     }
-    wire.drawable = drawable->drawId;
-    wire.ust_hi = ust >> 32;
-    wire.ust_lo = ust & 0xffffffff;
-    wire.msc_hi = msc >> 32;
-    wire.msc_lo = msc & 0xffffffff;
-    wire.sbc_hi = sbc >> 32;
-    wire.sbc_lo = sbc & 0xffffffff;
-
-    WriteEventsToClient(client, 1, (xEvent *) &wire);
 }
 
 /*
@@ -779,7 +826,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
      *    - GLX_ARB_multisample (1.4)
      */
     screen->base.GLXmajor = 1;
-    screen->base.GLXminor = 4;
+    screen->base.GLXminor = 5;
     
     screen->enterVT = pScrn->EnterVT;
     pScrn->EnterVT = glxDRIEnterVT; 
diff --git a/glx/glxext.c b/glx/glxext.c
index 9cfc096..01960a0 100644
--- a/glx/glxext.c
+++ b/glx/glxext.c
@@ -242,6 +242,7 @@ GLboolean __glXErrorOccured(void)
 
 static int __glXErrorBase;
 int __glXEventBase;
+int __glXExtBase;
 
 int __glXError(int error)
 {
@@ -365,6 +366,7 @@ void GlxExtensionInit(void)
 
     __glXErrorBase = extEntry->errorBase;
     __glXEventBase = extEntry->eventBase;
+    __glXExtBase = extEntry->base;
 }
 
 /************************************************************************/
diff --git a/glx/glxserver.h b/glx/glxserver.h
index 891315b..0b8539c 100644
--- a/glx/glxserver.h
+++ b/glx/glxserver.h
@@ -233,5 +233,6 @@ extern unsigned glxMajorVersion;
 extern unsigned glxMinorVersion;
 
 extern int __glXEventBase;
+extern int __glXExtBase;
 
 #endif /* !__GLX_server_h__ */
diff --git a/include/protocol-versions.h b/include/protocol-versions.h
index 8692ded..8fde917 100644
--- a/include/protocol-versions.h
+++ b/include/protocol-versions.h
@@ -57,7 +57,7 @@
 
 /* GLX */
 #define SERVER_GLX_MAJOR_VERSION		1
-#define SERVER_GLX_MINOR_VERSION		4
+#define SERVER_GLX_MINOR_VERSION		5
 
 /* Xinerama */
 #define SERVER_PANORAMIX_MAJOR_VERSION          1
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2011-05-03 18:02 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-03 17:59 [RFC] swap complete event handling fixes Jesse Barnes
     [not found] ` <1304445561-9910-1-git-send-email-jbarnes-Y1mF5jBUw70BENJcbMCuUQ@public.gmane.org>
2011-05-03 17:59   ` [PATCH] DRI2: fix swap complete event size by using a generic event Jesse Barnes
2011-05-03 17:59   ` [PATCH] GLX: fix broken swap " Jesse Barnes
2011-05-03 17:59   ` [PATCH 3/5] GLX: don't crash when indirect clients try to set an event mask Jesse Barnes
2011-05-03 17:59   ` [PATCH 4/5] DRI2: support generic swap event handling Jesse Barnes
2011-05-03 17:59 ` [PATCH 5/5] GLX: support generic swap events Jesse Barnes
2011-05-03 17:59 ` [PATCH 6/8] GLX/DRI2: pass drawable correctly for indirect " Jesse Barnes
2011-05-03 17:59 ` [PATCH 7/8] DRI2: support generic " Jesse Barnes
2011-05-03 17:59 ` [PATCH 8/8] GLX: " Jesse Barnes

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.