diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2011-07-11 10:50:36 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2011-07-11 22:13:01 +0100 |
commit | 7538be3315b8683b05e8f6b22023baadcc0bc4da (patch) | |
tree | 5c7137fa88bfe15d852c981fcc234515d8eca193 /src/intel.h | |
parent | 2608a367acba7247e50754c3daeed09ba2e97d05 (diff) |
dri: Enable triple-bufferred pageflips
By popular demand.
Triple-buffering trade-offs output latency versus jitter. By having a
pre-rendered frame ready to swap in following a pageflip, we avoid the
scenario where the latency between receiving the flip complete signal
from the kernel, waking up the vsynced application, it render the new
frame and then for the server to process the swap request is greater
than the frame interval, causing us to miss the vblank. The result is
that application can become frame-locked to 30fps. Instead, we report to
the application that the first frame swap is immediately completed,
supply a new back buffer (or else the rendering would be blocked on
waiting for the front-buffer to be swapped away from the scanout) and
let them proceed to render the second frame. The second frame is added
to the swap queue, and the client throttled to vrefresh. (If the client
missed the vblank, the swap queue is empty and the client is immediately
woken again, whilst the pageflip is pending.)
Note, for practical reasons this only applies to page-flipping, for
example, calls to glXSwapBuffer() on fullscreen applications.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/intel.h')
-rw-r--r-- | src/intel.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/intel.h b/src/intel.h index 9d64d30f..6135349f 100644 --- a/src/intel.h +++ b/src/intel.h @@ -260,7 +260,7 @@ typedef struct intel_screen_private { unsigned int current_batch; void *modes; - drm_intel_bo *front_buffer; + drm_intel_bo *front_buffer, *back_buffer; long front_pitch, front_tiling; void *shadow_buffer; int shadow_stride; @@ -423,12 +423,15 @@ typedef struct intel_screen_private { char *deviceName; Bool use_pageflipping; + Bool use_triple_buffer; Bool force_fallback; Bool can_blt; Bool has_kernel_flush; Bool needs_flush; Bool use_shadow; + struct _DRI2FrameEvent *pending_flip[2]; + /* Broken-out options. */ OptionInfoPtr Options; @@ -465,6 +468,7 @@ extern int intel_output_dpms_status(xf86OutputPtr output); enum DRI2FrameEventType { DRI2_SWAP, + DRI2_SWAP_CHAIN, DRI2_FLIP, DRI2_WAITMSC, }; @@ -475,10 +479,13 @@ typedef void (*DRI2SwapEventPtr)(ClientPtr client, void *data, int type, #endif typedef struct _DRI2FrameEvent { + struct intel_screen_private *intel; + XID drawable_id; ClientPtr client; enum DRI2FrameEventType type; int frame; + int pipe; struct list drawable_resource, client_resource; @@ -487,6 +494,8 @@ typedef struct _DRI2FrameEvent { void *event_data; DRI2BufferPtr front; DRI2BufferPtr back; + + struct _DRI2FrameEvent *chain; } DRI2FrameEventRec, *DRI2FrameEventPtr; extern Bool intel_do_pageflip(intel_screen_private *intel, |