mesa: misc GLX_INTEL_swap_event fixes
authorRobert Bragg <robert@linux.intel.com>
Wed, 20 Jan 2010 03:01:14 +0000 (03:01 +0000)
committerJesse Barnes <jbarnes@virtuousgeek.org>
Mon, 25 Jan 2010 23:40:56 +0000 (15:40 -0800)
Fixup a few issues found through testing:
  - update GLX names to match glproto
  - register DRI2WireToEvent so it actually gets called

Signed-off-by: Robert Bragg <robert@linux.intel.com>
include/GL/glx.h
include/GL/glxext.h
src/glx/x11/dri2.c
src/glx/x11/glxclient.h
src/glx/x11/glxext.c

index 82b0f2211465190f64fc657da8fb107772348fbc..fd53964ea06b0123bc27f8810c4bc6044b0bee6e 100644 (file)
@@ -518,8 +518,12 @@ typedef struct {
 } GLXPbufferClobberEvent;
 
 typedef struct {
+    int type;
+    unsigned long serial;      /* # of last request processed by server */
+    Bool send_event;           /* true if this came from a SendEvent request */
+    Display *display;          /* Display the event was read from */
+    GLXDrawable drawable;      /* drawable on which event was requested in event mask */
     int event_type;
-    GLXDrawable drawable;
     int64_t ust;
     int64_t msc;
     int64_t sbc;
index 36ee3665dfde8ec17e468733cae3bbdf6f88e25f..50740dd29db7b40951d6adda25dc08f77b318bec 100644 (file)
@@ -698,10 +698,10 @@ typedef void ( * PFNGLXJOINSWAPGROUPSGIXPROC) (Display *dpy, GLXDrawable drawabl
 
 #ifndef GLX_INTEL_swap_event
 #define GLX_INTEL_swap_event
-#define GLX_BUFFER_SWAP_COMPLETE_MASK      0x10000000
-#define GLX_EXCHANGE_COMPLETE              0x8024
-#define GLX_BLIT_COMPLETE                  0x8025
-#define GLX_FLIP_COMPLETE                  0x8026
+#define GLX_BUFFER_SWAP_COMPLETE_INTEL_MASK 0x10000000
+#define GLX_EXCHANGE_COMPLETE_INTEL        0x8024
+#define GLX_BLIT_COMPLETE_INTEL                    0x8025
+#define GLX_FLIP_COMPLETE_INTEL                    0x8026
 #endif
 
 #ifndef GLX_SGIX_swap_barrier
index 2cb5d3463afd92d220d8dfa10e79bb76a05b64bc..832935a3ba0a8691a5695d9b6e3d62396f75e682 100644 (file)
@@ -81,12 +81,15 @@ static XEXT_GENERATE_FIND_DISPLAY (DRI2FindDisplay,
                                    dri2Info,
                                    dri2ExtensionName,
                                    &dri2ExtensionHooks,
-                                   0, NULL)
+                                   1, NULL)
 
 static Bool
 DRI2WireToEvent(Display *dpy, XEvent *event, xEvent *wire)
 {
    XExtDisplayInfo *info = DRI2FindDisplay(dpy);
+   XExtDisplayInfo *glx_info = __glXFindDisplay(dpy);
+   static int glx_event_base;
+   static Bool found_glx_info = False;
 
    XextCheckExtension(dpy, info, dri2ExtensionName, False);
 
@@ -95,21 +98,26 @@ DRI2WireToEvent(Display *dpy, XEvent *event, xEvent *wire)
    {
       GLXBufferSwapComplete *aevent = (GLXBufferSwapComplete *)event;
       xDRI2BufferSwapComplete *awire = (xDRI2BufferSwapComplete *)wire;
-      switch (awire->type) {
+      aevent->serial = _XSetLastRequestRead(dpy, (xGenericReply *) wire);
+      aevent->type =
+         (glx_info->codes->first_event + GLX_BufferSwapComplete) & 0x75;
+      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;
+        aevent->event_type = GLX_EXCHANGE_COMPLETE_INTEL;
         break;
       case DRI2_BLIT_COMPLETE:
-        aevent->event_type = GLX_BLIT_COMPLETE;
+        aevent->event_type = GLX_BLIT_COMPLETE_INTEL;
         break;
       case DRI2_FLIP_COMPLETE:
-        aevent->event_type = GLX_FLIP_COMPLETE;
+        aevent->event_type = GLX_FLIP_COMPLETE_INTEL;
         break;
       default:
         /* unknown swap completion type */
         return False;
       }
-      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;
index ded4f5a434a189dc650e83d38f4c754ff490470f..e0b286b68838e99bafac9c1705964e3180caa40f 100644 (file)
@@ -41,6 +41,7 @@
 #define NEED_EVENTS
 #include <X11/Xproto.h>
 #include <X11/Xlibint.h>
+#include <X11/extensions/extutil.h>
 #define GLX_GLXEXT_PROTOTYPES
 #include <GL/glx.h>
 #include <GL/glxext.h>
@@ -793,6 +794,10 @@ extern GLboolean __glXGetMscRateOML(Display * dpy, GLXDrawable drawable,
 GLboolean
 __driGetMscRateOML(__DRIdrawable * draw,
                    int32_t * numerator, int32_t * denominator, void *private);
+
+/* So that dri2.c:DRI2WireToEvent() can access
+ * glx_info->codes->first_event */
+XExtDisplayInfo *__glXFindDisplay (Display *dpy);
 #endif
 
 #endif /* !__GLX_client_h__ */
index fe65216c41154df3e3032228ab29d7199c8df199..09bb85031963236098953b0e896ff5e3eaff8bc8 100644 (file)
@@ -120,7 +120,6 @@ static /* const */ XExtensionHooks __glXExtensionHooks = {
   __glXErrorString,       /* error_string */
 };
 
-static
 XEXT_GENERATE_FIND_DISPLAY(__glXFindDisplay, __glXExtensionInfo,
                            __glXExtensionName, &__glXExtensionHooks,
                            __GLX_NUMBER_EVENTS, NULL)
@@ -194,11 +193,11 @@ __glXEventToWire(Display *dpy, XEvent *event, xEvent *wire)
       break;
    case GLX_SAVED:
       break;
-   case GLX_EXCHANGE_COMPLETE:
+   case GLX_EXCHANGE_COMPLETE_INTEL:
       break;
-   case GLX_BLIT_COMPLETE:
+   case GLX_BLIT_COMPLETE_INTEL:
       break;
-   case GLX_FLIP_COMPLETE:
+   case GLX_FLIP_COMPLETE_INTEL:
       break;
    default:
       /* client doesn't support server event */