render: Enable animated cursor block handler only when needed
Calling BlockHandlers takes some time for each iteration in main loop which adds up quickly over multiple request. To reduce the round-trip costs to xserver BlockHandlers should be registered only when required. AnimCurScreenBlockHandler is the first victim for this optimization. Signed-off-by: Pauli Nieminen <ext-pauli.nieminen@nokia.com> Reviewed-by: Daniel Stone <daniel@fooishbar.org>
This commit is contained in:
parent
aa8cea953d
commit
6d0e9e5d6e
|
@ -96,8 +96,6 @@ AnimCurCloseScreen (int index, ScreenPtr pScreen)
|
||||||
|
|
||||||
Unwrap(as, pScreen, CloseScreen);
|
Unwrap(as, pScreen, CloseScreen);
|
||||||
|
|
||||||
Unwrap(as, pScreen, BlockHandler);
|
|
||||||
|
|
||||||
Unwrap(as, pScreen, CursorLimits);
|
Unwrap(as, pScreen, CursorLimits);
|
||||||
Unwrap(as, pScreen, DisplayCursor);
|
Unwrap(as, pScreen, DisplayCursor);
|
||||||
Unwrap(as, pScreen, SetCursorPosition);
|
Unwrap(as, pScreen, SetCursorPosition);
|
||||||
|
@ -196,7 +194,10 @@ AnimCurScreenBlockHandler (int screenNum,
|
||||||
|
|
||||||
Unwrap (as, pScreen, BlockHandler);
|
Unwrap (as, pScreen, BlockHandler);
|
||||||
(*pScreen->BlockHandler) (screenNum, blockData, pTimeout, pReadmask);
|
(*pScreen->BlockHandler) (screenNum, blockData, pTimeout, pReadmask);
|
||||||
Wrap (as, pScreen, BlockHandler, AnimCurScreenBlockHandler);
|
if (activeDevice)
|
||||||
|
Wrap (as, pScreen, BlockHandler, AnimCurScreenBlockHandler);
|
||||||
|
else
|
||||||
|
as->BlockHandler = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Bool
|
static Bool
|
||||||
|
@ -222,6 +223,9 @@ AnimCurDisplayCursor (DeviceIntPtr pDev,
|
||||||
pDev->spriteInfo->anim.time = GetTimeInMillis () + ac->elts[0].delay;
|
pDev->spriteInfo->anim.time = GetTimeInMillis () + ac->elts[0].delay;
|
||||||
pDev->spriteInfo->anim.pCursor = pCursor;
|
pDev->spriteInfo->anim.pCursor = pCursor;
|
||||||
pDev->spriteInfo->anim.pScreen = pScreen;
|
pDev->spriteInfo->anim.pScreen = pScreen;
|
||||||
|
|
||||||
|
if (!as->BlockHandler)
|
||||||
|
Wrap(as, pScreen, BlockHandler, AnimCurScreenBlockHandler);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -248,8 +252,12 @@ AnimCurSetCursorPosition (DeviceIntPtr pDev,
|
||||||
Bool ret;
|
Bool ret;
|
||||||
|
|
||||||
Unwrap (as, pScreen, SetCursorPosition);
|
Unwrap (as, pScreen, SetCursorPosition);
|
||||||
if (pDev->spriteInfo->anim.pCursor)
|
if (pDev->spriteInfo->anim.pCursor) {
|
||||||
pDev->spriteInfo->anim.pScreen = pScreen;
|
pDev->spriteInfo->anim.pScreen = pScreen;
|
||||||
|
|
||||||
|
if (!as->BlockHandler)
|
||||||
|
Wrap(as, pScreen, BlockHandler, AnimCurScreenBlockHandler);
|
||||||
|
}
|
||||||
ret = (*pScreen->SetCursorPosition) (pDev, pScreen, x, y, generateEvent);
|
ret = (*pScreen->SetCursorPosition) (pDev, pScreen, x, y, generateEvent);
|
||||||
Wrap (as, pScreen, SetCursorPosition, AnimCurSetCursorPosition);
|
Wrap (as, pScreen, SetCursorPosition, AnimCurSetCursorPosition);
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -334,7 +342,7 @@ AnimCurInit (ScreenPtr pScreen)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
Wrap(as, pScreen, CloseScreen, AnimCurCloseScreen);
|
Wrap(as, pScreen, CloseScreen, AnimCurCloseScreen);
|
||||||
|
|
||||||
Wrap(as, pScreen, BlockHandler, AnimCurScreenBlockHandler);
|
as->BlockHandler = NULL;
|
||||||
|
|
||||||
Wrap(as, pScreen, CursorLimits, AnimCurCursorLimits);
|
Wrap(as, pScreen, CursorLimits, AnimCurCursorLimits);
|
||||||
Wrap(as, pScreen, DisplayCursor, AnimCurDisplayCursor);
|
Wrap(as, pScreen, DisplayCursor, AnimCurDisplayCursor);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user