[PATCH 8/8] GLX: support generic swap events
Jesse Barnes
jbarnes at virtuousgeek.org
Tue May 3 10:59:21 PDT 2011
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 at 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
More information about the xorg-devel
mailing list