[PATCH xf86-video-trident 2/3] Fix indentation for image_accel.c
Kevin Brace
kevinbrace at gmx.com
Tue Feb 19 20:37:36 UTC 2019
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
---
src/image_accel.c | 561 ++++++++++++++++++++++++++++++++++--------------------
1 file changed, 351 insertions(+), 210 deletions(-)
diff --git a/src/image_accel.c b/src/image_accel.c
index 1ed074e..b90e0d3 100644
--- a/src/image_accel.c
+++ b/src/image_accel.c
@@ -1,26 +1,28 @@
/*
* Copyright 1997-2003 by Alan Hourihane, North Wales, UK.
*
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Alan Hourihane not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Alan Hourihane makes no representations
- * about the suitability of this software for any purpose. It is provided
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of Alan
+ * Hourihane not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Alan Hourihane makes no representations about the
+ * suitability of this software for any purpose. It is provided
* "as is" without express or implied warranty.
*
- * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
+ * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY
+ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
*
* Authors: Alan Hourihane, <alanh at fairlite.demon.co.uk>
- *
+ *
* Trident 3DImage' accelerated options.
*/
@@ -42,57 +44,88 @@
#include "xaarop.h"
#include "xaalocal.h"
+
static void ImageSync(ScrnInfoPtr pScrn);
static void ImageSyncClip(ScrnInfoPtr pScrn);
#if 0
-static void ImageSetupForSolidLine(ScrnInfoPtr pScrn, int color,
- int rop, unsigned int planemask);
+static void ImageSetupForSolidLine(ScrnInfoPtr pScrn,
+ int color,
+ int rop,
+ unsigned int planemask);
static void ImageSubsequentSolidBresenhamLine(ScrnInfoPtr pScrn,
- int x, int y, int dmaj, int dmin, int e,
- int len, int octant);
+ int x, int y,
+ int dmaj, int dmin,
+ int e, int len,
+ int octant);
#endif
-static void ImageSetupForFillRectSolid(ScrnInfoPtr pScrn, int color,
- int rop, unsigned int planemask);
-static void ImageSubsequentFillRectSolid(ScrnInfoPtr pScrn, int x,
- int y, int w, int h);
+static void ImageSetupForFillRectSolid(ScrnInfoPtr pScrn,
+ int color,
+ int rop,
+ unsigned int planemask);
+static void ImageSubsequentFillRectSolid(ScrnInfoPtr pScrn,
+ int x, int y,
+ int w, int h);
static void ImageSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn,
- int x1, int y1, int x2,
- int y2, int w, int h);
+ int x1, int y1,
+ int x2, int y2,
+ int w, int h);
static void ImageSetupForScreenToScreenCopy(ScrnInfoPtr pScrn,
- int xdir, int ydir, int rop,
- unsigned int planemask,
- int transparency_color);
-static void ImageSetClippingRectangle(ScrnInfoPtr pScrn, int x1, int y1,
- int x2, int y2);
+ int xdir, int ydir,
+ int rop,
+ unsigned int planemask,
+ int transparency_color);
+static void ImageSetClippingRectangle(ScrnInfoPtr pScrn,
+ int x1, int y1,
+ int x2, int y2);
static void ImageDisableClipping(ScrnInfoPtr pScrn);
-static void ImageSetupForMono8x8PatternFill(ScrnInfoPtr pScrn,
- int patternx, int patterny, int fg, int bg,
- int rop, unsigned int planemask);
-static void ImageSubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn,
- int patternx, int patterny, int x, int y,
- int w, int h);
+static void ImageSetupForMono8x8PatternFill(ScrnInfoPtr pScrn,
+ int patternx,
+ int patterny,
+ int fg, int bg,
+ int rop,
+ unsigned int planemask);
+static void ImageSubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn,
+ int patternx,
+ int patterny,
+ int x, int y,
+ int w, int h);
#if 0
-static void ImageSetupForColor8x8PatternFill(ScrnInfoPtr pScrn,
- int patternx, int patterny,
- int rop, unsigned int planemask, int trans_col);
-static void ImageSubsequentColor8x8PatternFillRect(ScrnInfoPtr pScrn,
- int patternx, int patterny, int x, int y,
- int w, int h);
+static void ImageSetupForColor8x8PatternFill(ScrnInfoPtr pScrn,
+ int patternx,
+ int patterny,
+ int rop,
+ unsigned int planemask,
+ int trans_col);
+static void ImageSubsequentColor8x8PatternFillRect(ScrnInfoPtr pScrn,
+ int patternx,
+ int patterny,
+ int x, int y,
+ int w, int h);
#endif
-static void ImageSetupForScanlineImageWrite(ScrnInfoPtr pScrn, int rop,
- unsigned int planemask, int transparency_color,
- int bpp, int depth);
-static void ImageSubsequentScanlineImageWriteRect(ScrnInfoPtr pScrn, int x,
- int y, int w, int h, int skipleft);
-static void ImageSubsequentImageWriteScanline(ScrnInfoPtr pScrn, int bufno);
+static void ImageSetupForScanlineImageWrite(ScrnInfoPtr pScrn,
+ int rop,
+ unsigned int planemask,
+ int transparency_color,
+ int bpp,
+ int depth);
+static void ImageSubsequentScanlineImageWriteRect(ScrnInfoPtr pScrn,
+ int x, int y,
+ int w, int h,
+ int skipleft);
+static void ImageSubsequentImageWriteScanline(ScrnInfoPtr pScrn,
+ int bufno);
static void ImageSetupForScanlineCPUToScreenColorExpandFill(
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask);
+ ScrnInfoPtr pScrn,
+ int fg, int bg,
+ int rop,
+ unsigned int planemask);
static void ImageSubsequentScanlineCPUToScreenColorExpandFill(
- ScrnInfoPtr pScrn, int x,
- int y, int w, int h, int skipleft);
-static void ImageSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno);
+ ScrnInfoPtr pScrn,
+ int x, int y,
+ int w, int h,
+ int skipleft);
+static void ImageSubsequentColorExpandScanline(ScrnInfoPtr pScrn,
+ int bufno);
static void
@@ -121,12 +154,14 @@ ImageInitializeAccelerator(ScrnInfoPtr pScrn)
IMAGE_OUT(0x2148, 0x00000000);
IMAGE_OUT(0x2150, 0x00000000);
IMAGE_OUT(0x2154, 0x00000000);
- IMAGE_OUT(0x2120, 0x60000000 |pScrn->displayWidth<<16 |pScrn->displayWidth);
+ IMAGE_OUT(0x2120, 0x60000000 |
+ (pScrn->displayWidth << 16) |
+ pScrn->displayWidth);
IMAGE_OUT(0x216C, 0x00000000);
IMAGE_OUT(0x2170, 0x00000000);
IMAGE_OUT(0x217C, 0x00000000);
IMAGE_OUT(0x2120, 0x10000000);
- IMAGE_OUT(0x2130, 2047 << 16 | 2047);
+ IMAGE_OUT(0x2130, (2047 << 16) | 2047);
pTrident->Clipping = FALSE;
pTrident->DstEnable = FALSE;
}
@@ -159,15 +194,16 @@ ImageAccelInit(ScreenPtr pScreen)
infoPtr->SetClippingRectangle = ImageSetClippingRectangle;
infoPtr->DisableClipping = ImageDisableClipping;
infoPtr->ClippingFlags = HARDWARE_CLIP_SOLID_FILL |
- HARDWARE_CLIP_SCREEN_TO_SCREEN_COPY |
- HARDWARE_CLIP_MONO_8x8_FILL;
+ HARDWARE_CLIP_SCREEN_TO_SCREEN_COPY |
+ HARDWARE_CLIP_MONO_8x8_FILL;
#endif
#if 0
infoPtr->SolidLineFlags = NO_PLANEMASK;
infoPtr->SetupForSolidLine = ImageSetupForSolidLine;
infoPtr->SolidBresenhamLineErrorTermBits = 13;
- infoPtr->SubsequentSolidBresenhamLine = ImageSubsequentSolidBresenhamLine;
+ infoPtr->SubsequentSolidBresenhamLine =
+ ImageSubsequentSolidBresenhamLine;
infoPtr->ClippingFlags |= HARDWARE_CLIP_SOLID_LINE;
#endif
@@ -176,70 +212,78 @@ ImageAccelInit(ScreenPtr pScreen)
infoPtr->SubsequentSolidFillRect = ImageSubsequentFillRectSolid;
infoPtr->ScreenToScreenCopyFlags = NO_PLANEMASK |
- NO_TRANSPARENCY |
- ONLY_TWO_BITBLT_DIRECTIONS;
+ NO_TRANSPARENCY |
+ ONLY_TWO_BITBLT_DIRECTIONS;
- infoPtr->SetupForScreenToScreenCopy =
- ImageSetupForScreenToScreenCopy;
- infoPtr->SubsequentScreenToScreenCopy =
- ImageSubsequentScreenToScreenCopy;
+ infoPtr->SetupForScreenToScreenCopy =
+ ImageSetupForScreenToScreenCopy;
+ infoPtr->SubsequentScreenToScreenCopy =
+ ImageSubsequentScreenToScreenCopy;
- infoPtr->Mono8x8PatternFillFlags = NO_PLANEMASK |
- BIT_ORDER_IN_BYTE_MSBFIRST |
- HARDWARE_PATTERN_SCREEN_ORIGIN |
- HARDWARE_PATTERN_PROGRAMMED_BITS;
+ infoPtr->Mono8x8PatternFillFlags = NO_PLANEMASK |
+ BIT_ORDER_IN_BYTE_MSBFIRST |
+ HARDWARE_PATTERN_SCREEN_ORIGIN |
+ HARDWARE_PATTERN_PROGRAMMED_BITS;
infoPtr->SetupForMono8x8PatternFill =
- ImageSetupForMono8x8PatternFill;
- infoPtr->SubsequentMono8x8PatternFillRect =
- ImageSubsequentMono8x8PatternFillRect;
+ ImageSetupForMono8x8PatternFill;
+ infoPtr->SubsequentMono8x8PatternFillRect =
+ ImageSubsequentMono8x8PatternFillRect;
#if 0
- infoPtr->Color8x8PatternFillFlags = NO_PLANEMASK |
- NO_TRANSPARENCY |
- HARDWARE_PATTERN_SCREEN_ORIGIN |
- BIT_ORDER_IN_BYTE_MSBFIRST;
+ infoPtr->Color8x8PatternFillFlags = NO_PLANEMASK |
+ NO_TRANSPARENCY |
+ HARDWARE_PATTERN_SCREEN_ORIGIN |
+ BIT_ORDER_IN_BYTE_MSBFIRST;
infoPtr->SetupForColor8x8PatternFill =
- ImageSetupForColor8x8PatternFill;
- infoPtr->SubsequentColor8x8PatternFillRect =
- ImageSubsequentColor8x8PatternFillRect;
+ ImageSetupForColor8x8PatternFill;
+ infoPtr->SubsequentColor8x8PatternFillRect =
+ ImageSubsequentColor8x8PatternFillRect;
infoPtr->ClippingFlags |= HARDWARE_CLIP_COLOR_8x8_FILL;
#endif
if (pTrident->Chipset != CYBER9397DVD) {
- /* It seems as though the 9397DVD doesn't like the transfer window */
- /* But then, I've also tried at the two port addresses too, with */
- /* no luck. Disable for this chipset for now. I'd guess there's some */
- /* extra setup needed for this chipset. */
- infoPtr->ScanlineCPUToScreenColorExpandFillFlags = NO_PLANEMASK |
- LEFT_EDGE_CLIPPING |
- BIT_ORDER_IN_BYTE_MSBFIRST;
+ /*
+ * It seems as though the 9397DVD doesn't like the transfer
+ * window. But then, I've also tried at the two port
+ * addresses too, with no luck. Disable for this chipset for
+ * now. I'd guess there's some extra setup needed for this
+ * chipset.
+ */
+ infoPtr->ScanlineCPUToScreenColorExpandFillFlags =
+ NO_PLANEMASK |
+ LEFT_EDGE_CLIPPING |
+ BIT_ORDER_IN_BYTE_MSBFIRST;
pTrident->XAAScanlineColorExpandBuffers[0] =
- xnfalloc(((pScrn->virtualX + 63)) *4* (pScrn->bitsPerPixel / 8));
+ xnfalloc(((pScrn->virtualX + 63)) * 4 *
+ (pScrn->bitsPerPixel / 8));
infoPtr->NumScanlineColorExpandBuffers = 1;
infoPtr->ScanlineColorExpandBuffers =
- pTrident->XAAScanlineColorExpandBuffers;
+ pTrident->XAAScanlineColorExpandBuffers;
infoPtr->SetupForScanlineCPUToScreenColorExpandFill =
- ImageSetupForScanlineCPUToScreenColorExpandFill;
+ ImageSetupForScanlineCPUToScreenColorExpandFill;
infoPtr->SubsequentScanlineCPUToScreenColorExpandFill =
- ImageSubsequentScanlineCPUToScreenColorExpandFill;
+ ImageSubsequentScanlineCPUToScreenColorExpandFill;
infoPtr->SubsequentColorExpandScanline =
- ImageSubsequentColorExpandScanline;
+ ImageSubsequentColorExpandScanline;
infoPtr->ScanlineImageWriteFlags = NO_PLANEMASK |
- LEFT_EDGE_CLIPPING;
+ LEFT_EDGE_CLIPPING;
- infoPtr->SetupForScanlineImageWrite = ImageSetupForScanlineImageWrite;
+ infoPtr->SetupForScanlineImageWrite =
+ ImageSetupForScanlineImageWrite;
infoPtr->SubsequentScanlineImageWriteRect =
ImageSubsequentScanlineImageWriteRect;
- infoPtr->SubsequentImageWriteScanline = ImageSubsequentImageWriteScanline;
+ infoPtr->SubsequentImageWriteScanline =
+ ImageSubsequentImageWriteScanline;
infoPtr->NumScanlineImageWriteBuffers = 1;
- infoPtr->ScanlineImageWriteBuffers = pTrident->XAAImageScanlineBuffer;
+ infoPtr->ScanlineImageWriteBuffers =
+ pTrident->XAAImageScanlineBuffer;
pTrident->XAAImageScanlineBuffer[0] =
xnfalloc(pScrn->virtualX * pScrn->bitsPerPixel / 8);
@@ -273,6 +317,7 @@ ImageSync(ScrnInfoPtr pScrn)
ErrorF("GE timeout\n");
IMAGE_OUT(0x2164, 0x80000000);
}
+
IMAGEBUSY(busy);
}
}
@@ -290,60 +335,74 @@ ImageSyncClip(ScrnInfoPtr pScrn)
ErrorF("GE timeout\n");
IMAGE_OUT(0x2164, 0x80000000);
}
+
IMAGEBUSY(busy);
}
}
static void
-ImageSetupForScreenToScreenCopy(ScrnInfoPtr pScrn,
- int xdir, int ydir, int rop,
- unsigned int planemask, int transparency_color)
+ImageSetupForScreenToScreenCopy(ScrnInfoPtr pScrn,
+ int xdir, int ydir,
+ int rop,
+ unsigned int planemask,
+ int transparency_color)
{
TRIDENTPtr pTrident = TRIDENTPTR(pScrn);
pTrident->BltScanDirection = 0;
- if ((xdir < 0) || (ydir < 0)) pTrident->BltScanDirection |= 1<<2;
+ if ((xdir < 0) || (ydir < 0))
+ pTrident->BltScanDirection |= (1 << 2);
IMAGE_OUT(0x2120, 0x80000000);
IMAGE_OUT(0x2120, 0x90000000 | XAAGetCopyROP(rop));
if (transparency_color != -1) {
- IMAGE_OUT(0x2120, 0x70000000 | 1<<26 | (transparency_color&0xffffff));
+ IMAGE_OUT(0x2120, 0x70000000 |
+ (1 << 26) |
+ (transparency_color & 0xffffff));
pTrident->DstEnable = TRUE;
}
}
static void
-ImageSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int x1, int y1,
- int x2, int y2, int w, int h)
+ImageSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn,
+ int x1, int y1,
+ int x2, int y2,
+ int w, int h)
{
TRIDENTPtr pTrident = TRIDENTPTR(pScrn);
if (pTrident->BltScanDirection) {
- IMAGE_OUT(0x2100, (y1+h-1)<<16 | (x1+w-1));
- IMAGE_OUT(0x2104, y1<<16 | x1);
- IMAGE_OUT(0x2108, (y2+h-1)<<16 | (x2+w-1));
+ IMAGE_OUT(0x2100, ((y1 + h - 1) << 16) | (x1 + w - 1));
+ IMAGE_OUT(0x2104, (y1 << 16) | x1);
+ IMAGE_OUT(0x2108, ((y2 + h - 1) << 16) | (x2 + w - 1));
IMAGE_OUT(0x210C, y2<<16 | x2);
} else {
- IMAGE_OUT(0x2100, y1<<16 | x1);
- IMAGE_OUT(0x2104, (y1+h-1)<<16 | (x1+w-1));
- IMAGE_OUT(0x2108, y2<<16 | x2);
- IMAGE_OUT(0x210C, (y2+h-1)<<16 | (x2+w-1));
+ IMAGE_OUT(0x2100, (y1 << 16) | x1);
+ IMAGE_OUT(0x2104, ((y1 + h - 1) << 16) | (x1 + w - 1));
+ IMAGE_OUT(0x2108, (y2 << 16) | x2);
+ IMAGE_OUT(0x210C, ((y2 + h - 1) << 16) | (x2 + w - 1));
}
- IMAGE_OUT(0x2124, 0x80000000 | 1<<7 | 1<<22 | 1<<10 | pTrident->BltScanDirection | (pTrident->Clipping ? 1 : 0));
+ IMAGE_OUT(0x2124, 0x80000000 |
+ (1 << 7) | (1 << 22) | (1 << 10) |
+ pTrident->BltScanDirection |
+ (pTrident->Clipping ? 1 : 0));
if (!pTrident->UsePCIRetry)
ImageSyncClip(pScrn);
}
static void
-ImageSetClippingRectangle(ScrnInfoPtr pScrn, int x1, int y1, int x2, int y2)
+ImageSetClippingRectangle(ScrnInfoPtr pScrn,
+ int x1, int y1,
+ int x2, int y2)
{
TRIDENTPtr pTrident = TRIDENTPTR(pScrn);
- IMAGE_OUT(0x2120, 0x10000000 | ((y1&0xfff)<<16) | (x1&0xfff));
- IMAGE_OUT(0x2130, ((y2&0xfff)<<16) | (x2&0xfff));
+ IMAGE_OUT(0x2120, 0x10000000 |
+ ((y1 & 0xfff) << 16) | (x1 & 0xfff));
+ IMAGE_OUT(0x2130, ((y2 & 0xfff) << 16) | (x2 & 0xfff));
pTrident->Clipping = TRUE;
}
@@ -356,8 +415,10 @@ ImageDisableClipping(ScrnInfoPtr pScrn)
#if 0
static void
-ImageSetupForSolidLine(ScrnInfoPtr pScrn, int color,
- int rop, unsigned int planemask)
+ImageSetupForSolidLine(ScrnInfoPtr pScrn,
+ int color,
+ int rop,
+ unsigned int planemask)
{
TRIDENTPtr pTrident = TRIDENTPTR(pScrn);
@@ -367,40 +428,83 @@ ImageSetupForSolidLine(ScrnInfoPtr pScrn, int color,
IMAGE_OUT(0x2144, color);
}
-static void
-ImageSubsequentSolidBresenhamLine( ScrnInfoPtr pScrn,
- int x, int y, int dmaj, int dmin, int e, int len, int octant)
+static void
+ImageSubsequentSolidBresenhamLine(ScrnInfoPtr pScrn,
+ int x, int y,
+ int dmaj, int dmin,
+ int e, int len, int octant)
{
TRIDENTPtr pTrident = TRIDENTPTR(pScrn);
int tmp;
int D = 0, E = 0, ymajor = 0;
- IMAGE_OUT(0x2124, 0x20000000 | 3<<22 | 1<<10 | 1<<9 | (pTrident->Clipping ? 1:0));
+ IMAGE_OUT(0x2124, 0x20000000 |
+ (3 << 22) | (1 << 10) | (1 << 9) |
+ (pTrident->Clipping ? 1 : 0));
if (!(octant & YMAJOR)) {
- if ((!(octant&XDECREASING)) && (!(octant&YDECREASING))) {E = 1; D = 0;}
- if ((!(octant&XDECREASING)) && ( (octant&YDECREASING))) {E = 1; D = 1;}
- if (( (octant&XDECREASING)) && (!(octant&YDECREASING))) {E = 1; D = 2;}
- if (( (octant&XDECREASING)) && ( (octant&YDECREASING))) {E = 1; D = 3;}
+ if ((!(octant & XDECREASING)) && (!(octant & YDECREASING))) {
+ E = 1;
+ D = 0;
+ }
+
+ if ((!(octant & XDECREASING)) && ( (octant & YDECREASING))) {
+ E = 1;
+ D = 1;
+ }
+
+ if (( (octant & XDECREASING)) && (!(octant & YDECREASING))) {
+ E = 1;
+ D = 2;
+ }
+ if (( (octant & XDECREASING)) && ( (octant & YDECREASING))) {
+ E = 1;
+ D = 3;
+ }
+
ymajor = 0;
} else {
- if ((!(octant&XDECREASING)) && (!(octant&YDECREASING))) {E = 0; D = 0;}
- if ((!(octant&XDECREASING)) && ( (octant&YDECREASING))) {E = 0; D = 2;}
- if (( (octant&XDECREASING)) && (!(octant&YDECREASING))) {E = 0; D = 1;}
- if (( (octant&XDECREASING)) && ( (octant&YDECREASING))) {E = 0; D = 3;}
- ymajor = 1<<18;
+ if ((!(octant & XDECREASING)) && (!(octant & YDECREASING))) {
+ E = 0;
+ D = 0;
+ }
+
+ if ((!(octant & XDECREASING)) && ( (octant & YDECREASING))) {
+ E = 0;
+ D = 2;
+ }
+
+ if (( (octant & XDECREASING)) && (!(octant & YDECREASING))) {
+ E = 0;
+ D = 1;
+ }
+
+ if (( (octant & XDECREASING)) && ( (octant & YDECREASING))) {
+ E = 0;
+ D = 3;
+ }
+
+ ymajor = (1 << 18);
}
- if (E) {
- tmp = x; x = y; y = tmp;
+ if (E) {
+ tmp = x;
+ x = y;
+ y = tmp;
}
- if (D&0x02) {
- IMAGE_OUT(0x21FC, 0x20000000 | 1<<27 | 1<<19 | 1<<17 | ymajor | (x+len-1));
+ if (D & 0x02) {
+ IMAGE_OUT(0x21FC, 0x20000000 |
+ (1 << 27) | (1 << 19) | (1 << 17) |
+ ymajor | (x + len - 1));
} else {
- IMAGE_OUT(0x21FC, 0x20000000 | 1<<27 | 1<<19 | 1<<17 | ymajor | (y+len-1));
+ IMAGE_OUT(0x21FC, 0x20000000 |
+ (1 << 27) | (1 << 19) | (1 << 17) |
+ ymajor | ( y + len - 1));
}
- IMAGE_OUT(0x2100, E<<30 | (y&0xfff)<<16 | (x&0xfff));
- IMAGE_OUT(0x2104, D<<30 | (((dmaj-dmin)&0xfff) << 16) | (-dmin&0xfff));
- IMAGE_OUT(0x2108, ((-e&0xfff) << 16));
+ IMAGE_OUT(0x2100, (E << 30) | ((y & 0xfff) << 16) | (x & 0xfff));
+ IMAGE_OUT(0x2104, (D << 30) |
+ (((dmaj - dmin) & 0xfff) << 16) |
+ (-dmin & 0xfff));
+ IMAGE_OUT(0x2108, ((-e & 0xfff) << 16));
if (!pTrident->UsePCIRetry)
ImageSyncClip(pScrn);
@@ -408,8 +512,10 @@ ImageSubsequentSolidBresenhamLine( ScrnInfoPtr pScrn,
#endif
static void
-ImageSetupForFillRectSolid(ScrnInfoPtr pScrn, int color,
- int rop, unsigned int planemask)
+ImageSetupForFillRectSolid(ScrnInfoPtr pScrn,
+ int color,
+ int rop,
+ unsigned int planemask)
{
TRIDENTPtr pTrident = TRIDENTPTR(pScrn);
@@ -420,28 +526,34 @@ ImageSetupForFillRectSolid(ScrnInfoPtr pScrn, int color,
}
static void
-ImageSubsequentFillRectSolid(ScrnInfoPtr pScrn, int x, int y, int w, int h)
+ImageSubsequentFillRectSolid(ScrnInfoPtr pScrn,
+ int x, int y,
+ int w, int h)
{
TRIDENTPtr pTrident = TRIDENTPTR(pScrn);
- if ((w<=0) || (h<=0))
+ if ((w <= 0) || (h <= 0))
return;
- IMAGE_OUT(0x2108, ((y&0xfff)<<16) | (x&0xfff));
- IMAGE_OUT(0x210C, (((y+h-1)&0xfff)<<16) | ((x+w-1)&0xfff));
- IMAGE_OUT(0x2124, 0x80000000| 3<<22| 1<<10| 1<<9| (pTrident->Clipping?1:0));
+ IMAGE_OUT(0x2108, ((y & 0xfff) << 16) | (x & 0xfff));
+ IMAGE_OUT(0x210C, (((y + h - 1) & 0xfff) << 16) |
+ ((x + w - 1) & 0xfff));
+ IMAGE_OUT(0x2124, 0x80000000 |
+ (3 << 22) | (1 << 10) | (1 << 9) |
+ (pTrident->Clipping ? 1 : 0));
if (!pTrident->UsePCIRetry)
ImageSyncClip(pScrn);
}
-static
-void MoveDWORDS(
- register CARD32* dest,
- register CARD32* src,
- register int dwords )
+static void
+MoveDWORDS(register CARD32* dest,
+ register CARD32* src,
+ register int dwords )
{
Bool extra = FALSE;
+
if (dwords & 0x01) extra = TRUE;
+
while(dwords & ~0x03) {
*dest = *src;
*(dest + 1) = *(src + 1);
@@ -451,36 +563,41 @@ void MoveDWORDS(
dest += 4;
dwords -= 4;
}
+
if(!dwords) {
if (extra) *dest = 0x00000000;
return;
}
+
*dest = *src;
if(dwords == 1) {
if (extra) *(dest + 1) = 0x00000000;
return;
}
+
*(dest + 1) = *(src + 1);
if(dwords == 2) {
if (extra) *(dest + 2) = 0x00000000;
return;
}
+
*(dest + 2) = *(src + 2);
if (extra) *(dest + 3) = 0x00000000;
}
-static void
-ImageSetupForMono8x8PatternFill(ScrnInfoPtr pScrn,
- int patternx, int patterny,
- int fg, int bg, int rop,
- unsigned int planemask)
+static void
+ImageSetupForMono8x8PatternFill(ScrnInfoPtr pScrn,
+ int patternx, int patterny,
+ int fg, int bg,
+ int rop,
+ unsigned int planemask)
{
TRIDENTPtr pTrident = TRIDENTPTR(pScrn);
IMAGE_OUT(0x2120, 0x90000000 | XAAGetPatternROP(rop));
if (bg == -1) {
REPLICATE(fg);
- IMAGE_OUT(0x2120, 0x80000000 | 1<<27);
+ IMAGE_OUT(0x2120, 0x80000000 | (1 << 27));
IMAGE_OUT(0x2130, patternx);
IMAGE_OUT(0x2134, patterny);
IMAGE_OUT(0x2150, fg);
@@ -488,7 +605,7 @@ ImageSetupForMono8x8PatternFill(ScrnInfoPtr pScrn,
} else {
REPLICATE(bg);
REPLICATE(fg);
- IMAGE_OUT(0x2120, 0x80000000 | 1<<27 | 1<<26);
+ IMAGE_OUT(0x2120, 0x80000000 | (1 << 27) | (1 << 26));
IMAGE_OUT(0x2130, patternx);
IMAGE_OUT(0x2134, patterny);
IMAGE_OUT(0x2150, fg);
@@ -496,75 +613,84 @@ ImageSetupForMono8x8PatternFill(ScrnInfoPtr pScrn,
}
}
-static void
-ImageSubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn,
- int patternx, int patterny,
- int x, int y,
- int w, int h)
+static void
+ImageSubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn,
+ int patternx, int patterny,
+ int x, int y,
+ int w, int h)
{
TRIDENTPtr pTrident = TRIDENTPTR(pScrn);
- IMAGE_OUT(0x2108, ((y&0xfff)<<16) | (x&0xfff));
- IMAGE_OUT(0x210C, (((y+h-1)&0xfff)<<16) | ((x+w-1)&0xfff));
- IMAGE_OUT(0x2124, 0x80000000 | 7<<18 | 1<<22 | 1<<10 | 1<<9 | (pTrident->Clipping ? 1 : 0));
+ IMAGE_OUT(0x2108, ((y & 0xfff) << 16) | (x & 0xfff));
+ IMAGE_OUT(0x210C, (((y + h - 1) & 0xfff) << 16) |
+ ((x + w - 1) & 0xfff));
+ IMAGE_OUT(0x2124, 0x80000000 |
+ (7 << 18) | (1 << 22) | (1 << 10) | (1 << 9) |
+ (pTrident->Clipping ? 1 : 0));
if (!pTrident->UsePCIRetry)
ImageSyncClip(pScrn);
}
#if 0
-static void
-ImageSetupForColor8x8PatternFill(ScrnInfoPtr pScrn,
- int patternx, int patterny,
- int rop,
- unsigned int planemask,
- int transparency_color)
+static void
+ImageSetupForColor8x8PatternFill(ScrnInfoPtr pScrn,
+ int patternx, int patterny,
+ int rop,
+ unsigned int planemask,
+ int transparency_color)
{
TRIDENTPtr pTrident = TRIDENTPTR(pScrn);
IMAGE_OUT(0x2120, 0x90000000 | XAAGetPatternROP(rop));
- IMAGE_OUT(0x2120, 0x80000000 | 1<<26);
+ IMAGE_OUT(0x2120, 0x80000000 | (1 << 26));
if (transparency_color != -1) {
- IMAGE_OUT(0x2120, 0x70000000 | 1<<26 | (transparency_color&0xffffff));
+ IMAGE_OUT(0x2120, 0x70000000 |
+ (1 << 26) |
+ (transparency_color & 0xffffff));
pTrident->DstEnable = TRUE;
}
}
-static void
-ImageSubsequentColor8x8PatternFillRect(ScrnInfoPtr pScrn,
- int patternx, int patterny,
- int x, int y,
- int w, int h)
+static void
+ImageSubsequentColor8x8PatternFillRect(ScrnInfoPtr pScrn,
+ int patternx, int patterny,
+ int x, int y,
+ int w, int h)
{
TRIDENTPtr pTrident = TRIDENTPTR(pScrn);
- IMAGE_OUT(0x2100, (patterny&0xfff)<<16 | (patternx&0xfff));
- IMAGE_OUT(0x2104, (((patterny+h-1)&0xfff)<<16) | ((patternx+w-1)&0xfff));
- IMAGE_OUT(0x2108, (y&0xfff)<<16 | (x&0xfff));
- IMAGE_OUT(0x210C, (((y+h-1)&0xfff)<<16) | ((x+w-1)&0xfff));
- IMAGE_OUT(0x2124, 0x80000000 | 1<<22 | 1<<10 | 1<<7 | (pTrident->Clipping ? 1 : 0));
+ IMAGE_OUT(0x2100, ((patterny & 0xfff) << 16) |
+ (patternx & 0xfff));
+ IMAGE_OUT(0x2104, (((patterny + h - 1) & 0xfff) << 16) |
+ ((patternx + w - 1) & 0xfff));
+ IMAGE_OUT(0x2108, ((y & 0xfff) << 16) | (x & 0xfff));
+ IMAGE_OUT(0x210C, (((y + h - 1) & 0xfff) << 16) |
+ ((x + w - 1) & 0xfff));
+ IMAGE_OUT(0x2124, 0x80000000 |
+ (1 << 22) | (1 << 10) | (1 << 7) |
+ (pTrident->Clipping ? 1 : 0));
if (!pTrident->UsePCIRetry)
ImageSyncClip(pScrn);
}
#endif
static void
-ImageSetupForScanlineCPUToScreenColorExpandFill(
- ScrnInfoPtr pScrn,
- int fg, int bg,
- int rop,
- unsigned int planemask
+ImageSetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
+ int fg, int bg,
+ int rop,
+ unsigned int planemask
){
TRIDENTPtr pTrident = TRIDENTPTR(pScrn);
IMAGE_OUT(0x2120, 0x80000000);
IMAGE_OUT(0x2120, 0x90000000 | XAAGetCopyROP(rop));
if (bg == -1) {
- pTrident->ROP = 2<<22;
+ pTrident->ROP = (2 << 22);
REPLICATE(fg);
IMAGE_OUT(0x2144, fg);
IMAGE_OUT(0x2148, ~fg);
} else {
- pTrident->ROP = 3<<22;
+ pTrident->ROP = (3 << 22);
REPLICATE(fg);
IMAGE_OUT(0x2144, fg);
REPLICATE(bg);
@@ -573,16 +699,18 @@ ImageSetupForScanlineCPUToScreenColorExpandFill(
}
static void
-ImageSubsequentScanlineCPUToScreenColorExpandFill(
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- int skipleft
+ImageSubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
+ int x, int y,
+ int w, int h,
+ int skipleft
){
TRIDENTPtr pTrident = TRIDENTPTR(pScrn);
- ImageSetClippingRectangle(pScrn,(x+skipleft),y,(x+w-1),(y+h-1));
- IMAGE_OUT(0x2108, (y&0xfff)<<16 | (x&0xfff));
- IMAGE_OUT(0x210C, (((y+h-1)&0xfff)<<16) | ((x+w-1)&0xfff));
- IMAGE_OUT(0x2124, 0x80000000 | pTrident->ROP | 1<<10 | 1);
+ ImageSetClippingRectangle(pScrn,(x + skipleft), y,
+ (x + w - 1), (y + h - 1));
+ IMAGE_OUT(0x2108, ((y & 0xfff) << 16) | (x & 0xfff));
+ IMAGE_OUT(0x210C, (((y + h - 1) & 0xfff) << 16) |
+ ((x + w - 1) & 0xfff));
+ IMAGE_OUT(0x2124, 0x80000000 | (pTrident->ROP) | (1 << 10) | 1);
pTrident->dwords = (w + 31) >> 5;
pTrident->h = h;
}
@@ -595,7 +723,8 @@ ImageSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno)
infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
MoveDWORDS((CARD32*)infoRec->ImageWriteBase,
- (CARD32*)pTrident->XAAScanlineColorExpandBuffers[bufno], pTrident->dwords);
+ (CARD32*)pTrident->XAAScanlineColorExpandBuffers[bufno],
+ pTrident->dwords);
pTrident->h--;
if (!pTrident->h)
@@ -603,29 +732,40 @@ ImageSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno)
}
static void
-ImageSetupForScanlineImageWrite(ScrnInfoPtr pScrn, int rop,
- unsigned int planemask, int transparency_color,
- int bpp, int depth)
+ImageSetupForScanlineImageWrite(ScrnInfoPtr pScrn,
+ int rop,
+ unsigned int planemask,
+ int transparency_color,
+ int bpp, int depth)
{
TRIDENTPtr pTrident = TRIDENTPTR(pScrn);
IMAGE_OUT(0x2120, 0x90000000 | XAAGetCopyROP(rop));
if (transparency_color != -1) {
- IMAGE_OUT(0x2120, 0x70000000 | 1<<26 | (transparency_color&0xffffff));
+ IMAGE_OUT(0x2120, 0x70000000 |
+ (1 << 26) |
+ (transparency_color & 0xffffff));
pTrident->DstEnable = TRUE;
}
+
IMAGE_OUT(0x2120, 0x80000000);
}
static void
-ImageSubsequentScanlineImageWriteRect(ScrnInfoPtr pScrn, int x, int y,
- int w, int h, int skipleft)
+ImageSubsequentScanlineImageWriteRect(ScrnInfoPtr pScrn,
+ int x, int y,
+ int w, int h,
+ int skipleft)
{
TRIDENTPtr pTrident = TRIDENTPTR(pScrn);
- ImageSetClippingRectangle(pScrn,(x+skipleft),y,(x+w-1),(y+h-1));
- IMAGE_OUT(0x2108, ((y&0xfff)<<16) | (x&0xfff));
- IMAGE_OUT(0x210C, (((y+h-1)&0xfff)<<16) | ((x+w-1)&0xfff));
- IMAGE_OUT(0x2124, 0x80000000 | 1<<22 | 1<<10 | 1);
- pTrident->dwords = ((w * (pScrn->bitsPerPixel/8)) + 3) >> 2;
+ ImageSetClippingRectangle(pScrn,
+ (x + skipleft), y,
+ (x + w - 1), (y + h - 1));
+ IMAGE_OUT(0x2108, ((y & 0xfff) << 16) | (x & 0xfff));
+ IMAGE_OUT(0x210C, (((y + h - 1) & 0xfff) << 16) |
+ ((x + w - 1) & 0xfff));
+ IMAGE_OUT(0x2124, 0x80000000 |
+ (1 << 22) | (1 << 10) | 1);
+ pTrident->dwords = ((w * (pScrn->bitsPerPixel / 8)) + 3) >> 2;
pTrident->h = h;
}
@@ -638,7 +778,8 @@ ImageSubsequentImageWriteScanline(ScrnInfoPtr pScrn, int bufno)
infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
MoveDWORDS((CARD32*)infoRec->ImageWriteBase,
- (CARD32*)pTrident->XAAImageScanlineBuffer[bufno], pTrident->dwords);
+ (CARD32*)pTrident->XAAImageScanlineBuffer[bufno],
+ pTrident->dwords);
pTrident->h--;
if (!pTrident->h)
--
2.7.4
More information about the xorg-devel
mailing list