Commit 4f6e3b0f authored by Pauli Nieminen's avatar Pauli Nieminen Committed by Daniel Stone
Browse files

mi: Register sprite damage handler only when required



There is no need to have damage handler registered when there isn't any
pointer in the screen. This avoids some overhead from damage handling
which takes tens of microseconds on arm.
Signed-off-by: default avatarPauli Nieminen <ext-pauli.nieminen@nokia.com>
Reviewed-by: Daniel Stone's avatarDaniel Stone <daniel@fooishbar.org>
parent bf48082f
......@@ -96,6 +96,7 @@ typedef struct {
VisualPtr pVisual;
DamagePtr pDamage; /* damage tracking structure */
Bool damageRegistered;
int numberOfCursors;
} miSpriteScreenRec, *miSpriteScreenPtr;
#define SOURCE_COLOR 0
......@@ -345,6 +346,7 @@ miSpriteInitialize (ScreenPtr pScreen,
pScreenPriv->colors[MASK_COLOR].green = 0;
pScreenPriv->colors[MASK_COLOR].blue = 0;
pScreenPriv->damageRegistered = 0;
pScreenPriv->numberOfCursors = 0;
dixSetPrivate(&pScreen->devPrivates, miSpriteScreenKey, pScreenPriv);
......@@ -772,21 +774,29 @@ static void
miSpriteSetCursor (DeviceIntPtr pDev, ScreenPtr pScreen,
CursorPtr pCursor, int x, int y)
{
miCursorInfoPtr pPointer;
miCursorInfoPtr pPointer;
miSpriteScreenPtr pScreenPriv;
if (!IsMaster(pDev) && !pDev->u.master)
return;
pPointer = MISPRITE(pDev);
pScreenPriv = GetSpriteScreen(pScreen);
if (!pCursor)
{
if (pPointer->shouldBeUp)
--pScreenPriv->numberOfCursors;
pPointer->shouldBeUp = FALSE;
if (pPointer->isUp)
miSpriteRemoveCursor (pDev, pScreen);
if (pScreenPriv->numberOfCursors == 0)
miSpriteDisableDamage(pScreen, pScreenPriv);
pPointer->pCursor = 0;
return;
}
if (!pPointer->shouldBeUp)
pScreenPriv->numberOfCursors++;
pPointer->shouldBeUp = TRUE;
if (pPointer->x == x &&
pPointer->y == y &&
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment