From 0e67ba7d6348a990ee1b23c5ddfd46fec7112613 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Mon, 2 Mar 2015 09:58:34 +0000 Subject: Add DRI2SwapBuffersWithDamage Signed-off-by: Chris Wilson Reviewed-by: Martin Peres --- dri2proto.h | 19 ++++++++++++++++++- dri2proto.txt | 50 +++++++++++++++++++++++++++++++++++++++----------- 2 files changed, 57 insertions(+), 12 deletions(-) diff --git a/dri2proto.h b/dri2proto.h index 086dc96..c150dc2 100644 --- a/dri2proto.h +++ b/dri2proto.h @@ -35,7 +35,7 @@ #define DRI2_NAME "DRI2" #define DRI2_MAJOR 1 -#define DRI2_MINOR 4 +#define DRI2_MINOR 5 #define DRI2NumberErrors 0 #define DRI2NumberEvents 2 @@ -55,6 +55,7 @@ #define X_DRI2WaitSBC 11 #define X_DRI2SwapInterval 12 #define X_DRI2GetParam 13 +#define X_DRI2SwapBuffersWithDamage 14 /* * Events @@ -217,6 +218,22 @@ typedef struct { } xDRI2SwapBuffersReq; #define sz_xDRI2SwapBuffersReq 32 +typedef struct { + CARD8 reqType; + CARD8 dri2ReqType; + CARD16 length B16; + CARD32 drawable B32; + CARD32 valid B32; + CARD32 update B32; + CARD32 target_msc_hi B32; + CARD32 target_msc_lo B32; + CARD32 divisor_hi B32; + CARD32 divisor_lo B32; + CARD32 remainder_hi B32; + CARD32 remainder_lo B32; +} xDRI2SwapBuffersWithDamageReq; +#define sz_xDRI2SwapBuffersWithDamageReq 32 + typedef struct { BYTE type; /* X_Reply */ BYTE pad1; diff --git a/dri2proto.txt b/dri2proto.txt index 9daa58e..21a69df 100644 --- a/dri2proto.txt +++ b/dri2proto.txt @@ -106,10 +106,13 @@ DRI2 implementation of direct rendering GLX, should use these enty points to copy contents back and forth to as necessary to ensure consistent rendering. -The client may also use the DRI2SwapBuffers function to request a swap -of the front and back buffers. If the display server supports it, this -operation may be preferred, since it may be easier and/or more performant -for the server to perform a simple buffer swap rather than a blit. +The client may also use the DRI2SwapBuffers or DRI2SwapBuffersWithDamage +function to request a swap of the front and back buffers. If the display +server supports it, this operation may be preferred, since it may be +easier and/or more performant for the server to perform a simple buffer +swap rather than a blit. The DRI2SwapBuffersWithDamage allows the client +to use an incomplete back buffer or to restrict the region that will be +treated as damaged upon swapping. 2.6 Synchronizing rendering @@ -118,16 +121,17 @@ The protocol for these methods is based on the SGI_video_sync and OML_sync_control GLX extensions. Using the DRI2WaitMSC request, a client can wait for a specific frame count or divisor/remainder before continuing its processing. With the DRI2WaitSBC request, clients can block until a given -swap count is reached (as incremented by DRI2SwapBuffers). Finally, using -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. +swap count is reached (as incremented by DRI2SwapBuffers and +DRI2SwapBuffersWithDamage). Finally, using 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 an 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. +DRI2 provides an event to indicate when a DRI2SwapBuffers or +DRI2SwapBuffersWithDamage request has been completed. This can be used to +throttle drawing on the client side and tie into application main loops. Another event is generated when the validity of the requested buffers changes. @@ -792,6 +796,30 @@ A.2 Protocol Requests 5n LISTofDRI2BUFFER buffers └─── +┌─── + DRI2SwapBuffersWithDamage + 1 CARD8 major opcode + 1 8 DRI2 opcode + 2 8 length + 4 DRAWABLE drawable + 4 CARD32 valid + 4 CARD32 update + 4 CARD32 target_msc_hi + 4 CARD32 target_msc_lo + 4 CARD32 divisor_hi + 4 CARD32 divisor_lo + 4 CARD32 remainder_hi + 4 CARD32 remainder_lo + ▶ + 1 1 Reply + 1 unused + 2 CARD16 sequence number + 4 0 reply length + 4 CARD32 swap_hi + 4 CARD32 swap_lo + 5n LISTofDRI2BUFFER buffers +└─── + ┌─── DRI2GetMSC 1 CARD8 major opcode -- cgit v1.2.3