diff options
Diffstat (limited to 'xorg-server/miext/shadow')
-rw-r--r-- | xorg-server/miext/shadow/shadow.c | 92 | ||||
-rw-r--r-- | xorg-server/miext/shadow/shadow.h | 114 | ||||
-rw-r--r-- | xorg-server/miext/shadow/shpacked.c | 128 | ||||
-rw-r--r-- | xorg-server/miext/shadow/shplanar.c | 162 | ||||
-rw-r--r-- | xorg-server/miext/shadow/shplanar8.c | 151 | ||||
-rw-r--r-- | xorg-server/miext/shadow/shrotate.c | 425 | ||||
-rw-r--r-- | xorg-server/miext/shadow/shrotpack.h | 111 | ||||
-rw-r--r-- | xorg-server/miext/shadow/shrotpackYX.h | 151 |
8 files changed, 649 insertions, 685 deletions
diff --git a/xorg-server/miext/shadow/shadow.c b/xorg-server/miext/shadow/shadow.c index 95f11cd21..d2ba68497 100644 --- a/xorg-server/miext/shadow/shadow.c +++ b/xorg-server/miext/shadow/shadow.c @@ -37,6 +37,7 @@ #include "shadow.h" static DevPrivateKeyRec shadowScrPrivateKeyRec; + #define shadowScrPrivateKey (&shadowScrPrivateKeyRec) #define wrap(priv, real, mem) {\ @@ -55,11 +56,11 @@ shadowRedisplay(ScreenPtr pScreen) RegionPtr pRegion; if (!pBuf || !pBuf->pDamage || !pBuf->update) - return; + return; pRegion = DamageRegion(pBuf->pDamage); if (RegionNotEmpty(pRegion)) { - (*pBuf->update)(pScreen, pBuf); - DamageEmpty(pBuf->pDamage); + (*pBuf->update) (pScreen, pBuf); + DamageEmpty(pBuf->pDamage); } } @@ -78,14 +79,15 @@ shadowWakeupHandler(pointer data, int i, pointer LastSelectMask) static void shadowGetImage(DrawablePtr pDrawable, int sx, int sy, int w, int h, - unsigned int format, unsigned long planeMask, char *pdstLine) + unsigned int format, unsigned long planeMask, char *pdstLine) { ScreenPtr pScreen = pDrawable->pScreen; + shadowBuf(pScreen); /* Many apps use GetImage to sync with the visable frame buffer */ if (pDrawable->type == DRAWABLE_WINDOW) - shadowRedisplay(pScreen); + shadowRedisplay(pScreen); unwrap(pBuf, pScreen, GetImage); pScreen->GetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine); wrap(pBuf, pScreen, GetImage); @@ -103,10 +105,10 @@ shadowCloseScreen(int i, ScreenPtr pScreen) shadowRemove(pScreen, pBuf->pPixmap); DamageDestroy(pBuf->pDamage); #ifdef BACKWARDS_COMPATIBILITY - RegionUninit(&pBuf->damage); /* bc */ + RegionUninit(&pBuf->damage); /* bc */ #endif if (pBuf->pPixmap) - pScreen->DestroyPixmap(pBuf->pPixmap); + pScreen->DestroyPixmap(pBuf->pPixmap); free(pBuf); return pScreen->CloseScreen(i, pScreen); } @@ -117,7 +119,7 @@ shadowReportFunc(DamagePtr pDamage, RegionPtr pRegion, void *closure) { ScreenPtr pScreen = closure; shadowBufPtr pBuf = (shadowBufPtr) - dixLookupPrivate(&pScreen->devPrivates, shadowScrPrivateKey); + dixLookupPrivate(&pScreen->devPrivates, shadowScrPrivateKey); /* Register the damaged region, use DamageReportNone below when we * want to break BC below... */ @@ -137,28 +139,26 @@ shadowSetup(ScreenPtr pScreen) shadowBufPtr pBuf; if (!dixRegisterPrivateKey(&shadowScrPrivateKeyRec, PRIVATE_SCREEN, 0)) - return FALSE; + return FALSE; if (!DamageSetup(pScreen)) - return FALSE; + return FALSE; pBuf = malloc(sizeof(shadowBufRec)); if (!pBuf) - return FALSE; + return FALSE; #ifdef BACKWARDS_COMPATIBILITY - pBuf->pDamage = DamageCreate((DamageReportFunc)shadowReportFunc, - (DamageDestroyFunc)NULL, - DamageReportRawRegion, - TRUE, pScreen, pScreen); + pBuf->pDamage = DamageCreate((DamageReportFunc) shadowReportFunc, + (DamageDestroyFunc) NULL, + DamageReportRawRegion, TRUE, pScreen, pScreen); #else - pBuf->pDamage = DamageCreate((DamageReportFunc)NULL, - (DamageDestroyFunc)NULL, - DamageReportNone, - TRUE, pScreen, pScreen); + pBuf->pDamage = DamageCreate((DamageReportFunc) NULL, + (DamageDestroyFunc) NULL, + DamageReportNone, TRUE, pScreen, pScreen); #endif if (!pBuf->pDamage) { - free(pBuf); - return FALSE; + free(pBuf); + return FALSE; } wrap(pBuf, pScreen, CloseScreen); @@ -169,7 +169,7 @@ shadowSetup(ScreenPtr pScreen) pBuf->closure = 0; pBuf->randr = 0; #ifdef BACKWARDS_COMPATIBILITY - RegionNull(&pBuf->damage); /* bc */ + RegionNull(&pBuf->damage); /* bc */ #endif dixSetPrivate(&pScreen->devPrivates, shadowScrPrivateKey, pBuf); @@ -178,13 +178,13 @@ shadowSetup(ScreenPtr pScreen) Bool shadowAdd(ScreenPtr pScreen, PixmapPtr pPixmap, ShadowUpdateProc update, - ShadowWindowProc window, int randr, void *closure) + ShadowWindowProc window, int randr, void *closure) { shadowBuf(pScreen); if (!RegisterBlockAndWakeupHandlers(shadowBlockHandler, shadowWakeupHandler, - (pointer)pScreen)) - return FALSE; + (pointer) pScreen)) + return FALSE; /* * Map simple rotation values to bitmasks; fortunately, @@ -192,17 +192,17 @@ shadowAdd(ScreenPtr pScreen, PixmapPtr pPixmap, ShadowUpdateProc update, */ switch (randr) { case 0: - randr = SHADOW_ROTATE_0; - break; + randr = SHADOW_ROTATE_0; + break; case 90: - randr = SHADOW_ROTATE_90; - break; + randr = SHADOW_ROTATE_90; + break; case 180: - randr = SHADOW_ROTATE_180; - break; + randr = SHADOW_ROTATE_180; + break; case 270: - randr = SHADOW_ROTATE_270; - break; + randr = SHADOW_ROTATE_270; + break; } pBuf->update = update; pBuf->window = window; @@ -219,31 +219,31 @@ shadowRemove(ScreenPtr pScreen, PixmapPtr pPixmap) shadowBuf(pScreen); if (pBuf->pPixmap) { - DamageUnregister(&pBuf->pPixmap->drawable, pBuf->pDamage); - pBuf->update = 0; - pBuf->window = 0; - pBuf->randr = 0; - pBuf->closure = 0; - pBuf->pPixmap = 0; + DamageUnregister(&pBuf->pPixmap->drawable, pBuf->pDamage); + pBuf->update = 0; + pBuf->window = 0; + pBuf->randr = 0; + pBuf->closure = 0; + pBuf->pPixmap = 0; } RemoveBlockAndWakeupHandlers(shadowBlockHandler, shadowWakeupHandler, - (pointer) pScreen); + (pointer) pScreen); } Bool shadowInit(ScreenPtr pScreen, ShadowUpdateProc update, ShadowWindowProc window) { PixmapPtr pPixmap; - + pPixmap = pScreen->CreatePixmap(pScreen, pScreen->width, pScreen->height, - pScreen->rootDepth, 0); + pScreen->rootDepth, 0); if (!pPixmap) - return FALSE; - + return FALSE; + if (!shadowSetup(pScreen)) { - pScreen->DestroyPixmap(pPixmap); - return FALSE; + pScreen->DestroyPixmap(pPixmap); + return FALSE; } shadowAdd(pScreen, pPixmap, update, window, SHADOW_ROTATE_0, 0); diff --git a/xorg-server/miext/shadow/shadow.h b/xorg-server/miext/shadow/shadow.h index f4473052d..83de22ccc 100644 --- a/xorg-server/miext/shadow/shadow.h +++ b/xorg-server/miext/shadow/shadow.h @@ -30,35 +30,32 @@ #include "damage.h" #include "damagestr.h" -typedef struct _shadowBuf *shadowBufPtr; +typedef struct _shadowBuf *shadowBufPtr; -typedef void (*ShadowUpdateProc) (ScreenPtr pScreen, - shadowBufPtr pBuf); +typedef void (*ShadowUpdateProc) (ScreenPtr pScreen, shadowBufPtr pBuf); #define SHADOW_WINDOW_RELOCATE 1 #define SHADOW_WINDOW_READ 2 #define SHADOW_WINDOW_WRITE 4 -typedef void *(*ShadowWindowProc) (ScreenPtr pScreen, - CARD32 row, - CARD32 offset, - int mode, - CARD32 *size, - void *closure); +typedef void *(*ShadowWindowProc) (ScreenPtr pScreen, + CARD32 row, + CARD32 offset, + int mode, CARD32 *size, void *closure); /* BC hack: do not move the damage member. see shadow.c for explanation. */ typedef struct _shadowBuf { - DamagePtr pDamage; - ShadowUpdateProc update; - ShadowWindowProc window; - RegionRec damage; - PixmapPtr pPixmap; - void *closure; - int randr; + DamagePtr pDamage; + ShadowUpdateProc update; + ShadowWindowProc window; + RegionRec damage; + PixmapPtr pPixmap; + void *closure; + int randr; /* screen wrappers */ - GetImageProcPtr GetImage; - CloseScreenProcPtr CloseScreen; + GetImageProcPtr GetImage; + CloseScreenProcPtr CloseScreen; } shadowBufRec; /* Match defines from randr extension */ @@ -77,105 +74,86 @@ extern _X_EXPORT DevPrivateKey shadowScrPrivateKey; #define shadowGetBuf(pScr) ((shadowBufPtr) \ dixLookupPrivate(&(pScr)->devPrivates, shadowScrPrivateKey)) #define shadowBuf(pScr) shadowBufPtr pBuf = shadowGetBuf(pScr) -#define shadowDamage(pBuf) DamageRegion(pBuf->pDamage) +#define shadowDamage(pBuf) DamageRegion(pBuf->pDamage) extern _X_EXPORT Bool -shadowSetup (ScreenPtr pScreen); + shadowSetup(ScreenPtr pScreen); extern _X_EXPORT Bool -shadowAdd (ScreenPtr pScreen, - PixmapPtr pPixmap, - ShadowUpdateProc update, - ShadowWindowProc window, - int randr, - void *closure); + +shadowAdd(ScreenPtr pScreen, + PixmapPtr pPixmap, + ShadowUpdateProc update, + ShadowWindowProc window, int randr, void *closure); extern _X_EXPORT void -shadowRemove (ScreenPtr pScreen, PixmapPtr pPixmap); + shadowRemove(ScreenPtr pScreen, PixmapPtr pPixmap); extern _X_EXPORT Bool -shadowInit (ScreenPtr pScreen, ShadowUpdateProc update, ShadowWindowProc window); -extern _X_EXPORT void * -shadowAlloc (int width, int height, int bpp); +shadowInit(ScreenPtr pScreen, ShadowUpdateProc update, ShadowWindowProc window); + +extern _X_EXPORT void *shadowAlloc(int width, int height, int bpp); extern _X_EXPORT void -shadowUpdatePacked (ScreenPtr pScreen, - shadowBufPtr pBuf); + shadowUpdatePacked(ScreenPtr pScreen, shadowBufPtr pBuf); extern _X_EXPORT void -shadowUpdatePlanar4 (ScreenPtr pScreen, - shadowBufPtr pBuf); + shadowUpdatePlanar4(ScreenPtr pScreen, shadowBufPtr pBuf); extern _X_EXPORT void -shadowUpdatePlanar4x8 (ScreenPtr pScreen, - shadowBufPtr pBuf); + shadowUpdatePlanar4x8(ScreenPtr pScreen, shadowBufPtr pBuf); extern _X_EXPORT void -shadowUpdateRotatePacked (ScreenPtr pScreen, - shadowBufPtr pBuf); + shadowUpdateRotatePacked(ScreenPtr pScreen, shadowBufPtr pBuf); extern _X_EXPORT void -shadowUpdateRotate8_90 (ScreenPtr pScreen, - shadowBufPtr pBuf); + shadowUpdateRotate8_90(ScreenPtr pScreen, shadowBufPtr pBuf); extern _X_EXPORT void -shadowUpdateRotate16_90 (ScreenPtr pScreen, - shadowBufPtr pBuf); + shadowUpdateRotate16_90(ScreenPtr pScreen, shadowBufPtr pBuf); extern _X_EXPORT void -shadowUpdateRotate16_90YX (ScreenPtr pScreen, - shadowBufPtr pBuf); + shadowUpdateRotate16_90YX(ScreenPtr pScreen, shadowBufPtr pBuf); extern _X_EXPORT void -shadowUpdateRotate32_90 (ScreenPtr pScreen, - shadowBufPtr pBuf); + shadowUpdateRotate32_90(ScreenPtr pScreen, shadowBufPtr pBuf); extern _X_EXPORT void -shadowUpdateRotate8_180 (ScreenPtr pScreen, - shadowBufPtr pBuf); + shadowUpdateRotate8_180(ScreenPtr pScreen, shadowBufPtr pBuf); extern _X_EXPORT void -shadowUpdateRotate16_180 (ScreenPtr pScreen, - shadowBufPtr pBuf); + shadowUpdateRotate16_180(ScreenPtr pScreen, shadowBufPtr pBuf); extern _X_EXPORT void -shadowUpdateRotate32_180 (ScreenPtr pScreen, - shadowBufPtr pBuf); + shadowUpdateRotate32_180(ScreenPtr pScreen, shadowBufPtr pBuf); extern _X_EXPORT void -shadowUpdateRotate8_270 (ScreenPtr pScreen, - shadowBufPtr pBuf); + shadowUpdateRotate8_270(ScreenPtr pScreen, shadowBufPtr pBuf); extern _X_EXPORT void -shadowUpdateRotate16_270 (ScreenPtr pScreen, - shadowBufPtr pBuf); + shadowUpdateRotate16_270(ScreenPtr pScreen, shadowBufPtr pBuf); extern _X_EXPORT void -shadowUpdateRotate16_270YX (ScreenPtr pScreen, - shadowBufPtr pBuf); + shadowUpdateRotate16_270YX(ScreenPtr pScreen, shadowBufPtr pBuf); extern _X_EXPORT void -shadowUpdateRotate32_270 (ScreenPtr pScreen, - shadowBufPtr pBuf); + shadowUpdateRotate32_270(ScreenPtr pScreen, shadowBufPtr pBuf); extern _X_EXPORT void -shadowUpdateRotate8 (ScreenPtr pScreen, - shadowBufPtr pBuf); + shadowUpdateRotate8(ScreenPtr pScreen, shadowBufPtr pBuf); extern _X_EXPORT void -shadowUpdateRotate16 (ScreenPtr pScreen, - shadowBufPtr pBuf); + shadowUpdateRotate16(ScreenPtr pScreen, shadowBufPtr pBuf); extern _X_EXPORT void -shadowUpdateRotate32 (ScreenPtr pScreen, - shadowBufPtr pBuf); + shadowUpdateRotate32(ScreenPtr pScreen, shadowBufPtr pBuf); -typedef void (* shadowUpdateProc)(ScreenPtr, shadowBufPtr); +typedef void (*shadowUpdateProc) (ScreenPtr, shadowBufPtr); extern _X_EXPORT shadowUpdateProc shadowUpdatePackedWeak(void); extern _X_EXPORT shadowUpdateProc shadowUpdatePlanar4Weak(void); extern _X_EXPORT shadowUpdateProc shadowUpdatePlanar4x8Weak(void); extern _X_EXPORT shadowUpdateProc shadowUpdateRotatePackedWeak(void); -#endif /* _SHADOW_H_ */ +#endif /* _SHADOW_H_ */ diff --git a/xorg-server/miext/shadow/shpacked.c b/xorg-server/miext/shadow/shpacked.c index c37dca175..d2b2e5e24 100644 --- a/xorg-server/miext/shadow/shpacked.c +++ b/xorg-server/miext/shadow/shpacked.c @@ -41,78 +41,76 @@ #include "fb.h" void -shadowUpdatePacked (ScreenPtr pScreen, - shadowBufPtr pBuf) +shadowUpdatePacked(ScreenPtr pScreen, shadowBufPtr pBuf) { - RegionPtr damage = shadowDamage (pBuf); - PixmapPtr pShadow = pBuf->pPixmap; - int nbox = RegionNumRects (damage); - BoxPtr pbox = RegionRects (damage); - FbBits *shaBase, *shaLine, *sha; - FbStride shaStride; - int scrBase, scrLine, scr; - int shaBpp; - _X_UNUSED int shaXoff, shaYoff; - int x, y, w, h, width; - int i; - FbBits *winBase = NULL, *win; - CARD32 winSize; + RegionPtr damage = shadowDamage(pBuf); + PixmapPtr pShadow = pBuf->pPixmap; + int nbox = RegionNumRects(damage); + BoxPtr pbox = RegionRects(damage); + FbBits *shaBase, *shaLine, *sha; + FbStride shaStride; + int scrBase, scrLine, scr; + int shaBpp; + _X_UNUSED int shaXoff, shaYoff; + int x, y, w, h, width; + int i; + FbBits *winBase = NULL, *win; + CARD32 winSize; - fbGetDrawable (&pShadow->drawable, shaBase, shaStride, shaBpp, shaXoff, shaYoff); - while (nbox--) - { - x = pbox->x1 * shaBpp; - y = pbox->y1; - w = (pbox->x2 - pbox->x1) * shaBpp; - h = pbox->y2 - pbox->y1; + fbGetDrawable(&pShadow->drawable, shaBase, shaStride, shaBpp, shaXoff, + shaYoff); + while (nbox--) { + x = pbox->x1 * shaBpp; + y = pbox->y1; + w = (pbox->x2 - pbox->x1) * shaBpp; + h = pbox->y2 - pbox->y1; - scrLine = (x >> FB_SHIFT); - shaLine = shaBase + y * shaStride + (x >> FB_SHIFT); - - x &= FB_MASK; - w = (w + x + FB_MASK) >> FB_SHIFT; - - while (h--) - { - winSize = 0; - scrBase = 0; - width = w; - scr = scrLine; - sha = shaLine; - while (width) { - /* how much remains in this window */ - i = scrBase + winSize - scr; - if (i <= 0 || scr < scrBase) - { - winBase = (FbBits *) (*pBuf->window) (pScreen, - y, - scr * sizeof (FbBits), - SHADOW_WINDOW_WRITE, - &winSize, - pBuf->closure); - if(!winBase) - return; - scrBase = scr; - winSize /= sizeof (FbBits); - i = winSize; - } - win = winBase + (scr - scrBase); - if (i > width) - i = width; - width -= i; - scr += i; + scrLine = (x >> FB_SHIFT); + shaLine = shaBase + y * shaStride + (x >> FB_SHIFT); + + x &= FB_MASK; + w = (w + x + FB_MASK) >> FB_SHIFT; + + while (h--) { + winSize = 0; + scrBase = 0; + width = w; + scr = scrLine; + sha = shaLine; + while (width) { + /* how much remains in this window */ + i = scrBase + winSize - scr; + if (i <= 0 || scr < scrBase) { + winBase = (FbBits *) (*pBuf->window) (pScreen, + y, + scr * sizeof(FbBits), + SHADOW_WINDOW_WRITE, + &winSize, + pBuf->closure); + if (!winBase) + return; + scrBase = scr; + winSize /= sizeof(FbBits); + i = winSize; + } + win = winBase + (scr - scrBase); + if (i > width) + i = width; + width -= i; + scr += i; #define PickBit(a,i) (((a) >> (i)) & 1) - memcpy(win, sha, i * sizeof(FbBits)); - sha += i; - } - shaLine += shaStride; - y++; - } - pbox++; + memcpy(win, sha, i * sizeof(FbBits)); + sha += i; + } + shaLine += shaStride; + y++; + } + pbox++; } } shadowUpdateProc -shadowUpdatePackedWeak(void) { +shadowUpdatePackedWeak(void) +{ return shadowUpdatePacked; } diff --git a/xorg-server/miext/shadow/shplanar.c b/xorg-server/miext/shadow/shplanar.c index 350405186..4f6542cb6 100644 --- a/xorg-server/miext/shadow/shplanar.c +++ b/xorg-server/miext/shadow/shplanar.c @@ -44,7 +44,7 @@ * 32 4-bit pixels per write */ -#define PL_SHIFT 7 +#define PL_SHIFT 7 #define PL_UNIT (1 << PL_SHIFT) #define PL_MASK (PL_UNIT - 1) @@ -87,94 +87,94 @@ #endif void -shadowUpdatePlanar4 (ScreenPtr pScreen, - shadowBufPtr pBuf) +shadowUpdatePlanar4(ScreenPtr pScreen, shadowBufPtr pBuf) { - RegionPtr damage = shadowDamage (pBuf); - PixmapPtr pShadow = pBuf->pPixmap; - int nbox = RegionNumRects (damage); - BoxPtr pbox = RegionRects (damage); - CARD32 *shaBase, *shaLine, *sha; - FbStride shaStride; - int scrBase, scrLine, scr; - int shaBpp; - _X_UNUSED int shaXoff, shaYoff; - int x, y, w, h, width; - int i; - CARD32 *winBase = NULL, *win; - CARD32 winSize; - int plane; - CARD32 m,m5,m6; - CARD8 s1, s2, s3, s4; + RegionPtr damage = shadowDamage(pBuf); + PixmapPtr pShadow = pBuf->pPixmap; + int nbox = RegionNumRects(damage); + BoxPtr pbox = RegionRects(damage); + CARD32 *shaBase, *shaLine, *sha; + FbStride shaStride; + int scrBase, scrLine, scr; + int shaBpp; + _X_UNUSED int shaXoff, shaYoff; + int x, y, w, h, width; + int i; + CARD32 *winBase = NULL, *win; + CARD32 winSize; + int plane; + CARD32 m, m5, m6; + CARD8 s1, s2, s3, s4; - fbGetStipDrawable (&pShadow->drawable, shaBase, shaStride, shaBpp, shaXoff, shaYoff); - while (nbox--) - { - x = (pbox->x1) * shaBpp; - y = (pbox->y1); - w = (pbox->x2 - pbox->x1) * shaBpp; - h = pbox->y2 - pbox->y1; + fbGetStipDrawable(&pShadow->drawable, shaBase, shaStride, shaBpp, shaXoff, + shaYoff); + while (nbox--) { + x = (pbox->x1) * shaBpp; + y = (pbox->y1); + w = (pbox->x2 - pbox->x1) * shaBpp; + h = pbox->y2 - pbox->y1; - w = (w + (x & PL_MASK) + PL_MASK) >> PL_SHIFT; - x &= ~PL_MASK; - - scrLine = (x >> PL_SHIFT); - shaLine = shaBase + y * shaStride + (x >> FB_SHIFT); - - while (h--) - { - for (plane = 0; plane < 4; plane++) - { - width = w; - scr = scrLine; - sha = shaLine; - winSize = 0; - scrBase = 0; - while (width) { - /* how much remains in this window */ - i = scrBase + winSize - scr; - if (i <= 0 || scr < scrBase) - { - winBase = (CARD32 *) (*pBuf->window) (pScreen, - y, - (scr << 4) | (plane), - SHADOW_WINDOW_WRITE, - &winSize, - pBuf->closure); - if(!winBase) - return; - winSize >>= 2; - scrBase = scr; - i = winSize; - } - win = winBase + (scr - scrBase); - if (i > width) - i = width; - width -= i; - scr += i; - - while (i--) - { - GetBits(plane,0,s1); - GetBits(plane,1,s2); - GetBits(plane,2,s3); - GetBits(plane,3,s4); - *win++ = s1 | (s2 << 8) | (s3 << 16) | (s4 << 24); - sha += 4; - } - } - } - shaLine += shaStride; - y++; - } - pbox++; + w = (w + (x & PL_MASK) + PL_MASK) >> PL_SHIFT; + x &= ~PL_MASK; + + scrLine = (x >> PL_SHIFT); + shaLine = shaBase + y * shaStride + (x >> FB_SHIFT); + + while (h--) { + for (plane = 0; plane < 4; plane++) { + width = w; + scr = scrLine; + sha = shaLine; + winSize = 0; + scrBase = 0; + while (width) { + /* how much remains in this window */ + i = scrBase + winSize - scr; + if (i <= 0 || scr < scrBase) { + winBase = (CARD32 *) (*pBuf->window) (pScreen, + y, + (scr << 4) | + (plane), + SHADOW_WINDOW_WRITE, + &winSize, + pBuf->closure); + if (!winBase) + return; + winSize >>= 2; + scrBase = scr; + i = winSize; + } + win = winBase + (scr - scrBase); + if (i > width) + i = width; + width -= i; + scr += i; + + while (i--) { + GetBits(plane, 0, s1); + GetBits(plane, 1, s2); + GetBits(plane, 2, s3); + GetBits(plane, 3, s4); + *win++ = s1 | (s2 << 8) | (s3 << 16) | (s4 << 24); + sha += 4; + } + } + } + shaLine += shaStride; + y++; + } + pbox++; } } -shadowUpdateProc shadowUpdatePlanar4Weak(void) { +shadowUpdateProc +shadowUpdatePlanar4Weak(void) +{ return shadowUpdatePlanar4; } -shadowUpdateProc shadowUpdatePlanar4x8Weak(void) { +shadowUpdateProc +shadowUpdatePlanar4x8Weak(void) +{ return shadowUpdatePlanar4x8; } diff --git a/xorg-server/miext/shadow/shplanar8.c b/xorg-server/miext/shadow/shplanar8.c index d0648147a..214fa9aac 100644 --- a/xorg-server/miext/shadow/shplanar8.c +++ b/xorg-server/miext/shadow/shplanar8.c @@ -90,86 +90,81 @@ #endif void -shadowUpdatePlanar4x8 (ScreenPtr pScreen, - shadowBufPtr pBuf) +shadowUpdatePlanar4x8(ScreenPtr pScreen, shadowBufPtr pBuf) { - RegionPtr damage = shadowDamage (pBuf); - PixmapPtr pShadow = pBuf->pPixmap; - int nbox = RegionNumRects (damage); - BoxPtr pbox = RegionRects (damage); - CARD32 *shaBase, *shaLine, *sha; - CARD8 s1, s2, s3, s4; - FbStride shaStride; - int scrBase, scrLine, scr; - int shaBpp; - _X_UNUSED int shaXoff, shaYoff; - int x, y, w, h, width; - int i; - CARD32 *winBase = NULL, *win; - CARD32 winSize; - int plane; + RegionPtr damage = shadowDamage(pBuf); + PixmapPtr pShadow = pBuf->pPixmap; + int nbox = RegionNumRects(damage); + BoxPtr pbox = RegionRects(damage); + CARD32 *shaBase, *shaLine, *sha; + CARD8 s1, s2, s3, s4; + FbStride shaStride; + int scrBase, scrLine, scr; + int shaBpp; + _X_UNUSED int shaXoff, shaYoff; + int x, y, w, h, width; + int i; + CARD32 *winBase = NULL, *win; + CARD32 winSize; + int plane; - fbGetStipDrawable (&pShadow->drawable, shaBase, shaStride, shaBpp, shaXoff, shaYoff); - while (nbox--) - { - x = pbox->x1 * shaBpp; - y = pbox->y1; - w = (pbox->x2 - pbox->x1) * shaBpp; - h = pbox->y2 - pbox->y1; + fbGetStipDrawable(&pShadow->drawable, shaBase, shaStride, shaBpp, shaXoff, + shaYoff); + while (nbox--) { + x = pbox->x1 * shaBpp; + y = pbox->y1; + w = (pbox->x2 - pbox->x1) * shaBpp; + h = pbox->y2 - pbox->y1; - w = (w + (x & PL_MASK) + PL_MASK) >> PL_SHIFT; - x &= ~PL_MASK; - - scrLine = (x >> PL_SHIFT); - shaLine = shaBase + y * shaStride + (x >> FB_SHIFT); - - while (h--) - { - for (plane = 0; plane < 4; plane++) - { - width = w; - scr = scrLine; - sha = shaLine; - winSize = 0; - scrBase = 0; - while (width) { - /* how much remains in this window */ - i = scrBase + winSize - scr; - if (i <= 0 || scr < scrBase) - { - winBase = (CARD32 *) (*pBuf->window) (pScreen, - y, - (scr << 4) | (plane), - SHADOW_WINDOW_WRITE, - &winSize, - pBuf->closure); - if(!winBase) - return; - winSize >>= 2; - scrBase = scr; - i = winSize; - } - win = winBase + (scr - scrBase); - if (i > width) - i = width; - width -= i; - scr += i; - - while (i--) - { - GetBits(plane,0,s1); - GetBits(plane,2,s2); - GetBits(plane,4,s3); - GetBits(plane,6,s4); - *win++ = s1 | (s2 << 8) | (s3 << 16) | (s4 << 24); - sha += 8; - } - } - } - shaLine += shaStride; - y++; - } - pbox++; + w = (w + (x & PL_MASK) + PL_MASK) >> PL_SHIFT; + x &= ~PL_MASK; + + scrLine = (x >> PL_SHIFT); + shaLine = shaBase + y * shaStride + (x >> FB_SHIFT); + + while (h--) { + for (plane = 0; plane < 4; plane++) { + width = w; + scr = scrLine; + sha = shaLine; + winSize = 0; + scrBase = 0; + while (width) { + /* how much remains in this window */ + i = scrBase + winSize - scr; + if (i <= 0 || scr < scrBase) { + winBase = (CARD32 *) (*pBuf->window) (pScreen, + y, + (scr << 4) | + (plane), + SHADOW_WINDOW_WRITE, + &winSize, + pBuf->closure); + if (!winBase) + return; + winSize >>= 2; + scrBase = scr; + i = winSize; + } + win = winBase + (scr - scrBase); + if (i > width) + i = width; + width -= i; + scr += i; + + while (i--) { + GetBits(plane, 0, s1); + GetBits(plane, 2, s2); + GetBits(plane, 4, s3); + GetBits(plane, 6, s4); + *win++ = s1 | (s2 << 8) | (s3 << 16) | (s4 << 24); + sha += 8; + } + } + } + shaLine += shaStride; + y++; + } + pbox++; } } - diff --git a/xorg-server/miext/shadow/shrotate.c b/xorg-server/miext/shadow/shrotate.c index 090120387..779a905d2 100644 --- a/xorg-server/miext/shadow/shrotate.c +++ b/xorg-server/miext/shadow/shrotate.c @@ -49,265 +49,256 @@ #define BOTTOM_TO_TOP -2 void -shadowUpdateRotatePacked (ScreenPtr pScreen, - shadowBufPtr pBuf) +shadowUpdateRotatePacked(ScreenPtr pScreen, shadowBufPtr pBuf) { - RegionPtr damage = shadowDamage (pBuf); - PixmapPtr pShadow = pBuf->pPixmap; - int nbox = RegionNumRects (damage); - BoxPtr pbox = RegionRects (damage); - FbBits *shaBits; - FbStride shaStride; - int shaBpp; - _X_UNUSED int shaXoff, shaYoff; - int box_x1, box_x2, box_y1, box_y2; - int sha_x1 = 0, sha_y1 = 0; - int scr_x1 = 0, scr_x2 = 0, scr_y1 = 0, scr_y2 = 0, scr_w, scr_h; - int scr_x, scr_y; - int w; - int pixelsPerBits; - int pixelsMask; - FbStride shaStepOverY = 0, shaStepDownY = 0; - FbStride shaStepOverX = 0, shaStepDownX = 0; - FbBits *shaLine, *sha; - int shaHeight = pShadow->drawable.height; - int shaWidth = pShadow->drawable.width; - FbBits shaMask; - int shaFirstShift, shaShift; - int o_x_dir; - int o_y_dir; - int x_dir; - int y_dir; + RegionPtr damage = shadowDamage(pBuf); + PixmapPtr pShadow = pBuf->pPixmap; + int nbox = RegionNumRects(damage); + BoxPtr pbox = RegionRects(damage); + FbBits *shaBits; + FbStride shaStride; + int shaBpp; + _X_UNUSED int shaXoff, shaYoff; + int box_x1, box_x2, box_y1, box_y2; + int sha_x1 = 0, sha_y1 = 0; + int scr_x1 = 0, scr_x2 = 0, scr_y1 = 0, scr_y2 = 0, scr_w, scr_h; + int scr_x, scr_y; + int w; + int pixelsPerBits; + int pixelsMask; + FbStride shaStepOverY = 0, shaStepDownY = 0; + FbStride shaStepOverX = 0, shaStepDownX = 0; + FbBits *shaLine, *sha; + int shaHeight = pShadow->drawable.height; + int shaWidth = pShadow->drawable.width; + FbBits shaMask; + int shaFirstShift, shaShift; + int o_x_dir; + int o_y_dir; + int x_dir; + int y_dir; - fbGetDrawable (&pShadow->drawable, shaBits, shaStride, shaBpp, shaXoff, shaYoff); - pixelsPerBits = (sizeof (FbBits) * 8) / shaBpp; + fbGetDrawable(&pShadow->drawable, shaBits, shaStride, shaBpp, shaXoff, + shaYoff); + pixelsPerBits = (sizeof(FbBits) * 8) / shaBpp; pixelsMask = ~(pixelsPerBits - 1); - shaMask = FbBitsMask (FB_UNIT-shaBpp, shaBpp); + shaMask = FbBitsMask(FB_UNIT - shaBpp, shaBpp); /* * Compute rotation related constants to walk the shadow */ o_x_dir = LEFT_TO_RIGHT; o_y_dir = TOP_TO_BOTTOM; if (pBuf->randr & SHADOW_REFLECT_X) - o_x_dir = -o_x_dir; + o_x_dir = -o_x_dir; if (pBuf->randr & SHADOW_REFLECT_Y) - o_y_dir = -o_y_dir; + o_y_dir = -o_y_dir; switch (pBuf->randr & (SHADOW_ROTATE_ALL)) { - case SHADOW_ROTATE_0: /* upper left shadow -> upper left screen */ + case SHADOW_ROTATE_0: /* upper left shadow -> upper left screen */ default: - x_dir = o_x_dir; - y_dir = o_y_dir; - break; - case SHADOW_ROTATE_90: /* upper right shadow -> upper left screen */ - x_dir = o_y_dir; - y_dir = -o_x_dir; - break; - case SHADOW_ROTATE_180: /* lower right shadow -> upper left screen */ - x_dir = -o_x_dir; - y_dir = -o_y_dir; - break; - case SHADOW_ROTATE_270: /* lower left shadow -> upper left screen */ - x_dir = -o_y_dir; - y_dir = o_x_dir; - break; + x_dir = o_x_dir; + y_dir = o_y_dir; + break; + case SHADOW_ROTATE_90: /* upper right shadow -> upper left screen */ + x_dir = o_y_dir; + y_dir = -o_x_dir; + break; + case SHADOW_ROTATE_180: /* lower right shadow -> upper left screen */ + x_dir = -o_x_dir; + y_dir = -o_y_dir; + break; + case SHADOW_ROTATE_270: /* lower left shadow -> upper left screen */ + x_dir = -o_y_dir; + y_dir = o_x_dir; + break; } switch (x_dir) { case LEFT_TO_RIGHT: - shaStepOverX = shaBpp; - shaStepOverY = 0; - break; + shaStepOverX = shaBpp; + shaStepOverY = 0; + break; case TOP_TO_BOTTOM: - shaStepOverX = 0; - shaStepOverY = shaStride; - break; + shaStepOverX = 0; + shaStepOverY = shaStride; + break; case RIGHT_TO_LEFT: - shaStepOverX = -shaBpp; - shaStepOverY = 0; - break; + shaStepOverX = -shaBpp; + shaStepOverY = 0; + break; case BOTTOM_TO_TOP: - shaStepOverX = 0; - shaStepOverY = -shaStride; - break; + shaStepOverX = 0; + shaStepOverY = -shaStride; + break; } switch (y_dir) { case TOP_TO_BOTTOM: - shaStepDownX = 0; - shaStepDownY = shaStride; - break; + shaStepDownX = 0; + shaStepDownY = shaStride; + break; case RIGHT_TO_LEFT: - shaStepDownX = -shaBpp; - shaStepDownY = 0; - break; + shaStepDownX = -shaBpp; + shaStepDownY = 0; + break; case BOTTOM_TO_TOP: - shaStepDownX = 0; - shaStepDownY = -shaStride; - break; + shaStepDownX = 0; + shaStepDownY = -shaStride; + break; case LEFT_TO_RIGHT: - shaStepDownX = shaBpp; - shaStepDownY = 0; - break; + shaStepDownX = shaBpp; + shaStepDownY = 0; + break; } - - while (nbox--) - { + + while (nbox--) { box_x1 = pbox->x1; box_y1 = pbox->y1; box_x2 = pbox->x2; box_y2 = pbox->y2; pbox++; - /* - * Compute screen and shadow locations for this box - */ - switch (x_dir) { - case LEFT_TO_RIGHT: - scr_x1 = box_x1 & pixelsMask; - scr_x2 = (box_x2 + pixelsPerBits - 1) & pixelsMask; - - sha_x1 = scr_x1; - break; - case TOP_TO_BOTTOM: - scr_x1 = box_y1 & pixelsMask; - scr_x2 = (box_y2 + pixelsPerBits - 1) & pixelsMask; + /* + * Compute screen and shadow locations for this box + */ + switch (x_dir) { + case LEFT_TO_RIGHT: + scr_x1 = box_x1 & pixelsMask; + scr_x2 = (box_x2 + pixelsPerBits - 1) & pixelsMask; + + sha_x1 = scr_x1; + break; + case TOP_TO_BOTTOM: + scr_x1 = box_y1 & pixelsMask; + scr_x2 = (box_y2 + pixelsPerBits - 1) & pixelsMask; + + sha_y1 = scr_x1; + break; + case RIGHT_TO_LEFT: + scr_x1 = (shaWidth - box_x2) & pixelsMask; + scr_x2 = (shaWidth - box_x1 + pixelsPerBits - 1) & pixelsMask; + + sha_x1 = (shaWidth - scr_x1 - 1); + break; + case BOTTOM_TO_TOP: + scr_x1 = (shaHeight - box_y2) & pixelsMask; + scr_x2 = (shaHeight - box_y1 + pixelsPerBits - 1) & pixelsMask; - sha_y1 = scr_x1; - break; - case RIGHT_TO_LEFT: - scr_x1 = (shaWidth - box_x2) & pixelsMask; - scr_x2 = (shaWidth - box_x1 + pixelsPerBits - 1) & pixelsMask; + sha_y1 = (shaHeight - scr_x1 - 1); + break; + } + switch (y_dir) { + case TOP_TO_BOTTOM: + scr_y1 = box_y1; + scr_y2 = box_y2; - sha_x1 = (shaWidth - scr_x1 - 1); - break; - case BOTTOM_TO_TOP: - scr_x1 = (shaHeight - box_y2) & pixelsMask; - scr_x2 = (shaHeight - box_y1 + pixelsPerBits - 1) & pixelsMask; - - sha_y1 = (shaHeight - scr_x1 - 1); - break; - } - switch (y_dir) { - case TOP_TO_BOTTOM: - scr_y1 = box_y1; - scr_y2 = box_y2; + sha_y1 = scr_y1; + break; + case RIGHT_TO_LEFT: + scr_y1 = (shaWidth - box_x2); + scr_y2 = (shaWidth - box_x1); - sha_y1 = scr_y1; - break; - case RIGHT_TO_LEFT: - scr_y1 = (shaWidth - box_x2); - scr_y2 = (shaWidth - box_x1); + sha_x1 = box_x2 - 1; + break; + case BOTTOM_TO_TOP: + scr_y1 = shaHeight - box_y2; + scr_y2 = shaHeight - box_y1; - sha_x1 = box_x2 - 1; - break; - case BOTTOM_TO_TOP: - scr_y1 = shaHeight - box_y2; - scr_y2 = shaHeight - box_y1; - - sha_y1 = box_y2 - 1; - break; - case LEFT_TO_RIGHT: - scr_y1 = box_x1; - scr_y2 = box_x2; + sha_y1 = box_y2 - 1; + break; + case LEFT_TO_RIGHT: + scr_y1 = box_x1; + scr_y2 = box_x2; - sha_x1 = box_x1; - break; - } - scr_w = ((scr_x2 - scr_x1) * shaBpp) >> FB_SHIFT; - scr_h = scr_y2 - scr_y1; - scr_y = scr_y1; + sha_x1 = box_x1; + break; + } + scr_w = ((scr_x2 - scr_x1) * shaBpp) >> FB_SHIFT; + scr_h = scr_y2 - scr_y1; + scr_y = scr_y1; - /* shift amount for first pixel on screen */ - shaFirstShift = FB_UNIT - ((sha_x1 * shaBpp) & FB_MASK) - shaBpp; - - /* pointer to shadow data first placed on screen */ - shaLine = (shaBits + - sha_y1 * shaStride + - ((sha_x1 * shaBpp) >> FB_SHIFT)); + /* shift amount for first pixel on screen */ + shaFirstShift = FB_UNIT - ((sha_x1 * shaBpp) & FB_MASK) - shaBpp; - /* - * Copy the bits, always write across the physical frame buffer - * to take advantage of write combining. - */ - while (scr_h--) - { - int p; - FbBits bits; - FbBits *win; - int i; - CARD32 winSize; - - sha = shaLine; - shaShift = shaFirstShift; - w = scr_w; - scr_x = scr_x1 * shaBpp >> FB_SHIFT; + /* pointer to shadow data first placed on screen */ + shaLine = (shaBits + + sha_y1 * shaStride + ((sha_x1 * shaBpp) >> FB_SHIFT)); - while (w) - { - /* - * Map some of this line - */ - win = (FbBits *) (*pBuf->window) (pScreen, - scr_y, - scr_x << 2, - SHADOW_WINDOW_WRITE, - &winSize, - pBuf->closure); - i = (winSize >> 2); - if (i > w) - i = w; - w -= i; - scr_x += i; - /* - * Copy the portion of the line mapped - */ - while (i--) - { - bits = 0; - p = pixelsPerBits; - /* - * Build one word of output from multiple inputs - * - * Note that for 90/270 rotations, this will walk - * down the shadow hitting each scanline once. - * This is probably not very efficient. - */ - while (p--) - { - bits = FbScrLeft(bits, shaBpp); - bits |= FbScrRight (*sha, shaShift) & shaMask; + /* + * Copy the bits, always write across the physical frame buffer + * to take advantage of write combining. + */ + while (scr_h--) { + int p; + FbBits bits; + FbBits *win; + int i; + CARD32 winSize; - shaShift -= shaStepOverX; - if (shaShift >= FB_UNIT) - { - shaShift -= FB_UNIT; - sha--; - } - else if (shaShift < 0) - { - shaShift += FB_UNIT; - sha++; - } - sha += shaStepOverY; - } - *win++ = bits; - } - } - scr_y++; - shaFirstShift -= shaStepDownX; - if (shaFirstShift >= FB_UNIT) - { - shaFirstShift -= FB_UNIT; - shaLine--; - } - else if (shaFirstShift < 0) - { - shaFirstShift += FB_UNIT; - shaLine++; - } - shaLine += shaStepDownY; - } + sha = shaLine; + shaShift = shaFirstShift; + w = scr_w; + scr_x = scr_x1 * shaBpp >> FB_SHIFT; + + while (w) { + /* + * Map some of this line + */ + win = (FbBits *) (*pBuf->window) (pScreen, + scr_y, + scr_x << 2, + SHADOW_WINDOW_WRITE, + &winSize, pBuf->closure); + i = (winSize >> 2); + if (i > w) + i = w; + w -= i; + scr_x += i; + /* + * Copy the portion of the line mapped + */ + while (i--) { + bits = 0; + p = pixelsPerBits; + /* + * Build one word of output from multiple inputs + * + * Note that for 90/270 rotations, this will walk + * down the shadow hitting each scanline once. + * This is probably not very efficient. + */ + while (p--) { + bits = FbScrLeft(bits, shaBpp); + bits |= FbScrRight(*sha, shaShift) & shaMask; + + shaShift -= shaStepOverX; + if (shaShift >= FB_UNIT) { + shaShift -= FB_UNIT; + sha--; + } + else if (shaShift < 0) { + shaShift += FB_UNIT; + sha++; + } + sha += shaStepOverY; + } + *win++ = bits; + } + } + scr_y++; + shaFirstShift -= shaStepDownX; + if (shaFirstShift >= FB_UNIT) { + shaFirstShift -= FB_UNIT; + shaLine--; + } + else if (shaFirstShift < 0) { + shaFirstShift += FB_UNIT; + shaLine++; + } + shaLine += shaStepDownY; + } } } -shadowUpdateProc shadowUpdateRotatePackedWeak(void) { +shadowUpdateProc +shadowUpdateRotatePackedWeak(void) +{ return shadowUpdateRotatePacked; } diff --git a/xorg-server/miext/shadow/shrotpack.h b/xorg-server/miext/shadow/shrotpack.h index 16afff184..b1cb30d5c 100644 --- a/xorg-server/miext/shadow/shrotpack.h +++ b/xorg-server/miext/shadow/shrotpack.h @@ -94,72 +94,76 @@ #endif void -FUNC (ScreenPtr pScreen, - shadowBufPtr pBuf) +FUNC(ScreenPtr pScreen, shadowBufPtr pBuf) { - RegionPtr damage = shadowDamage (pBuf); - PixmapPtr pShadow = pBuf->pPixmap; - int nbox = RegionNumRects (damage); - BoxPtr pbox = RegionRects (damage); - FbBits *shaBits; - Data *shaBase, *shaLine, *sha; - FbStride shaStride; - int scrBase, scrLine, scr; - int shaBpp; - _X_UNUSED int shaXoff, shaYoff; - int x, y, w, h, width; - int i; - Data *winBase = NULL, *win; - CARD32 winSize; - - fbGetDrawable (&pShadow->drawable, shaBits, shaStride, shaBpp, shaXoff, shaYoff); + RegionPtr damage = shadowDamage(pBuf); + PixmapPtr pShadow = pBuf->pPixmap; + int nbox = RegionNumRects(damage); + BoxPtr pbox = RegionRects(damage); + FbBits *shaBits; + Data *shaBase, *shaLine, *sha; + FbStride shaStride; + int scrBase, scrLine, scr; + int shaBpp; + _X_UNUSED int shaXoff, shaYoff; + int x, y, w, h, width; + int i; + Data *winBase = NULL, *win; + CARD32 winSize; + + fbGetDrawable(&pShadow->drawable, shaBits, shaStride, shaBpp, shaXoff, + shaYoff); shaBase = (Data *) shaBits; - shaStride = shaStride * sizeof (FbBits) / sizeof (Data); + shaStride = shaStride * sizeof(FbBits) / sizeof(Data); #if (DANDEBUG > 1) - ErrorF ("-> Entering Shadow Update:\r\n |- Origins: pShadow=%x, pScreen=%x, damage=%x\r\n |- Metrics: shaStride=%d, shaBase=%x, shaBpp=%d\r\n | \n", pShadow, pScreen, damage, shaStride, shaBase, shaBpp); + ErrorF + ("-> Entering Shadow Update:\r\n |- Origins: pShadow=%x, pScreen=%x, damage=%x\r\n |- Metrics: shaStride=%d, shaBase=%x, shaBpp=%d\r\n | \n", + pShadow, pScreen, damage, shaStride, shaBase, shaBpp); #endif - while (nbox--) - { + while (nbox--) { x = pbox->x1; y = pbox->y1; w = (pbox->x2 - pbox->x1); h = pbox->y2 - pbox->y1; - + #if (DANDEBUG > 2) - ErrorF (" |-> Redrawing box - Metrics: X=%d, Y=%d, Width=%d, Height=%d\n", x, y, w, h); + ErrorF + (" |-> Redrawing box - Metrics: X=%d, Y=%d, Width=%d, Height=%d\n", + x, y, w, h); #endif - scrLine = SCRLEFT(x,y,w,h); - shaLine = shaBase + FIRSTSHA(x,y,w,h); - - while (STEPDOWN(x,y,w,h)) - { + scrLine = SCRLEFT(x, y, w, h); + shaLine = shaBase + FIRSTSHA(x, y, w, h); + + while (STEPDOWN(x, y, w, h)) { winSize = 0; scrBase = 0; - width = SCRWIDTH(x,y,w,h); + width = SCRWIDTH(x, y, w, h); scr = scrLine; sha = shaLine; #if (DANDEBUG > 3) - ErrorF (" | |-> StepDown - Metrics: width=%d, scr=%x, sha=%x\n", width, scr, sha); + ErrorF(" | |-> StepDown - Metrics: width=%d, scr=%x, sha=%x\n", + width, scr, sha); #endif - while (width) - { + while (width) { /* how much remains in this window */ i = scrBase + winSize - scr; - if (i <= 0 || scr < scrBase) - { + if (i <= 0 || scr < scrBase) { winBase = (Data *) (*pBuf->window) (pScreen, - SCRY(x,y,w,h), - scr * sizeof (Data), - SHADOW_WINDOW_WRITE, - &winSize, - pBuf->closure); - if(!winBase) + SCRY(x, y, w, h), + scr * sizeof(Data), + SHADOW_WINDOW_WRITE, + &winSize, + pBuf->closure); + if (!winBase) return; scrBase = scr; - winSize /= sizeof (Data); + winSize /= sizeof(Data); i = winSize; #if(DANDEBUG > 4) - ErrorF (" | | |-> Starting New Line - Metrics: winBase=%x, scrBase=%x, winSize=%d\r\n | | | Xstride=%d, Ystride=%d, w=%d h=%d\n", winBase, scrBase, winSize, SHASTEPX(shaStride), SHASTEPY(shaStride), w, h); + ErrorF + (" | | |-> Starting New Line - Metrics: winBase=%x, scrBase=%x, winSize=%d\r\n | | | Xstride=%d, Ystride=%d, w=%d h=%d\n", + winBase, scrBase, winSize, SHASTEPX(shaStride), + SHASTEPY(shaStride), w, h); #endif } win = winBase + (scr - scrBase); @@ -168,20 +172,23 @@ FUNC (ScreenPtr pScreen, width -= i; scr += i; #if(DANDEBUG > 5) - ErrorF (" | | |-> Writing Line - Metrics: win=%x, sha=%x\n", win, sha); + ErrorF + (" | | |-> Writing Line - Metrics: win=%x, sha=%x\n", + win, sha); #endif - while (i--) - { + while (i--) { #if(DANDEBUG > 6) - ErrorF (" | | |-> Writing Pixel - Metrics: win=%x, sha=%d, remaining=%d\n", win, sha, i); + ErrorF + (" | | |-> Writing Pixel - Metrics: win=%x, sha=%d, remaining=%d\n", + win, sha, i); #endif *win++ = *sha; sha += SHASTEPX(shaStride); - } /* i */ - } /* width */ + } /* i */ + } /* width */ shaLine += SHASTEPY(shaStride); - NEXTY(x,y,w,h); - } /* STEPDOWN */ + NEXTY(x, y, w, h); + } /* STEPDOWN */ pbox++; - } /* nbox */ + } /* nbox */ } diff --git a/xorg-server/miext/shadow/shrotpackYX.h b/xorg-server/miext/shadow/shrotpackYX.h index d7b01ec2a..57fcf22fa 100644 --- a/xorg-server/miext/shadow/shrotpackYX.h +++ b/xorg-server/miext/shadow/shrotpackYX.h @@ -54,107 +54,102 @@ #endif void -FUNC (ScreenPtr pScreen, - shadowBufPtr pBuf); + FUNC(ScreenPtr pScreen, shadowBufPtr pBuf); void -FUNC (ScreenPtr pScreen, - shadowBufPtr pBuf) +FUNC(ScreenPtr pScreen, shadowBufPtr pBuf) { - RegionPtr damage = shadowDamage(pBuf); - PixmapPtr pShadow = pBuf->pPixmap; - int nbox = RegionNumRects (damage); - BoxPtr pbox = RegionRects (damage); - FbBits *shaBits; - Data *shaBase, *shaLine, *sha; - FbStride shaStride, winStride; - int shaBpp; - _X_UNUSED int shaXoff, shaYoff; - int x, y, w, h; - Data *winBase, *win, *winLine; - CARD32 winSize; - - fbGetDrawable (&pShadow->drawable, shaBits, shaStride, shaBpp, shaXoff, shaYoff); + RegionPtr damage = shadowDamage(pBuf); + PixmapPtr pShadow = pBuf->pPixmap; + int nbox = RegionNumRects(damage); + BoxPtr pbox = RegionRects(damage); + FbBits *shaBits; + Data *shaBase, *shaLine, *sha; + FbStride shaStride, winStride; + int shaBpp; + _X_UNUSED int shaXoff, shaYoff; + int x, y, w, h; + Data *winBase, *win, *winLine; + CARD32 winSize; + + fbGetDrawable(&pShadow->drawable, shaBits, shaStride, shaBpp, shaXoff, + shaYoff); shaBase = (Data *) shaBits; - shaStride = shaStride * sizeof (FbBits) / sizeof (Data); + shaStride = shaStride * sizeof(FbBits) / sizeof(Data); winBase = (Data *) (*pBuf->window) (pScreen, 0, 0, - SHADOW_WINDOW_WRITE, - &winSize, pBuf->closure); + SHADOW_WINDOW_WRITE, + &winSize, pBuf->closure); winStride = (Data *) (*pBuf->window) (pScreen, 1, 0, - SHADOW_WINDOW_WRITE, - &winSize, pBuf->closure) - winBase; + SHADOW_WINDOW_WRITE, + &winSize, pBuf->closure) - winBase; - while (nbox--) - { + while (nbox--) { x = pbox->x1; y = pbox->y1; w = (pbox->x2 - pbox->x1); h = pbox->y2 - pbox->y1; - shaLine = shaBase + (y * shaStride) + x; + shaLine = shaBase + (y * shaStride) + x; #ifdef PREFETCH - __builtin_prefetch (shaLine); + __builtin_prefetch(shaLine); #endif - winLine = winBase + WINSTART(x, y); + winLine = winBase + WINSTART(x, y); - while (h--) - { - sha = shaLine; - win = winLine; + while (h--) { + sha = shaLine; + win = winLine; - while (sha < (shaLine + w - 16)) - { + while (sha < (shaLine + w - 16)) { #ifdef PREFETCH - __builtin_prefetch (sha + shaStride); + __builtin_prefetch(sha + shaStride); #endif - *win = *sha++; - win += WINSTEPX(winStride); - *win = *sha++; - win += WINSTEPX(winStride); - *win = *sha++; - win += WINSTEPX(winStride); - *win = *sha++; - win += WINSTEPX(winStride); - - *win = *sha++; - win += WINSTEPX(winStride); - *win = *sha++; - win += WINSTEPX(winStride); - *win = *sha++; - win += WINSTEPX(winStride); - *win = *sha++; - win += WINSTEPX(winStride); - - *win = *sha++; - win += WINSTEPX(winStride); - *win = *sha++; - win += WINSTEPX(winStride); - *win = *sha++; - win += WINSTEPX(winStride); - *win = *sha++; - win += WINSTEPX(winStride); - - *win = *sha++; - win += WINSTEPX(winStride); - *win = *sha++; - win += WINSTEPX(winStride); - *win = *sha++; - win += WINSTEPX(winStride); - *win = *sha++; - win += WINSTEPX(winStride); + *win = *sha++; + win += WINSTEPX(winStride); + *win = *sha++; + win += WINSTEPX(winStride); + *win = *sha++; + win += WINSTEPX(winStride); + *win = *sha++; + win += WINSTEPX(winStride); + + *win = *sha++; + win += WINSTEPX(winStride); + *win = *sha++; + win += WINSTEPX(winStride); + *win = *sha++; + win += WINSTEPX(winStride); + *win = *sha++; + win += WINSTEPX(winStride); + + *win = *sha++; + win += WINSTEPX(winStride); + *win = *sha++; + win += WINSTEPX(winStride); + *win = *sha++; + win += WINSTEPX(winStride); + *win = *sha++; + win += WINSTEPX(winStride); + + *win = *sha++; + win += WINSTEPX(winStride); + *win = *sha++; + win += WINSTEPX(winStride); + *win = *sha++; + win += WINSTEPX(winStride); + *win = *sha++; + win += WINSTEPX(winStride); } - while (sha < (shaLine + w)) - { - *win = *sha++; - win += WINSTEPX(winStride); + while (sha < (shaLine + w)) { + *win = *sha++; + win += WINSTEPX(winStride); } - y++; - shaLine += shaStride; - winLine += WINSTEPY(); + y++; + shaLine += shaStride; + winLine += WINSTEPY(); } pbox++; - } /* nbox */ + } /* nbox */ } |