diff options
author | Alex Deucher <alex@botch2.com> | 2007-03-04 02:45:55 -0500 |
---|---|---|
committer | Alex Deucher <alex@botch2.com> | 2007-03-13 00:17:29 -0400 |
commit | 3030e5a6afda5d05ddee5b586295a9e608b7a0de (patch) | |
tree | 6bfa950179dd258492b1d64a8a24970af0054d0e /src/smi_shadow.c | |
parent | 606971fc8a323b0b33bb43524941b4bae6a0c334 (diff) |
Whitespace and formatting changes
Diffstat (limited to 'src/smi_shadow.c')
-rw-r--r-- | src/smi_shadow.c | 528 |
1 files changed, 249 insertions, 279 deletions
diff --git a/src/smi_shadow.c b/src/smi_shadow.c index 10cfe4d..5b6e65a 100644 --- a/src/smi_shadow.c +++ b/src/smi_shadow.c @@ -47,141 +47,128 @@ authorization from the XFree86 Project and Silicon Motion. |*============================================================================= |* |* PARAMETERS: pScrn Pointer to ScrnInfo structure. -|* num Number of boxes to refresh. -|* pbox Pointer to an array of boxes to refresh. +|* num Number of boxes to refresh. +|* pbox Pointer to an array of boxes to refresh. |* |* DESCRIPTION: Refresh a portion of the shadow buffer to the visual screen -|* buffer. This is mainly used for rotation purposes. -|* y +|* buffer. This is mainly used for rotation purposes. +|* |* RETURNS: Nothing. |* \******************************************************************************/ void SMI_RefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox) { - SMIPtr pSmi = SMIPTR(pScrn); - int width, height, srcX, srcY, destX, destY; + SMIPtr pSmi = SMIPTR(pScrn); + int width, height, srcX, srcY, destX, destY; - ENTER_PROC("SMI_RefreshArea"); + ENTER_PROC("SMI_RefreshArea"); - /* #671 */ - if (pSmi->polyLines) - { - pSmi->polyLines = FALSE; - return; - } + /* #671 */ + if (pSmi->polyLines) { + pSmi->polyLines = FALSE; + return; + } - if (pSmi->rotate) - { - /* IF we need to do rotation, setup the hardware here. */ - WaitIdleEmpty(); - WRITE_DPR(pSmi, 0x10, pSmi->ShadowPitch); - WRITE_DPR(pSmi, 0x3C, pSmi->ShadowPitch); - WRITE_DPR(pSmi, 0x44, pSmi->FBOffset >> 3); - } + if (pSmi->rotate) { + /* IF we need to do rotation, setup the hardware here. */ + WaitIdleEmpty(); + WRITE_DPR(pSmi, 0x10, pSmi->ShadowPitch); + WRITE_DPR(pSmi, 0x3C, pSmi->ShadowPitch); + WRITE_DPR(pSmi, 0x44, pSmi->FBOffset >> 3); + } - /* #672 */ - if (pSmi->ClipTurnedOn) - { - WaitQueue(1); - WRITE_DPR(pSmi, 0x2C, pSmi->ScissorsLeft); - pSmi->ClipTurnedOn = FALSE; - } + /* #672 */ + if (pSmi->ClipTurnedOn) { + WaitQueue(1); + WRITE_DPR(pSmi, 0x2C, pSmi->ScissorsLeft); + pSmi->ClipTurnedOn = FALSE; + } - while (num--) - { - /* Get coordinates of the box to refresh. */ - srcX = pbox->x1; - srcY = pbox->y1; - width = pbox->x2 - srcX; - height = pbox->y2 - srcY; - - DEBUG((VERBLEV, "x=%d y=%d w=%d h=%d\n", srcX, srcY, width, height)); - - if ((width > 0) && (height > 0)) - { - switch (pSmi->rotate) - { - case SMI_ROTATE_CW: - /* 90 degrees CW rotation. Calculate destination - coordinates: - - *---+ - | | +-----* - | | | | destX = shadowHeight - srcY - 1 - | | --> | | destY = srcX - | | | | - | | +-----+ - +---+ - */ - destX = pSmi->ShadowHeight - srcY - 1; - destY = srcX; - - WaitQueue(4); - WRITE_DPR(pSmi, 0x00, (srcX << 16) + srcY); - WRITE_DPR(pSmi, 0x04, (destX << 16) + destY); - WRITE_DPR(pSmi, 0x08, (width << 16) + height); - WRITE_DPR(pSmi, 0x0C, 0xCC | SMI_ROTATE_BLT | - SMI_ROTATE_CW | SMI_START_ENGINE); - break; - - case SMI_ROTATE_CCW: - /* 90 degrees CCW rotatation. Calculate destination - coordinates: - - *---+ - | | +-----+ - | | | | destX = srcY - | | --> | | destY = shadowWidth - srcX - 1 - | | | | - | | *-----+ - +---+ - */ - destX = srcY; - destY = pSmi->ShadowWidth - srcX - 1; - - WaitQueue(4); - WRITE_DPR(pSmi, 0x00, (srcX << 16) + srcY); - WRITE_DPR(pSmi, 0x04, (destX << 16) + destY); - WRITE_DPR(pSmi, 0x08, (width << 16) + height); - WRITE_DPR(pSmi, 0x0C, 0xCC | SMI_ROTATE_BLT | - SMI_ROTATE_CCW | SMI_START_ENGINE); - break; - - default: - /* No rotation, perform a normal copy. */ - if (pScrn->bitsPerPixel == 24) - { - srcX *= 3; - width *= 3; - - if (pSmi->Chipset == SMI_LYNX) - { - srcY *= 3; - } - } - - WaitQueue(4); - WRITE_DPR(pSmi, 0x00, (srcX << 16) + srcY); - WRITE_DPR(pSmi, 0x04, (srcX << 16) + srcY); - WRITE_DPR(pSmi, 0x08, (width << 16) + height); - WRITE_DPR(pSmi, 0x0C, SMI_BITBLT + SMI_START_ENGINE + 0xCC); - break; - } + while (num--) { + /* Get coordinates of the box to refresh. */ + srcX = pbox->x1; + srcY = pbox->y1; + width = pbox->x2 - srcX; + height = pbox->y2 - srcY; + + DEBUG((VERBLEV, "x=%d y=%d w=%d h=%d\n", srcX, srcY, width, height)); + + if ((width > 0) && (height > 0)) { + switch (pSmi->rotate) { + case SMI_ROTATE_CW: + /* 90 degrees CW rotation. Calculate destination coordinates: + + *---+ + | | +-----* + | | | | destX = shadowHeight - srcY - 1 + | | --> | | destY = srcX + | | | | + | | +-----+ + +---+ + */ + destX = pSmi->ShadowHeight - srcY - 1; + destY = srcX; + + WaitQueue(4); + WRITE_DPR(pSmi, 0x00, (srcX << 16) + srcY); + WRITE_DPR(pSmi, 0x04, (destX << 16) + destY); + WRITE_DPR(pSmi, 0x08, (width << 16) + height); + WRITE_DPR(pSmi, 0x0C, 0xCC | SMI_ROTATE_BLT | + SMI_ROTATE_CW | SMI_START_ENGINE); + break; + case SMI_ROTATE_CCW: + /* 90 degrees CCW rotatation. Calculate destination coordinates: + + *---+ + | | +-----+ + | | | | destX = srcY + | | --> | | destY = shadowWidth - srcX - 1 + | | | | + | | *-----+ + +---+ + */ + destX = srcY; + destY = pSmi->ShadowWidth - srcX - 1; + + WaitQueue(4); + WRITE_DPR(pSmi, 0x00, (srcX << 16) + srcY); + WRITE_DPR(pSmi, 0x04, (destX << 16) + destY); + WRITE_DPR(pSmi, 0x08, (width << 16) + height); + WRITE_DPR(pSmi, 0x0C, 0xCC | SMI_ROTATE_BLT | + SMI_ROTATE_CCW | SMI_START_ENGINE); + break; + default: + /* No rotation, perform a normal copy. */ + if (pScrn->bitsPerPixel == 24) { + srcX *= 3; + width *= 3; + + if (pSmi->Chipset == SMI_LYNX) { + srcY *= 3; + } } - pbox++; + WaitQueue(4); + WRITE_DPR(pSmi, 0x00, (srcX << 16) + srcY); + WRITE_DPR(pSmi, 0x04, (srcX << 16) + srcY); + WRITE_DPR(pSmi, 0x08, (width << 16) + height); + WRITE_DPR(pSmi, 0x0C, 0xCC | SMI_BITBLT | SMI_START_ENGINE); + break; + } } - if (pSmi->rotate) - { - /* If we did a rotation, we need to restore the hardware state here. */ - WaitIdleEmpty(); - WRITE_DPR(pSmi, 0x10, (pSmi->Stride << 16) | pSmi->Stride); - WRITE_DPR(pSmi, 0x3C, (pSmi->Stride << 16) | pSmi->Stride); - WRITE_DPR(pSmi, 0x44, 0); - } + pbox++; + } + + if (pSmi->rotate) { + /* If we did a rotation, we need to restore the hardware state here. */ + WaitIdleEmpty(); + WRITE_DPR(pSmi, 0x10, (pSmi->Stride << 16) | pSmi->Stride); + WRITE_DPR(pSmi, 0x3C, (pSmi->Stride << 16) | pSmi->Stride); + WRITE_DPR(pSmi, 0x44, 0); + } - LEAVE_PROC("SMI_RefreshArea"); + LEAVE_PROC("SMI_RefreshArea"); } /* Custom version for the 730 series (Cougar3DR). @@ -189,155 +176,140 @@ void SMI_RefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox) void SMI_RefreshArea730(ScrnInfoPtr pScrn, int num, BoxPtr pbox) { - SMIPtr pSmi = SMIPTR(pScrn); - int width, height, srcX, srcY, destX, destY; - int maxPixels, tempWidth; + SMIPtr pSmi = SMIPTR(pScrn); + int width, height, srcX, srcY, destX, destY; + int maxPixels, tempWidth; - ENTER_PROC("SMI_RefreshArea730"); + ENTER_PROC("SMI_RefreshArea730"); - /* #671 */ - if (pSmi->polyLines) - { - pSmi->polyLines = FALSE; - return; - } + /* #671 */ + if (pSmi->polyLines) { + pSmi->polyLines = FALSE; + return; + } - if (pSmi->rotate) - { - /* IF we need to do rotation, setup the hardware here. */ - WaitIdleEmpty(); - WRITE_DPR(pSmi, 0x10, pSmi->ShadowPitch); - WRITE_DPR(pSmi, 0x3C, pSmi->ShadowPitch); - WRITE_DPR(pSmi, 0x44, pSmi->FBOffset >> 3); - } + if (pSmi->rotate) { + /* IF we need to do rotation, setup the hardware here. */ + WaitIdleEmpty(); + WRITE_DPR(pSmi, 0x10, pSmi->ShadowPitch); + WRITE_DPR(pSmi, 0x3C, pSmi->ShadowPitch); + WRITE_DPR(pSmi, 0x44, pSmi->FBOffset >> 3); + } - /* #672 */ - if (pSmi->ClipTurnedOn) - { - WaitQueue(1); - WRITE_DPR(pSmi, 0x2C, pSmi->ScissorsLeft); - pSmi->ClipTurnedOn = FALSE; - } + /* #672 */ + if (pSmi->ClipTurnedOn) { + WaitQueue(1); + WRITE_DPR(pSmi, 0x2C, pSmi->ScissorsLeft); + pSmi->ClipTurnedOn = FALSE; + } - /* SM731 cannot rotate-blt more than a certain number of pixels - (based on a calculation from the Windows driver source */ - maxPixels = 1280 / pScrn->bitsPerPixel; - - while (num--) - { - /* Get coordinates of the box to refresh. */ - srcX = pbox->x1; - srcY = pbox->y1; - width = pbox->x2 - srcX; - height = pbox->y2 - srcY; - - DEBUG((VERBLEV, "x=%d y=%d w=%d h=%d\n", srcX, srcY, width, height)); - - if ((width > 0) && (height > 0)) - { - switch (pSmi->rotate) - { - case SMI_ROTATE_CW: - /* 90 degrees CW rotation. Calculate destination - coordinates: - - *---+ - | | +-----* - | | | | destX = shadowHeight - srcY - 1 - | | --> | | destY = srcX - | | | | - | | +-----+ - +---+ - */ - destX = pSmi->ShadowHeight - srcY - 1; - destY = srcX; - - for (tempWidth=width; tempWidth>0;) - { - if (width>maxPixels) - width = maxPixels; - WaitQueue(4); - WRITE_DPR(pSmi, 0x00, (srcX << 16) + srcY); - WRITE_DPR(pSmi, 0x04, (destX << 16) + destY); - WRITE_DPR(pSmi, 0x08, (width << 16) + height); - WRITE_DPR(pSmi, 0x0C, 0xCC | SMI_ROTATE_BLT | - SMI_ROTATE_CW | SMI_START_ENGINE); - destY += maxPixels; - srcX += maxPixels; - tempWidth -= maxPixels; - width = tempWidth; - } - - break; - - case SMI_ROTATE_CCW: - /* 90 degrees CCW rotatation. Calculate destination - coordinates: - - *---+ - | | +-----+ - | | | | destX = srcY - | | --> | | destY = shadowWidth - srcX - 1 - | | | | - | | *-----+ - +---+ - */ - destX = srcY; - destY = pSmi->ShadowWidth - srcX - 1; - - for (tempWidth=width; tempWidth>0;) - { - if (width>maxPixels) - width = maxPixels; - WaitQueue(4); - WRITE_DPR(pSmi, 0x00, (srcX << 16) + srcY); - WRITE_DPR(pSmi, 0x04, (destX << 16) + destY); - WRITE_DPR(pSmi, 0x08, (width << 16) + height); - WRITE_DPR(pSmi, 0x0C, 0xCC | SMI_ROTATE_BLT | - SMI_ROTATE_CCW | SMI_START_ENGINE); - destY -= maxPixels; - srcX += maxPixels; - tempWidth -= maxPixels; - width = tempWidth; - } - - break; - - default: - /* No rotation, perform a normal copy. */ - if (pScrn->bitsPerPixel == 24) - { - srcX *= 3; - width *= 3; - - if (pSmi->Chipset == SMI_LYNX) - { - srcY *= 3; - } - } - - WaitQueue(4); - WRITE_DPR(pSmi, 0x00, (srcX << 16) + srcY); - WRITE_DPR(pSmi, 0x04, (srcX << 16) + srcY); - WRITE_DPR(pSmi, 0x08, (width << 16) + height); - WRITE_DPR(pSmi, 0x0C, SMI_BITBLT + SMI_START_ENGINE + 0xCC); - break; - } + /* SM731 cannot rotate-blt more than a certain number of pixels + (based on a calculation from the Windows driver source */ + maxPixels = 1280 / pScrn->bitsPerPixel; + + while (num--) { + /* Get coordinates of the box to refresh. */ + srcX = pbox->x1; + srcY = pbox->y1; + width = pbox->x2 - srcX; + height = pbox->y2 - srcY; + + DEBUG((VERBLEV, "x=%d y=%d w=%d h=%d\n", srcX, srcY, width, height)); + + if ((width > 0) && (height > 0)) { + switch (pSmi->rotate) { + case SMI_ROTATE_CW: + /* 90 degrees CW rotation. Calculate destination coordinates: + + *---+ + | | +-----* + | | | | destX = shadowHeight - srcY - 1 + | | --> | | destY = srcX + | | | | + | | +-----+ + +---+ + */ + destX = pSmi->ShadowHeight - srcY - 1; + destY = srcX; + + for (tempWidth=width; tempWidth > 0;) { + if (width>maxPixels) + width = maxPixels; + WaitQueue(4); + WRITE_DPR(pSmi, 0x00, (srcX << 16) + srcY); + WRITE_DPR(pSmi, 0x04, (destX << 16) + destY); + WRITE_DPR(pSmi, 0x08, (width << 16) + height); + WRITE_DPR(pSmi, 0x0C, 0xCC | SMI_ROTATE_BLT | + SMI_ROTATE_CW | SMI_START_ENGINE); + destY += maxPixels; + srcX += maxPixels; + tempWidth -= maxPixels; + width = tempWidth; } - pbox++; - } + break; + case SMI_ROTATE_CCW: + /* 90 degrees CCW rotatation. Calculate destination coordinates: + + *---+ + | | +-----+ + | | | | destX = srcY + | | --> | | destY = shadowWidth - srcX - 1 + | | | | + | | *-----+ + +---+ + */ + destX = srcY; + destY = pSmi->ShadowWidth - srcX - 1; + + for (tempWidth=width; tempWidth > 0;) { + if (width>maxPixels) + width = maxPixels; + WaitQueue(4); + WRITE_DPR(pSmi, 0x00, (srcX << 16) + srcY); + WRITE_DPR(pSmi, 0x04, (destX << 16) + destY); + WRITE_DPR(pSmi, 0x08, (width << 16) + height); + WRITE_DPR(pSmi, 0x0C, 0xCC | SMI_ROTATE_BLT | + SMI_ROTATE_CCW | SMI_START_ENGINE); + destY -= maxPixels; + srcX += maxPixels; + tempWidth -= maxPixels; + width = tempWidth; + } + + break; + default: + /* No rotation, perform a normal copy. */ + if (pScrn->bitsPerPixel == 24) { + srcX *= 3; + width *= 3; - if (pSmi->rotate) - { - /* If we did a rotation, we need to restore the hardware state here. */ - WaitIdleEmpty(); - WRITE_DPR(pSmi, 0x10, (pSmi->Stride << 16) | pSmi->Stride); - WRITE_DPR(pSmi, 0x3C, (pSmi->Stride << 16) | pSmi->Stride); - WRITE_DPR(pSmi, 0x44, 0); + if (pSmi->Chipset == SMI_LYNX) { + srcY *= 3; + } + } + + WaitQueue(4); + WRITE_DPR(pSmi, 0x00, (srcX << 16) + srcY); + WRITE_DPR(pSmi, 0x04, (srcX << 16) + srcY); + WRITE_DPR(pSmi, 0x08, (width << 16) + height); + WRITE_DPR(pSmi, 0x0C, 0xCC | SMI_BITBLT | SMI_START_ENGINE); + break; + } } - LEAVE_PROC("SMI_RefreshArea730"); + pbox++; + } + + if (pSmi->rotate) { + /* If we did a rotation, we need to restore the hardware state here. */ + WaitIdleEmpty(); + WRITE_DPR(pSmi, 0x10, (pSmi->Stride << 16) | pSmi->Stride); + WRITE_DPR(pSmi, 0x3C, (pSmi->Stride << 16) | pSmi->Stride); + WRITE_DPR(pSmi, 0x44, 0); + } + + LEAVE_PROC("SMI_RefreshArea730"); } /******************************************************************************\ @@ -345,8 +317,8 @@ void SMI_RefreshArea730(ScrnInfoPtr pScrn, int num, BoxPtr pbox) |*============================================================================= |* |* PARAMETERS: index Index of current screen. -|* x X location of pointer. -|* y Y location of pointer. +|* x X location of pointer. +|* y Y location of pointer. |* |* DESCRIPTION: Adjust the pointer location if we are in rotation mode. |* @@ -359,27 +331,25 @@ void SMI_PointerMoved(int index, int x, int y) SMIPtr pSmi = SMIPTR(pScrn); int newX, newY; - switch (pSmi->rotate) - { - case SMI_ROTATE_CW: - /* 90 degrees CW rotation. */ - newX = pScrn->pScreen->height - y - 1; - newY = x; - break; - - case SMI_ROTATE_CCW: - /* 90 degrees CCW rotation. */ - newX = y; - newY = pScrn->pScreen->width - x - 1; - break; - - default: - /* No rotation. */ - newX = x; - newY = y; - break; + switch (pSmi->rotate) { + case SMI_ROTATE_CW: + /* 90 degrees CW rotation. */ + newX = pScrn->pScreen->height - y - 1; + newY = x; + break; + case SMI_ROTATE_CCW: + /* 90 degrees CCW rotation. */ + newX = y; + newY = pScrn->pScreen->width - x - 1; + break; + default: + /* No rotation. */ + newX = x; + newY = y; + break; } - /* Pass adjusted pointer coordinates original PointerMoved function. */ + /* Pass adjusted pointer coordinates original PointerMoved function. */ (*pSmi->PointerMoved)(index, newX, newY); } + |