summaryrefslogtreecommitdiff
path: root/src/nsc_gx2_accel.c
diff options
context:
space:
mode:
authorMartin-Éric Racine <martin-eric.racine@iki.fi>2012-07-11 15:45:24 +0300
committerMartin-Éric Racine <martin-eric.racine@iki.fi>2012-07-11 15:45:24 +0300
commit921635f34aa4be45a5efbb8d8b11e2e295b2b46c (patch)
tree5ce30b158059d4828021c21332ee148caebd3697 /src/nsc_gx2_accel.c
parent1a658ae0d991d38956466a0174dd9de543d9cd2d (diff)
Whitespace cleanup using ../modular/x-indent.sh
Diffstat (limited to 'src/nsc_gx2_accel.c')
-rw-r--r--src/nsc_gx2_accel.c2057
1 files changed, 1036 insertions, 1021 deletions
diff --git a/src/nsc_gx2_accel.c b/src/nsc_gx2_accel.c
index 90daf2c..e7f9bf0 100644
--- a/src/nsc_gx2_accel.c
+++ b/src/nsc_gx2_accel.c
@@ -181,6 +181,7 @@ static unsigned int gu2_xshift = 1;
static unsigned int gu2_yshift = 1;
static unsigned int gu2_bpp = 1;
static unsigned int SetCPUToScreen = 0;
+
#if IMGWRITE_SUPPORT
static unsigned int SetImageWriteRect = 0;
#endif
@@ -207,109 +208,108 @@ static XAAInfoRecPtr localRecPtr;
Bool GX2AccelInit(ScreenPtr pScreen);
void GX2AccelSync(ScrnInfoPtr pScreenInfo);
void GX2SetupForFillRectSolid(ScrnInfoPtr pScreenInfo, int color, int rop,
- unsigned int planemask);
+ unsigned int planemask);
void GX2SubsequentFillRectSolid(ScrnInfoPtr pScreenInfo, int x, int y,
- int w, int h);
+ int w, int h);
void GX2SetupFor8x8PatternColorExpand(ScrnInfoPtr pScreenInfo,
- int patternx, int patterny,
- int rop, unsigned int planemask,
- int trans_color);
+ int patternx, int patterny,
+ int rop, unsigned int planemask,
+ int trans_color);
void GX2Subsequent8x8PatternColorExpand(ScrnInfoPtr pScreenInfo,
- int patternx, int patterny, int x,
- int y, int w, int h);
+ int patternx, int patterny, int x,
+ int y, int w, int h);
void GX2SetupFor8x8PatternMonoExpand(ScrnInfoPtr pScreenInfo, int patternx,
- int patterny, int fg, int bg, int rop,
- unsigned int planemask);
+ int patterny, int fg, int bg, int rop,
+ unsigned int planemask);
void GX2Subsequent8x8PatternMonoExpand(ScrnInfoPtr pScreenInfo, int patternx,
- int patterny, int x, int y, int w,
- int h);
+ int patterny, int x, int y, int w,
+ int h);
void GX2SetupForScreenToScreenCopy(ScrnInfoPtr pScreenInfo, int xdir,
- int ydir, int rop, unsigned int planemask,
- int transparency_color);
+ int ydir, int rop, unsigned int planemask,
+ int transparency_color);
void GX2SubsequentScreenToScreenCopy(ScrnInfoPtr pScreenInfo, int x1, int y1,
- int x2, int y2, int w, int h);
+ int x2, int y2, int w, int h);
void GX2SetupForSolidLine(ScrnInfoPtr pScreenInfo, int color, int rop,
- unsigned int planemask);
+ unsigned int planemask);
void GX2SetupForDashedLine(ScrnInfoPtr pScrn, int fg, int bg, int rop,
- unsigned int planemask, int length,
- unsigned char *pattern);
+ unsigned int planemask, int length,
+ unsigned char *pattern);
void GX2SubsequentBresenhamLine(ScrnInfoPtr pScreenInfo, int x1, int y1,
- int absmaj, int absmin, int err, int len,
- int octant);
+ int absmaj, int absmin, int err, int len,
+ int octant);
void GX2SubsequentSolidTwoPointLine(ScrnInfoPtr pScreenInfo, int x0, int y0,
- int x1, int y1, int flags);
+ int x1, int y1, int flags);
void GX2SubsequentHorVertLine(ScrnInfoPtr pScreenInfo, int x, int y, int len,
- int dir);
+ int dir);
void GX2SetupForScanlineImageWrite(ScrnInfoPtr pScreenInfo,
- int rop, unsigned int planemask,
- int transparency_color, int bpp,
- int depth);
+ int rop, unsigned int planemask,
+ int transparency_color, int bpp, int depth);
void GX2SubsequentScanlineImageWriteRect(ScrnInfoPtr pScreenInfo,
- int x, int y, int w, int h,
- int skipleft);
+ int x, int y, int w, int h,
+ int skipleft);
void GX2SubsequentImageWriteScanline(ScrnInfoPtr pScreenInfo, int bufno);
void GX2FillCacheBltRects(ScrnInfoPtr pScrn, int rop, unsigned int planemask,
- int nBox, BoxPtr pBox, int xorg, int yorg,
- XAACacheInfoPtr pCache);
+ int nBox, BoxPtr pBox, int xorg, int yorg,
+ XAACacheInfoPtr pCache);
void GX2SetupForImageWrite(ScrnInfoPtr pScreenInfo,
- int rop, unsigned int planemask,
- int transparency_color, int bpp, int depth);
+ int rop, unsigned int planemask,
+ int transparency_color, int bpp, int depth);
void GX2SubsequentImageWriteRect(ScrnInfoPtr pScreenInfo,
- int x, int y, int w, int h, int skipleft);
+ int x, int y, int w, int h, int skipleft);
void GX2SetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScreenInfo,
- int fg, int bg, int rop,
- unsigned int planemask);
+ int fg, int bg, int rop,
+ unsigned int planemask);
void GX2SubsequentCPUToScreenColorExpandFill(ScrnInfoPtr pScreenInfo,
- int x, int y, int w, int h,
- int skipleft);
+ int x, int y, int w, int h,
+ int skipleft);
void OPTGX2SetupForFillRectSolid(ScrnInfoPtr pScreenInfo, int color, int rop,
- unsigned int planemask);
+ unsigned int planemask);
void OPTGX2SubsequentFillRectSolid(ScrnInfoPtr pScreenInfo, int x, int y,
- int w, int h);
+ int w, int h);
void OPTGX2SetupForScreenToScreenCopy(ScrnInfoPtr pScreenInfo, int xdir,
- int ydir, int rop,
- unsigned int planemask,
- int transparency_color);
+ int ydir, int rop,
+ unsigned int planemask,
+ int transparency_color);
void OPTGX2SubsequentScreenToScreenCopy(ScrnInfoPtr pScreenInfo, int x1,
- int y1, int x2, int y2, int w, int h);
+ int y1, int x2, int y2, int w, int h);
void OPTGX2SetupForSolidLine(ScrnInfoPtr pScreenInfo, int color, int rop,
- unsigned int planemask);
+ unsigned int planemask);
void OPTGX2SetupForDashedLine(ScrnInfoPtr pScrn, int fg, int bg, int rop,
- unsigned int planemask, int length,
- unsigned char *pattern);
+ unsigned int planemask, int length,
+ unsigned char *pattern);
void OPTGX2SubsequentBresenhamLine(ScrnInfoPtr pScreenInfo, int x1, int y1,
- int absmaj, int absmin, int err, int len,
- int octant);
+ int absmaj, int absmin, int err, int len,
+ int octant);
void OPTGX2SubsequentSolidTwoPointLine(ScrnInfoPtr pScreenInfo,
- int x0, int y0, int x1, int y1,
- int flags);
+ int x0, int y0, int x1, int y1,
+ int flags);
void OPTGX2SubsequentHorVertLine(ScrnInfoPtr pScreenInfo, int x, int y,
- int len, int dir);
+ int len, int dir);
void OPTGX2SetupForScanlineImageWrite(ScrnInfoPtr pScreenInfo,
- int rop, unsigned int planemask,
- int transparency_color, int bpp,
- int depth);
+ int rop, unsigned int planemask,
+ int transparency_color, int bpp,
+ int depth);
void OPTGX2SubsequentScanlineImageWriteRect(ScrnInfoPtr pScreenInfo,
- int x, int y, int w, int h,
- int skipleft);
+ int x, int y, int w, int h,
+ int skipleft);
void OPTGX2SubsequentImageWriteScanline(ScrnInfoPtr pScreenInfo, int bufno);
void OPTGX2SetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScreenInfo,
- int fg, int bg, int rop,
- unsigned int planemask);
+ int fg, int bg, int rop,
+ unsigned int planemask);
void OPTGX2SubsequentCPUToScreenColorExpandFill(ScrnInfoPtr pScreenInfo,
- int x, int y, int w, int h,
- int skipleft);
+ int x, int y, int w, int h,
+ int skipleft);
void OPTGX2SetupForImageWrite(ScrnInfoPtr pScreenInfo,
- int rop, unsigned int planemask,
- int transparency_color, int bpp, int depth);
+ int rop, unsigned int planemask,
+ int transparency_color, int bpp, int depth);
void OPTGX2SubsequentImageWriteRect(ScrnInfoPtr pScreenInfo,
- int x, int y, int w, int h, int skipleft);
+ int x, int y, int w, int h, int skipleft);
/*----------------------------------------------------------------------------
* GX2AccelSync.
@@ -329,36 +329,36 @@ void OPTGX2SubsequentImageWriteRect(ScrnInfoPtr pScreenInfo,
void
GX2AccelSync(ScrnInfoPtr pScreenInfo)
{
- if (SetCPUToScreen) {
+ if (SetCPUToScreen) {
#if defined(OPT_ACCEL)
- WRITE_GP32(MGP_BLT_MODE, Geode_blt_mode |
- MGP_BM_SRC_FB | MGP_BM_SRC_MONO);
+ WRITE_GP32(MGP_BLT_MODE, Geode_blt_mode |
+ MGP_BM_SRC_FB | MGP_BM_SRC_MONO);
#else
- GFX(mono_bitmap_to_screen_blt(0, 0, Geodedstx, Geodedsty,
- Geodewidth, Geodeheight,
- localRecPtr->ColorExpandBase,
- ((Geodewidth + 31) >> 5) << 2));
+ GFX(mono_bitmap_to_screen_blt(0, 0, Geodedstx, Geodedsty,
+ Geodewidth, Geodeheight,
+ localRecPtr->ColorExpandBase,
+ ((Geodewidth + 31) >> 5) << 2));
#endif
- SetCPUToScreen = 0;
- }
+ SetCPUToScreen = 0;
+ }
#if IMGWRITE_SUPPORT
- if (SetImageWriteRect) {
- unsigned long srcpitch;
+ if (SetImageWriteRect) {
+ unsigned long srcpitch;
#if defined(OPT_ACCEL)
- GeodePtr pGeode = GEODEPTR(pScreenInfo);
-
- srcpitch = ((Geodewidth << gu2_xshift) + 3) & 0xFFFFFFFC;
-
- GU2_WAIT_PENDING;
- WRITE_GP32(MGP_STRIDE, (srcpitch << 16) | pGeode->Pitch);
- WRITE_GP32(MGP_SRC_OFFSET, ImgBufOffset);
- WRITE_GP32(MGP_DST_OFFSET,
- (CALC_FBOFFSET(Geodedstx, Geodedsty)) & 0x00FFFFFF);
- WRITE_GP32(MGP_WID_HEIGHT,
- ((unsigned long)Geodewidth << 16) | (unsigned long)
- Geodeheight);
+ GeodePtr pGeode = GEODEPTR(pScreenInfo);
+
+ srcpitch = ((Geodewidth << gu2_xshift) + 3) & 0xFFFFFFFC;
+
+ GU2_WAIT_PENDING;
+ WRITE_GP32(MGP_STRIDE, (srcpitch << 16) | pGeode->Pitch);
+ WRITE_GP32(MGP_SRC_OFFSET, ImgBufOffset);
+ WRITE_GP32(MGP_DST_OFFSET,
+ (CALC_FBOFFSET(Geodedstx, Geodedsty)) & 0x00FFFFFF);
+ WRITE_GP32(MGP_WID_HEIGHT,
+ ((unsigned long) Geodewidth << 16) | (unsigned long)
+ Geodeheight);
/*
ErrorF("%d %d, %d\n", Geodewidth, Geodeheight, gu2_xshift);
ErrorF("%X , %X %X %X %X\n", srcpitch, ((srcpitch << 16) |
@@ -367,19 +367,19 @@ GX2AccelSync(ScrnInfoPtr pScreenInfo)
((unsigned long)Geodewidth << 16) |
(unsigned long)Geodeheight);
*/
- WRITE_GP32(MGP_BLT_MODE, Geode_blt_mode);
+ WRITE_GP32(MGP_BLT_MODE, Geode_blt_mode);
#else
- srcpitch = ((Geodewidth << gu2_xshift) + 3) & 0xFFFFFFFC;
- GFX2(set_source_stride(srcpitch));
- GFX2(screen_to_screen_blt(ImgBufOffset,
- CALC_FBOFFSET(Geodedstx, Geodedsty),
- Geodewidth, Geodeheight, 0));
+ srcpitch = ((Geodewidth << gu2_xshift) + 3) & 0xFFFFFFFC;
+ GFX2(set_source_stride(srcpitch));
+ GFX2(screen_to_screen_blt(ImgBufOffset,
+ CALC_FBOFFSET(Geodedstx, Geodedsty),
+ Geodewidth, Geodeheight, 0));
#endif
- SetImageWriteRect = 0;
- }
-#endif /* IMGWRITE_SUPPORT */
+ SetImageWriteRect = 0;
+ }
+#endif /* IMGWRITE_SUPPORT */
- GFX(wait_until_idle());
+ GFX(wait_until_idle());
}
/*----------------------------------------------------------------------------
@@ -403,19 +403,20 @@ GX2AccelSync(ScrnInfoPtr pScreenInfo)
*/
void
GX2SetupForFillRectSolid(ScrnInfoPtr pScreenInfo,
- int color, int rop, unsigned int planemask)
+ int color, int rop, unsigned int planemask)
{
- GFX(set_solid_pattern((unsigned int)color));
-
- /* CHECK IF PLANEMASK IS NOT USED (ALL PLANES ENABLED) */
- if (planemask == 0xFFFFFFFF) {
- /* USE NORMAL PATTERN ROPs IF ALL PLANES ARE ENABLED */
- GFX(set_raster_operation(XAAGetPatternROP(rop)));
- } else {
- /* SELECT ROP THAT USES SOURCE DATA FOR PLANEMASK */
- GFX(set_solid_source((unsigned int)planemask));
- GFX(set_raster_operation(XAAGetPatternROP(rop)));
- }
+ GFX(set_solid_pattern((unsigned int) color));
+
+ /* CHECK IF PLANEMASK IS NOT USED (ALL PLANES ENABLED) */
+ if (planemask == 0xFFFFFFFF) {
+ /* USE NORMAL PATTERN ROPs IF ALL PLANES ARE ENABLED */
+ GFX(set_raster_operation(XAAGetPatternROP(rop)));
+ }
+ else {
+ /* SELECT ROP THAT USES SOURCE DATA FOR PLANEMASK */
+ GFX(set_solid_source((unsigned int) planemask));
+ GFX(set_raster_operation(XAAGetPatternROP(rop)));
+ }
}
/*----------------------------------------------------------------------------
@@ -441,15 +442,14 @@ GX2SetupForFillRectSolid(ScrnInfoPtr pScreenInfo,
*----------------------------------------------------------------------------
*/
void
-GX2SubsequentFillRectSolid(ScrnInfoPtr pScreenInfo, int x, int y, int w,
- int h)
+GX2SubsequentFillRectSolid(ScrnInfoPtr pScreenInfo, int x, int y, int w, int h)
{
- DEBUGMSG(0, (0, 0, "FillRect %d %d %dx%d\n", x, y, w, h));
+ DEBUGMSG(0, (0, 0, "FillRect %d %d %dx%d\n", x, y, w, h));
- /* SIMPLY PASS THE PARAMETERS TO THE DURANGO ROUTINE */
+ /* SIMPLY PASS THE PARAMETERS TO THE DURANGO ROUTINE */
- GFX(pattern_fill((unsigned short)x, (unsigned short)y,
- (unsigned short)w, (unsigned short)h));
+ GFX(pattern_fill((unsigned short) x, (unsigned short) y,
+ (unsigned short) w, (unsigned short) h));
}
/*----------------------------------------------------------------------------
@@ -472,18 +472,19 @@ GX2SubsequentFillRectSolid(ScrnInfoPtr pScreenInfo, int x, int y, int w,
void
GX2SetupFor8x8PatternColorExpand(ScrnInfoPtr pScreenInfo,
- int patternx, int patterny, int rop,
- unsigned int planemask, int trans_color)
+ int patternx, int patterny, int rop,
+ unsigned int planemask, int trans_color)
{
- /* CHECK IF PLANEMASK IS NOT USED (ALL PLANES ENABLED) */
- if (planemask == 0xFFFFFFFF) {
- /* USE NORMAL PATTERN ROPs IF ALL PLANES ARE ENABLED */
- GFX(set_raster_operation(XAAGetPatternROP(rop)));
- } else {
- /* SELECT ROP THAT USES SOURCE DATA FOR PLANEMASK */
- GFX(set_solid_source((unsigned int)planemask));
- GFX(set_raster_operation(XAAGetPatternROP(rop)));
- }
+ /* CHECK IF PLANEMASK IS NOT USED (ALL PLANES ENABLED) */
+ if (planemask == 0xFFFFFFFF) {
+ /* USE NORMAL PATTERN ROPs IF ALL PLANES ARE ENABLED */
+ GFX(set_raster_operation(XAAGetPatternROP(rop)));
+ }
+ else {
+ /* SELECT ROP THAT USES SOURCE DATA FOR PLANEMASK */
+ GFX(set_solid_source((unsigned int) planemask));
+ GFX(set_raster_operation(XAAGetPatternROP(rop)));
+ }
}
/*----------------------------------------------------------------------------
@@ -512,20 +513,20 @@ GX2SetupFor8x8PatternColorExpand(ScrnInfoPtr pScreenInfo,
*/
void
GX2Subsequent8x8PatternColorExpand(ScrnInfoPtr pScreenInfo,
- int patternx, int patterny, int x, int y,
- int w, int h)
+ int patternx, int patterny, int x, int y,
+ int w, int h)
{
- GeodePtr pGeode = GEODEPTR(pScreenInfo);
+ GeodePtr pGeode = GEODEPTR(pScreenInfo);
- DEBUGMSG(1, (0, 0, "8x8color %d %d %dx%d\n", x, y, w, h));
+ DEBUGMSG(1, (0, 0, "8x8color %d %d %dx%d\n", x, y, w, h));
- /* SIMPLY PASS THE PARAMETERS TO THE DURANGO ROUTINE */
- /* Ignores specified pattern. */
- GFX(color_pattern_fill((unsigned short)x, (unsigned short)y,
- (unsigned short)w, (unsigned short)h,
- ((unsigned long *)((pGeode->FBBase +
- (patterny << gu2_yshift)) +
- patternx))));
+ /* SIMPLY PASS THE PARAMETERS TO THE DURANGO ROUTINE */
+ /* Ignores specified pattern. */
+ GFX(color_pattern_fill((unsigned short) x, (unsigned short) y,
+ (unsigned short) w, (unsigned short) h,
+ ((unsigned long *) ((pGeode->FBBase +
+ (patterny << gu2_yshift)) +
+ patternx))));
}
/*----------------------------------------------------------------------------
@@ -549,25 +550,26 @@ GX2Subsequent8x8PatternColorExpand(ScrnInfoPtr pScreenInfo,
*/
void
GX2SetupFor8x8PatternMonoExpand(ScrnInfoPtr pScreenInfo,
- int patternx, int patterny, int fg,
- int bg, int rop, unsigned int planemask)
+ int patternx, int patterny, int fg,
+ int bg, int rop, unsigned int planemask)
{
- int trans = (bg == -1);
-
- /* LOAD PATTERN COLORS AND DATA */
- GFX(set_mono_pattern((unsigned int)bg, (unsigned int)fg,
- (unsigned int)patternx, (unsigned int)patterny,
- trans));
-
- /* CHECK IF PLANEMASK IS NOT USED (ALL PLANES ENABLED) */
- if (planemask == 0xFFFFFFFF) {
- /* USE NORMAL PATTERN ROPs IF ALL PLANES ARE ENABLED */
- GFX(set_raster_operation(XAAGetPatternROP(rop)));
- } else {
- /* SELECT ROP THAT USES SOURCE DATA FOR PLANEMASK */
- GFX(set_solid_source((unsigned int)planemask));
- GFX(set_raster_operation(XAAGetPatternROP(rop)));
- }
+ int trans = (bg == -1);
+
+ /* LOAD PATTERN COLORS AND DATA */
+ GFX(set_mono_pattern((unsigned int) bg, (unsigned int) fg,
+ (unsigned int) patternx, (unsigned int) patterny,
+ trans));
+
+ /* CHECK IF PLANEMASK IS NOT USED (ALL PLANES ENABLED) */
+ if (planemask == 0xFFFFFFFF) {
+ /* USE NORMAL PATTERN ROPs IF ALL PLANES ARE ENABLED */
+ GFX(set_raster_operation(XAAGetPatternROP(rop)));
+ }
+ else {
+ /* SELECT ROP THAT USES SOURCE DATA FOR PLANEMASK */
+ GFX(set_solid_source((unsigned int) planemask));
+ GFX(set_raster_operation(XAAGetPatternROP(rop)));
+ }
}
/*----------------------------------------------------------------------------
@@ -595,15 +597,15 @@ GX2SetupFor8x8PatternMonoExpand(ScrnInfoPtr pScreenInfo,
*/
void
GX2Subsequent8x8PatternMonoExpand(ScrnInfoPtr pScreenInfo,
- int patternx, int patterny, int x, int y,
- int w, int h)
+ int patternx, int patterny, int x, int y,
+ int w, int h)
{
- DEBUGMSG(0, (0, 0, "8x8mono %d %d %dx%d\n", x, y, w, h));
+ DEBUGMSG(0, (0, 0, "8x8mono %d %d %dx%d\n", x, y, w, h));
- /* SIMPLY PASS THE PARAMETERS TO THE DURANGO ROUTINE */
- /* Ignores specified pattern. */
- GFX(pattern_fill((unsigned short)x, (unsigned short)y,
- (unsigned short)w, (unsigned short)h));
+ /* SIMPLY PASS THE PARAMETERS TO THE DURANGO ROUTINE */
+ /* Ignores specified pattern. */
+ GFX(pattern_fill((unsigned short) x, (unsigned short) y,
+ (unsigned short) w, (unsigned short) h));
}
/*----------------------------------------------------------------------------
@@ -627,15 +629,15 @@ GX2Subsequent8x8PatternMonoExpand(ScrnInfoPtr pScreenInfo,
*/
void
GX2SetupForScreenToScreenCopy(ScrnInfoPtr pScreenInfo,
- int xdir, int ydir, int rop,
- unsigned int planemask, int transparency_color)
+ int xdir, int ydir, int rop,
+ unsigned int planemask, int transparency_color)
{
- GFX(set_solid_pattern(planemask));
- /* SET RASTER OPERATION FOR USING PATTERN AS PLANE MASK */
- GFX(set_raster_operation(XAAGetCopyROP(rop)));
- /* SAVE TRANSPARENCY FLAG */
- GeodeTransparent = (transparency_color == -1) ? 0 : 1;
- GeodeTransColor = transparency_color;
+ GFX(set_solid_pattern(planemask));
+ /* SET RASTER OPERATION FOR USING PATTERN AS PLANE MASK */
+ GFX(set_raster_operation(XAAGetCopyROP(rop)));
+ /* SAVE TRANSPARENCY FLAG */
+ GeodeTransparent = (transparency_color == -1) ? 0 : 1;
+ GeodeTransColor = transparency_color;
}
@@ -667,47 +669,48 @@ GX2SetupForScreenToScreenCopy(ScrnInfoPtr pScreenInfo,
*/
void
GX2SubsequentScreenToScreenCopy(ScrnInfoPtr pScreenInfo,
- int x1, int y1, int x2, int y2, int w, int h)
+ int x1, int y1, int x2, int y2, int w, int h)
{
- if (GeodeTransparent) {
- /* CALL ROUTINE FOR TRANSPARENT SCREEN TO SCREEN BLT
- * * Should only be called for the "copy" raster operation.
- */
- GFX(screen_to_screen_xblt((unsigned short)x1, (unsigned short)y1,
- (unsigned short)x2, (unsigned short)y2,
- (unsigned short)w, (unsigned short)h,
- GeodeTransColor));
- } else {
- /* CALL ROUTINE FOR NORMAL SCREEN TO SCREEN BLT */
- GFX(screen_to_screen_blt((unsigned short)x1, (unsigned short)y1,
- (unsigned short)x2, (unsigned short)y2,
- (unsigned short)w, (unsigned short)h));
- }
+ if (GeodeTransparent) {
+ /* CALL ROUTINE FOR TRANSPARENT SCREEN TO SCREEN BLT
+ * * Should only be called for the "copy" raster operation.
+ */
+ GFX(screen_to_screen_xblt((unsigned short) x1, (unsigned short) y1,
+ (unsigned short) x2, (unsigned short) y2,
+ (unsigned short) w, (unsigned short) h,
+ GeodeTransColor));
+ }
+ else {
+ /* CALL ROUTINE FOR NORMAL SCREEN TO SCREEN BLT */
+ GFX(screen_to_screen_blt((unsigned short) x1, (unsigned short) y1,
+ (unsigned short) x2, (unsigned short) y2,
+ (unsigned short) w, (unsigned short) h));
+ }
}
void
GX2SetupForImageWrite(ScrnInfoPtr pScreenInfo,
- int rop, unsigned int planemask,
- int transparency_color, int bpp, int depth)
+ int rop, unsigned int planemask,
+ int transparency_color, int bpp, int depth)
{
- GFX(set_solid_pattern((unsigned int)planemask));
- /* SET RASTER OPERATION FOR USING PATTERN AS PLANE MASK */
- GFX(set_raster_operation(XAAGetCopyROP(rop)));
- /* SAVE TRANSPARENCY FLAG */
- GeodeTransparent = (transparency_color == -1) ? 0 : 1;
- GeodeTransColor = transparency_color;
+ GFX(set_solid_pattern((unsigned int) planemask));
+ /* SET RASTER OPERATION FOR USING PATTERN AS PLANE MASK */
+ GFX(set_raster_operation(XAAGetCopyROP(rop)));
+ /* SAVE TRANSPARENCY FLAG */
+ GeodeTransparent = (transparency_color == -1) ? 0 : 1;
+ GeodeTransColor = transparency_color;
}
void
GX2SubsequentImageWriteRect(ScrnInfoPtr pScreenInfo,
- int x, int y, int w, int h, int skipleft)
+ int x, int y, int w, int h, int skipleft)
{
- Geodedstx = x;
- Geodedsty = y;
- Geodewidth = w;
- Geodeheight = h;
+ Geodedstx = x;
+ Geodedsty = y;
+ Geodewidth = w;
+ Geodeheight = h;
#if IMGWRITE_SUPPORT
- SetImageWriteRect = 1;
+ SetImageWriteRect = 1;
#endif
}
@@ -735,15 +738,15 @@ GX2SubsequentImageWriteRect(ScrnInfoPtr pScreenInfo,
*/
void
GX2SetupForScanlineImageWrite(ScrnInfoPtr pScreenInfo,
- int rop, unsigned int planemask,
- int transparency_color, int bpp, int depth)
+ int rop, unsigned int planemask,
+ int transparency_color, int bpp, int depth)
{
- GFX(set_solid_pattern((unsigned int)planemask));
- /* SET RASTER OPERATION FOR USING PATTERN AS PLANE MASK */
- GFX(set_raster_operation(XAAGetCopyROP(rop & 0x0F)));
- /* SAVE TRANSPARENCY FLAG */
- GeodeTransparent = (transparency_color == -1) ? 0 : 1;
- GeodeTransColor = transparency_color;
+ GFX(set_solid_pattern((unsigned int) planemask));
+ /* SET RASTER OPERATION FOR USING PATTERN AS PLANE MASK */
+ GFX(set_raster_operation(XAAGetCopyROP(rop & 0x0F)));
+ /* SAVE TRANSPARENCY FLAG */
+ GeodeTransparent = (transparency_color == -1) ? 0 : 1;
+ GeodeTransColor = transparency_color;
}
/*----------------------------------------------------------------------------
@@ -766,13 +769,13 @@ GX2SetupForScanlineImageWrite(ScrnInfoPtr pScreenInfo,
*/
void
GX2SubsequentScanlineImageWriteRect(ScrnInfoPtr pScreenInfo,
- int x, int y, int w, int h, int skipleft)
+ int x, int y, int w, int h, int skipleft)
{
- Geodedstx = x;
- Geodedsty = y;
- Geodewidth = w;
- Geodeheight = h;
- GeodeCounter = 0;
+ Geodedstx = x;
+ Geodedsty = y;
+ Geodewidth = w;
+ Geodeheight = h;
+ GeodeCounter = 0;
}
/*----------------------------------------------------------------------------
@@ -799,54 +802,57 @@ GX2SubsequentScanlineImageWriteRect(ScrnInfoPtr pScreenInfo,
void
GX2SubsequentImageWriteScanline(ScrnInfoPtr pScreenInfo, int bufno)
{
- GeodePtr pGeode;
- int blt_height = 0;
- char blit = FALSE;
-
- pGeode = GEODEPTR(pScreenInfo);
-
- GeodeCounter++;
-
- if ((Geodeheight <= pGeode->NoOfImgBuffers) &&
- (GeodeCounter == Geodeheight)) {
- blit = TRUE;
- blt_height = Geodeheight;
- } else if ((Geodeheight > pGeode->NoOfImgBuffers)
- && (GeodeCounter == pGeode->NoOfImgBuffers)) {
- blit = TRUE;
- Geodeheight -= pGeode->NoOfImgBuffers;
- blt_height = pGeode->NoOfImgBuffers;
- } else
- return;
-
- if (blit) {
- blit = FALSE;
-
- GeodeCounter = 0;
-
- if (GeodeTransparent) {
- /* CALL ROUTINE FOR TRANSPARENT SCREEN TO SCREEN BLT
- * * Should only be called for the "copy" raster operation.
- */
- GFX(screen_to_screen_xblt((unsigned short)Geodesrcx,
- (unsigned short)Geodesrcy,
- (unsigned short)Geodedstx,
- (unsigned short)Geodedsty,
- (unsigned short)Geodewidth,
- (unsigned short)blt_height,
- GeodeTransColor));
- } else {
- /* CALL ROUTINE FOR NORMAL SCREEN TO SCREEN BLT */
- GFX(screen_to_screen_blt((unsigned short)Geodesrcx,
- (unsigned short)Geodesrcy,
- (unsigned short)Geodedstx,
- (unsigned short)Geodedsty,
- (unsigned short)Geodewidth,
- (unsigned short)blt_height));
- }
- Geodedsty += blt_height;
- GFX(wait_until_idle());
- }
+ GeodePtr pGeode;
+ int blt_height = 0;
+ char blit = FALSE;
+
+ pGeode = GEODEPTR(pScreenInfo);
+
+ GeodeCounter++;
+
+ if ((Geodeheight <= pGeode->NoOfImgBuffers) &&
+ (GeodeCounter == Geodeheight)) {
+ blit = TRUE;
+ blt_height = Geodeheight;
+ }
+ else if ((Geodeheight > pGeode->NoOfImgBuffers)
+ && (GeodeCounter == pGeode->NoOfImgBuffers)) {
+ blit = TRUE;
+ Geodeheight -= pGeode->NoOfImgBuffers;
+ blt_height = pGeode->NoOfImgBuffers;
+ }
+ else
+ return;
+
+ if (blit) {
+ blit = FALSE;
+
+ GeodeCounter = 0;
+
+ if (GeodeTransparent) {
+ /* CALL ROUTINE FOR TRANSPARENT SCREEN TO SCREEN BLT
+ * * Should only be called for the "copy" raster operation.
+ */
+ GFX(screen_to_screen_xblt((unsigned short) Geodesrcx,
+ (unsigned short) Geodesrcy,
+ (unsigned short) Geodedstx,
+ (unsigned short) Geodedsty,
+ (unsigned short) Geodewidth,
+ (unsigned short) blt_height,
+ GeodeTransColor));
+ }
+ else {
+ /* CALL ROUTINE FOR NORMAL SCREEN TO SCREEN BLT */
+ GFX(screen_to_screen_blt((unsigned short) Geodesrcx,
+ (unsigned short) Geodesrcy,
+ (unsigned short) Geodedstx,
+ (unsigned short) Geodedsty,
+ (unsigned short) Geodewidth,
+ (unsigned short) blt_height));
+ }
+ Geodedsty += blt_height;
+ GFX(wait_until_idle());
+ }
}
/*----------------------------------------------------------------------------
@@ -878,16 +884,16 @@ GX2SubsequentImageWriteScanline(ScrnInfoPtr pScreenInfo, int bufno)
*/
void
GX2SetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScreenInfo,
- int fg, int bg, int rop,
- unsigned int planemask)
+ int fg, int bg, int rop,
+ unsigned int planemask)
{
- GFX(set_solid_pattern(planemask));
- GFX(set_mono_source(bg, fg, (bg == -1)));
+ GFX(set_solid_pattern(planemask));
+ GFX(set_mono_source(bg, fg, (bg == -1)));
- /* USE NORMAL PATTERN ROPs IF ALL PLANES ARE ENABLED */
- GFX(set_raster_operation(XAAGetCopyROP_PM(rop & 0x0F)));
+ /* USE NORMAL PATTERN ROPs IF ALL PLANES ARE ENABLED */
+ GFX(set_raster_operation(XAAGetCopyROP_PM(rop & 0x0F)));
- DEBUGMSG(0, (0, X_NONE, "%x %x %x %x\n", fg, bg, rop, planemask));
+ DEBUGMSG(0, (0, X_NONE, "%x %x %x %x\n", fg, bg, rop, planemask));
}
/*-------------------------------------------------------------------------------
@@ -909,54 +915,54 @@ GX2SetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScreenInfo,
*/
void
GX2SubsequentCPUToScreenColorExpandFill(ScrnInfoPtr pScreenInfo,
- int x, int y, int w, int h,
- int skipleft)
+ int x, int y, int w, int h,
+ int skipleft)
{
- Geodedstx = x;
- Geodedsty = y;
- Geodewidth = w;
- Geodeheight = h;
- SetCPUToScreen = 1;
+ Geodedstx = x;
+ Geodedsty = y;
+ Geodewidth = w;
+ Geodeheight = h;
+ SetCPUToScreen = 1;
}
#if SCR2SCREXP
void
GX2SetupForScreenToScreenColorExpandFill(ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask)
+ int fg, int bg, int rop,
+ unsigned int planemask)
{
- GFX(set_solid_pattern(planemask));
- GFX(set_mono_source(bg, fg, (bg == -1)));
+ GFX(set_solid_pattern(planemask));
+ GFX(set_mono_source(bg, fg, (bg == -1)));
- /* USE NORMAL PATTERN ROPs IF ALL PLANES ARE ENABLED */
- GFX(set_raster_operation(XAAGetCopyROP_PM(rop & 0x0F)));
+ /* USE NORMAL PATTERN ROPs IF ALL PLANES ARE ENABLED */
+ GFX(set_raster_operation(XAAGetCopyROP_PM(rop & 0x0F)));
- DEBUGMSG(0, (0, X_NONE, "%x %x %x %x\n", fg, bg, rop, planemask));
+ DEBUGMSG(0, (0, X_NONE, "%x %x %x %x\n", fg, bg, rop, planemask));
}
void
GX2SubsequentScreenToScreenColorExpandFill(ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- int srcx, int srcy, int offset)
+ int x, int y, int w, int h,
+ int srcx, int srcy, int offset)
{
- GeodePtr pGeode = GEODEPTR(pScrn);
+ GeodePtr pGeode = GEODEPTR(pScrn);
- GFX(mono_bitmap_to_screen_blt(offset, 0, x, y, w, h,
- (unsigned char *)(pGeode->FBBase +
- CALC_FBOFFSET(srcx, srcy)),
- pGeode->Pitch));
+ GFX(mono_bitmap_to_screen_blt(offset, 0, x, y, w, h,
+ (unsigned char *) (pGeode->FBBase +
+ CALC_FBOFFSET(srcx, srcy)),
+ pGeode->Pitch));
}
#endif
static unsigned short vector_mode_table[] = {
- VM_MAJOR_INC | VM_MINOR_INC | VM_X_MAJOR,
- VM_MAJOR_INC | VM_MINOR_INC | VM_Y_MAJOR,
- VM_MAJOR_INC | VM_X_MAJOR,
- VM_MINOR_INC | VM_Y_MAJOR,
- VM_MINOR_INC | VM_X_MAJOR,
- VM_MAJOR_INC | VM_Y_MAJOR,
- VM_X_MAJOR,
- VM_Y_MAJOR,
+ VM_MAJOR_INC | VM_MINOR_INC | VM_X_MAJOR,
+ VM_MAJOR_INC | VM_MINOR_INC | VM_Y_MAJOR,
+ VM_MAJOR_INC | VM_X_MAJOR,
+ VM_MINOR_INC | VM_Y_MAJOR,
+ VM_MINOR_INC | VM_X_MAJOR,
+ VM_MAJOR_INC | VM_Y_MAJOR,
+ VM_X_MAJOR,
+ VM_Y_MAJOR,
};
/*----------------------------------------------------------------------------
@@ -978,13 +984,13 @@ static unsigned short vector_mode_table[] = {
*/
void
GX2SetupForSolidLine(ScrnInfoPtr pScreenInfo,
- int color, int rop, unsigned int planemask)
+ int color, int rop, unsigned int planemask)
{
- /* LOAD THE SOLID PATTERN COLOR */
- GFX(set_solid_pattern((unsigned int)color));
+ /* LOAD THE SOLID PATTERN COLOR */
+ GFX(set_solid_pattern((unsigned int) color));
- /* USE NORMAL PATTERN ROPs IF ALL PLANES ARE ENABLED */
- GFX(set_raster_operation(XAAGetPatternROP(rop & 0x0F)));
+ /* USE NORMAL PATTERN ROPs IF ALL PLANES ARE ENABLED */
+ GFX(set_raster_operation(XAAGetPatternROP(rop & 0x0F)));
}
/*---------------------------------------------------------------------------
@@ -1014,38 +1020,38 @@ GX2SetupForSolidLine(ScrnInfoPtr pScreenInfo,
*/
void
GX2SubsequentBresenhamLine(ScrnInfoPtr pScreenInfo,
- int x1, int y1, int absmaj, int absmin, int err,
- int len, int octant)
+ int x1, int y1, int absmaj, int absmin, int err,
+ int len, int octant)
{
- int axial, init, diag;
+ int axial, init, diag;
- DEBUGMSG(0, (0, 0, "BLine %d, %d, %d, %d, %d, %d, %d\n",
- x1, y1, absmaj, absmin, err, len, octant));
+ DEBUGMSG(0, (0, 0, "BLine %d, %d, %d, %d, %d, %d, %d\n",
+ x1, y1, absmaj, absmin, err, len, octant));
- /* DETERMINE BRESENHAM PARAMETERS */
+ /* DETERMINE BRESENHAM PARAMETERS */
- axial = ((int)absmin << 1);
- init = axial - (int)absmaj;
- diag = init - (int)absmaj;
+ axial = ((int) absmin << 1);
+ init = axial - (int) absmaj;
+ diag = init - (int) absmaj;
- /* ADJUST INITIAL ERROR
- * * Adjust by -1 for certain directions so that the vector
- * * hits the same pixels when drawn in either direction.
- * * The Gamma value is assumed to account for the initial
- * * error adjustment for clipped lines.
- */
+ /* ADJUST INITIAL ERROR
+ * * Adjust by -1 for certain directions so that the vector
+ * * hits the same pixels when drawn in either direction.
+ * * The Gamma value is assumed to account for the initial
+ * * error adjustment for clipped lines.
+ */
- init += err;
+ init += err;
- /* CALL ROUTINE TO DRAW VECTOR */
+ /* CALL ROUTINE TO DRAW VECTOR */
- GFX(bresenham_line((unsigned short)x1,
- (unsigned short)y1,
- (unsigned short)len,
- (unsigned short)init,
- (unsigned short)axial,
- (unsigned short)diag,
- (unsigned short)vector_mode_table[octant]));
+ GFX(bresenham_line((unsigned short) x1,
+ (unsigned short) y1,
+ (unsigned short) len,
+ (unsigned short) init,
+ (unsigned short) axial,
+ (unsigned short) diag,
+ (unsigned short) vector_mode_table[octant]));
}
@@ -1053,43 +1059,44 @@ GX2SubsequentBresenhamLine(ScrnInfoPtr pScreenInfo,
void
GX2SubsequentSolidTwoPointLine(ScrnInfoPtr pScreenInfo,
- int x0, int y0, int x1, int y1, int flags)
+ int x0, int y0, int x1, int y1, int flags)
{
- long dx, dy, dmaj, dmin;
- long axialerr, diagerr, initerr;
- unsigned short vec_flags = 0;
-
- dx = ABS(x1, x0);
- dy = ABS(y1, y0);
- if (dx >= dy) {
- dmaj = dx;
- dmin = dy;
- vec_flags = VM_X_MAJOR;
- if (x1 > x0)
- vec_flags |= VM_MAJOR_INC;
- if (y1 > y0)
- vec_flags |= VM_MINOR_INC;
- } else {
- dmaj = dy;
- dmin = dx;
- vec_flags = VM_Y_MAJOR;
- if (x1 > x0)
- vec_flags |= VM_MINOR_INC;
- if (y1 > y0)
- vec_flags |= VM_MAJOR_INC;
- }
- axialerr = dmin << 1;
- diagerr = (dmin - dmaj) << 1;
- initerr = (dmin << 1) - dmaj;
- if (!(vec_flags & VM_MINOR_INC))
- initerr--;
-
- GFX(bresenham_line((unsigned short)x0,
- (unsigned short)y0,
- (unsigned short)dmaj,
- (unsigned short)initerr,
- (unsigned short)axialerr,
- (unsigned short)diagerr, vec_flags));
+ long dx, dy, dmaj, dmin;
+ long axialerr, diagerr, initerr;
+ unsigned short vec_flags = 0;
+
+ dx = ABS(x1, x0);
+ dy = ABS(y1, y0);
+ if (dx >= dy) {
+ dmaj = dx;
+ dmin = dy;
+ vec_flags = VM_X_MAJOR;
+ if (x1 > x0)
+ vec_flags |= VM_MAJOR_INC;
+ if (y1 > y0)
+ vec_flags |= VM_MINOR_INC;
+ }
+ else {
+ dmaj = dy;
+ dmin = dx;
+ vec_flags = VM_Y_MAJOR;
+ if (x1 > x0)
+ vec_flags |= VM_MINOR_INC;
+ if (y1 > y0)
+ vec_flags |= VM_MAJOR_INC;
+ }
+ axialerr = dmin << 1;
+ diagerr = (dmin - dmaj) << 1;
+ initerr = (dmin << 1) - dmaj;
+ if (!(vec_flags & VM_MINOR_INC))
+ initerr--;
+
+ GFX(bresenham_line((unsigned short) x0,
+ (unsigned short) y0,
+ (unsigned short) dmaj,
+ (unsigned short) initerr,
+ (unsigned short) axialerr,
+ (unsigned short) diagerr, vec_flags));
}
/*---------------------------------------------------------------------------
@@ -1106,41 +1113,41 @@ GX2SubsequentSolidTwoPointLine(ScrnInfoPtr pScreenInfo,
*/
void
GX2SubsequentHorVertLine(ScrnInfoPtr pScreenInfo,
- int x, int y, int len, int dir)
+ int x, int y, int len, int dir)
{
- DEBUGMSG(0, (0, 0, "HLine %d, %d, %d, %d\n", x, y, len, dir));
- GFX(pattern_fill((unsigned short)x, (unsigned short)y,
- (unsigned short)((dir == DEGREES_0) ? len : 1),
- (unsigned short)((dir == DEGREES_0) ? 1 : len)));
+ DEBUGMSG(0, (0, 0, "HLine %d, %d, %d, %d\n", x, y, len, dir));
+ GFX(pattern_fill((unsigned short) x, (unsigned short) y,
+ (unsigned short) ((dir == DEGREES_0) ? len : 1),
+ (unsigned short) ((dir == DEGREES_0) ? 1 : len)));
}
#if DASHED_SUPPORT
void
-BuildPattern(CARD32 pat, int len, CARD32 * pat8x8)
+BuildPattern(CARD32 pat, int len, CARD32 *pat8x8)
{
- unsigned long i, count;
-
- /* find homany can fit comfortably */
- count = 32 / len;
- /* add 1 for the residue */
- count++;
- /* construct the mask and knock off the unwanted data */
- i = ((CARD32) 0xFFFFFFFF) << (31 - len);
- pat &= i;
- /* init before the show */
- pat8x8[0] = 0;
- /* loop and build the pattern aray data */
- for (i = 0; i < count; i++) {
- pat8x8[0] |= (pat >> (len * i));
- }
-
- /* equate both the array's and then adjust */
- pat8x8[1] = pat8x8[0];
-
- /* how many carried from last operation */
- i = (len * count) - 32;
- pat8x8[1] >>= i;
- pat8x8[1] |= (pat << (len - i));
+ unsigned long i, count;
+
+ /* find homany can fit comfortably */
+ count = 32 / len;
+ /* add 1 for the residue */
+ count++;
+ /* construct the mask and knock off the unwanted data */
+ i = ((CARD32) 0xFFFFFFFF) << (31 - len);
+ pat &= i;
+ /* init before the show */
+ pat8x8[0] = 0;
+ /* loop and build the pattern aray data */
+ for (i = 0; i < count; i++) {
+ pat8x8[0] |= (pat >> (len * i));
+ }
+
+ /* equate both the array's and then adjust */
+ pat8x8[1] = pat8x8[0];
+
+ /* how many carried from last operation */
+ i = (len * count) - 32;
+ pat8x8[1] >>= i;
+ pat8x8[1] |= (pat << (len - i));
}
#define PAT_SHIFT(pat,n) pat >> n
@@ -1164,51 +1171,52 @@ BuildPattern(CARD32 pat, int len, CARD32 * pat8x8)
*/
void
GX2SetupForDashedLine(ScrnInfoPtr pScrn, int fg, int bg, int rop,
- unsigned int planemask, int length,
- unsigned char *pattern)
+ unsigned int planemask, int length,
+ unsigned char *pattern)
{
- int trans = (bg == -1);
- CARD32 *pat = (CARD32 *) pattern;
- CARD32 pat8x8[2];
-
- pat8x8[0] = pat[0];
- switch (length) {
- case 2:
- pat8x8[0] |= PAT_SHIFT(pat8x8[0], 2); /* fall through */
- case 4:
- pat8x8[0] |= PAT_SHIFT(pat8x8[0], 4); /* fall through */
- case 8:
- pat8x8[0] |= PAT_SHIFT(pat8x8[0], 8); /* fall through */
- case 16:
- pat8x8[0] |= PAT_SHIFT(pat8x8[0], 16);
- case 32:
- pat8x8[1] = pat8x8[0];
- break;
- case 64:
- pat8x8[1] = pat[1];
- break;
- default:
- BuildPattern(pat[0], length, pat8x8);
- }
+ int trans = (bg == -1);
+ CARD32 *pat = (CARD32 *) pattern;
+ CARD32 pat8x8[2];
+
+ pat8x8[0] = pat[0];
+ switch (length) {
+ case 2:
+ pat8x8[0] |= PAT_SHIFT(pat8x8[0], 2); /* fall through */
+ case 4:
+ pat8x8[0] |= PAT_SHIFT(pat8x8[0], 4); /* fall through */
+ case 8:
+ pat8x8[0] |= PAT_SHIFT(pat8x8[0], 8); /* fall through */
+ case 16:
+ pat8x8[0] |= PAT_SHIFT(pat8x8[0], 16);
+ case 32:
+ pat8x8[1] = pat8x8[0];
+ break;
+ case 64:
+ pat8x8[1] = pat[1];
+ break;
+ default:
+ BuildPattern(pat[0], length, pat8x8);
+ }
/*
ErrorF("%X %d, %X %X\n", pat[0], length, pat8x8[0], pat8x8[1]);
*/
- /* LOAD PATTERN COLORS AND DATA */
+ /* LOAD PATTERN COLORS AND DATA */
- GFX(set_mono_pattern((unsigned int)bg, (unsigned int)fg,
- pat8x8[0], pat8x8[1], (unsigned char)trans));
+ GFX(set_mono_pattern((unsigned int) bg, (unsigned int) fg,
+ pat8x8[0], pat8x8[1], (unsigned char) trans));
- /* CHECK IF PLANEMASK IS NOT USED (ALL PLANES ENABLED) */
+ /* CHECK IF PLANEMASK IS NOT USED (ALL PLANES ENABLED) */
- if (planemask == 0xFFFFFFFF) {
- /* USE NORMAL PATTERN ROPs IF ALL PLANES ARE ENABLED */
+ if (planemask == 0xFFFFFFFF) {
+ /* USE NORMAL PATTERN ROPs IF ALL PLANES ARE ENABLED */
- GFX(set_raster_operation(windowsROPpat[rop & 0x0F]));
- } else {
- /* SELECT ROP THAT USES SOURCE DATA FOR PLANEMASK */
+ GFX(set_raster_operation(windowsROPpat[rop & 0x0F]));
+ }
+ else {
+ /* SELECT ROP THAT USES SOURCE DATA FOR PLANEMASK */
- GFX(set_raster_operation(windowsROPsrcMask[rop & 0x0F]));
- }
+ GFX(set_raster_operation(windowsROPsrcMask[rop & 0x0F]));
+ }
}
/*---------------------------------------------------------------------------
@@ -1238,36 +1246,36 @@ GX2SetupForDashedLine(ScrnInfoPtr pScrn, int fg, int bg, int rop,
*/
void
GX2SubsequentDashedBresenhamLine(ScrnInfoPtr pScreenInfo,
- int x1, int y1, int absmaj, int absmin,
- int err, int len, int octant)
+ int x1, int y1, int absmaj, int absmin,
+ int err, int len, int octant)
{
- int axial, init, diag;
+ int axial, init, diag;
- DEBUGMSG(0, (0, 0, "BLine %d, %d, %d, %d, %d, %d, %d\n",
- x1, y1, absmaj, absmin, err, len, octant));
+ DEBUGMSG(0, (0, 0, "BLine %d, %d, %d, %d, %d, %d, %d\n",
+ x1, y1, absmaj, absmin, err, len, octant));
- /* DETERMINE BRESENHAM PARAMETERS */
+ /* DETERMINE BRESENHAM PARAMETERS */
- axial = ((int)absmin << 1);
- init = axial - (int)absmaj;
- diag = init - (int)absmaj;
+ axial = ((int) absmin << 1);
+ init = axial - (int) absmaj;
+ diag = init - (int) absmaj;
- /* ADJUST INITIAL ERROR
- * * Adjust by -1 for certain directions so that the vector
- * * hits the same pixels when drawn in either direction.
- * * The Gamma value is assumed to account for the initial
- * * error adjustment for clipped lines.
- */
+ /* ADJUST INITIAL ERROR
+ * * Adjust by -1 for certain directions so that the vector
+ * * hits the same pixels when drawn in either direction.
+ * * The Gamma value is assumed to account for the initial
+ * * error adjustment for clipped lines.
+ */
- init += err;
+ init += err;
- /* CALL ROUTINE TO DRAW VECTOR */
+ /* CALL ROUTINE TO DRAW VECTOR */
- gfx2_set_pattern_origin(x1, y1);
- gfx2_bresenham_line(CALC_FBOFFSET(x1, y1),
- (unsigned short)len, (unsigned short)init,
- (unsigned short)axial, (unsigned short)diag,
- (unsigned short)vector_mode_table[octant]);
+ gfx2_set_pattern_origin(x1, y1);
+ gfx2_bresenham_line(CALC_FBOFFSET(x1, y1),
+ (unsigned short) len, (unsigned short) init,
+ (unsigned short) axial, (unsigned short) diag,
+ (unsigned short) vector_mode_table[octant]);
}
#endif
@@ -1315,28 +1323,29 @@ GX2SubsequentDashedBresenhamLine(ScrnInfoPtr pScreenInfo,
void
OPTGX2SetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScreenInfo,
- int fg, int bg, int rop,
- unsigned int planemask)
+ int fg, int bg, int rop,
+ unsigned int planemask)
{
- int trans = (bg == -1);
-
- GeodeROP = XAAGetCopyROP_PM(rop);
-
- if ((GeodeROP & 0x55) ^ ((GeodeROP >> 1) & 0x55)) {
- Geode_blt_mode = MGP_BM_DST_REQ;
- } else {
- Geode_blt_mode = 0;
- }
- if (trans)
- GeodeROP |= MGP_RM_SRC_TRANS;
-
- /* POLL UNTIL ABLE TO WRITE THE PATTERN COLOR */
-
- GU2_WAIT_PENDING;
- WRITE_GP32(MGP_PAT_COLOR_0, (unsigned long)planemask);
- WRITE_GP32(MGP_RASTER_MODE, gu2_bpp | GeodeROP);
- WRITE_GP32(MGP_SRC_COLOR_FG, fg);
- WRITE_GP32(MGP_SRC_COLOR_BG, bg);
+ int trans = (bg == -1);
+
+ GeodeROP = XAAGetCopyROP_PM(rop);
+
+ if ((GeodeROP & 0x55) ^ ((GeodeROP >> 1) & 0x55)) {
+ Geode_blt_mode = MGP_BM_DST_REQ;
+ }
+ else {
+ Geode_blt_mode = 0;
+ }
+ if (trans)
+ GeodeROP |= MGP_RM_SRC_TRANS;
+
+ /* POLL UNTIL ABLE TO WRITE THE PATTERN COLOR */
+
+ GU2_WAIT_PENDING;
+ WRITE_GP32(MGP_PAT_COLOR_0, (unsigned long) planemask);
+ WRITE_GP32(MGP_RASTER_MODE, gu2_bpp | GeodeROP);
+ WRITE_GP32(MGP_SRC_COLOR_FG, fg);
+ WRITE_GP32(MGP_SRC_COLOR_BG, bg);
}
/*-------------------------------------------------------------------------------
@@ -1358,18 +1367,18 @@ OPTGX2SetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScreenInfo,
*/
void
OPTGX2SubsequentCPUToScreenColorExpandFill(ScrnInfoPtr pScreenInfo,
- int x, int y, int w, int h,
- int skipleft)
+ int x, int y, int w, int h,
+ int skipleft)
{
- GeodePtr pGeode = GEODEPTR(pScreenInfo);
-
- GU2_WAIT_PENDING;
- WRITE_GP32(MGP_SRC_OFFSET, ((unsigned int)(localRecPtr->ColorExpandBase -
- pGeode->FBBase)));
- WRITE_GP32(MGP_DST_OFFSET, CALC_FBOFFSET(x, y));
- WRITE_GP32(MGP_WID_HEIGHT, (((unsigned long)w) << 16) | h);
- WRITE_GP32(MGP_STRIDE, (((w + 31) >> 5) << 18) | pGeode->Pitch);
- SetCPUToScreen = 1;
+ GeodePtr pGeode = GEODEPTR(pScreenInfo);
+
+ GU2_WAIT_PENDING;
+ WRITE_GP32(MGP_SRC_OFFSET, ((unsigned int) (localRecPtr->ColorExpandBase -
+ pGeode->FBBase)));
+ WRITE_GP32(MGP_DST_OFFSET, CALC_FBOFFSET(x, y));
+ WRITE_GP32(MGP_WID_HEIGHT, (((unsigned long) w) << 16) | h);
+ WRITE_GP32(MGP_STRIDE, (((w + 31) >> 5) << 18) | pGeode->Pitch);
+ SetCPUToScreen = 1;
}
/*----------------------------------------------------------------------------
@@ -1394,34 +1403,36 @@ OPTGX2SubsequentCPUToScreenColorExpandFill(ScrnInfoPtr pScreenInfo,
*/
void
OPTGX2SetupForFillRectSolid(ScrnInfoPtr pScreenInfo,
- int color, int rop, unsigned int planemask)
+ int color, int rop, unsigned int planemask)
{
- GeodePtr pGeode = GEODEPTR(pScreenInfo);
-
- GU2_WAIT_PENDING;
- WRITE_GP32(MGP_PAT_COLOR_0, (unsigned long)color);
-
- WRITE_GP32(MGP_STRIDE, pGeode->Pitch);
-
- if (planemask == 0xFFFFFFFF) {
- GeodeROP = XAAGetPatternROP(rop);
- } else {
- WRITE_GP32(MGP_SRC_COLOR_FG, (unsigned long)planemask);
- GeodeROP = XAAGetPatternROP(rop);
- }
-
- WRITE_GP32(MGP_RASTER_MODE, gu2_bpp | GeodeROP);
-
- Geode_blt_mode = 0;
- if (!((GeodeROP & 0x33) ^ ((GeodeROP >> 2) & 0x33)))
- Geode_blt_mode = MGP_BM_SRC_MONO;
-
- if ((GeodeROP & 0x55) ^ ((GeodeROP >> 1) & 0x55)) {
- Geode_blt_mode |= MGP_BM_DST_REQ;
- Geode_vector_mode = MGP_VM_DST_REQ;
- } else {
- Geode_vector_mode = 0;
- }
+ GeodePtr pGeode = GEODEPTR(pScreenInfo);
+
+ GU2_WAIT_PENDING;
+ WRITE_GP32(MGP_PAT_COLOR_0, (unsigned long) color);
+
+ WRITE_GP32(MGP_STRIDE, pGeode->Pitch);
+
+ if (planemask == 0xFFFFFFFF) {
+ GeodeROP = XAAGetPatternROP(rop);
+ }
+ else {
+ WRITE_GP32(MGP_SRC_COLOR_FG, (unsigned long) planemask);
+ GeodeROP = XAAGetPatternROP(rop);
+ }
+
+ WRITE_GP32(MGP_RASTER_MODE, gu2_bpp | GeodeROP);
+
+ Geode_blt_mode = 0;
+ if (!((GeodeROP & 0x33) ^ ((GeodeROP >> 2) & 0x33)))
+ Geode_blt_mode = MGP_BM_SRC_MONO;
+
+ if ((GeodeROP & 0x55) ^ ((GeodeROP >> 1) & 0x55)) {
+ Geode_blt_mode |= MGP_BM_DST_REQ;
+ Geode_vector_mode = MGP_VM_DST_REQ;
+ }
+ else {
+ Geode_vector_mode = 0;
+ }
}
/*----------------------------------------------------------------------------
@@ -1449,11 +1460,11 @@ OPTGX2SetupForFillRectSolid(ScrnInfoPtr pScreenInfo,
*/
void
OPTGX2SubsequentFillRectSolid(ScrnInfoPtr pScreenInfo,
- int x, int y, int width, int height)
+ int x, int y, int width, int height)
{
- DEBUGMSG(0, (0, 0, "FillRect %d %d %dx%d\n", x, y, width, height));
+ DEBUGMSG(0, (0, 0, "FillRect %d %d %dx%d\n", x, y, width, height));
- GFX_PATTERN_FILL(x, y, width, height);
+ GFX_PATTERN_FILL(x, y, width, height);
}
/*----------------------------------------------------------------------------
@@ -1478,31 +1489,30 @@ OPTGX2SubsequentFillRectSolid(ScrnInfoPtr pScreenInfo,
*/
void
OPTGX2SetupForScreenToScreenCopy(ScrnInfoPtr pScreenInfo,
- int xdir, int ydir, int rop,
- unsigned int planemask,
- int transparency_color)
+ int xdir, int ydir, int rop,
+ unsigned int planemask, int transparency_color)
{
- GeodePtr pGeode = GEODEPTR(pScreenInfo);
+ GeodePtr pGeode = GEODEPTR(pScreenInfo);
- GeodeROP = XAAGetCopyROP_PM(rop);
+ GeodeROP = XAAGetCopyROP_PM(rop);
- Geode_blt_mode = MGP_BM_SRC_FB;
+ Geode_blt_mode = MGP_BM_SRC_FB;
- /* CALCULATE THE DIRECTION OF THE BLT */
- if ((GeodeROP & 0x55) ^ ((GeodeROP >> 1) & 0x55)) {
- Geode_blt_mode |= MGP_BM_DST_REQ;
- }
+ /* CALCULATE THE DIRECTION OF THE BLT */
+ if ((GeodeROP & 0x55) ^ ((GeodeROP >> 1) & 0x55)) {
+ Geode_blt_mode |= MGP_BM_DST_REQ;
+ }
- GU2_WAIT_PENDING;
+ GU2_WAIT_PENDING;
- if (transparency_color != -1) {
- WRITE_GP32(MGP_SRC_COLOR_FG, transparency_color);
- WRITE_GP32(MGP_SRC_COLOR_BG, 0xFFFFFFFF);
- GeodeROP = MGP_RM_SRC_TRANS | 0xCC;
- }
- WRITE_GP32(MGP_PAT_COLOR_0, planemask);
- WRITE_GP32(MGP_RASTER_MODE, gu2_bpp | GeodeROP);
- WRITE_GP32(MGP_STRIDE, pGeode->Pitch | (pGeode->Pitch << 16));
+ if (transparency_color != -1) {
+ WRITE_GP32(MGP_SRC_COLOR_FG, transparency_color);
+ WRITE_GP32(MGP_SRC_COLOR_BG, 0xFFFFFFFF);
+ GeodeROP = MGP_RM_SRC_TRANS | 0xCC;
+ }
+ WRITE_GP32(MGP_PAT_COLOR_0, planemask);
+ WRITE_GP32(MGP_RASTER_MODE, gu2_bpp | GeodeROP);
+ WRITE_GP32(MGP_STRIDE, pGeode->Pitch | (pGeode->Pitch << 16));
}
/*----------------------------------------------------------------------------
@@ -1534,49 +1544,49 @@ OPTGX2SetupForScreenToScreenCopy(ScrnInfoPtr pScreenInfo,
*/
void
OPTGX2SubsequentScreenToScreenCopy(ScrnInfoPtr pScreenInfo,
- int srcx, int srcy, int dstx, int dsty,
- int width, int height)
+ int srcx, int srcy, int dstx, int dsty,
+ int width, int height)
{
- unsigned int srcoffset, dstoffset, blt_mode, size;
-
- DEBUGMSG(0, (0, 0, "Scr2scr %d %d %d %d %dx%d\n",
- srcx, srcy, dstx, dsty, width, height));
-
- size = (((unsigned int)width) << 16) | height;
-
- blt_mode = Geode_blt_mode;
-
- if (dstx > srcx) {
- blt_mode |= MGP_BM_NEG_XDIR;
- srcx += width - 1;
- dstx += width - 1;
- }
- if (dsty > srcy) {
- blt_mode |= MGP_BM_NEG_YDIR;
- srcy += height - 1;
- dsty += height - 1;
- }
-
- /* CALCULATE STARTING OFFSETS */
-
- srcoffset = CALC_FBOFFSET(srcx, srcy);
- dstoffset = CALC_FBOFFSET(dstx, dsty) & 0xFFFFFF;
-
- /* TURN INTO BYTE ADDRESS IF NEGATIVE X DIRECTION */
- /* This is a quirk of the hardware. */
-
- if (Geode_blt_mode & MGP_BM_NEG_XDIR) {
- srcoffset += (1 << gu2_xshift) - 1;
- dstoffset += (1 << gu2_xshift) - 1;
- }
- /* POLL UNTIL ABLE TO WRITE TO THE REGISTERS */
- /* Put off poll for as long as possible (do most calculations first). */
-
- GU2_WAIT_PENDING;
- WRITE_GP32(MGP_SRC_OFFSET, srcoffset);
- WRITE_GP32(MGP_DST_OFFSET, dstoffset);
- WRITE_GP32(MGP_WID_HEIGHT, size);
- WRITE_GP32(MGP_BLT_MODE, blt_mode);
+ unsigned int srcoffset, dstoffset, blt_mode, size;
+
+ DEBUGMSG(0, (0, 0, "Scr2scr %d %d %d %d %dx%d\n",
+ srcx, srcy, dstx, dsty, width, height));
+
+ size = (((unsigned int) width) << 16) | height;
+
+ blt_mode = Geode_blt_mode;
+
+ if (dstx > srcx) {
+ blt_mode |= MGP_BM_NEG_XDIR;
+ srcx += width - 1;
+ dstx += width - 1;
+ }
+ if (dsty > srcy) {
+ blt_mode |= MGP_BM_NEG_YDIR;
+ srcy += height - 1;
+ dsty += height - 1;
+ }
+
+ /* CALCULATE STARTING OFFSETS */
+
+ srcoffset = CALC_FBOFFSET(srcx, srcy);
+ dstoffset = CALC_FBOFFSET(dstx, dsty) & 0xFFFFFF;
+
+ /* TURN INTO BYTE ADDRESS IF NEGATIVE X DIRECTION */
+ /* This is a quirk of the hardware. */
+
+ if (Geode_blt_mode & MGP_BM_NEG_XDIR) {
+ srcoffset += (1 << gu2_xshift) - 1;
+ dstoffset += (1 << gu2_xshift) - 1;
+ }
+ /* POLL UNTIL ABLE TO WRITE TO THE REGISTERS */
+ /* Put off poll for as long as possible (do most calculations first). */
+
+ GU2_WAIT_PENDING;
+ WRITE_GP32(MGP_SRC_OFFSET, srcoffset);
+ WRITE_GP32(MGP_DST_OFFSET, dstoffset);
+ WRITE_GP32(MGP_WID_HEIGHT, size);
+ WRITE_GP32(MGP_BLT_MODE, blt_mode);
}
/*----------------------------------------------------------------------------
@@ -1599,23 +1609,23 @@ OPTGX2SubsequentScreenToScreenCopy(ScrnInfoPtr pScreenInfo,
*/
void
OPTGX2SetupForImageWrite(ScrnInfoPtr pScreenInfo,
- int rop, unsigned int planemask,
- int transparency_color, int bpp, int depth)
+ int rop, unsigned int planemask,
+ int transparency_color, int bpp, int depth)
{
- OPTGX2SetupForScreenToScreenCopy(pScreenInfo,
- 0, 0, rop, planemask, transparency_color);
+ OPTGX2SetupForScreenToScreenCopy(pScreenInfo,
+ 0, 0, rop, planemask, transparency_color);
}
void
OPTGX2SubsequentImageWriteRect(ScrnInfoPtr pScreenInfo,
- int x, int y, int w, int h, int skipleft)
+ int x, int y, int w, int h, int skipleft)
{
- Geodedstx = x;
- Geodedsty = y;
- Geodewidth = w;
- Geodeheight = h;
+ Geodedstx = x;
+ Geodedsty = y;
+ Geodewidth = w;
+ Geodeheight = h;
#if IMGWRITE_SUPPORT
- SetImageWriteRect = 1;
+ SetImageWriteRect = 1;
#endif
}
@@ -1639,11 +1649,11 @@ OPTGX2SubsequentImageWriteRect(ScrnInfoPtr pScreenInfo,
*/
void
OPTGX2SetupForScanlineImageWrite(ScrnInfoPtr pScreenInfo,
- int rop, unsigned int planemask,
- int transparency_color, int bpp, int depth)
+ int rop, unsigned int planemask,
+ int transparency_color, int bpp, int depth)
{
- OPTGX2SetupForScreenToScreenCopy(pScreenInfo,
- 0, 0, rop, planemask, transparency_color);
+ OPTGX2SetupForScreenToScreenCopy(pScreenInfo,
+ 0, 0, rop, planemask, transparency_color);
}
/*----------------------------------------------------------------------------
@@ -1665,14 +1675,13 @@ OPTGX2SetupForScanlineImageWrite(ScrnInfoPtr pScreenInfo,
*/
void
OPTGX2SubsequentScanlineImageWriteRect(ScrnInfoPtr pScreenInfo,
- int x, int y, int w, int h,
- int skipleft)
+ int x, int y, int w, int h, int skipleft)
{
- Geodedstx = x;
- Geodedsty = y;
- Geodewidth = w;
- Geodeheight = h;
- GeodeCounter = 0;
+ Geodedstx = x;
+ Geodedsty = y;
+ Geodewidth = w;
+ Geodeheight = h;
+ GeodeCounter = 0;
}
/*----------------------------------------------------------------------------
@@ -1700,35 +1709,37 @@ OPTGX2SubsequentScanlineImageWriteRect(ScrnInfoPtr pScreenInfo,
void
OPTGX2SubsequentImageWriteScanline(ScrnInfoPtr pScreenInfo, int bufno)
{
- GeodePtr pGeode;
-
- int blt_height = 0;
- char blit = FALSE;
-
- pGeode = GEODEPTR(pScreenInfo);
- GeodeCounter++;
-
- if ((Geodeheight <= pGeode->NoOfImgBuffers) &&
- (GeodeCounter == Geodeheight)) {
- blit = TRUE;
- blt_height = Geodeheight;
- } else if ((Geodeheight > pGeode->NoOfImgBuffers)
- && (GeodeCounter == pGeode->NoOfImgBuffers)) {
- blit = TRUE;
- Geodeheight -= pGeode->NoOfImgBuffers;
- blt_height = pGeode->NoOfImgBuffers;
- } else
- return;
-
- if (blit) {
- blit = FALSE;
- GeodeCounter = 0;
- OPTGX2SubsequentScreenToScreenCopy(pScreenInfo,
- Geodesrcx, Geodesrcy, Geodedstx,
- Geodedsty, Geodewidth, blt_height);
- Geodedsty += blt_height;
- GU2_WAIT_BUSY;
- }
+ GeodePtr pGeode;
+
+ int blt_height = 0;
+ char blit = FALSE;
+
+ pGeode = GEODEPTR(pScreenInfo);
+ GeodeCounter++;
+
+ if ((Geodeheight <= pGeode->NoOfImgBuffers) &&
+ (GeodeCounter == Geodeheight)) {
+ blit = TRUE;
+ blt_height = Geodeheight;
+ }
+ else if ((Geodeheight > pGeode->NoOfImgBuffers)
+ && (GeodeCounter == pGeode->NoOfImgBuffers)) {
+ blit = TRUE;
+ Geodeheight -= pGeode->NoOfImgBuffers;
+ blt_height = pGeode->NoOfImgBuffers;
+ }
+ else
+ return;
+
+ if (blit) {
+ blit = FALSE;
+ GeodeCounter = 0;
+ OPTGX2SubsequentScreenToScreenCopy(pScreenInfo,
+ Geodesrcx, Geodesrcy, Geodedstx,
+ Geodedsty, Geodewidth, blt_height);
+ Geodedsty += blt_height;
+ GU2_WAIT_BUSY;
+ }
}
/*----------------------------------------------------------------------------
@@ -1750,9 +1761,9 @@ OPTGX2SubsequentImageWriteScanline(ScrnInfoPtr pScreenInfo, int bufno)
*/
void
OPTGX2SetupForSolidLine(ScrnInfoPtr pScreenInfo,
- int color, int rop, unsigned int planemask)
+ int color, int rop, unsigned int planemask)
{
- OPTGX2SetupForFillRectSolid(pScreenInfo, color, rop, planemask);
+ OPTGX2SetupForFillRectSolid(pScreenInfo, color, rop, planemask);
}
/*---------------------------------------------------------------------------
@@ -1781,84 +1792,85 @@ OPTGX2SetupForSolidLine(ScrnInfoPtr pScreenInfo,
*/
void
OPTGX2SubsequentBresenhamLine(ScrnInfoPtr pScreenInfo,
- int x1, int y1, int absmaj, int absmin,
- int err, int len, int octant)
+ int x1, int y1, int absmaj, int absmin,
+ int err, int len, int octant)
{
- int axial, init, diag;
+ int axial, init, diag;
- DEBUGMSG(0, (0, 0, "BLine %d, %d, %d, %d, %d, %d, %d\n",
- x1, y1, absmaj, absmin, err, len, octant));
+ DEBUGMSG(0, (0, 0, "BLine %d, %d, %d, %d, %d, %d, %d\n",
+ x1, y1, absmaj, absmin, err, len, octant));
- /* DETERMINE BRESENHAM PARAMETERS */
+ /* DETERMINE BRESENHAM PARAMETERS */
- axial = ((int)absmin << 1);
- init = axial - (int)absmaj;
- diag = init - (int)absmaj;
+ axial = ((int) absmin << 1);
+ init = axial - (int) absmaj;
+ diag = init - (int) absmaj;
- /* ADJUST INITIAL ERROR
- * * Adjust by -1 for certain directions so that the vector
- * * hits the same pixels when drawn in either direction.
- * * The Gamma value is assumed to account for the initial
- * * error adjustment for clipped lines.
- */
+ /* ADJUST INITIAL ERROR
+ * * Adjust by -1 for certain directions so that the vector
+ * * hits the same pixels when drawn in either direction.
+ * * The Gamma value is assumed to account for the initial
+ * * error adjustment for clipped lines.
+ */
- init += err;
+ init += err;
- /* POLL UNTIL ABLE TO WRITE TO THE REGISTERS */
- /* Put off poll for as long as possible (do most calculations first). */
+ /* POLL UNTIL ABLE TO WRITE TO THE REGISTERS */
+ /* Put off poll for as long as possible (do most calculations first). */
- GU2_WAIT_PENDING;
- WRITE_GP32(MGP_DST_OFFSET, CALC_FBOFFSET(x1, y1));
- WRITE_GP32(MGP_VEC_ERR,
- (((unsigned long)axial) << 16) | (unsigned short)diag);
- WRITE_GP32(MGP_VEC_LEN,
- (((unsigned long)len) << 16) | (unsigned short)init);
- WRITE_GP32(MGP_VECTOR_MODE,
- (Geode_vector_mode | vector_mode_table[octant]));
+ GU2_WAIT_PENDING;
+ WRITE_GP32(MGP_DST_OFFSET, CALC_FBOFFSET(x1, y1));
+ WRITE_GP32(MGP_VEC_ERR,
+ (((unsigned long) axial) << 16) | (unsigned short) diag);
+ WRITE_GP32(MGP_VEC_LEN,
+ (((unsigned long) len) << 16) | (unsigned short) init);
+ WRITE_GP32(MGP_VECTOR_MODE,
+ (Geode_vector_mode | vector_mode_table[octant]));
}
void
OPTGX2SubsequentSolidTwoPointLine(ScrnInfoPtr pScreenInfo,
- int x0, int y0, int x1, int y1, int flags)
+ int x0, int y0, int x1, int y1, int flags)
{
- long dx, dy, dmaj, dmin;
- long axialerr, diagerr, initerr;
- unsigned short vec_flags = 0;
-
- dx = ABS(x1, x0);
- dy = ABS(y1, y0);
- if (dx >= dy) {
- dmaj = dx;
- dmin = dy;
- vec_flags = VM_X_MAJOR;
- if (x1 > x0)
- vec_flags |= VM_MAJOR_INC;
- if (y1 > y0)
- vec_flags |= VM_MINOR_INC;
- } else {
- dmaj = dy;
- dmin = dx;
- vec_flags = VM_Y_MAJOR;
- if (x1 > x0)
- vec_flags |= VM_MINOR_INC;
- if (y1 > y0)
- vec_flags |= VM_MAJOR_INC;
- }
-
- axialerr = dmin << 1;
- diagerr = (dmin - dmaj) << 1;
- initerr = (axialerr - dmaj);
-
- if (!(vec_flags & VM_MINOR_INC))
- initerr--;
-
- GU2_WAIT_PENDING;
- WRITE_GP32(MGP_DST_OFFSET, CALC_FBOFFSET(x0, y0));
- WRITE_GP32(MGP_VEC_ERR,
- (((unsigned long)axialerr) << 16) | (unsigned short)diagerr);
- WRITE_GP32(MGP_VEC_LEN,
- (((unsigned long)dmaj) << 16) | (unsigned short)initerr);
- WRITE_GP32(MGP_VECTOR_MODE, (Geode_vector_mode | vec_flags));
+ long dx, dy, dmaj, dmin;
+ long axialerr, diagerr, initerr;
+ unsigned short vec_flags = 0;
+
+ dx = ABS(x1, x0);
+ dy = ABS(y1, y0);
+ if (dx >= dy) {
+ dmaj = dx;
+ dmin = dy;
+ vec_flags = VM_X_MAJOR;
+ if (x1 > x0)
+ vec_flags |= VM_MAJOR_INC;
+ if (y1 > y0)
+ vec_flags |= VM_MINOR_INC;
+ }
+ else {
+ dmaj = dy;
+ dmin = dx;
+ vec_flags = VM_Y_MAJOR;
+ if (x1 > x0)
+ vec_flags |= VM_MINOR_INC;
+ if (y1 > y0)
+ vec_flags |= VM_MAJOR_INC;
+ }
+
+ axialerr = dmin << 1;
+ diagerr = (dmin - dmaj) << 1;
+ initerr = (axialerr - dmaj);
+
+ if (!(vec_flags & VM_MINOR_INC))
+ initerr--;
+
+ GU2_WAIT_PENDING;
+ WRITE_GP32(MGP_DST_OFFSET, CALC_FBOFFSET(x0, y0));
+ WRITE_GP32(MGP_VEC_ERR,
+ (((unsigned long) axialerr) << 16) | (unsigned short) diagerr);
+ WRITE_GP32(MGP_VEC_LEN,
+ (((unsigned long) dmaj) << 16) | (unsigned short) initerr);
+ WRITE_GP32(MGP_VECTOR_MODE, (Geode_vector_mode | vec_flags));
}
/*---------------------------------------------------------------------------
@@ -1875,22 +1887,22 @@ OPTGX2SubsequentSolidTwoPointLine(ScrnInfoPtr pScreenInfo,
*/
void
OPTGX2SubsequentHorVertLine(ScrnInfoPtr pScreenInfo,
- int x, int y, int len, int dir)
+ int x, int y, int len, int dir)
{
- DEBUGMSG(0, (0, 0, "HLine %d, %d, %d, %d\n", x, y, len, dir));
+ DEBUGMSG(0, (0, 0, "HLine %d, %d, %d, %d\n", x, y, len, dir));
#if 1
- GFX_PATTERN_FILL(x, y,
- (unsigned short)((dir == DEGREES_0) ? len : 1),
- (unsigned short)((dir == DEGREES_0) ? 1 : len));
+ GFX_PATTERN_FILL(x, y,
+ (unsigned short) ((dir == DEGREES_0) ? len : 1),
+ (unsigned short) ((dir == DEGREES_0) ? 1 : len));
#else
- GU2_WAIT_PENDING;
- WRITE_GP32(MGP_DST_OFFSET, CALC_FBOFFSET(x, y));
- WRITE_GP32(MGP_VEC_ERR, 0);
- WRITE_GP32(MGP_VEC_LEN,
- (((unsigned long)len) << 16) | (unsigned short)-len);
- WRITE_GP32(MGP_VECTOR_MODE,
- (Geode_vector_mode |
- vector_mode_table[(dir == DEGREES_0) ? 2 : 5]));
+ GU2_WAIT_PENDING;
+ WRITE_GP32(MGP_DST_OFFSET, CALC_FBOFFSET(x, y));
+ WRITE_GP32(MGP_VEC_ERR, 0);
+ WRITE_GP32(MGP_VEC_LEN,
+ (((unsigned long) len) << 16) | (unsigned short) -len);
+ WRITE_GP32(MGP_VECTOR_MODE,
+ (Geode_vector_mode |
+ vector_mode_table[(dir == DEGREES_0) ? 2 : 5]));
#endif
}
@@ -1905,210 +1917,214 @@ OPTGX2SubsequentHorVertLine(ScrnInfoPtr pScreenInfo,
*/
void
OPTGX2SetupForDashedLine(ScrnInfoPtr pScrn, int fg, int bg, int rop,
- unsigned int planemask, int length,
- unsigned char *pattern)
+ unsigned int planemask, int length,
+ unsigned char *pattern)
{
- GeodePtr pGeode = GEODEPTR(pScrn);
- CARD32 *pat = (CARD32 *) pattern;
- CARD32 pat8x8[2];
-
- pat8x8[0] = pat[0];
- switch (length) {
- case 2:
- pat8x8[0] |= PAT_SHIFT(pat8x8[0], 2); /* fall through */
- case 4:
- pat8x8[0] |= PAT_SHIFT(pat8x8[0], 4); /* fall through */
- case 8:
- pat8x8[0] |= PAT_SHIFT(pat8x8[0], 8); /* fall through */
- case 16:
- pat8x8[0] |= PAT_SHIFT(pat8x8[0], 16);
- case 32:
- pat8x8[1] = pat8x8[0];
- break;
- case 64:
- pat8x8[1] = pat[1];
- break;
- default:
- BuildPattern(pat[0], length, pat8x8);
- }
- /* LOAD PATTERN COLORS AND DATA */
-
- /* SET PATTERN FLAGS */
-
- if (planemask == 0xFFFFFFFF) {
- GeodeROP = XAAGetPatternROP(rop & 0x0F);
- } else {
- GeodeROP = XAAGetPatternROP_PM(rop & 0x0F);
- }
- if (bg == -1)
- GeodeROP |= MGP_RM_PAT_MONO | MGP_RM_PAT_TRANS;
- else
- GeodeROP |= MGP_RM_PAT_MONO;
-
- if ((GeodeROP & 0x55) ^ ((GeodeROP >> 1) & 0x55)) {
- Geode_blt_mode = MGP_BM_DST_REQ;
- Geode_vector_mode = MGP_VM_DST_REQ;
- } else {
- Geode_blt_mode = MGP_BM_SRC_MONO;
- Geode_vector_mode = 0;
- }
-
- /* POLL UNTIL ABLE TO WRITE THE PATTERN COLOR */
-
- GU2_WAIT_PENDING;
- WRITE_GP32(MGP_RASTER_MODE, gu2_bpp | GeodeROP);
- WRITE_GP32(MGP_PAT_COLOR_0, bg);
- WRITE_GP32(MGP_PAT_COLOR_1, fg);
- WRITE_GP32(MGP_PAT_DATA_0, pat8x8[0]);
- WRITE_GP32(MGP_PAT_DATA_1, pat8x8[1]);
- WRITE_GP32(MGP_STRIDE, pGeode->Pitch);
+ GeodePtr pGeode = GEODEPTR(pScrn);
+ CARD32 *pat = (CARD32 *) pattern;
+ CARD32 pat8x8[2];
+
+ pat8x8[0] = pat[0];
+ switch (length) {
+ case 2:
+ pat8x8[0] |= PAT_SHIFT(pat8x8[0], 2); /* fall through */
+ case 4:
+ pat8x8[0] |= PAT_SHIFT(pat8x8[0], 4); /* fall through */
+ case 8:
+ pat8x8[0] |= PAT_SHIFT(pat8x8[0], 8); /* fall through */
+ case 16:
+ pat8x8[0] |= PAT_SHIFT(pat8x8[0], 16);
+ case 32:
+ pat8x8[1] = pat8x8[0];
+ break;
+ case 64:
+ pat8x8[1] = pat[1];
+ break;
+ default:
+ BuildPattern(pat[0], length, pat8x8);
+ }
+ /* LOAD PATTERN COLORS AND DATA */
+
+ /* SET PATTERN FLAGS */
+
+ if (planemask == 0xFFFFFFFF) {
+ GeodeROP = XAAGetPatternROP(rop & 0x0F);
+ }
+ else {
+ GeodeROP = XAAGetPatternROP_PM(rop & 0x0F);
+ }
+ if (bg == -1)
+ GeodeROP |= MGP_RM_PAT_MONO | MGP_RM_PAT_TRANS;
+ else
+ GeodeROP |= MGP_RM_PAT_MONO;
+
+ if ((GeodeROP & 0x55) ^ ((GeodeROP >> 1) & 0x55)) {
+ Geode_blt_mode = MGP_BM_DST_REQ;
+ Geode_vector_mode = MGP_VM_DST_REQ;
+ }
+ else {
+ Geode_blt_mode = MGP_BM_SRC_MONO;
+ Geode_vector_mode = 0;
+ }
+
+ /* POLL UNTIL ABLE TO WRITE THE PATTERN COLOR */
+
+ GU2_WAIT_PENDING;
+ WRITE_GP32(MGP_RASTER_MODE, gu2_bpp | GeodeROP);
+ WRITE_GP32(MGP_PAT_COLOR_0, bg);
+ WRITE_GP32(MGP_PAT_COLOR_1, fg);
+ WRITE_GP32(MGP_PAT_DATA_0, pat8x8[0]);
+ WRITE_GP32(MGP_PAT_DATA_1, pat8x8[1]);
+ WRITE_GP32(MGP_STRIDE, pGeode->Pitch);
}
void
OPTGX2SubsequentDashedBresenhamLine(ScrnInfoPtr pScreenInfo,
- int x1, int y1, int absmaj, int absmin,
- int err, int len, int octant)
+ int x1, int y1, int absmaj, int absmin,
+ int err, int len, int octant)
{
- int axial, init, diag;
- unsigned long gu2_pattern_origin;
+ int axial, init, diag;
+ unsigned long gu2_pattern_origin;
- DEBUGMSG(0, (0, 0, "BLine %d, %d, %d, %d, %d, %d, %d\n",
- x1, y1, absmaj, absmin, err, len, octant));
+ DEBUGMSG(0, (0, 0, "BLine %d, %d, %d, %d, %d, %d, %d\n",
+ x1, y1, absmaj, absmin, err, len, octant));
- /* CHECK NULL LENGTH */
+ /* CHECK NULL LENGTH */
- if (!len)
- return;
+ if (!len)
+ return;
- /* DETERMINE BRESENHAM PARAMETERS */
+ /* DETERMINE BRESENHAM PARAMETERS */
- axial = ((int)absmin << 1);
- init = axial - (int)absmaj;
- diag = init - (int)absmaj;
+ axial = ((int) absmin << 1);
+ init = axial - (int) absmaj;
+ diag = init - (int) absmaj;
- /* ADJUST INITIAL ERROR
- * * Adjust by -1 for certain directions so that the vector
- * * hits the same pixels when drawn in either direction.
- * * The Gamma value is assumed to account for the initial
- * * error adjustment for clipped lines.
- */
+ /* ADJUST INITIAL ERROR
+ * * Adjust by -1 for certain directions so that the vector
+ * * hits the same pixels when drawn in either direction.
+ * * The Gamma value is assumed to account for the initial
+ * * error adjustment for clipped lines.
+ */
- init += err;
+ init += err;
- /* CALL ROUTINE TO DRAW VECTOR */
+ /* CALL ROUTINE TO DRAW VECTOR */
- gu2_pattern_origin = (((unsigned long)(x1 & 7)) << 26) |
- (((unsigned long)(y1 & 7)) << 29);
+ gu2_pattern_origin = (((unsigned long) (x1 & 7)) << 26) |
+ (((unsigned long) (y1 & 7)) << 29);
- /* POLL UNTIL ABLE TO WRITE TO THE REGISTERS */
- /* Put off poll for as long as possible (do most calculations first). */
+ /* POLL UNTIL ABLE TO WRITE TO THE REGISTERS */
+ /* Put off poll for as long as possible (do most calculations first). */
- GU2_WAIT_PENDING;
- WRITE_GP32(MGP_DST_OFFSET, (CALC_FBOFFSET(x1, y1) & 0x00FFFFFF) |
- gu2_pattern_origin);
- WRITE_GP32(MGP_VEC_ERR,
- (((unsigned long)axial) << 16) | (unsigned short)diag);
- WRITE_GP32(MGP_VEC_LEN,
- (((unsigned long)len) << 16) | (unsigned short)init);
- WRITE_GP32(MGP_VECTOR_MODE, (Geode_vector_mode |
- vector_mode_table[octant]));
+ GU2_WAIT_PENDING;
+ WRITE_GP32(MGP_DST_OFFSET, (CALC_FBOFFSET(x1, y1) & 0x00FFFFFF) |
+ gu2_pattern_origin);
+ WRITE_GP32(MGP_VEC_ERR,
+ (((unsigned long) axial) << 16) | (unsigned short) diag);
+ WRITE_GP32(MGP_VEC_LEN,
+ (((unsigned long) len) << 16) | (unsigned short) init);
+ WRITE_GP32(MGP_VECTOR_MODE, (Geode_vector_mode |
+ vector_mode_table[octant]));
}
void
OPTGX2SubsequentDashedTwoPointLine(ScrnInfoPtr pScreenInfo,
- int x0, int y0, int x1, int y1, int flags)
+ int x0, int y0, int x1, int y1, int flags)
{
- long dx, dy, dmaj, dmin;
- long axialerr, diagerr, initerr;
- unsigned long gu2_pattern_origin;
- unsigned short vec_flags = 0;
-
- dx = ABS(x1, x0);
- dy = ABS(y1, y0);
- if (dx >= dy) {
- dmaj = dx;
- dmin = dy;
- vec_flags = VM_X_MAJOR;
- if (x1 > x0)
- vec_flags |= VM_MAJOR_INC;
- if (y1 > y0)
- vec_flags |= VM_MINOR_INC;
- } else {
- dmaj = dy;
- dmin = dx;
- vec_flags = VM_Y_MAJOR;
- if (x1 > x0)
- vec_flags |= VM_MINOR_INC;
- if (y1 > y0)
- vec_flags |= VM_MAJOR_INC;
- }
-
- axialerr = dmin << 1;
- diagerr = (dmin - dmaj) << 1;
- initerr = (axialerr - dmaj);
-
- if (!(vec_flags & VM_MINOR_INC))
- initerr--;
-
- /* CALL ROUTINE TO DRAW VECTOR */
-
- gu2_pattern_origin = (((unsigned long)(x0 & 7)) << 26) |
- (((unsigned long)(y0 & 7)) << 29);
-
- GU2_WAIT_PENDING;
- WRITE_GP32(MGP_DST_OFFSET, (CALC_FBOFFSET(x0, y0) & 0x00FFFFFF) |
- gu2_pattern_origin);
- WRITE_GP32(MGP_VEC_ERR,
- (((unsigned long)axialerr) << 16) | (unsigned short)diagerr);
- WRITE_GP32(MGP_VEC_LEN,
- (((unsigned long)dmaj) << 16) | (unsigned short)initerr);
- WRITE_GP16(MGP_VECTOR_MODE, (Geode_vector_mode | vec_flags));
+ long dx, dy, dmaj, dmin;
+ long axialerr, diagerr, initerr;
+ unsigned long gu2_pattern_origin;
+ unsigned short vec_flags = 0;
+
+ dx = ABS(x1, x0);
+ dy = ABS(y1, y0);
+ if (dx >= dy) {
+ dmaj = dx;
+ dmin = dy;
+ vec_flags = VM_X_MAJOR;
+ if (x1 > x0)
+ vec_flags |= VM_MAJOR_INC;
+ if (y1 > y0)
+ vec_flags |= VM_MINOR_INC;
+ }
+ else {
+ dmaj = dy;
+ dmin = dx;
+ vec_flags = VM_Y_MAJOR;
+ if (x1 > x0)
+ vec_flags |= VM_MINOR_INC;
+ if (y1 > y0)
+ vec_flags |= VM_MAJOR_INC;
+ }
+
+ axialerr = dmin << 1;
+ diagerr = (dmin - dmaj) << 1;
+ initerr = (axialerr - dmaj);
+
+ if (!(vec_flags & VM_MINOR_INC))
+ initerr--;
+
+ /* CALL ROUTINE TO DRAW VECTOR */
+
+ gu2_pattern_origin = (((unsigned long) (x0 & 7)) << 26) |
+ (((unsigned long) (y0 & 7)) << 29);
+
+ GU2_WAIT_PENDING;
+ WRITE_GP32(MGP_DST_OFFSET, (CALC_FBOFFSET(x0, y0) & 0x00FFFFFF) |
+ gu2_pattern_origin);
+ WRITE_GP32(MGP_VEC_ERR,
+ (((unsigned long) axialerr) << 16) | (unsigned short) diagerr);
+ WRITE_GP32(MGP_VEC_LEN,
+ (((unsigned long) dmaj) << 16) | (unsigned short) initerr);
+ WRITE_GP16(MGP_VECTOR_MODE, (Geode_vector_mode | vec_flags));
}
-#endif /* DASHED_SUPPORT */
-#endif /* STB_X */
+#endif /* DASHED_SUPPORT */
+#endif /* STB_X */
#if 0
void
GX2WriteBitmap(ScrnInfoPtr pScrn, int x, int y, int w, int h,
- unsigned char *src, int srcwidth, int skipleft,
- int fg, int bg, int rop, unsigned int planemask)
+ unsigned char *src, int srcwidth, int skipleft,
+ int fg, int bg, int rop, unsigned int planemask)
{
- GFX(set_solid_pattern(planemask));
- GFX(set_mono_source(bg, fg, (bg == -1)));
+ GFX(set_solid_pattern(planemask));
+ GFX(set_mono_source(bg, fg, (bg == -1)));
- /* USE NORMAL PATTERN ROPs IF ALL PLANES ARE ENABLED */
- GFX(set_raster_operation(windowsROPpatMask[rop & 0x0F]));
- GFX(mono_bitmap_to_screen_blt_swp(0, 0, x, y,
- srcwidth << 3, h, src, srcwidth));
+ /* USE NORMAL PATTERN ROPs IF ALL PLANES ARE ENABLED */
+ GFX(set_raster_operation(windowsROPpatMask[rop & 0x0F]));
+ GFX(mono_bitmap_to_screen_blt_swp(0, 0, x, y,
+ srcwidth << 3, h, src, srcwidth));
}
void
-GX2WritePixmap(ScrnInfoPtr pScrn, int x, int y, int w, int h, unsigned char *src, int srcwidth, /* bytes */
- int rop, unsigned int planemask, int trans, int bpp, int depth)
+GX2WritePixmap(ScrnInfoPtr pScrn, int x, int y, int w, int h, unsigned char *src, int srcwidth, /* bytes */
+ int rop, unsigned int planemask, int trans, int bpp, int depth)
{
- /*
- * ErrorF("GX2WritePixmap %d %d %d %d %X %d %d %d, %d\n",
- * x, y, w, h, src, srcwidth, bpp, depth, trans);
- */
- GFX(set_solid_pattern(planemask));
-
- /* USE NORMAL PATTERN ROPs IF ALL PLANES ARE ENABLED */
- GFX(set_raster_operation(windowsROPpatMask[rop & 0x0F]));
- if (trans == -1) {
- GFX(color_bitmap_to_screen_blt(0, 0, x, y, w, h, src, srcwidth));
- } else {
- GFX(color_bitmap_to_screen_xblt(0, 0, x, y, w, h, src,
- srcwidth, trans));
- }
+ /*
+ * ErrorF("GX2WritePixmap %d %d %d %d %X %d %d %d, %d\n",
+ * x, y, w, h, src, srcwidth, bpp, depth, trans);
+ */
+ GFX(set_solid_pattern(planemask));
+
+ /* USE NORMAL PATTERN ROPs IF ALL PLANES ARE ENABLED */
+ GFX(set_raster_operation(windowsROPpatMask[rop & 0x0F]));
+ if (trans == -1) {
+ GFX(color_bitmap_to_screen_blt(0, 0, x, y, w, h, src, srcwidth));
+ }
+ else {
+ GFX(color_bitmap_to_screen_xblt(0, 0, x, y, w, h, src,
+ srcwidth, trans));
+ }
}
void
GX2ReadPixmap(ScrnInfoPtr pScrn, int x, int y, int w, int h,
- unsigned char *dst, int dstwidth, int bpp, int depth)
+ unsigned char *dst, int dstwidth, int bpp, int depth)
{
- ErrorF("GX2ReadPixmap %d %d %d %d %X %d %d %d\n",
- x, y, w, h, dst, dstwidth, bpp, depth);
+ ErrorF("GX2ReadPixmap %d %d %d %d %X %d %d %d\n",
+ x, y, w, h, dst, dstwidth, bpp, depth);
}
#endif
/**************************************************************************/
@@ -2131,175 +2147,174 @@ GX2ReadPixmap(ScrnInfoPtr pScrn, int x, int y, int w, int h,
Bool
GX2AccelInit(ScreenPtr pScreen)
{
- GeodePtr pGeode;
- ScrnInfoPtr pScreenInfo;
-
- pScreenInfo = xf86Screens[pScreen->myNum];
- pGeode = GEODEPTR(pScreenInfo);
-
- switch (pScreenInfo->bitsPerPixel) {
- case 8:
- gu2_bpp = MGP_RM_BPPFMT_332;
- break;
- case 16:
- gu2_bpp = MGP_RM_BPPFMT_565;
- break;
- case 32:
- gu2_bpp = MGP_RM_BPPFMT_8888;
- break;
- }
-
- gu2_xshift = pScreenInfo->bitsPerPixel >> 4;
-
- switch (pGeode->Pitch) {
- case 1024:
- gu2_yshift = 10;
- break;
- case 2048:
- gu2_yshift = 11;
- break;
- case 4096:
- gu2_yshift = 12;
- break;
- case 8192:
- gu2_yshift = 13;
- break;
- }
-
- /* Getting the pointer for acceleration Inforecord */
- pGeode->AccelInfoRec = localRecPtr = XAACreateInfoRec();
-
- /* SET ACCELERATION FLAGS */
- localRecPtr->Flags = PIXMAP_CACHE | OFFSCREEN_PIXMAPS | LINEAR_FRAMEBUFFER;
-
- /* HOOK SYNCRONIZARION ROUTINE */
- localRecPtr->Sync = GX2AccelSync;
-
- /* HOOK FILLED RECTANGLES */
- localRecPtr->SetupForSolidFill = OPTACCEL(GX2SetupForFillRectSolid);
- localRecPtr->SubsequentSolidFillRect =
- OPTACCEL(GX2SubsequentFillRectSolid);
- localRecPtr->SolidFillFlags = 0;
-
- /* HOOK 8x8 Mono EXPAND PATTERNS */
- localRecPtr->SetupForMono8x8PatternFill = GX2SetupFor8x8PatternMonoExpand;
- localRecPtr->SubsequentMono8x8PatternFillRect =
- GX2Subsequent8x8PatternMonoExpand;
- localRecPtr->Mono8x8PatternFillFlags = BIT_ORDER_IN_BYTE_MSBFIRST |
- HARDWARE_PATTERN_PROGRAMMED_BITS | HARDWARE_PATTERN_SCREEN_ORIGIN;
-
- localRecPtr->SetupForColor8x8PatternFill =
- GX2SetupFor8x8PatternColorExpand;
- localRecPtr->SubsequentColor8x8PatternFillRect =
- GX2Subsequent8x8PatternColorExpand;
- /* Color expansion */
- localRecPtr->Color8x8PatternFillFlags =
- BIT_ORDER_IN_BYTE_MSBFIRST |
- SCANLINE_PAD_DWORD | HARDWARE_PATTERN_SCREEN_ORIGIN;
-
- /* HOOK SCREEN TO SCREEN COPIES
- * * Set flag to only allow copy if transparency is enabled.
- */
- localRecPtr->SetupForScreenToScreenCopy =
- OPTACCEL(GX2SetupForScreenToScreenCopy);
- localRecPtr->SubsequentScreenToScreenCopy =
- OPTACCEL(GX2SubsequentScreenToScreenCopy);
- localRecPtr->ScreenToScreenCopyFlags = 0;
-
- /* HOOK BRESENHAM SOLID LINES */
- /* Do not hook unless flag can be set preventing use of planemask. */
- localRecPtr->SolidLineFlags = NO_PLANEMASK;
- localRecPtr->SetupForSolidLine = OPTACCEL(GX2SetupForSolidLine);
- localRecPtr->SubsequentSolidBresenhamLine =
- OPTACCEL(GX2SubsequentBresenhamLine);
- localRecPtr->SubsequentSolidHorVertLine =
- OPTACCEL(GX2SubsequentHorVertLine);
- localRecPtr->SubsequentSolidTwoPointLine =
- OPTACCEL(GX2SubsequentSolidTwoPointLine);
- localRecPtr->SolidBresenhamLineErrorTermBits = 15;
+ GeodePtr pGeode;
+ ScrnInfoPtr pScreenInfo;
+
+ pScreenInfo = xf86Screens[pScreen->myNum];
+ pGeode = GEODEPTR(pScreenInfo);
+
+ switch (pScreenInfo->bitsPerPixel) {
+ case 8:
+ gu2_bpp = MGP_RM_BPPFMT_332;
+ break;
+ case 16:
+ gu2_bpp = MGP_RM_BPPFMT_565;
+ break;
+ case 32:
+ gu2_bpp = MGP_RM_BPPFMT_8888;
+ break;
+ }
+
+ gu2_xshift = pScreenInfo->bitsPerPixel >> 4;
+
+ switch (pGeode->Pitch) {
+ case 1024:
+ gu2_yshift = 10;
+ break;
+ case 2048:
+ gu2_yshift = 11;
+ break;
+ case 4096:
+ gu2_yshift = 12;
+ break;
+ case 8192:
+ gu2_yshift = 13;
+ break;
+ }
+
+ /* Getting the pointer for acceleration Inforecord */
+ pGeode->AccelInfoRec = localRecPtr = XAACreateInfoRec();
+
+ /* SET ACCELERATION FLAGS */
+ localRecPtr->Flags = PIXMAP_CACHE | OFFSCREEN_PIXMAPS | LINEAR_FRAMEBUFFER;
+
+ /* HOOK SYNCRONIZARION ROUTINE */
+ localRecPtr->Sync = GX2AccelSync;
+
+ /* HOOK FILLED RECTANGLES */
+ localRecPtr->SetupForSolidFill = OPTACCEL(GX2SetupForFillRectSolid);
+ localRecPtr->SubsequentSolidFillRect = OPTACCEL(GX2SubsequentFillRectSolid);
+ localRecPtr->SolidFillFlags = 0;
+
+ /* HOOK 8x8 Mono EXPAND PATTERNS */
+ localRecPtr->SetupForMono8x8PatternFill = GX2SetupFor8x8PatternMonoExpand;
+ localRecPtr->SubsequentMono8x8PatternFillRect =
+ GX2Subsequent8x8PatternMonoExpand;
+ localRecPtr->Mono8x8PatternFillFlags = BIT_ORDER_IN_BYTE_MSBFIRST |
+ HARDWARE_PATTERN_PROGRAMMED_BITS | HARDWARE_PATTERN_SCREEN_ORIGIN;
+
+ localRecPtr->SetupForColor8x8PatternFill = GX2SetupFor8x8PatternColorExpand;
+ localRecPtr->SubsequentColor8x8PatternFillRect =
+ GX2Subsequent8x8PatternColorExpand;
+ /* Color expansion */
+ localRecPtr->Color8x8PatternFillFlags =
+ BIT_ORDER_IN_BYTE_MSBFIRST |
+ SCANLINE_PAD_DWORD | HARDWARE_PATTERN_SCREEN_ORIGIN;
+
+ /* HOOK SCREEN TO SCREEN COPIES
+ * * Set flag to only allow copy if transparency is enabled.
+ */
+ localRecPtr->SetupForScreenToScreenCopy =
+ OPTACCEL(GX2SetupForScreenToScreenCopy);
+ localRecPtr->SubsequentScreenToScreenCopy =
+ OPTACCEL(GX2SubsequentScreenToScreenCopy);
+ localRecPtr->ScreenToScreenCopyFlags = 0;
+
+ /* HOOK BRESENHAM SOLID LINES */
+ /* Do not hook unless flag can be set preventing use of planemask. */
+ localRecPtr->SolidLineFlags = NO_PLANEMASK;
+ localRecPtr->SetupForSolidLine = OPTACCEL(GX2SetupForSolidLine);
+ localRecPtr->SubsequentSolidBresenhamLine =
+ OPTACCEL(GX2SubsequentBresenhamLine);
+ localRecPtr->SubsequentSolidHorVertLine =
+ OPTACCEL(GX2SubsequentHorVertLine);
+ localRecPtr->SubsequentSolidTwoPointLine =
+ OPTACCEL(GX2SubsequentSolidTwoPointLine);
+ localRecPtr->SolidBresenhamLineErrorTermBits = 15;
#if DASHED_SUPPORT
- localRecPtr->SetupForDashedLine = OPTACCEL(GX2SetupForDashedLine);
- localRecPtr->SubsequentDashedBresenhamLine =
- OPTACCEL(GX2SubsequentDashedBresenhamLine);
- localRecPtr->SubsequentSolidTwoPointLine =
- OPTACCEL(GX2SubsequentDashedTwoPointLine);
- localRecPtr->DashedBresenhamLineErrorTermBits = 15;
- localRecPtr->DashPatternMaxLength = 64;
- localRecPtr->DashedLineFlags = NO_PLANEMASK |
- LINE_PATTERN_POWER_OF_2_ONLY | LINE_PATTERN_MSBFIRST_MSBJUSTIFIED;
+ localRecPtr->SetupForDashedLine = OPTACCEL(GX2SetupForDashedLine);
+ localRecPtr->SubsequentDashedBresenhamLine =
+ OPTACCEL(GX2SubsequentDashedBresenhamLine);
+ localRecPtr->SubsequentSolidTwoPointLine =
+ OPTACCEL(GX2SubsequentDashedTwoPointLine);
+ localRecPtr->DashedBresenhamLineErrorTermBits = 15;
+ localRecPtr->DashPatternMaxLength = 64;
+ localRecPtr->DashedLineFlags = NO_PLANEMASK |
+ LINE_PATTERN_POWER_OF_2_ONLY | LINE_PATTERN_MSBFIRST_MSBJUSTIFIED;
#endif
#if SCR2SCREXP
- /* Color expansion */
- localRecPtr->ScreenToScreenColorExpandFillFlags =
- BIT_ORDER_IN_BYTE_MSBFIRST | NO_TRANSPARENCY;
-
- localRecPtr->SetupForScreenToScreenColorExpandFill =
- (GX2SetupForScreenToScreenColorExpandFill);
- localRecPtr->SubsequentScreenToScreenColorExpandFill =
- (GX2SubsequentScreenToScreenColorExpandFill);
+ /* Color expansion */
+ localRecPtr->ScreenToScreenColorExpandFillFlags =
+ BIT_ORDER_IN_BYTE_MSBFIRST | NO_TRANSPARENCY;
+
+ localRecPtr->SetupForScreenToScreenColorExpandFill =
+ (GX2SetupForScreenToScreenColorExpandFill);
+ localRecPtr->SubsequentScreenToScreenColorExpandFill =
+ (GX2SubsequentScreenToScreenColorExpandFill);
#endif
- /*
- * ImageWrite.
- *
- * SInce this uses off-screen scanline buffers, it is only of use when
- * complex ROPs are used. But since the current XAA pixmap cache code
- * only works when an ImageWrite is provided, the NO_GXCOPY flag is
- * temporarily disabled.
- */
- if (pGeode->AccelImageWriteBufferOffsets) {
- /* Color expansion */
- localRecPtr->CPUToScreenColorExpandFillFlags =
- BIT_ORDER_IN_BYTE_MSBFIRST |
- NO_PLANEMASK | SYNC_AFTER_COLOR_EXPAND | SCANLINE_PAD_DWORD;
- localRecPtr->ColorExpandBase = pGeode->AccelImageWriteBufferOffsets[0];
- localRecPtr->ColorExpandRange = pGeode->NoOfImgBuffers << gu2_yshift;
-
- localRecPtr->SetupForCPUToScreenColorExpandFill =
- OPTACCEL(GX2SetupForCPUToScreenColorExpandFill);
- localRecPtr->SubsequentCPUToScreenColorExpandFill =
- OPTACCEL(GX2SubsequentCPUToScreenColorExpandFill);
+ /*
+ * ImageWrite.
+ *
+ * SInce this uses off-screen scanline buffers, it is only of use when
+ * complex ROPs are used. But since the current XAA pixmap cache code
+ * only works when an ImageWrite is provided, the NO_GXCOPY flag is
+ * temporarily disabled.
+ */
+ if (pGeode->AccelImageWriteBufferOffsets) {
+ /* Color expansion */
+ localRecPtr->CPUToScreenColorExpandFillFlags =
+ BIT_ORDER_IN_BYTE_MSBFIRST |
+ NO_PLANEMASK | SYNC_AFTER_COLOR_EXPAND | SCANLINE_PAD_DWORD;
+ localRecPtr->ColorExpandBase = pGeode->AccelImageWriteBufferOffsets[0];
+ localRecPtr->ColorExpandRange = pGeode->NoOfImgBuffers << gu2_yshift;
+
+ localRecPtr->SetupForCPUToScreenColorExpandFill =
+ OPTACCEL(GX2SetupForCPUToScreenColorExpandFill);
+ localRecPtr->SubsequentCPUToScreenColorExpandFill =
+ OPTACCEL(GX2SubsequentCPUToScreenColorExpandFill);
#if IMGWRITE_SUPPORT
- localRecPtr->ImageWriteFlags = NO_PLANEMASK |
- SCANLINE_PAD_DWORD | SYNC_AFTER_IMAGE_WRITE;
- localRecPtr->ImageWriteBase = pGeode->AccelImageWriteBufferOffsets[0];
- localRecPtr->ImageWriteRange = pGeode->NoOfImgBuffers << gu2_yshift;
- localRecPtr->SetupForImageWrite = OPTACCEL(GX2SetupForImageWrite);
- localRecPtr->SubsequentImageWriteRect =
- OPTACCEL(GX2SubsequentImageWriteRect);
-#endif /* IMGWRITE_SUPPORT */
-
- localRecPtr->ScanlineImageWriteFlags =
- localRecPtr->ScreenToScreenCopyFlags;
- localRecPtr->ScanlineImageWriteBuffers =
- pGeode->AccelImageWriteBufferOffsets;
- localRecPtr->NumScanlineImageWriteBuffers = pGeode->NoOfImgBuffers;
- localRecPtr->ImageWriteRange = pGeode->NoOfImgBuffers << gu2_yshift;
- localRecPtr->SetupForScanlineImageWrite =
- OPTACCEL(GX2SetupForScanlineImageWrite);
- localRecPtr->SubsequentScanlineImageWriteRect =
- OPTACCEL(GX2SubsequentScanlineImageWriteRect);
- localRecPtr->SubsequentImageWriteScanline =
- OPTACCEL(GX2SubsequentImageWriteScanline);
-
- ImgBufOffset = pGeode->AccelImageWriteBufferOffsets[0] - pGeode->FBBase;
- Geodesrcy = ImgBufOffset >> gu2_yshift;
-
- Geodesrcx = ImgBufOffset & (pGeode->Pitch - 1);
- Geodesrcx /= (pScreenInfo->bitsPerPixel >> 3);
- } else {
- localRecPtr->PixmapCacheFlags = DO_NOT_BLIT_STIPPLES;
- }
+ localRecPtr->ImageWriteFlags = NO_PLANEMASK |
+ SCANLINE_PAD_DWORD | SYNC_AFTER_IMAGE_WRITE;
+ localRecPtr->ImageWriteBase = pGeode->AccelImageWriteBufferOffsets[0];
+ localRecPtr->ImageWriteRange = pGeode->NoOfImgBuffers << gu2_yshift;
+ localRecPtr->SetupForImageWrite = OPTACCEL(GX2SetupForImageWrite);
+ localRecPtr->SubsequentImageWriteRect =
+ OPTACCEL(GX2SubsequentImageWriteRect);
+#endif /* IMGWRITE_SUPPORT */
+
+ localRecPtr->ScanlineImageWriteFlags =
+ localRecPtr->ScreenToScreenCopyFlags;
+ localRecPtr->ScanlineImageWriteBuffers =
+ pGeode->AccelImageWriteBufferOffsets;
+ localRecPtr->NumScanlineImageWriteBuffers = pGeode->NoOfImgBuffers;
+ localRecPtr->ImageWriteRange = pGeode->NoOfImgBuffers << gu2_yshift;
+ localRecPtr->SetupForScanlineImageWrite =
+ OPTACCEL(GX2SetupForScanlineImageWrite);
+ localRecPtr->SubsequentScanlineImageWriteRect =
+ OPTACCEL(GX2SubsequentScanlineImageWriteRect);
+ localRecPtr->SubsequentImageWriteScanline =
+ OPTACCEL(GX2SubsequentImageWriteScanline);
+
+ ImgBufOffset = pGeode->AccelImageWriteBufferOffsets[0] - pGeode->FBBase;
+ Geodesrcy = ImgBufOffset >> gu2_yshift;
+
+ Geodesrcx = ImgBufOffset & (pGeode->Pitch - 1);
+ Geodesrcx /= (pScreenInfo->bitsPerPixel >> 3);
+ }
+ else {
+ localRecPtr->PixmapCacheFlags = DO_NOT_BLIT_STIPPLES;
+ }
#if 0
#if !defined(STB_X)
- localRecPtr->WriteBitmap = GX2WriteBitmap;
+ localRecPtr->WriteBitmap = GX2WriteBitmap;
#endif
- localRecPtr->WritePixmap = GX2WritePixmap;
- localRecPtr->ReadPixmap = GX2ReadPixmap;
+ localRecPtr->WritePixmap = GX2WritePixmap;
+ localRecPtr->ReadPixmap = GX2ReadPixmap;
#endif
- return (XAAInit(pScreen, localRecPtr));
+ return (XAAInit(pScreen, localRecPtr));
}
/* END OF FILE */