Add option to control swapbuffers behavior

Until we get triple buffering, we'll want this so users can avoid taking a
performance hit on apps that render slower than the refresh rate.

Fixes fdo bug #22234.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
This commit is contained in:
Jesse Barnes 2009-06-23 15:05:03 -07:00
parent bfeeac6de0
commit 1eec83a203
3 changed files with 26 additions and 0 deletions

View File

@ -92,6 +92,16 @@ performance.
.IP
Default: enabled.
.TP
.BI "Option \*qSwapbuffersWait\*q \*q" boolean \*q
This option controls the behavior of glXSwapBuffers and glXCopySubBufferMESA
calls by GL applications. If enabled, the calls will avoid tearing by making
sure the display scanline is outside of the area to be copied before the copy
occurs. If disabled, no scanline synchronization is performed, meaning tearing
will likely occur. Note that when enabled, this option can adversely affect
the framerate of applications that render frames at less than refresh rate.
.IP
Default: enabled.
.TP
.BI "Option \*qDRI\*q \*q" boolean \*q
Disable or enable DRI support.
.IP

View File

@ -414,6 +414,7 @@ typedef struct _I830Rec {
Bool tiling;
Bool fb_compression;
Bool swapbuffers_wait;
Bool CursorNeedsPhysical;

View File

@ -171,6 +171,7 @@ typedef enum {
OPTION_LVDS24BITMODE,
OPTION_FBC,
OPTION_TILING,
OPTION_SWAPBUFFERS_WAIT,
OPTION_LVDSFIXEDMODE,
OPTION_FORCEENABLEPIPEA,
#ifdef INTEL_XVMC
@ -189,6 +190,7 @@ static OptionInfoRec I830Options[] = {
{OPTION_LVDS24BITMODE, "LVDS24Bit", OPTV_BOOLEAN, {0}, FALSE},
{OPTION_FBC, "FramebufferCompression", OPTV_BOOLEAN, {0}, TRUE},
{OPTION_TILING, "Tiling", OPTV_BOOLEAN, {0}, TRUE},
{OPTION_SWAPBUFFERS_WAIT, "SwapbuffersWait", OPTV_BOOLEAN, {0}, TRUE},
{OPTION_LVDSFIXEDMODE, "LVDSFixedMode", OPTV_BOOLEAN, {0}, FALSE},
{OPTION_FORCEENABLEPIPEA, "ForceEnablePipeA", OPTV_BOOLEAN, {0}, FALSE},
#ifdef INTEL_XVMC
@ -2663,10 +2665,23 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
pI830->fb_compression = FALSE;
}
/* SwapBuffers delays to avoid tearing */
pI830->swapbuffers_wait = TRUE;
/* Allow user override if they set a value */
if (xf86IsOptionSet(pI830->Options, OPTION_SWAPBUFFERS_WAIT)) {
if (xf86ReturnOptValBool(pI830->Options, OPTION_SWAPBUFFERS_WAIT, FALSE))
pI830->swapbuffers_wait = TRUE;
else
pI830->swapbuffers_wait = FALSE;
}
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Framebuffer compression %sabled\n",
pI830->fb_compression ? "en" : "dis");
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Tiling %sabled\n", pI830->tiling ?
"en" : "dis");
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "SwapBuffers wait %sabled\n",
pI830->swapbuffers_wait ? "en" : "dis");
pI830->last_3d = LAST_3D_OTHER;
pI830->overlayOn = FALSE;