summaryrefslogtreecommitdiff
path: root/src/gx_accel.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gx_accel.c')
-rw-r--r--src/gx_accel.c1202
1 files changed, 613 insertions, 589 deletions
diff --git a/src/gx_accel.c b/src/gx_accel.c
index 34df4df..764e0db 100644
--- a/src/gx_accel.c
+++ b/src/gx_accel.c
@@ -39,7 +39,9 @@
#include "vgaHW.h"
#include "xf86.h"
+#ifdef HAVE_XAA_H
#include "xaalocal.h"
+#endif
#include "xf86fbman.h"
#include "miline.h"
#include "xaarop.h"
@@ -97,8 +99,7 @@ static unsigned int ACCEL_STRIDE;
/* static storage declarations */
-typedef struct sGBltBox
-{
+typedef struct sGBltBox {
ulong x, y;
ulong w, h;
ulong color;
@@ -116,8 +117,7 @@ static ulong *gc8x8p;
#endif
#if GX_DASH_LINE_SUPPORT
-typedef struct sGDashLine
-{
+typedef struct sGDashLine {
ulong pat[2];
int len;
int fg;
@@ -130,7 +130,9 @@ static GDashLine gdln;
static unsigned int gu2_xshift, gu2_yshift;
static unsigned int gu2_pitch;
+#if XF86XAA
static XAAInfoRecPtr localRecPtr;
+#endif
/* pat 0xF0 */
/* src 0xCC */
@@ -170,16 +172,16 @@ amd_gx_BppToRasterMode(int bpp)
{
switch (bpp) {
case 16:
- return MGP_RM_BPPFMT_565;
+ return MGP_RM_BPPFMT_565;
case 32:
- return MGP_RM_BPPFMT_8888;
+ return MGP_RM_BPPFMT_8888;
case 8:
- return MGP_RM_BPPFMT_332;
+ return MGP_RM_BPPFMT_332;
default:
- return 0;
+ return 0;
}
}
-#endif /* OPT_ACCEL */
+#endif /* OPT_ACCEL */
/*----------------------------------------------------------------------------
* GXAccelSync.
@@ -223,7 +225,7 @@ GXAccelSync(ScrnInfoPtr pScrni)
*--------------------------------------------------------------------------*/
static void
GXSetupForSolidFill(ScrnInfoPtr pScrni,
- int color, int rop, unsigned int planemask)
+ int color, int rop, unsigned int planemask)
{
//ErrorF("GXSetupForSolidFill(%#x,%#x,%#x)\n", color, rop, planemask);
rop &= 0x0F;
@@ -233,16 +235,16 @@ GXSetupForSolidFill(ScrnInfoPtr pScrni,
gfx_set_raster_operation(planemask == ~0U ? SDfn[rop] : SDfn_PM[rop]);
#else
{
- unsigned int ROP =
- BPP | (planemask == ~0U ? SDfn[rop] : SDfn_PM[rop]);
- BLT_MODE = ((ROP ^ (ROP >> 2)) & 0x33) == 0 ? MGP_BM_SRC_MONO : 0;
- if (((ROP ^ (ROP >> 1)) & 0x55) != 0)
- BLT_MODE |= MGP_BM_DST_REQ;
- GU2_WAIT_PENDING;
- WRITE_GP32(MGP_RASTER_MODE, ROP);
- WRITE_GP32(MGP_PAT_COLOR_0, planemask);
- WRITE_GP32(MGP_SRC_COLOR_FG, color);
- WRITE_GP32(MGP_STRIDE, ACCEL_STRIDE);
+ unsigned int ROP = BPP | (planemask == ~0U ? SDfn[rop] : SDfn_PM[rop]);
+
+ BLT_MODE = ((ROP ^ (ROP >> 2)) & 0x33) == 0 ? MGP_BM_SRC_MONO : 0;
+ if (((ROP ^ (ROP >> 1)) & 0x55) != 0)
+ BLT_MODE |= MGP_BM_DST_REQ;
+ GU2_WAIT_PENDING;
+ WRITE_GP32(MGP_RASTER_MODE, ROP);
+ WRITE_GP32(MGP_PAT_COLOR_0, planemask);
+ WRITE_GP32(MGP_SRC_COLOR_FG, color);
+ WRITE_GP32(MGP_STRIDE, ACCEL_STRIDE);
}
#endif
}
@@ -277,18 +279,18 @@ GXSubsequentSolidFillRect(ScrnInfoPtr pScrni, int x, int y, int w, int h)
gfx_pattern_fill(x, y, w, h);
#else
{
- unsigned int offset = CALC_FBOFFSET(x, y);
- unsigned int size = (w << 16) | h;
+ unsigned int offset = CALC_FBOFFSET(x, y);
+ unsigned int size = (w << 16) | h;
- GU2_WAIT_PENDING;
- WRITE_GP32(MGP_DST_OFFSET, offset);
- WRITE_GP32(MGP_WID_HEIGHT, size);
- WRITE_GP32(MGP_BLT_MODE, BLT_MODE);
+ GU2_WAIT_PENDING;
+ WRITE_GP32(MGP_DST_OFFSET, offset);
+ WRITE_GP32(MGP_WID_HEIGHT, size);
+ WRITE_GP32(MGP_BLT_MODE, BLT_MODE);
}
#endif
}
-#endif /* if GX_FILL_RECT_SUPPORT */
+#endif /* if GX_FILL_RECT_SUPPORT */
#if GX_CLREXP_8X8_PAT_SUPPORT
/*----------------------------------------------------------------------------
@@ -315,24 +317,24 @@ GXSubsequentSolidFillRect(ScrnInfoPtr pScrni, int x, int y, int w, int h)
static void
GXSetupForColor8x8PatternFill(ScrnInfoPtr pScrni, int patx, int paty, int rop,
- uint planemask, int trans_color)
+ uint planemask, int trans_color)
{
GeodeRec *pGeode = GEODEPTR(pScrni);
//ErrorF("GXSetupForColor8x8PatternFill() pat %#x,%#x rop %#x %#x %#x\n",
// patx, paty, rop, planemask, trans_color);
rop &= 0x0F;
- gc8x8p = (unsigned long *)FBADDR(patx, paty);
+ gc8x8p = (unsigned long *) FBADDR(patx, paty);
/* gfx_set_solid_pattern is needed to clear src/pat transparency */
gfx_set_solid_pattern(0);
gfx_set_raster_operation(planemask == ~0U ? PDfn[rop] :
- (gfx_set_solid_source(planemask), PDfn_SM[rop]));
+ (gfx_set_solid_source(planemask), PDfn_SM[rop]));
gfx2_set_source_stride(pGeode->Pitch);
gfx2_set_destination_stride(pGeode->Pitch);
if (trans_color == -1)
- gfx2_set_source_transparency(0, 0);
+ gfx2_set_source_transparency(0, 0);
else
- gfx2_set_source_transparency(trans_color, ~0);
+ gfx2_set_source_transparency(trans_color, ~0);
}
/*----------------------------------------------------------------------------
@@ -358,7 +360,7 @@ GXSetupForColor8x8PatternFill(ScrnInfoPtr pScrni, int patx, int paty, int rop,
*--------------------------------------------------------------------------*/
static void
GXSubsequentColor8x8PatternFillRect(ScrnInfoPtr pScrni, int patx, int paty,
- int x, int y, int w, int h)
+ int x, int y, int w, int h)
{
//ErrorF(
// "GXSubsequentColor8x8PatternFillRect() patxy %d,%d at %d,%d %dsx%d\n",
@@ -396,7 +398,7 @@ GXSubsequentColor8x8PatternFillRect(ScrnInfoPtr pScrni, int patx, int paty,
*--------------------------------------------------------------------------*/
static void
GXSetupForMono8x8PatternFill(ScrnInfoPtr pScrni, int patx, int paty,
- int fg, int bg, int rop, uint planemask)
+ int fg, int bg, int rop, uint planemask)
{
//ErrorF(
//"GXSetupForMono8x8PatternFill() pat %#x,%#x fg %#x bg %#x %#x %#x\n",
@@ -405,24 +407,24 @@ GXSetupForMono8x8PatternFill(ScrnInfoPtr pScrni, int patx, int paty,
#ifndef OPT_ACCEL
gfx_set_mono_pattern(bg, fg, patx, paty, bg == -1 ? 1 : 0);
gfx_set_raster_operation(planemask == ~0U ? PDfn[rop] :
- (gfx_set_solid_source(planemask), PDfn_SM[rop]));
+ (gfx_set_solid_source(planemask), PDfn_SM[rop]));
#else
{
- unsigned int ROP = BPP |
- (bg ==
- -1 ? MGP_RM_PAT_MONO | MGP_RM_PAT_TRANS : MGP_RM_PAT_MONO) |
- (planemask == ~0U ? PDfn[rop] : PDfn_SM[rop]);
- BLT_MODE = ((ROP ^ (ROP >> 2)) & 0x33) == 0 ? MGP_BM_SRC_MONO : 0;
- if (((ROP ^ (ROP >> 1)) & 0x55) != 0)
- BLT_MODE |= MGP_BM_DST_REQ;
- GU2_WAIT_PENDING;
- WRITE_GP32(MGP_RASTER_MODE, ROP);
- WRITE_GP32(MGP_SRC_COLOR_FG, planemask);
- WRITE_GP32(MGP_PAT_COLOR_0, bg);
- WRITE_GP32(MGP_PAT_COLOR_1, fg);
- WRITE_GP32(MGP_PAT_DATA_0, patx);
- WRITE_GP32(MGP_PAT_DATA_1, paty);
- WRITE_GP32(MGP_STRIDE, ACCEL_STRIDE);
+ unsigned int ROP = BPP |
+ (bg ==
+ -1 ? MGP_RM_PAT_MONO | MGP_RM_PAT_TRANS : MGP_RM_PAT_MONO) |
+ (planemask == ~0U ? PDfn[rop] : PDfn_SM[rop]);
+ BLT_MODE = ((ROP ^ (ROP >> 2)) & 0x33) == 0 ? MGP_BM_SRC_MONO : 0;
+ if (((ROP ^ (ROP >> 1)) & 0x55) != 0)
+ BLT_MODE |= MGP_BM_DST_REQ;
+ GU2_WAIT_PENDING;
+ WRITE_GP32(MGP_RASTER_MODE, ROP);
+ WRITE_GP32(MGP_SRC_COLOR_FG, planemask);
+ WRITE_GP32(MGP_PAT_COLOR_0, bg);
+ WRITE_GP32(MGP_PAT_COLOR_1, fg);
+ WRITE_GP32(MGP_PAT_DATA_0, patx);
+ WRITE_GP32(MGP_PAT_DATA_1, paty);
+ WRITE_GP32(MGP_STRIDE, ACCEL_STRIDE);
}
#endif
}
@@ -450,27 +452,27 @@ GXSetupForMono8x8PatternFill(ScrnInfoPtr pScrni, int patx, int paty,
*--------------------------------------------------------------------------*/
static void
GXSubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrni, int patx, int paty,
- int x, int y, int w, int h)
+ int x, int y, int w, int h)
{
DEBUGMSG(1, (0, X_INFO, "%s() pat %#x,%#x at %d,%d %dx%d\n",
- __func__, patx, paty, x, y, w, h));
+ __func__, patx, paty, x, y, w, h));
#ifndef OPT_ACCEL
gfx_pattern_fill(x, y, w, h);
#else
{
- unsigned int offset =
- CALC_FBOFFSET(x, y) | ((x & 7) << 26) | ((y & 7) << 29);
- unsigned int size = (w << 16) | h;
-
- GU2_WAIT_PENDING;
- WRITE_GP32(MGP_DST_OFFSET, offset);
- WRITE_GP32(MGP_WID_HEIGHT, size);
- WRITE_GP32(MGP_BLT_MODE, BLT_MODE);
+ unsigned int offset =
+ CALC_FBOFFSET(x, y) | ((x & 7) << 26) | ((y & 7) << 29);
+ unsigned int size = (w << 16) | h;
+
+ GU2_WAIT_PENDING;
+ WRITE_GP32(MGP_DST_OFFSET, offset);
+ WRITE_GP32(MGP_WID_HEIGHT, size);
+ WRITE_GP32(MGP_BLT_MODE, BLT_MODE);
}
#endif
}
-#endif /* GX_MONO_8X8_PAT_SUPPORT */
+#endif /* GX_MONO_8X8_PAT_SUPPORT */
#if GX_SCR2SCRCPY_SUPPORT
/*----------------------------------------------------------------------------
@@ -492,40 +494,40 @@ GXSubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrni, int patx, int paty,
*---------------------------------------------------------------------------*/
static void
GXSetupForScreenToScreenCopy(ScrnInfoPtr pScrni, int xdir, int ydir, int rop,
- uint planemask, int trans_color)
+ uint planemask, int trans_color)
{
DEBUGMSG(1, (0, X_INFO, "%s() xd%d yd%d rop %#x %#x %#x\n",
- __func__, xdir, ydir, rop, planemask, trans_color));
+ __func__, xdir, ydir, rop, planemask, trans_color));
rop &= 0x0F;
#ifndef OPT_ACCEL
{
- GeodeRec *pGeode = GEODEPTR(pScrni);
-
- gfx_set_solid_pattern(planemask);
- /* transparency is a parameter to set_rop, but set...pattern clears
- * transparency */
- if (trans_color == -1)
- gfx2_set_source_transparency(0, 0);
- else
- gfx2_set_source_transparency(trans_color, ~0);
- gfx_set_raster_operation(planemask == ~0U ? SDfn[rop] : SDfn_PM[rop]);
- gfx2_set_source_stride(pGeode->Pitch);
- gfx2_set_destination_stride(pGeode->Pitch);
+ GeodeRec *pGeode = GEODEPTR(pScrni);
+
+ gfx_set_solid_pattern(planemask);
+ /* transparency is a parameter to set_rop, but set...pattern clears
+ * transparency */
+ if (trans_color == -1)
+ gfx2_set_source_transparency(0, 0);
+ else
+ gfx2_set_source_transparency(trans_color, ~0);
+ gfx_set_raster_operation(planemask == ~0U ? SDfn[rop] : SDfn_PM[rop]);
+ gfx2_set_source_stride(pGeode->Pitch);
+ gfx2_set_destination_stride(pGeode->Pitch);
}
#else
{
- unsigned int ROP =
- BPP | (planemask == ~0U ? SDfn[rop] : SDfn_PM[rop]);
- if (trans_color != -1)
- ROP |= MGP_RM_SRC_TRANS;
- BLT_MODE = ((ROP ^ (ROP >> 1)) & 0x55) != 0 ?
- MGP_BM_SRC_FB | MGP_BM_DST_REQ : MGP_BM_SRC_FB;
- GU2_WAIT_PENDING;
- WRITE_GP32(MGP_RASTER_MODE, ROP);
- WRITE_GP32(MGP_PAT_COLOR_0, planemask);
- WRITE_GP32(MGP_SRC_COLOR_FG, trans_color);
- WRITE_GP32(MGP_SRC_COLOR_BG, ~0);
- WRITE_GP32(MGP_STRIDE, ACCEL_STRIDE);
+ unsigned int ROP = BPP | (planemask == ~0U ? SDfn[rop] : SDfn_PM[rop]);
+
+ if (trans_color != -1)
+ ROP |= MGP_RM_SRC_TRANS;
+ BLT_MODE = ((ROP ^ (ROP >> 1)) & 0x55) != 0 ?
+ MGP_BM_SRC_FB | MGP_BM_DST_REQ : MGP_BM_SRC_FB;
+ GU2_WAIT_PENDING;
+ WRITE_GP32(MGP_RASTER_MODE, ROP);
+ WRITE_GP32(MGP_PAT_COLOR_0, planemask);
+ WRITE_GP32(MGP_SRC_COLOR_FG, trans_color);
+ WRITE_GP32(MGP_SRC_COLOR_BG, ~0);
+ WRITE_GP32(MGP_STRIDE, ACCEL_STRIDE);
}
#endif
}
@@ -553,53 +555,54 @@ GXSetupForScreenToScreenCopy(ScrnInfoPtr pScrni, int xdir, int ydir, int rop,
*---------------------------------------------------------------------------*/
static void
GXSubsequentScreenToScreenCopy(ScrnInfoPtr pScrni,
- int x1, int y1, int x2, int y2, int w, int h)
+ int x1, int y1, int x2, int y2, int w, int h)
{
DEBUGMSG(1, (0, X_INFO, "%s() from %d,%d to %d,%d %dx%d\n",
- __func__, x1, y1, x2, y2, w, h));
+ __func__, x1, y1, x2, y2, w, h));
#ifndef OPT_ACCEL
{
- int flags = 0;
-
- if (x2 > x1)
- flags |= 1;
- if (y2 > y1)
- flags |= 2;
- gfx2_screen_to_screen_blt(CALC_FBOFFSET(x1, y1), CALC_FBOFFSET(x2,
- y2), w, h, flags);
+ int flags = 0;
+
+ if (x2 > x1)
+ flags |= 1;
+ if (y2 > y1)
+ flags |= 2;
+ gfx2_screen_to_screen_blt(CALC_FBOFFSET(x1, y1), CALC_FBOFFSET(x2,
+ y2), w,
+ h, flags);
}
#else
{
- GeodeRec *pGeode = GEODEPTR(pScrni);
- unsigned int src = CALC_FBOFFSET(x1, y1);
- unsigned int dst = CALC_FBOFFSET(x2, y2);
- unsigned int size = (w << 16) | h;
- unsigned int blt_mode = BLT_MODE;
-
- if (x2 > x1) {
- int n = (w << gu2_xshift) - 1;
-
- src += n;
- dst += n;
- blt_mode |= MGP_BM_NEG_XDIR;
- }
- if (y2 > y1) {
- int n = (h - 1) * pGeode->Pitch;
-
- src += n;
- dst += n;
- blt_mode |= MGP_BM_NEG_YDIR;
- }
- GU2_WAIT_PENDING;
- WRITE_GP32(MGP_SRC_OFFSET, src);
- WRITE_GP32(MGP_DST_OFFSET, dst);
- WRITE_GP32(MGP_WID_HEIGHT, size);
- WRITE_GP16(MGP_BLT_MODE, blt_mode);
+ GeodeRec *pGeode = GEODEPTR(pScrni);
+ unsigned int src = CALC_FBOFFSET(x1, y1);
+ unsigned int dst = CALC_FBOFFSET(x2, y2);
+ unsigned int size = (w << 16) | h;
+ unsigned int blt_mode = BLT_MODE;
+
+ if (x2 > x1) {
+ int n = (w << gu2_xshift) - 1;
+
+ src += n;
+ dst += n;
+ blt_mode |= MGP_BM_NEG_XDIR;
+ }
+ if (y2 > y1) {
+ int n = (h - 1) * pGeode->Pitch;
+
+ src += n;
+ dst += n;
+ blt_mode |= MGP_BM_NEG_YDIR;
+ }
+ GU2_WAIT_PENDING;
+ WRITE_GP32(MGP_SRC_OFFSET, src);
+ WRITE_GP32(MGP_DST_OFFSET, dst);
+ WRITE_GP32(MGP_WID_HEIGHT, size);
+ WRITE_GP16(MGP_BLT_MODE, blt_mode);
}
#endif
}
-#endif /* if GX_SCR2SCRCPY_SUPPORT */
+#endif /* if GX_SCR2SCRCPY_SUPPORT */
#if GX_SCANLINE_SUPPORT
/*----------------------------------------------------------------------------
@@ -626,20 +629,20 @@ GXSubsequentScreenToScreenCopy(ScrnInfoPtr pScrni,
*/
static void
GXSetupForScanlineImageWrite(ScrnInfoPtr pScrni, int rop, uint planemask,
- int trans_color, int bpp, int depth)
+ int trans_color, int bpp, int depth)
{
GeodeRec *pGeode = GEODEPTR(pScrni);
DEBUGMSG(1, (0, X_INFO, "%s() rop %#x %#x %#x %d %d\n",
- __func__, rop, planemask, trans_color, bpp, depth));
+ __func__, rop, planemask, trans_color, bpp, depth));
rop &= 0x0F;
/* transparency is a parameter to set_rop, but set...pattern clears
* transparency */
gfx_set_solid_pattern(planemask);
if (trans_color == -1)
- gfx2_set_source_transparency(0, 0);
+ gfx2_set_source_transparency(0, 0);
else
- gfx2_set_source_transparency(trans_color, ~0);
+ gfx2_set_source_transparency(trans_color, ~0);
gfx_set_raster_operation(planemask == ~0U ? SDfn[rop] : SDfn_PM[rop]);
gfx2_set_source_stride(pGeode->Pitch);
gfx2_set_destination_stride(pGeode->Pitch);
@@ -662,10 +665,10 @@ GXSetupForScanlineImageWrite(ScrnInfoPtr pScrni, int rop, uint planemask,
*---------------------------------------------------------------------------*/
static void
GXSubsequentScanlineImageWriteRect(ScrnInfoPtr pScrni,
- int x, int y, int w, int h, int skipleft)
+ int x, int y, int w, int h, int skipleft)
{
DEBUGMSG(1, (0, X_INFO, "%s() rop %d,%d %dx%d %d\n",
- __func__, x, y, w, h, skipleft));
+ __func__, x, y, w, h, skipleft));
giwr.x = x;
giwr.y = y;
giwr.w = w;
@@ -708,35 +711,39 @@ GXSubsequentImageWriteScanline(ScrnInfoPtr pScrni, int bufno)
#if !GX_USE_OFFSCRN_MEM
offset = pGeode->AccelImageWriteBuffers[bufno] - pGeode->FBBase;
gfx2_screen_to_screen_blt(offset, CALC_FBOFFSET(giwr.x, giwr.y), giwr.w,
- 1, 0);
-#else /* if !GX_USE_OFFSCRN_MEM */
+ 1, 0);
+#else /* if !GX_USE_OFFSCRN_MEM */
gfx2_color_bitmap_to_screen_blt(0, 0, CALC_FBOFFSET(giwr.x, giwr.y),
- giwr.w, 1, pGeode->AccelImageWriteBuffers[bufno], pGeode->Pitch);
-#endif /* if !GX_USE_OFFSCRN_MEM */
+ giwr.w, 1,
+ pGeode->AccelImageWriteBuffers[bufno],
+ pGeode->Pitch);
+#endif /* if !GX_USE_OFFSCRN_MEM */
++giwr.y;
-#else /* if GX_ONE_LINE_AT_A_TIME */
+#else /* if GX_ONE_LINE_AT_A_TIME */
int blt_height;
DEBUGMSG(1, (0, X_INFO, "%s() %d\n", __func__, bufno));
if ((blt_height = pGeode->NoOfImgBuffers) > giwr.h)
- blt_height = giwr.h;
+ blt_height = giwr.h;
if (++bufno < blt_height)
- return;
+ return;
#if !GX_USE_OFFSCRN_MEM
offset = pGeode->AccelImageWriteBuffers[0] - pGeode->FBBase;
gfx2_screen_to_screen_blt(offset, CALC_FBOFFSET(giwr.x, giwr.y), giwr.w,
- blt_height, 0);
+ blt_height, 0);
GXAccelSync(pScrni);
-#else /* if !GX_USE_OFFSCRN_MEM */
+#else /* if !GX_USE_OFFSCRN_MEM */
gfx2_color_bitmap_to_screen_blt(0, 0, CALC_FBOFFSET(giwr.x, giwr.y),
- giwr.w, blt_height, pGeode->AccelImageWriteBuffers[0], pGeode->Pitch);
-#endif /* if !GX_USE_OFFSCRN_MEM */
+ giwr.w, blt_height,
+ pGeode->AccelImageWriteBuffers[0],
+ pGeode->Pitch);
+#endif /* if !GX_USE_OFFSCRN_MEM */
giwr.h -= blt_height;
giwr.y += blt_height;
-#endif /* if GX_ONE_LINE_AT_A_TIME */
+#endif /* if GX_ONE_LINE_AT_A_TIME */
}
-#endif /* GX_SCANLINE_SUPPORT */
+#endif /* GX_SCANLINE_SUPPORT */
#if GX_CPU2SCREXP_SUPPORT
/*----------------------------------------------------------------------------
@@ -759,13 +766,14 @@ GXSubsequentImageWriteScanline(ScrnInfoPtr pScrni, int bufno)
static void
GXSetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrni,
- int fg, int bg, int rop, uint planemask)
+ int fg, int bg, int rop,
+ uint planemask)
{
GeodeRec *pGeode = GEODEPTR(pScrni);
ulong srcpitch;
DEBUGMSG(1, (0, X_INFO, "%s() fg %#x bg %#x rop %#x %#x\n",
- __func__, fg, bg, rop, planemask));
+ __func__, fg, bg, rop, planemask));
rop &= 0x0F;
srcpitch = ((pGeode->Pitch + 31) >> 5) << 2;
#ifndef OPT_ACCEL
@@ -776,20 +784,20 @@ GXSetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrni,
gfx2_set_destination_stride(pGeode->Pitch);
#else
{
- unsigned int stride = (srcpitch << 16) | pGeode->Pitch;
- unsigned int ROP =
- BPP | (planemask == ~0U ? SDfn[rop] : SDfn_PM[rop]);
- if (bg == -1)
- ROP |= MGP_RM_SRC_TRANS;
- BLT_MODE = ((ROP ^ (ROP >> 1)) & 0x55) != 0 ?
- MGP_BM_SRC_MONO | MGP_BM_SRC_FB | MGP_BM_DST_REQ :
- MGP_BM_SRC_MONO | MGP_BM_SRC_FB;
- GU2_WAIT_PENDING;
- WRITE_GP32(MGP_RASTER_MODE, ROP);
- WRITE_GP32(MGP_PAT_COLOR_0, planemask);
- WRITE_GP32(MGP_SRC_COLOR_BG, bg);
- WRITE_GP32(MGP_SRC_COLOR_FG, fg);
- WRITE_GP32(MGP_STRIDE, stride);
+ unsigned int stride = (srcpitch << 16) | pGeode->Pitch;
+ unsigned int ROP = BPP | (planemask == ~0U ? SDfn[rop] : SDfn_PM[rop]);
+
+ if (bg == -1)
+ ROP |= MGP_RM_SRC_TRANS;
+ BLT_MODE = ((ROP ^ (ROP >> 1)) & 0x55) != 0 ?
+ MGP_BM_SRC_MONO | MGP_BM_SRC_FB | MGP_BM_DST_REQ :
+ MGP_BM_SRC_MONO | MGP_BM_SRC_FB;
+ GU2_WAIT_PENDING;
+ WRITE_GP32(MGP_RASTER_MODE, ROP);
+ WRITE_GP32(MGP_PAT_COLOR_0, planemask);
+ WRITE_GP32(MGP_SRC_COLOR_BG, bg);
+ WRITE_GP32(MGP_SRC_COLOR_FG, fg);
+ WRITE_GP32(MGP_STRIDE, stride);
}
#endif
}
@@ -812,10 +820,11 @@ GXSetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrni,
*---------------------------------------------------------------------------*/
static void
GXSubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrni,
- int x, int y, int w, int h, int skipleft)
+ int x, int y, int w, int h,
+ int skipleft)
{
DEBUGMSG(1, (0, X_INFO, "%s() %d,%d %dx%d %d\n",
- __func__, x, y, w, h, skipleft));
+ __func__, x, y, w, h, skipleft));
gc2s.x = x;
gc2s.y = y;
gc2s.w = w;
@@ -823,16 +832,16 @@ GXSubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrni,
#ifdef OPT_ACCEL
{
#if GX_ONE_LINE_AT_A_TIME
- unsigned int size = (gc2s.w << 16) | 1;
+ unsigned int size = (gc2s.w << 16) | 1;
- GU2_WAIT_PENDING;
- WRITE_GP32(MGP_WID_HEIGHT, size);
+ GU2_WAIT_PENDING;
+ WRITE_GP32(MGP_WID_HEIGHT, size);
#else
- GeodeRec *pGeode = GEODEPTR(pScrni);
- unsigned int src =
- pGeode->AccelColorExpandBuffers[0] - pGeode->FBBase;
- GU2_WAIT_PENDING;
- WRITE_GP32(MGP_SRC_OFFSET, src);
+ GeodeRec *pGeode = GEODEPTR(pScrni);
+ unsigned int src = pGeode->AccelColorExpandBuffers[0] - pGeode->FBBase;
+
+ GU2_WAIT_PENDING;
+ WRITE_GP32(MGP_SRC_OFFSET, src);
#endif
}
#endif
@@ -859,62 +868,64 @@ GXSubsequentColorExpandScanline(ScrnInfoPtr pScrni, int bufno)
#ifndef OPT_ACCEL
{
#if GX_ONE_LINE_AT_A_TIME
- ulong offset =
- pGeode->AccelColorExpandBuffers[bufno] - pGeode->FBBase;
- gfx2_mono_expand_blt(offset, 0, 0, CALC_FBOFFSET(gc2s.x, gc2s.y),
- gc2s.w, 1, 0);
- ++gc2s.y;
-#else /* if GX_ONE_LINE_AT_A_TIME */
- ulong srcpitch;
- int blt_height;
-
- if ((blt_height = pGeode->NoOfImgBuffers) > gc2s.h)
- blt_height = gc2s.h;
- if (++bufno < blt_height)
- return;
-
- /* convert from bits to dwords */
- srcpitch = ((pGeode->Pitch + 31) >> 5) << 2;
- gfx2_mono_bitmap_to_screen_blt(0, 0, CALC_FBOFFSET(gc2s.x, gc2s.y),
- gc2s.w, blt_height, pGeode->AccelColorExpandBuffers[0], srcpitch);
- gc2s.h -= blt_height;
- gc2s.y += blt_height;
-#endif /* if GX_ONE_LINE_AT_A_TIME */
+ ulong offset = pGeode->AccelColorExpandBuffers[bufno] - pGeode->FBBase;
+
+ gfx2_mono_expand_blt(offset, 0, 0, CALC_FBOFFSET(gc2s.x, gc2s.y),
+ gc2s.w, 1, 0);
+ ++gc2s.y;
+#else /* if GX_ONE_LINE_AT_A_TIME */
+ ulong srcpitch;
+ int blt_height;
+
+ if ((blt_height = pGeode->NoOfImgBuffers) > gc2s.h)
+ blt_height = gc2s.h;
+ if (++bufno < blt_height)
+ return;
+
+ /* convert from bits to dwords */
+ srcpitch = ((pGeode->Pitch + 31) >> 5) << 2;
+ gfx2_mono_bitmap_to_screen_blt(0, 0, CALC_FBOFFSET(gc2s.x, gc2s.y),
+ gc2s.w, blt_height,
+ pGeode->AccelColorExpandBuffers[0],
+ srcpitch);
+ gc2s.h -= blt_height;
+ gc2s.y += blt_height;
+#endif /* if GX_ONE_LINE_AT_A_TIME */
}
-#else /* ifndef OPT_ACCEL */
+#else /* ifndef OPT_ACCEL */
{
#if GX_ONE_LINE_AT_A_TIME
- unsigned int src =
- pGeode->AccelColorExpandBuffers[bufno] - pGeode->FBBase;
- unsigned int dst = CALC_FBOFFSET(gc2s.x, gc2s.y);
-
- ++gc2s.y;
- GU2_WAIT_PENDING;
- WRITE_GP32(MGP_SRC_OFFSET, src);
- WRITE_GP32(MGP_DST_OFFSET, dst);
- WRITE_GP16(MGP_BLT_MODE, BLT_MODE);
-#else /* if GX_ONE_LINE_AT_A_TIME */
- unsigned int dst, size;
- int blt_height;
-
- GU2_WAIT_BUSY;
- if ((blt_height = pGeode->NoOfImgBuffers) > gc2s.h)
- blt_height = gc2s.h;
- if (++bufno < blt_height)
- return;
- dst = CALC_FBOFFSET(gc2s.x, gc2s.y);
- size = (gc2s.w << 16) | blt_height;
- gc2s.h -= blt_height;
- gc2s.y += blt_height;
- GU2_WAIT_PENDING;
- WRITE_GP32(MGP_DST_OFFSET, dst);
- WRITE_GP32(MGP_WID_HEIGHT, size);
- WRITE_GP16(MGP_BLT_MODE, BLT_MODE);
-#endif /* if GX_ONE_LINE_AT_A_TIME */
+ unsigned int src =
+ pGeode->AccelColorExpandBuffers[bufno] - pGeode->FBBase;
+ unsigned int dst = CALC_FBOFFSET(gc2s.x, gc2s.y);
+
+ ++gc2s.y;
+ GU2_WAIT_PENDING;
+ WRITE_GP32(MGP_SRC_OFFSET, src);
+ WRITE_GP32(MGP_DST_OFFSET, dst);
+ WRITE_GP16(MGP_BLT_MODE, BLT_MODE);
+#else /* if GX_ONE_LINE_AT_A_TIME */
+ unsigned int dst, size;
+ int blt_height;
+
+ GU2_WAIT_BUSY;
+ if ((blt_height = pGeode->NoOfImgBuffers) > gc2s.h)
+ blt_height = gc2s.h;
+ if (++bufno < blt_height)
+ return;
+ dst = CALC_FBOFFSET(gc2s.x, gc2s.y);
+ size = (gc2s.w << 16) | blt_height;
+ gc2s.h -= blt_height;
+ gc2s.y += blt_height;
+ GU2_WAIT_PENDING;
+ WRITE_GP32(MGP_DST_OFFSET, dst);
+ WRITE_GP32(MGP_WID_HEIGHT, size);
+ WRITE_GP16(MGP_BLT_MODE, BLT_MODE);
+#endif /* if GX_ONE_LINE_AT_A_TIME */
}
-#endif /* ifndef OPT_ACCEL */
+#endif /* ifndef OPT_ACCEL */
}
-#endif /* GX_CPU2SCREXP_SUPPORT */
+#endif /* GX_CPU2SCREXP_SUPPORT */
#if GX_SCR2SCREXP_SUPPORT
/*----------------------------------------------------------------------------
@@ -937,36 +948,36 @@ GXSubsequentColorExpandScanline(ScrnInfoPtr pScrni, int bufno)
static void
GXSetupForScreenToScreenColorExpandFill(ScrnInfoPtr pScrni, int fg, int bg,
- int rop, uint planemask)
+ int rop, uint planemask)
{
DEBUGMSG(1, (0, X_INFO, "%s() fg %#x bg %#x rop %#x %#x\n",
- __func__, fg, bg, rop, planemask));
+ __func__, fg, bg, rop, planemask));
rop &= 0x0F;
#ifndef OPT_ACCEL
{
- GeodeRec *pGeode = GEODEPTR(pScrni);
+ GeodeRec *pGeode = GEODEPTR(pScrni);
- gfx_set_solid_pattern(planemask);
- gfx_set_mono_source(bg, fg, bg == -1 ? 1 : 0);
- gfx_set_raster_operation(planemask == ~0U ? SDfn[rop] : SDfn_PM[rop]);
- gfx2_set_source_stride(pGeode->Pitch);
- gfx2_set_destination_stride(pGeode->Pitch);
+ gfx_set_solid_pattern(planemask);
+ gfx_set_mono_source(bg, fg, bg == -1 ? 1 : 0);
+ gfx_set_raster_operation(planemask == ~0U ? SDfn[rop] : SDfn_PM[rop]);
+ gfx2_set_source_stride(pGeode->Pitch);
+ gfx2_set_destination_stride(pGeode->Pitch);
}
#else
{
- unsigned int ROP =
- BPP | (planemask == ~0U ? SDfn[rop] : SDfn_PM[rop]);
- if (bg == -1)
- ROP |= MGP_RM_SRC_TRANS;
- BLT_MODE = ((ROP ^ (ROP >> 1)) & 0x55) != 0 ?
- MGP_BM_SRC_MONO | MGP_BM_SRC_FB | MGP_BM_DST_REQ :
- MGP_BM_SRC_MONO | MGP_BM_SRC_FB;
- GU2_WAIT_PENDING;
- WRITE_GP32(MGP_RASTER_MODE, ROP);
- WRITE_GP32(MGP_PAT_COLOR_0, planemask);
- WRITE_GP32(MGP_SRC_COLOR_BG, bg);
- WRITE_GP32(MGP_SRC_COLOR_FG, fg);
- WRITE_GP32(MGP_STRIDE, ACCEL_STRIDE);
+ unsigned int ROP = BPP | (planemask == ~0U ? SDfn[rop] : SDfn_PM[rop]);
+
+ if (bg == -1)
+ ROP |= MGP_RM_SRC_TRANS;
+ BLT_MODE = ((ROP ^ (ROP >> 1)) & 0x55) != 0 ?
+ MGP_BM_SRC_MONO | MGP_BM_SRC_FB | MGP_BM_DST_REQ :
+ MGP_BM_SRC_MONO | MGP_BM_SRC_FB;
+ GU2_WAIT_PENDING;
+ WRITE_GP32(MGP_RASTER_MODE, ROP);
+ WRITE_GP32(MGP_PAT_COLOR_0, planemask);
+ WRITE_GP32(MGP_SRC_COLOR_BG, bg);
+ WRITE_GP32(MGP_SRC_COLOR_FG, fg);
+ WRITE_GP32(MGP_STRIDE, ACCEL_STRIDE);
}
#endif
}
@@ -990,29 +1001,31 @@ GXSetupForScreenToScreenColorExpandFill(ScrnInfoPtr pScrni, int fg, int bg,
*---------------------------------------------------------------------------*/
static void
GXSubsequentScreenToScreenColorExpandFill(ScrnInfoPtr pScrni,
- 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)
{
DEBUGMSG(1, (0, X_INFO, "%s() %d,%d %dx%d %d,%d %d\n",
- __func__, x, y, w, h, srcx, srcy, offset));
+ __func__, x, y, w, h, srcx, srcy, offset));
#ifndef OPT_ACCEL
gfx2_mono_expand_blt(CALC_FBOFFSET(srcx, srcy), offset, 0,
- CALC_FBOFFSET(x, y), w, h, 0);
+ CALC_FBOFFSET(x, y), w, h, 0);
#else
{
- unsigned int src = (CALC_FBOFFSET(srcx,
- srcy) + (offset >> 3)) | ((offset & 7) << 26);
- unsigned int dst = CALC_FBOFFSET(x, y);
- unsigned int size = (w << 16) | h;
-
- GU2_WAIT_PENDING;
- WRITE_GP32(MGP_SRC_OFFSET, src);
- WRITE_GP32(MGP_DST_OFFSET, dst);
- WRITE_GP32(MGP_WID_HEIGHT, size);
- WRITE_GP16(MGP_BLT_MODE, BLT_MODE);
+ unsigned int src = (CALC_FBOFFSET(srcx,
+ srcy) +
+ (offset >> 3)) | ((offset & 7) << 26);
+ unsigned int dst = CALC_FBOFFSET(x, y);
+ unsigned int size = (w << 16) | h;
+
+ GU2_WAIT_PENDING;
+ WRITE_GP32(MGP_SRC_OFFSET, src);
+ WRITE_GP32(MGP_DST_OFFSET, dst);
+ WRITE_GP32(MGP_WID_HEIGHT, size);
+ WRITE_GP16(MGP_BLT_MODE, BLT_MODE);
}
#endif
}
-#endif /* GX_SCR2SCREXP_SUPPORT */
+#endif /* GX_SCR2SCREXP_SUPPORT */
#define VM_MAJOR_DEC 0
#define VM_MINOR_DEC 0
@@ -1056,24 +1069,25 @@ static void
GXSetupForSolidLine(ScrnInfoPtr pScrni, int color, int rop, uint planemask)
{
DEBUGMSG(1, (0, X_INFO, "%s() %#x %#x %#x\n",
- __func__, color, rop, planemask));
+ __func__, color, rop, planemask));
rop &= 0x0F;
#ifndef OPT_ACCEL
gfx_set_solid_pattern(color);
gfx_set_raster_operation(planemask == ~0U ? PDfn[rop] :
- (gfx_set_solid_source(planemask), PDfn_SM[rop]));
+ (gfx_set_solid_source(planemask), PDfn_SM[rop]));
#else
{
- unsigned int ROP =
- BPP | (planemask == ~0U ? PDfn[rop] : PDfn_SM[rop]);
- BLT_MODE = ((ROP ^ (ROP >> 2)) & 0x33) == 0 ? MGP_BM_SRC_MONO : 0;
- VEC_MODE = ((ROP ^ (ROP >> 1)) & 0x55) != 0 ? ((BLT_MODE |=
- MGP_BM_DST_REQ), MGP_VM_DST_REQ) : 0;
- GU2_WAIT_PENDING;
- WRITE_GP32(MGP_RASTER_MODE, ROP);
- WRITE_GP32(MGP_PAT_COLOR_0, color);
- WRITE_GP32(MGP_SRC_COLOR_FG, planemask);
- WRITE_GP32(MGP_STRIDE, ACCEL_STRIDE);
+ unsigned int ROP = BPP | (planemask == ~0U ? PDfn[rop] : PDfn_SM[rop]);
+
+ BLT_MODE = ((ROP ^ (ROP >> 2)) & 0x33) == 0 ? MGP_BM_SRC_MONO : 0;
+ VEC_MODE = ((ROP ^ (ROP >> 1)) & 0x55) != 0 ? ((BLT_MODE |=
+ MGP_BM_DST_REQ),
+ MGP_VM_DST_REQ) : 0;
+ GU2_WAIT_PENDING;
+ WRITE_GP32(MGP_RASTER_MODE, ROP);
+ WRITE_GP32(MGP_PAT_COLOR_0, color);
+ WRITE_GP32(MGP_SRC_COLOR_FG, planemask);
+ WRITE_GP32(MGP_STRIDE, ACCEL_STRIDE);
}
#endif
}
@@ -1103,14 +1117,15 @@ GXSetupForSolidLine(ScrnInfoPtr pScrni, int color, int rop, uint planemask)
*---------------------------------------------------------------------------*/
static void
GXSubsequentSolidBresenhamLine(ScrnInfoPtr pScrni, int x1, int y1,
- int absmaj, int absmin, int err, int len, int octant)
+ int absmaj, int absmin, int err, int len,
+ int octant)
{
long axial, diagn;
DEBUGMSG(1, (0, X_INFO, "%s() %d,%d %d %d, %d %d, %d\n",
- __func__, x1, y1, absmaj, absmin, err, len, octant));
+ __func__, x1, y1, absmaj, absmin, err, len, octant));
if (len <= 0)
- return;
+ return;
axial = absmin;
err += axial;
diagn = absmin - absmaj;
@@ -1118,16 +1133,16 @@ GXSubsequentSolidBresenhamLine(ScrnInfoPtr pScrni, int x1, int y1,
gfx_bresenham_line(x1, y1, len, err, axial, diagn, vmode[octant]);
#else
{
- unsigned int offset = CALC_FBOFFSET(x1, y1);
- unsigned int vec_err = (axial << 16) | (unsigned short)diagn;
- unsigned int vec_len = (len << 16) | (unsigned short)err;
- unsigned int vec_mode = VEC_MODE | vmode[octant];
-
- GU2_WAIT_PENDING;
- WRITE_GP32(MGP_DST_OFFSET, offset);
- WRITE_GP32(MGP_VEC_ERR, vec_err);
- WRITE_GP32(MGP_VEC_LEN, vec_len);
- WRITE_GP32(MGP_VECTOR_MODE, vec_mode);
+ unsigned int offset = CALC_FBOFFSET(x1, y1);
+ unsigned int vec_err = (axial << 16) | (unsigned short) diagn;
+ unsigned int vec_len = (len << 16) | (unsigned short) err;
+ unsigned int vec_mode = VEC_MODE | vmode[octant];
+
+ GU2_WAIT_PENDING;
+ WRITE_GP32(MGP_DST_OFFSET, offset);
+ WRITE_GP32(MGP_VEC_ERR, vec_err);
+ WRITE_GP32(MGP_VEC_LEN, vec_len);
+ WRITE_GP32(MGP_VECTOR_MODE, vec_mode);
}
#endif
}
@@ -1149,36 +1164,37 @@ GXSubsequentSolidBresenhamLine(ScrnInfoPtr pScrni, int x1, int y1,
*---------------------------------------------------------------------------*/
static void
GXSubsequentSolidTwoPointLine(ScrnInfoPtr pScrni, int x0, int y0,
- int x1, int y1, int flags)
+ int x1, int y1, int flags)
{
long dx, dy, dmaj, dmin, octant, bias;
long axial, diagn, err, len;
DEBUGMSG(1, (0, X_INFO, "%s() %d,%d %d,%d, %#x\n",
- __func__, x0, y0, x1, y1, flags));
+ __func__, x0, y0, x1, y1, flags));
if ((dx = x1 - x0) < 0)
- dx = -dx;
+ dx = -dx;
if ((dy = y1 - y0) < 0)
- dy = -dy;
+ dy = -dy;
if (dy >= dx) {
- dmaj = dy;
- dmin = dx;
- octant = YMAJOR;
- } else {
- dmaj = dx;
- dmin = dy;
- octant = 0;
+ dmaj = dy;
+ dmin = dx;
+ octant = YMAJOR;
+ }
+ else {
+ dmaj = dx;
+ dmin = dy;
+ octant = 0;
}
len = dmaj;
if ((flags & OMIT_LAST) == 0)
- ++len;
+ ++len;
if (len <= 0)
- return;
+ return;
if (x1 < x0)
- octant |= XDECREASING;
+ octant |= XDECREASING;
if (y1 < y0)
- octant |= YDECREASING;
+ octant |= YDECREASING;
axial = dmin << 1;
bias = miGetZeroLineBias(pScrni->pScreen);
@@ -1189,16 +1205,16 @@ GXSubsequentSolidTwoPointLine(ScrnInfoPtr pScrni, int x0, int y0,
gfx_bresenham_line(x0, y0, len, err, axial, diagn, vmode[octant]);
#else
{
- unsigned int offset = CALC_FBOFFSET(x0, y0);
- unsigned int vec_err = (axial << 16) | (unsigned short)diagn;
- unsigned int vec_len = (len << 16) | (unsigned short)err;
- unsigned int vec_mode = VEC_MODE | vmode[octant];
-
- GU2_WAIT_PENDING;
- WRITE_GP32(MGP_DST_OFFSET, offset);
- WRITE_GP32(MGP_VEC_ERR, vec_err);
- WRITE_GP32(MGP_VEC_LEN, vec_len);
- WRITE_GP32(MGP_VECTOR_MODE, vec_mode);
+ unsigned int offset = CALC_FBOFFSET(x0, y0);
+ unsigned int vec_err = (axial << 16) | (unsigned short) diagn;
+ unsigned int vec_len = (len << 16) | (unsigned short) err;
+ unsigned int vec_mode = VEC_MODE | vmode[octant];
+
+ GU2_WAIT_PENDING;
+ WRITE_GP32(MGP_DST_OFFSET, offset);
+ WRITE_GP32(MGP_VEC_ERR, vec_err);
+ WRITE_GP32(MGP_VEC_LEN, vec_len);
+ WRITE_GP32(MGP_VECTOR_MODE, vec_mode);
}
#endif
}
@@ -1222,28 +1238,27 @@ GXSubsequentSolidTwoPointLine(ScrnInfoPtr pScrni, int x0, int y0,
*---------------------------------------------------------------------------
*/
static void
-GXSubsequentSolidHorVertLine(ScrnInfoPtr pScrni,
- int x, int y, int len, int dir)
+GXSubsequentSolidHorVertLine(ScrnInfoPtr pScrni, int x, int y, int len, int dir)
{
DEBUGMSG(1, (0, X_INFO, "%s() %d,%d %d %d\n", __func__, x, y, len, dir));
#ifndef OPT_ACCEL
if (dir == DEGREES_0)
- gfx_pattern_fill(x, y, len, 1);
+ gfx_pattern_fill(x, y, len, 1);
else
- gfx_pattern_fill(x, y, 1, len);
+ gfx_pattern_fill(x, y, 1, len);
#else
{
- unsigned int offset = CALC_FBOFFSET(x, y);
- unsigned int size =
- dir == DEGREES_0 ? (len << 16) | 1 : (1 << 16) | len;
- GU2_WAIT_PENDING;
- WRITE_GP32(MGP_DST_OFFSET, offset);
- WRITE_GP32(MGP_WID_HEIGHT, size);
- WRITE_GP32(MGP_BLT_MODE, BLT_MODE);
+ unsigned int offset = CALC_FBOFFSET(x, y);
+ unsigned int size =
+ dir == DEGREES_0 ? (len << 16) | 1 : (1 << 16) | len;
+ GU2_WAIT_PENDING;
+ WRITE_GP32(MGP_DST_OFFSET, offset);
+ WRITE_GP32(MGP_WID_HEIGHT, size);
+ WRITE_GP32(MGP_BLT_MODE, BLT_MODE);
}
#endif
}
-#endif /* GX_BRES_LINE_SUPPORT */
+#endif /* GX_BRES_LINE_SUPPORT */
#if GX_DASH_LINE_SUPPORT
/*----------------------------------------------------------------------------
@@ -1266,23 +1281,23 @@ GXSubsequentSolidHorVertLine(ScrnInfoPtr pScrni,
*---------------------------------------------------------------------------*/
static void
GXSetupForDashedLine(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 i, l, n, m;
CARD32 pat = *pattern;
CARD32 pat8x8[2];
if (length <= 0)
- return;
+ return;
i = l = m = 0;
while (i < 2) {
- m |= pat >> l;
- l += length;
- if ((n = l - 32) >= 0) {
- pat8x8[i++] = m;
- m = pat << (length - n);
- l = n;
- }
+ m |= pat >> l;
+ l += length;
+ if ((n = l - 32) >= 0) {
+ pat8x8[i++] = m;
+ m = pat << (length - n);
+ l = n;
+ }
}
gdln.pat[0] = pat8x8[0];
gdln.pat[1] = pat8x8[1];
@@ -1292,7 +1307,7 @@ GXSetupForDashedLine(ScrnInfoPtr pScrn, int fg, int bg, int rop,
rop &= 0x0F;
gfx_set_solid_pattern(0);
gfx_set_raster_operation(planemask == ~0U ? PDfn[rop] :
- (gfx_set_solid_source(planemask), PDfn_SM[rop]));
+ (gfx_set_solid_source(planemask), PDfn_SM[rop]));
}
/*---------------------------------------------------------------------------
@@ -1324,8 +1339,8 @@ GXSetupForDashedLine(ScrnInfoPtr pScrn, int fg, int bg, int rop,
*/
static void
GXSubsequentDashedBresenhamLine(ScrnInfoPtr pScrni,
- int x1, int y1, int absmaj, int absmin,
- int err, int len, int octant, int phase)
+ int x1, int y1, int absmaj, int absmin,
+ int err, int len, int octant, int phase)
{
int i, n;
int axial, diagn;
@@ -1338,16 +1353,16 @@ GXSubsequentDashedBresenhamLine(ScrnInfoPtr pScrni,
i = phase >= 32 ? (phase -= 32, 1) : 0;
n = 32 - phase;
pat8x8[0] =
- ((gdln.pat[i] >> phase) & ((1UL << n) - 1)) | (gdln.pat[1 - i] << n);
+ ((gdln.pat[i] >> phase) & ((1UL << n) - 1)) | (gdln.pat[1 - i] << n);
pat8x8[1] =
- ((gdln.pat[1 - i] >> phase) & ((1UL << n) - 1)) | (gdln.pat[i] << n);
+ ((gdln.pat[1 - i] >> phase) & ((1UL << n) - 1)) | (gdln.pat[i] << n);
axial = absmin;
err += axial;
diagn = absmin - absmaj;
gfx_set_mono_pattern(gdln.bg, gdln.fg, pat8x8[0], pat8x8[1], trans);
gfx2_set_pattern_origin(x1, y1);
gfx2_bresenham_line(CALC_FBOFFSET(x1, y1), len, err, axial, diagn,
- vmode[octant]);
+ vmode[octant]);
}
/*---------------------------------------------------------------------------
@@ -1368,7 +1383,7 @@ GXSubsequentDashedBresenhamLine(ScrnInfoPtr pScrni,
*---------------------------------------------------------------------------*/
static void
GXSubsequentDashedTwoPointLine(ScrnInfoPtr pScrni, int x0, int y0,
- int x1, int y1, int flags, int phase)
+ int x1, int y1, int flags, int phase)
{
int i, n;
long dx, dy, dmaj, dmin, octant, bias;
@@ -1380,32 +1395,33 @@ GXSubsequentDashedTwoPointLine(ScrnInfoPtr pScrni, int x0, int y0,
i = phase >= 32 ? (phase -= 32, 1) : 0;
n = 32 - phase;
pat8x8[0] =
- ((gdln.pat[i] >> phase) & ((1UL << n) - 1)) | (gdln.pat[1 - i] << n);
+ ((gdln.pat[i] >> phase) & ((1UL << n) - 1)) | (gdln.pat[1 - i] << n);
pat8x8[1] =
- ((gdln.pat[1 - i] >> phase) & ((1UL << n) - 1)) | (gdln.pat[i] << n);
+ ((gdln.pat[1 - i] >> phase) & ((1UL << n) - 1)) | (gdln.pat[i] << n);
if ((dx = x1 - x0) < 0)
- dx = -dx;
+ dx = -dx;
if ((dy = y1 - y0) < 0)
- dy = -dy;
+ dy = -dy;
if (dy >= dx) {
- dmaj = dy;
- dmin = dx;
- octant = YMAJOR;
- } else {
- dmaj = dx;
- dmin = dy;
- octant = 0;
+ dmaj = dy;
+ dmin = dx;
+ octant = YMAJOR;
+ }
+ else {
+ dmaj = dx;
+ dmin = dy;
+ octant = 0;
}
len = dmaj;
if ((flags & OMIT_LAST) == 0)
- ++len;
+ ++len;
if (len <= 0)
- return;
+ return;
if (x1 < x0)
- octant |= XDECREASING;
+ octant |= XDECREASING;
if (y1 < y0)
- octant |= YDECREASING;
+ octant |= YDECREASING;
axial = dmin << 1;
bias = miGetZeroLineBias(pScrni->pScreen);
@@ -1414,16 +1430,16 @@ GXSubsequentDashedTwoPointLine(ScrnInfoPtr pScrni, int x0, int y0,
gfx2_set_pattern_origin(x0, y0);
gfx2_bresenham_line(CALC_FBOFFSET(x0, y0), len, err, axial, diagn,
- vmode[octant]);
+ vmode[octant]);
}
-#endif /* GX_DASH_LINE_SUPPORT */
+#endif /* GX_DASH_LINE_SUPPORT */
#if GX_WRITE_PIXMAP_SUPPORT
static void
GXWritePixmap(ScrnInfoPtr pScrni, int x, int y, int w, int h,
- unsigned char *src, int srcwidth, int rop, unsigned int planemask,
- int trans, int bpp, int depth)
+ unsigned char *src, int srcwidth, int rop, unsigned int planemask,
+ int trans, int bpp, int depth)
{
GeodeRec *pGeode = GEODEPTR(pScrni);
@@ -1431,29 +1447,30 @@ GXWritePixmap(ScrnInfoPtr pScrni, int x, int y, int w, int h,
// x, y, w, h, src, srcwidth, rop, planemask, trans, bpp, depth);
if (bpp == pScrni->bitsPerPixel) {
- rop &= 0x0F;
- if (rop == GXcopy && trans == -1) {
- gfx_wait_until_idle();
- geode_memory_to_screen_blt((unsigned long)src,
- (unsigned long)FBADDR(x, y), srcwidth, pGeode->Pitch, w,
- h, bpp);
- } else {
- gfx_set_solid_pattern(planemask);
- gfx_set_raster_operation(planemask ==
- ~0U ? SDfn[rop] : SDfn_PM[rop]);
- if (trans != -1)
- gfx_color_bitmap_to_screen_xblt(0, 0, x, y, w, h, src,
- srcwidth, trans);
- else
- gfx_color_bitmap_to_screen_blt(0, 0, x, y, w, h, src,
- srcwidth);
- SET_SYNC_FLAG(pGeode->AccelInfoRec);
- }
- } else
- pGeode->WritePixmap(pScrni, x, y, w, h, src, srcwidth, rop, planemask,
- trans, bpp, depth);
+ rop &= 0x0F;
+ if (rop == GXcopy && trans == -1) {
+ gfx_wait_until_idle();
+ geode_memory_to_screen_blt((unsigned long) src,
+ (unsigned long) FBADDR(x, y), srcwidth,
+ pGeode->Pitch, w, h, bpp);
+ }
+ else {
+ gfx_set_solid_pattern(planemask);
+ gfx_set_raster_operation(planemask ==
+ ~0U ? SDfn[rop] : SDfn_PM[rop]);
+ if (trans != -1)
+ gfx_color_bitmap_to_screen_xblt(0, 0, x, y, w, h, src,
+ srcwidth, trans);
+ else
+ gfx_color_bitmap_to_screen_blt(0, 0, x, y, w, h, src, srcwidth);
+ SET_SYNC_FLAG(pGeode->AccelInfoRec);
+ }
+ }
+ else
+ pGeode->WritePixmap(pScrni, x, y, w, h, src, srcwidth, rop, planemask,
+ trans, bpp, depth);
}
-#endif /* if GX_WRITE_PIXMAP_SUPPORT */
+#endif /* if GX_WRITE_PIXMAP_SUPPORT */
#if XF86EXA
@@ -1470,7 +1487,7 @@ amd_gx_exa_Done(PixmapPtr p)
static Bool
amd_gx_exa_UploadToScreen(PixmapPtr pDst, int x, int y, int w, int h,
- char *src, int src_pitch)
+ char *src, int src_pitch)
{
char *dst = pDst->devPrivate.ptr;
int dst_pitch = exaGetPixmapPitch(pDst);
@@ -1478,14 +1495,14 @@ amd_gx_exa_UploadToScreen(PixmapPtr pDst, int x, int y, int w, int h,
dst += y * dst_pitch + x * (bpp >> 3);
GU2_WAIT_BUSY;
- geode_memory_to_screen_blt((unsigned long)src, (unsigned long)dst,
- src_pitch, dst_pitch, w, h, bpp);
+ geode_memory_to_screen_blt((unsigned long) src, (unsigned long) dst,
+ src_pitch, dst_pitch, w, h, bpp);
return TRUE;
}
static Bool
amd_gx_exa_DownloadFromScreen(PixmapPtr pSrc, int x, int y, int w, int h,
- char *dst, int dst_pitch)
+ char *dst, int dst_pitch)
{
char *src = pSrc->devPrivate.ptr;
int src_pitch = exaGetPixmapPitch(pSrc);
@@ -1493,8 +1510,8 @@ amd_gx_exa_DownloadFromScreen(PixmapPtr pSrc, int x, int y, int w, int h,
src += (y * src_pitch) + (x * (bpp >> 3));
GU2_WAIT_BUSY;
- geode_memory_to_screen_blt((unsigned long)src, (unsigned long)dst,
- src_pitch, dst_pitch, w, h, bpp);
+ geode_memory_to_screen_blt((unsigned long) src, (unsigned long) dst,
+ src_pitch, dst_pitch, w, h, bpp);
return TRUE;
}
@@ -1505,7 +1522,7 @@ amd_gx_exa_PrepareSolid(PixmapPtr pxMap, int alu, Pixel planemask, Pixel fg)
{
int dstPitch = exaGetPixmapPitch(pxMap);
unsigned int ROP = amd_gx_BppToRasterMode(pxMap->drawable.bitsPerPixel)
- | (planemask == ~0U ? SDfn[alu] : SDfn_PM[alu]);
+ | (planemask == ~0U ? SDfn[alu] : SDfn_PM[alu]);
// FIXME: this should go away -- workaround for the blockparty icon corruption
//if (pxMap->drawable.bitsPerPixel == 32)
@@ -1513,7 +1530,7 @@ amd_gx_exa_PrepareSolid(PixmapPtr pxMap, int alu, Pixel planemask, Pixel fg)
BLT_MODE = ((ROP ^ (ROP >> 2)) & 0x33) == 0 ? MGP_BM_SRC_MONO : 0;
if (((ROP ^ (ROP >> 1)) & 0x55) != 0)
- BLT_MODE |= MGP_BM_DST_REQ;
+ BLT_MODE |= MGP_BM_DST_REQ;
//ErrorF("amd_gx_exa_PrepareSolid(%#x,%#x,%#x - ROP=%x,BLT_MODE=%x)\n", alu, planemask, fg, ROP, BLT_MODE);
GU2_WAIT_PENDING;
WRITE_GP32(MGP_RASTER_MODE, ROP);
@@ -1543,7 +1560,7 @@ amd_gx_exa_Solid(PixmapPtr pxMap, int x1, int y1, int x2, int y2)
static Bool
amd_gx_exa_PrepareCopy(PixmapPtr pxSrc, PixmapPtr pxDst, int dx, int dy,
- int alu, Pixel planemask)
+ int alu, Pixel planemask)
{
GeodeRec *pGeode = GEODEPTR_FROM_PIXMAP(pxDst);
int dstPitch = exaGetPixmapPitch(pxDst);
@@ -1552,7 +1569,7 @@ amd_gx_exa_PrepareCopy(PixmapPtr pxSrc, PixmapPtr pxDst, int dx, int dy,
/* Punt if the color formats aren't the same */
if (pxSrc->drawable.bitsPerPixel != pxDst->drawable.bitsPerPixel)
- return FALSE;
+ return FALSE;
//ErrorF("amd_gx_exa_PrepareCopy() dx%d dy%d alu %#x %#x\n",
// dx, dy, alu, planemask);
@@ -1563,10 +1580,10 @@ amd_gx_exa_PrepareCopy(PixmapPtr pxSrc, PixmapPtr pxDst, int dx, int dy,
pGeode->cpyDx = dx;
pGeode->cpyDy = dy;
ROP = amd_gx_BppToRasterMode(pxSrc->drawable.bitsPerPixel) |
- (planemask == ~0U ? SDfn[alu] : SDfn_PM[alu]);
+ (planemask == ~0U ? SDfn[alu] : SDfn_PM[alu]);
BLT_MODE = ((ROP ^ (ROP >> 1)) & 0x55) != 0 ?
- MGP_BM_SRC_FB | MGP_BM_DST_REQ : MGP_BM_SRC_FB;
+ MGP_BM_SRC_FB | MGP_BM_DST_REQ : MGP_BM_SRC_FB;
GU2_WAIT_PENDING;
WRITE_GP32(MGP_RASTER_MODE, ROP);
WRITE_GP32(MGP_PAT_COLOR_0, planemask);
@@ -1578,16 +1595,16 @@ amd_gx_exa_PrepareCopy(PixmapPtr pxSrc, PixmapPtr pxDst, int dx, int dy,
static void
amd_gx_exa_Copy(PixmapPtr pxDst, int srcX, int srcY, int dstX, int dstY,
- int w, int h)
+ int w, int h)
{
GeodeRec *pGeode = GEODEPTR_FROM_PIXMAP(pxDst);
int dstBpp = (pxDst->drawable.bitsPerPixel + 7) / 8;
int dstPitch = exaGetPixmapPitch(pxDst);
unsigned int srcOffset =
- pGeode->cpySrcOffset + (pGeode->cpySrcPitch * srcY) +
- (pGeode->cpySrcBpp * srcX);
+ pGeode->cpySrcOffset + (pGeode->cpySrcPitch * srcY) +
+ (pGeode->cpySrcBpp * srcX);
unsigned int dstOffset =
- exaGetPixmapOffset(pxDst) + (dstPitch * dstY) + (dstBpp * dstX);
+ exaGetPixmapOffset(pxDst) + (dstPitch * dstY) + (dstBpp * dstX);
unsigned int size = (w << 16) | h;
unsigned int blt_mode = BLT_MODE;
@@ -1595,14 +1612,14 @@ amd_gx_exa_Copy(PixmapPtr pxDst, int srcX, int srcY, int dstX, int dstY,
// dstX, dstY, w, h);
if (pGeode->cpyDx < 0) {
- srcOffset += w * pGeode->cpySrcBpp - 1;
- dstOffset += w * dstBpp - 1;
- blt_mode |= MGP_BM_NEG_XDIR;
+ srcOffset += w * pGeode->cpySrcBpp - 1;
+ dstOffset += w * dstBpp - 1;
+ blt_mode |= MGP_BM_NEG_XDIR;
}
if (pGeode->cpyDy < 0) {
- srcOffset += (h - 1) * pGeode->cpySrcPitch;
- dstOffset += (h - 1) * dstPitch;
- blt_mode |= MGP_BM_NEG_YDIR;
+ srcOffset += (h - 1) * pGeode->cpySrcPitch;
+ dstOffset += (h - 1) * dstPitch;
+ blt_mode |= MGP_BM_NEG_YDIR;
}
GU2_WAIT_PENDING;
WRITE_GP32(MGP_SRC_OFFSET, srcOffset);
@@ -1633,32 +1650,31 @@ amd_gx_exa_Copy(PixmapPtr pxDst, int srcX, int srcY, int dstX, int dstY,
#define a_1 MGP_RM_SELECT_ALPHA_1
#define MGP_RM_ALPHA_TO_ARGB (MGP_RM_ALPHA_TO_ALPHA | MGP_RM_ALPHA_TO_RGB)
-#define gxPictOpMAX PictOpAdd /* highest accelerated op */
+#define gxPictOpMAX PictOpAdd /* highest accelerated op */
unsigned int amd_gx_exa_alpha_ops[] =
/* A B OP AS const = 0 */
{
- (SRC_DST | Aa_B0 | a_C), 0, /* clear (src*0) */
- (SRC_DST | Aa_B0 | a_1), 0, /* src (src*1) */
- (DST_SRC | Aa_B0 | a_1), 0, /* dst (dst*1) */
- (SRC_DST | A1_B1a | a_A), 0, /* src-over (src*1 + dst(1-A)) */
- (DST_SRC | A1_B1a | a_A), 0, /* dst-over (dst*1 + src(1-B)) */
- (SRC_DST | Aa_B0 | a_B), 0, /* src-in (src*B) */
- (DST_SRC | Aa_B0 | a_B), 0, /* dst-in (dst*A) */
- (DST_SRC | A0_B1a | a_A), 0, /* src-out (src*(1-B)) */
- (SRC_DST | A0_B1a | a_A), 0, /* dst-out (dst*(1-A)) */
+ (SRC_DST | Aa_B0 | a_C), 0, /* clear (src*0) */
+ (SRC_DST | Aa_B0 | a_1), 0, /* src (src*1) */
+ (DST_SRC | Aa_B0 | a_1), 0, /* dst (dst*1) */
+ (SRC_DST | A1_B1a | a_A), 0, /* src-over (src*1 + dst(1-A)) */
+ (DST_SRC | A1_B1a | a_A), 0, /* dst-over (dst*1 + src(1-B)) */
+ (SRC_DST | Aa_B0 | a_B), 0, /* src-in (src*B) */
+ (DST_SRC | Aa_B0 | a_B), 0, /* dst-in (dst*A) */
+ (DST_SRC | A0_B1a | a_A), 0, /* src-out (src*(1-B)) */
+ (SRC_DST | A0_B1a | a_A), 0, /* dst-out (dst*(1-A)) */
/* pass1 (SRC=dst DST=scr=src), pass2 (SRC=src, DST=dst) */
- (DST_SRC | Aa_B0 | a_B), /* srcatop (src*B) */
- (SRC_DST | A0_B1a | a_A), /* + (dst(1-A)) */
- (SRC_DST | Aa_B0 | a_B), /* dstatop (dst*A) */
- (DST_SRC | A0_B1a | a_A), /* + (src(1-B) */
- (SRC_DST | A0_B1a | a_A), /* xor (src*(1-B) */
- (SRC_DST | A0_B1a | a_A), /* + (dst(1-A) */
- (SRC_DST | A1_B1a | a_C), 0, /* add (src*1 + dst*1) */
+ (DST_SRC | Aa_B0 | a_B), /* srcatop (src*B) */
+ (SRC_DST | A0_B1a | a_A), /* + (dst(1-A)) */
+ (SRC_DST | Aa_B0 | a_B), /* dstatop (dst*A) */
+ (DST_SRC | A0_B1a | a_A), /* + (src(1-B) */
+ (SRC_DST | A0_B1a | a_A), /* xor (src*(1-B) */
+ (SRC_DST | A0_B1a | a_A), /* + (dst(1-A) */
+ (SRC_DST | A1_B1a | a_C), 0, /* add (src*1 + dst*1) */
};
-typedef struct
-{
+typedef struct {
int exa_fmt;
int bpp;
int gx_fmt;
@@ -1682,13 +1698,13 @@ amd_gx_exa_check_format(PicturePtr p)
amd_gx_exa_fmt_t *fp = &amd_gx_exa_fmts[0];
for (i = sizeof(amd_gx_exa_fmts) / sizeof(amd_gx_exa_fmts[0]); --i >= 0;
- ++fp) {
- if (fp->bpp < bpp)
- return NULL;
- if (fp->bpp != bpp)
- continue;
- if (fp->exa_fmt == p->format)
- break;
+ ++fp) {
+ if (fp->bpp < bpp)
+ return NULL;
+ if (fp->bpp != bpp)
+ continue;
+ if (fp->exa_fmt == p->format)
+ break;
}
return i < 0 ? NULL : fp;
}
@@ -1697,30 +1713,31 @@ amd_gx_exa_check_format(PicturePtr p)
static Bool
amd_gx_exa_CheckComposite(int op, PicturePtr pSrc, PicturePtr pMsk,
- PicturePtr pDst)
+ PicturePtr pDst)
{
GeodeRec *pGeode = GEODEPTR_FROM_PICTURE(pDst);
if (op > gxPictOpMAX)
- return FALSE;
+ return FALSE;
if (pMsk)
- return FALSE;
+ return FALSE;
if (usesPasses(op) && pGeode->exaBfrSz == 0)
- return FALSE;
+ return FALSE;
if (pSrc->filter != PictFilterNearest &&
- pSrc->filter != PictFilterFast &&
- pSrc->filter != PictFilterGood && pSrc->filter != PictFilterBest)
- return FALSE;
+ pSrc->filter != PictFilterFast &&
+ pSrc->filter != PictFilterGood && pSrc->filter != PictFilterBest)
+ return FALSE;
if (pSrc->repeat)
- return FALSE;
+ return FALSE;
if (pSrc->transform)
- return FALSE;
+ return FALSE;
return TRUE;
}
static Bool
amd_gx_exa_PrepareComposite(int op, PicturePtr pSrc, PicturePtr pMsk,
- PicturePtr pDst, PixmapPtr pxSrc, PixmapPtr pxMsk, PixmapPtr pxDst)
+ PicturePtr pDst, PixmapPtr pxSrc, PixmapPtr pxMsk,
+ PixmapPtr pxDst)
{
int srcPitch;
@@ -1730,31 +1747,32 @@ amd_gx_exa_PrepareComposite(int op, PicturePtr pSrc, PicturePtr pMsk,
//ErrorF("amd_gx_exa_PrepareComposite()\n");
if ((sfp = amd_gx_exa_check_format(pSrc)) == NULL)
- return FALSE;
+ return FALSE;
if (sfp->alpha_bits == 0 && usesSrcAlpha(op))
- return FALSE;
+ return FALSE;
if ((dfp = amd_gx_exa_check_format(pDst)) == NULL)
- return FALSE;
+ return FALSE;
if (dfp->alpha_bits == 0 && usesDstAlpha(op))
- return FALSE;
+ return FALSE;
if (sfp->gx_fmt != dfp->gx_fmt)
- return FALSE;
+ return FALSE;
srcPitch = exaGetPixmapPitch(pxSrc);
if (usesPasses(op) && srcPitch > pGeode->exaBfrSz)
- return FALSE;
+ return FALSE;
pGeode->cmpSrcPitch = srcPitch;
pGeode->cmpOp = op;
pGeode->cmpSrcOffset = exaGetPixmapOffset(pxSrc);
pGeode->cmpSrcBpp = (pxSrc->drawable.bitsPerPixel + 7) / 8;
pGeode->cmpSrcFmt = sfp->gx_fmt;
pGeode->cmpDstFmt = dfp->gx_fmt | (dfp->alpha_bits == 0 ?
- MGP_RM_ALPHA_TO_RGB : MGP_RM_ALPHA_TO_ARGB);
+ MGP_RM_ALPHA_TO_RGB :
+ MGP_RM_ALPHA_TO_ARGB);
return TRUE;
}
static void
amd_gx_exa_Composite(PixmapPtr pxDst, int srcX, int srcY, int maskX,
- int maskY, int dstX, int dstY, int width, int height)
+ int maskY, int dstX, int dstY, int width, int height)
{
int op, current_line, max_lines, lines, pass, scratchPitch;
unsigned int srcOffset, srcOfs = 0, srcPitch, srcPch = 0, srcBpp;
@@ -1767,16 +1785,17 @@ amd_gx_exa_Composite(PixmapPtr pxDst, int srcX, int srcY, int maskX,
op = pGeode->cmpOp;
if (usesPasses(op)) {
- int cacheLineSz = 32;
- int cachelines =
- (width * pGeode->cmpSrcBpp + cacheLineSz - 1) / cacheLineSz;
- scratchPitch = cachelines * cacheLineSz;
- if (scratchPitch > pGeode->cmpSrcPitch)
- scratchPitch = pGeode->cmpSrcPitch;
- max_lines = pGeode->exaBfrSz / scratchPitch;
- } else {
- scratchPitch = 0;
- max_lines = height;
+ int cacheLineSz = 32;
+ int cachelines =
+ (width * pGeode->cmpSrcBpp + cacheLineSz - 1) / cacheLineSz;
+ scratchPitch = cachelines * cacheLineSz;
+ if (scratchPitch > pGeode->cmpSrcPitch)
+ scratchPitch = pGeode->cmpSrcPitch;
+ max_lines = pGeode->exaBfrSz / scratchPitch;
+ }
+ else {
+ scratchPitch = 0;
+ max_lines = height;
}
dstBpp = (pxDst->drawable.bitsPerPixel + 7) / 8;
@@ -1788,83 +1807,84 @@ amd_gx_exa_Composite(PixmapPtr pxDst, int srcX, int srcY, int maskX,
current_line = pass = 0;
while (current_line < height) {
- if (usesPasses(op)) {
- lines = height - current_line;
- if (lines > max_lines)
- lines = max_lines;
- switch (pass) {
- case 0: /* copy src to scratch */
- srcPch = srcPitch;
- srcOfs = srcOffset + current_line * srcPch;
- dstPch = scratchPitch;
- dstOfs = pGeode->exaBfrOffset;
- rop = pGeode->cmpSrcFmt | MGP_RM_ALPHA_TO_ARGB;
- rop |= amd_gx_exa_alpha_ops[PictOpSrc * 2];
- blt_mode = usesChanB0(PictOpSrc) ?
- MGP_BM_SRC_FB | MGP_BM_DST_REQ : MGP_BM_SRC_FB;
- ++pass;
- break;
- case 1: /* pass1 */
- srcPch = dstPitch;
- srcOfs = dstOffset + current_line * srcPch;
- dstPch = scratchPitch;
- dstOfs = pGeode->exaBfrOffset;
- rop = pGeode->cmpSrcFmt | MGP_RM_ALPHA_TO_ARGB;
- rop |= amd_gx_exa_alpha_ops[op * 2];
- blt_mode = usesChanB1(op) ?
- MGP_BM_SRC_FB | MGP_BM_DST_REQ : MGP_BM_SRC_FB;
- ++pass;
- break;
- case 2: /* pass2 */
- srcPch = srcPitch;
- srcOfs = srcOffset + current_line * srcPch;
- dstPch = dstPitch;
- dstOfs = dstOffset + current_line * dstPch;
- rop = pGeode->cmpSrcFmt | MGP_RM_ALPHA_TO_ARGB;
- rop |= amd_gx_exa_alpha_ops[op * 2 + 1];
- blt_mode = usesChanB2(op) ?
- MGP_BM_SRC_FB | MGP_BM_DST_REQ : MGP_BM_SRC_FB;
- ++pass;
- break;
- case 3: /* add */
- srcPch = scratchPitch;
- srcOfs = pGeode->exaBfrOffset;
- dstPch = dstPitch;
- dstOfs = dstOffset + current_line * dstPch;
- rop = pGeode->cmpDstFmt;
- rop |= amd_gx_exa_alpha_ops[PictOpAdd * 2];
- blt_mode = usesChanB0(PictOpAdd) ?
- MGP_BM_SRC_FB | MGP_BM_DST_REQ : MGP_BM_SRC_FB;
- current_line += lines;
- pass = 0;
- break;
- }
- strides = (srcPch << 16) | dstPch;
- } else { /* not multi pass */
- srcOfs = srcOffset;
- dstOfs = dstOffset;
- current_line = lines = height;
- strides = (srcPitch << 16) | dstPitch;
- rop = pGeode->cmpDstFmt | amd_gx_exa_alpha_ops[op * 2];
- blt_mode = usesChanB0(op) ?
- MGP_BM_SRC_FB | MGP_BM_DST_REQ : MGP_BM_SRC_FB;
- }
- sizes = (width << 16) | lines;
- if (srcOfs < dstOfs) {
- srcOfs += (lines - 1) * srcPitch + width * srcBpp - 1;
- dstOfs += (lines - 1) * dstPitch + width * dstBpp - 1;
- blt_mode |= MGP_BM_NEG_XDIR | MGP_BM_NEG_YDIR;
- }
- GU2_WAIT_PENDING;
- WRITE_GP32(MGP_RASTER_MODE, rop);
- WRITE_GP32(MGP_SRC_OFFSET, srcOfs);
- WRITE_GP32(MGP_DST_OFFSET, dstOfs);
- WRITE_GP32(MGP_WID_HEIGHT, sizes);
- WRITE_GP32(MGP_STRIDE, strides);
- WRITE_GP16(MGP_BLT_MODE, blt_mode);
+ if (usesPasses(op)) {
+ lines = height - current_line;
+ if (lines > max_lines)
+ lines = max_lines;
+ switch (pass) {
+ case 0: /* copy src to scratch */
+ srcPch = srcPitch;
+ srcOfs = srcOffset + current_line * srcPch;
+ dstPch = scratchPitch;
+ dstOfs = pGeode->exaBfrOffset;
+ rop = pGeode->cmpSrcFmt | MGP_RM_ALPHA_TO_ARGB;
+ rop |= amd_gx_exa_alpha_ops[PictOpSrc * 2];
+ blt_mode = usesChanB0(PictOpSrc) ?
+ MGP_BM_SRC_FB | MGP_BM_DST_REQ : MGP_BM_SRC_FB;
+ ++pass;
+ break;
+ case 1: /* pass1 */
+ srcPch = dstPitch;
+ srcOfs = dstOffset + current_line * srcPch;
+ dstPch = scratchPitch;
+ dstOfs = pGeode->exaBfrOffset;
+ rop = pGeode->cmpSrcFmt | MGP_RM_ALPHA_TO_ARGB;
+ rop |= amd_gx_exa_alpha_ops[op * 2];
+ blt_mode = usesChanB1(op) ?
+ MGP_BM_SRC_FB | MGP_BM_DST_REQ : MGP_BM_SRC_FB;
+ ++pass;
+ break;
+ case 2: /* pass2 */
+ srcPch = srcPitch;
+ srcOfs = srcOffset + current_line * srcPch;
+ dstPch = dstPitch;
+ dstOfs = dstOffset + current_line * dstPch;
+ rop = pGeode->cmpSrcFmt | MGP_RM_ALPHA_TO_ARGB;
+ rop |= amd_gx_exa_alpha_ops[op * 2 + 1];
+ blt_mode = usesChanB2(op) ?
+ MGP_BM_SRC_FB | MGP_BM_DST_REQ : MGP_BM_SRC_FB;
+ ++pass;
+ break;
+ case 3: /* add */
+ srcPch = scratchPitch;
+ srcOfs = pGeode->exaBfrOffset;
+ dstPch = dstPitch;
+ dstOfs = dstOffset + current_line * dstPch;
+ rop = pGeode->cmpDstFmt;
+ rop |= amd_gx_exa_alpha_ops[PictOpAdd * 2];
+ blt_mode = usesChanB0(PictOpAdd) ?
+ MGP_BM_SRC_FB | MGP_BM_DST_REQ : MGP_BM_SRC_FB;
+ current_line += lines;
+ pass = 0;
+ break;
+ }
+ strides = (srcPch << 16) | dstPch;
+ }
+ else { /* not multi pass */
+ srcOfs = srcOffset;
+ dstOfs = dstOffset;
+ current_line = lines = height;
+ strides = (srcPitch << 16) | dstPitch;
+ rop = pGeode->cmpDstFmt | amd_gx_exa_alpha_ops[op * 2];
+ blt_mode = usesChanB0(op) ?
+ MGP_BM_SRC_FB | MGP_BM_DST_REQ : MGP_BM_SRC_FB;
+ }
+ sizes = (width << 16) | lines;
+ if (srcOfs < dstOfs) {
+ srcOfs += (lines - 1) * srcPitch + width * srcBpp - 1;
+ dstOfs += (lines - 1) * dstPitch + width * dstBpp - 1;
+ blt_mode |= MGP_BM_NEG_XDIR | MGP_BM_NEG_YDIR;
+ }
+ GU2_WAIT_PENDING;
+ WRITE_GP32(MGP_RASTER_MODE, rop);
+ WRITE_GP32(MGP_SRC_OFFSET, srcOfs);
+ WRITE_GP32(MGP_DST_OFFSET, dstOfs);
+ WRITE_GP32(MGP_WID_HEIGHT, sizes);
+ WRITE_GP32(MGP_STRIDE, strides);
+ WRITE_GP16(MGP_BLT_MODE, blt_mode);
}
}
-#endif /* #if XF86EXA */
+#endif /* #if XF86EXA */
/*----------------------------------------------------------------------------
* GXAccelInit.
@@ -1884,7 +1904,7 @@ amd_gx_exa_Composite(PixmapPtr pxDst, int srcX, int srcY, int maskX,
Bool
GXAccelInit(ScreenPtr pScrn)
{
- ScrnInfoPtr pScrni = xf86Screens[pScrn->myNum];
+ ScrnInfoPtr pScrni = xf86ScreenToScrn(pScrn);
GeodeRec *pGeode = GEODEPTR(pScrni);
#if XF86EXA
@@ -1899,17 +1919,17 @@ GXAccelInit(ScreenPtr pScrn)
switch (pGeode->Pitch) {
case 1024:
- gu2_yshift = 10;
- break;
+ gu2_yshift = 10;
+ break;
case 2048:
- gu2_yshift = 11;
- break;
+ gu2_yshift = 11;
+ break;
case 4096:
- gu2_yshift = 12;
- break;
+ gu2_yshift = 12;
+ break;
default:
- gu2_yshift = 13;
- break;
+ gu2_yshift = 13;
+ break;
}
#ifdef OPT_ACCEL
@@ -1919,43 +1939,44 @@ GXAccelInit(ScreenPtr pScrn)
#if XF86EXA
if (pExa && pGeode->useEXA) {
- pExa->exa_major = EXA_VERSION_MAJOR;
- pExa->exa_minor = EXA_VERSION_MINOR;
-
- /* Sync */
- pExa->WaitMarker = amd_gx_exa_WaitMarker;
- /* UploadToScreen */
- pExa->UploadToScreen = amd_gx_exa_UploadToScreen;
- pExa->DownloadFromScreen = amd_gx_exa_DownloadFromScreen;
-
- /* Solid fill */
- pExa->PrepareSolid = amd_gx_exa_PrepareSolid;
- pExa->Solid = amd_gx_exa_Solid;
- pExa->DoneSolid = amd_gx_exa_Done;
-
- /* Copy */
- pExa->PrepareCopy = amd_gx_exa_PrepareCopy;
- pExa->Copy = amd_gx_exa_Copy;
- pExa->DoneCopy = amd_gx_exa_Done;
-
- /* Composite */
- pExa->CheckComposite = amd_gx_exa_CheckComposite;
- pExa->PrepareComposite = amd_gx_exa_PrepareComposite;
- pExa->Composite = amd_gx_exa_Composite;
- pExa->DoneComposite = amd_gx_exa_Done;
-
- return exaDriverInit(pScrn, pGeode->pExa);
+ pExa->exa_major = EXA_VERSION_MAJOR;
+ pExa->exa_minor = EXA_VERSION_MINOR;
+
+ /* Sync */
+ pExa->WaitMarker = amd_gx_exa_WaitMarker;
+ /* UploadToScreen */
+ pExa->UploadToScreen = amd_gx_exa_UploadToScreen;
+ pExa->DownloadFromScreen = amd_gx_exa_DownloadFromScreen;
+
+ /* Solid fill */
+ pExa->PrepareSolid = amd_gx_exa_PrepareSolid;
+ pExa->Solid = amd_gx_exa_Solid;
+ pExa->DoneSolid = amd_gx_exa_Done;
+
+ /* Copy */
+ pExa->PrepareCopy = amd_gx_exa_PrepareCopy;
+ pExa->Copy = amd_gx_exa_Copy;
+ pExa->DoneCopy = amd_gx_exa_Done;
+
+ /* Composite */
+ pExa->CheckComposite = amd_gx_exa_CheckComposite;
+ pExa->PrepareComposite = amd_gx_exa_PrepareComposite;
+ pExa->Composite = amd_gx_exa_Composite;
+ pExa->DoneComposite = amd_gx_exa_Done;
+
+ return exaDriverInit(pScrn, pGeode->pExa);
}
#endif
+#if XF86XAA
+
/* Getting the pointer for acceleration Inforecord */
pGeode->AccelInfoRec = localRecPtr = XAACreateInfoRec();
if (!pGeode->AccelInfoRec)
- return FALSE;
+ return FALSE;
/* SET ACCELERATION FLAGS */
- localRecPtr->Flags =
- PIXMAP_CACHE | OFFSCREEN_PIXMAPS | LINEAR_FRAMEBUFFER;
+ localRecPtr->Flags = PIXMAP_CACHE | OFFSCREEN_PIXMAPS | LINEAR_FRAMEBUFFER;
/* HOOK SYNCRONIZARION ROUTINE */
localRecPtr->Sync = GXAccelSync;
@@ -1973,7 +1994,7 @@ GXAccelInit(ScreenPtr pScrn)
HOOK(SubsequentMono8x8PatternFillRect);
/* BIT_ORDER_IN_BYTE_MSBFIRST | SCANLINE_PAD_DWORD | NO_TRANSPARENCY | */
localRecPtr->Mono8x8PatternFillFlags = BIT_ORDER_IN_BYTE_MSBFIRST |
- HARDWARE_PATTERN_PROGRAMMED_BITS | HARDWARE_PATTERN_SCREEN_ORIGIN;
+ HARDWARE_PATTERN_PROGRAMMED_BITS | HARDWARE_PATTERN_SCREEN_ORIGIN;
#endif
#if GX_CLREXP_8X8_PAT_SUPPORT
@@ -1982,8 +2003,8 @@ GXAccelInit(ScreenPtr pScrn)
HOOK(SubsequentColor8x8PatternFillRect);
/* BIT_ORDER_IN_BYTE_MSBFIRST | SCANLINE_PAD_DWORD | NO_TRANSPARENCY | */
localRecPtr->Color8x8PatternFillFlags =
- BIT_ORDER_IN_BYTE_MSBFIRST | SCANLINE_PAD_DWORD |
- HARDWARE_PATTERN_PROGRAMMED_BITS | HARDWARE_PATTERN_PROGRAMMED_ORIGIN;
+ BIT_ORDER_IN_BYTE_MSBFIRST | SCANLINE_PAD_DWORD |
+ HARDWARE_PATTERN_PROGRAMMED_BITS | HARDWARE_PATTERN_PROGRAMMED_ORIGIN;
#endif
#if GX_SCR2SCRCPY_SUPPORT
@@ -1993,7 +2014,7 @@ GXAccelInit(ScreenPtr pScrn)
HOOK(SetupForScreenToScreenCopy);
HOOK(SubsequentScreenToScreenCopy);
localRecPtr->ScreenToScreenCopyFlags =
- BIT_ORDER_IN_BYTE_MSBFIRST | SCANLINE_PAD_DWORD;
+ BIT_ORDER_IN_BYTE_MSBFIRST | SCANLINE_PAD_DWORD;
#endif
#if GX_BRES_LINE_SUPPORT
@@ -2013,8 +2034,8 @@ GXAccelInit(ScreenPtr pScrn)
HOOK(SubsequentDashedTwoPointLine);
localRecPtr->DashedBresenhamLineErrorTermBits = 15;
localRecPtr->DashPatternMaxLength = 64;
- localRecPtr->DashedLineFlags = NO_PLANEMASK | /* TRANSPARENCY_ONLY | */
- LINE_PATTERN_POWER_OF_2_ONLY | LINE_PATTERN_MSBFIRST_MSBJUSTIFIED;
+ localRecPtr->DashedLineFlags = NO_PLANEMASK | /* TRANSPARENCY_ONLY | */
+ LINE_PATTERN_POWER_OF_2_ONLY | LINE_PATTERN_MSBFIRST_MSBJUSTIFIED;
#endif
#if GX_SCR2SCREXP_SUPPORT
@@ -2022,37 +2043,37 @@ GXAccelInit(ScreenPtr pScrn)
HOOK(SetupForScreenToScreenColorExpandFill);
HOOK(SubsequentScreenToScreenColorExpandFill);
localRecPtr->ScreenToScreenColorExpandFillFlags =
- BIT_ORDER_IN_BYTE_MSBFIRST | SCANLINE_PAD_DWORD | NO_TRANSPARENCY;
+ BIT_ORDER_IN_BYTE_MSBFIRST | SCANLINE_PAD_DWORD | NO_TRANSPARENCY;
#endif
if (pGeode->AccelImageWriteBuffers) {
#if GX_SCANLINE_SUPPORT
- localRecPtr->ScanlineImageWriteBuffers =
- pGeode->AccelImageWriteBuffers;
- localRecPtr->NumScanlineImageWriteBuffers = pGeode->NoOfImgBuffers;
- HOOK(SetupForScanlineImageWrite);
- HOOK(SubsequentScanlineImageWriteRect);
- HOOK(SubsequentImageWriteScanline);
- localRecPtr->ScanlineImageWriteFlags = NO_PLANEMASK | NO_GXCOPY |
- BIT_ORDER_IN_BYTE_MSBFIRST | SCANLINE_PAD_DWORD;
+ localRecPtr->ScanlineImageWriteBuffers = pGeode->AccelImageWriteBuffers;
+ localRecPtr->NumScanlineImageWriteBuffers = pGeode->NoOfImgBuffers;
+ HOOK(SetupForScanlineImageWrite);
+ HOOK(SubsequentScanlineImageWriteRect);
+ HOOK(SubsequentImageWriteScanline);
+ localRecPtr->ScanlineImageWriteFlags = NO_PLANEMASK | NO_GXCOPY |
+ BIT_ORDER_IN_BYTE_MSBFIRST | SCANLINE_PAD_DWORD;
#endif
- } else {
- localRecPtr->PixmapCacheFlags = DO_NOT_BLIT_STIPPLES;
+ }
+ else {
+ localRecPtr->PixmapCacheFlags = DO_NOT_BLIT_STIPPLES;
}
if (pGeode->AccelColorExpandBuffers) {
#if GX_CPU2SCREXP_SUPPORT
- /* Color expansion */
- localRecPtr->ScanlineColorExpandBuffers =
- pGeode->AccelColorExpandBuffers;
- localRecPtr->NumScanlineColorExpandBuffers =
- pGeode->NoOfColorExpandLines;
- HOOK(SetupForScanlineCPUToScreenColorExpandFill);
- HOOK(SubsequentScanlineCPUToScreenColorExpandFill);
- HOOK(SubsequentColorExpandScanline);
- localRecPtr->ScanlineCPUToScreenColorExpandFillFlags = NO_PLANEMASK |
- BIT_ORDER_IN_BYTE_MSBFIRST | SCANLINE_PAD_DWORD;
+ /* Color expansion */
+ localRecPtr->ScanlineColorExpandBuffers =
+ pGeode->AccelColorExpandBuffers;
+ localRecPtr->NumScanlineColorExpandBuffers =
+ pGeode->NoOfColorExpandLines;
+ HOOK(SetupForScanlineCPUToScreenColorExpandFill);
+ HOOK(SubsequentScanlineCPUToScreenColorExpandFill);
+ HOOK(SubsequentColorExpandScanline);
+ localRecPtr->ScanlineCPUToScreenColorExpandFillFlags = NO_PLANEMASK |
+ BIT_ORDER_IN_BYTE_MSBFIRST | SCANLINE_PAD_DWORD;
#endif
}
#if GX_WRITE_PIXMAP_SUPPORT
@@ -2061,6 +2082,9 @@ GXAccelInit(ScreenPtr pScrn)
#endif
return (XAAInit(pScrn, localRecPtr));
+#else /* XF86XAA */
+ return FALSE;
+#endif
}
/* END OF FILE */