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_driver.c | |
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_driver.c')
-rw-r--r-- | src/intel_driver.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/intel_driver.c b/src/intel_driver.c index 3efc7f40..7fc1c1a3 100644 --- a/src/intel_driver.c +++ b/src/intel_driver.c @@ -91,6 +91,7 @@ typedef enum { OPTION_TILING_2D, OPTION_SHADOW, OPTION_SWAPBUFFERS_WAIT, + OPTION_TRIPLE_BUFFER, #ifdef INTEL_XVMC OPTION_XVMC, #endif @@ -111,6 +112,7 @@ static OptionInfoRec I830Options[] = { {OPTION_TILING_FB, "LinearFramebuffer", OPTV_BOOLEAN, {0}, FALSE}, {OPTION_SHADOW, "Shadow", OPTV_BOOLEAN, {0}, FALSE}, {OPTION_SWAPBUFFERS_WAIT, "SwapbuffersWait", OPTV_BOOLEAN, {0}, TRUE}, + {OPTION_TRIPLE_BUFFER, "TripleBuffer", OPTV_BOOLEAN, {0}, TRUE}, #ifdef INTEL_XVMC {OPTION_XVMC, "XvMC", OPTV_BOOLEAN, {0}, TRUE}, #endif @@ -656,6 +658,15 @@ static Bool I830PreInit(ScrnInfoPtr scrn, int flags) intel->swapbuffers_wait = xf86ReturnOptValBool(intel->Options, OPTION_SWAPBUFFERS_WAIT, TRUE); + xf86DrvMsg(scrn->scrnIndex, X_CONFIG, "Wait on SwapBuffers? %s\n", + intel->swapbuffers_wait ? "enabled" : "disabled"); + + intel->use_triple_buffer = + xf86ReturnOptValBool(intel->Options, + OPTION_TRIPLE_BUFFER, + TRUE); + xf86DrvMsg(scrn->scrnIndex, X_CONFIG, "Triple buffering? %s\n", + intel->use_triple_buffer ? "enabled" : "disabled"); xf86DrvMsg(scrn->scrnIndex, X_CONFIG, "Framebuffer %s\n", intel->tiling & INTEL_TILING_FB ? "tiled" : "linear"); @@ -1177,6 +1188,11 @@ static Bool I830CloseScreen(int scrnIndex, ScreenPtr screen) intel->uxa_driver = NULL; } + if (intel->back_buffer) { + drm_intel_bo_unreference(intel->back_buffer); + intel->back_buffer = NULL; + } + if (intel->front_buffer) { if (!intel->use_shadow) intel_set_pixmap_bo(screen->GetScreenPixmap(screen), |