From 7c7e9bbf4ab6177e9623f3c4d667ed83789167b4 Mon Sep 17 00:00:00 2001 From: Jesse Barnes Date: Thu, 12 Nov 2009 15:26:40 +0000 Subject: Add DRI2 event support for DRI2BufferSwapComplete --- dri2proto.h | 24 ++++++++++++++++++++++-- dri2proto.txt | 54 ++++++++++++++++++++++++++++++++++++++++++++++-------- dri2tokens.h | 5 +++++ 3 files changed, 73 insertions(+), 10 deletions(-) diff --git a/dri2proto.h b/dri2proto.h index 377bdb9..43152c2 100644 --- a/dri2proto.h +++ b/dri2proto.h @@ -38,8 +38,8 @@ #define DRI2_MINOR 2 #define DRI2NumberErrors 0 -#define DRI2NumberEvents 0 -#define DRI2NumberRequests 8 +#define DRI2NumberEvents 1 +#define DRI2NumberRequests 13 #define X_DRI2QueryVersion 0 #define X_DRI2Connect 1 @@ -55,6 +55,11 @@ #define X_DRI2WaitSBC 11 #define X_DRI2SwapInterval 12 +/* + * Events + */ +#define DRI2_BufferSwapComplete 0 + typedef struct { CARD32 attachment B32; CARD32 name B32; @@ -279,4 +284,19 @@ typedef struct { } xDRI2SwapIntervalReq; #define sz_xDRI2SwapIntervalReq 12 +typedef struct { + CARD8 type; + CARD8 pad; + CARD16 sequenceNumber B16; + CARD16 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; +} xDRI2BufferSwapComplete; +#define sz_xDRI2BufferSwapComplete 32 + #endif diff --git a/dri2proto.txt b/dri2proto.txt index 71fc0ca..0b382ff 100644 --- a/dri2proto.txt +++ b/dri2proto.txt @@ -123,6 +123,12 @@ DRI2SwapBuffers, clients can limit their frame rate by specifying a swap interval using the swap interval call (currently only available through GLX) or by using the OML swap buffers routine. +2.7 Events + +DRI2 provides a single event to indicate when a DRI2SwapBuffers request has +been completed. This can be used to throttle drawing on the client side and +tie into application main loops. + ⚙ ⚙ ⚙ ⚙ ⚙ ⚙ @@ -142,8 +148,15 @@ No errrors defined by the DRI2 extension. ⚙ ⚙ ⚙ ⚙ ⚙ ⚙ +5. Events + +The only event provided by DRI2 is DRI2_BufferSwapComplete. + + + ⚙ ⚙ ⚙ ⚙ ⚙ ⚙ + -5. Protocol Types +6. Protocol Types DRI2DRIVER { DRI2DriverDRI } @@ -187,7 +200,7 @@ DRI2ATTACH_FORMAT { attachment: CARD32 ⚙ ⚙ ⚙ ⚙ ⚙ ⚙ -6. Extension Initialization +7. Extension Initialization The name of this extension is "DRI2". @@ -218,7 +231,7 @@ The name of this extension is "DRI2". ⚙ ⚙ ⚙ ⚙ ⚙ ⚙ -7. Extension Requests +8. Extension Requests ┌─── DRI2Connect @@ -427,8 +440,27 @@ The name of this extension is "DRI2". ⚙ ⚙ ⚙ ⚙ ⚙ ⚙ +9. Extension Requests + +┌─── + DRI2BufferSwapComplete + ▶ + event_type: CARD16 + drawable: CARD32 + ust: CARD64 + msc: CARD64 + sbc: CARD64 +└─── + + This event reports the status of the last DRI2SwapBuffers event to + the client. The event type should be one of DRI2_EXCHANGE_COMPLETE, + indicating a successful buffer exchange, DRI2_BLIT_COMPLETE, indicating + the swap was performed with a blit, and DRI2_FLIP_COMPLETE, indicating + a full page flip was completed. -8. Extension Versioning + ⚙ ⚙ ⚙ ⚙ ⚙ ⚙ + +10. Extension Versioning The DRI2 extension has undergone a number of revisions before @@ -452,30 +484,36 @@ The DRI2 extension has undergone a number of revisions before 2.0: Awesomeness! + 2.1: True excellence. Added DRI2GetBuffersWithFormat to allow + more flexible object creation. + + 2.2: Approaching perfection. Added requests for swapbuffers, + MSC and SBC related requests, and events. + Compatibility up to 2.0 is not preserved, but was also never released. ⚙ ⚙ ⚙ ⚙ ⚙ ⚙ -10. Relationship with other extensions +11. Relationship with other extensions As an extension designed to support other extensions, there is naturally some interactions with other extensions. -10.1 GLX +11.1 GLX The GL auxilary buffers map directly to the DRI2 buffers... eh -10.2 DBE +11.2 DBE The DBE back buffer must correspond to the DRI2_BUFFER_FRONT_LEFT DRI2 buffer for servers that support both DBE and DRI2. -10.3 XvMC / Xv +11.3 XvMC / Xv We might add a DRI2_BUFFER_YUV to do vsynced colorspace conversion blits. Maybe... not really sure. diff --git a/dri2tokens.h b/dri2tokens.h index d56e4fb..a20462a 100644 --- a/dri2tokens.h +++ b/dri2tokens.h @@ -46,4 +46,9 @@ #define DRI2DriverDRI 0 +/* Event sub-types for the swap complete event */ +#define DRI2_EXCHANGE_COMPLETE 0x1 +#define DRI2_BLIT_COMPLETE 0x2 +#define DRI2_FLIP_COMPLETE 0x3 + #endif -- cgit v1.2.1