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: Pauli Nieminen <ext-pauli.nieminen@nokia.com> Reviewed-by: Daniel Stone <daniel@fooishbar.org>
This commit is contained in:
parent
bf48082f30
commit
4f6e3b0f37
|
@ -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 &&
|
||||
|
|
Loading…
Reference in New Issue