summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTilman Sauerbeck <tilman@code-monkey.de>2006-08-27 12:27:59 +0200
committerTilman Sauerbeck <tilman@code-monkey.de>2006-08-27 12:27:59 +0200
commit5982e8200270d25a57da8ab0d1a8290cfaec070c (patch)
tree9461d95a95651559656eface37f19156e90c81f9
parente7ba7c993f4e439672810ec9ce3a24df823051a4 (diff)
Cleaned up the XAA code a bit.
-rw-r--r--src/mga_reg.h1
-rw-r--r--src/mga_storm.c58
2 files changed, 44 insertions, 15 deletions
diff --git a/src/mga_reg.h b/src/mga_reg.h
index 9feceb6..8e844f2 100644
--- a/src/mga_reg.h
+++ b/src/mga_reg.h
@@ -481,6 +481,7 @@
# define MGA_TAKEY (0x02000000)
# define MGA_TAMASK (0x04000000)
# define MGA_CLAMPUV (0x18000000)
+# define MGA_TEXMODULATE (0x20000000)
#define MGAREG_TEXCTL2 0x2c3c
# define MGA_G400_TC2_MAGIC (0x00008000)
# define MGA_TC2_DECALBLEND (0x00000001)
diff --git a/src/mga_storm.c b/src/mga_storm.c
index 40742c3..417675f 100644
--- a/src/mga_storm.c
+++ b/src/mga_storm.c
@@ -304,6 +304,7 @@ Bool MGASetupForCPUToScreenAlphaTextureFaked( ScrnInfoPtr pScrn, int op,
int height, int flags )
{
int log2w, log2h, pitch, sizeNeeded, offset;
+ unsigned int texctl, dwgctl, alphactrl;
MGAPtr pMga = MGAPTR(pScrn);
if(op != PictOpOver) /* only one tested */
@@ -358,11 +359,19 @@ Bool MGASetupForCPUToScreenAlphaTextureFaked( ScrnInfoPtr pScrn, int op,
((width - 1) << 18));
OUTREG(MGAREG_TEXHEIGHT, log2h | (((8 - log2h) & 63) << 9) |
((height - 1) << 18));
- OUTREG(MGAREG_TEXCTL, 0x1A000106 | ((pitch & 0x07FF) << 9));
- OUTREG(MGAREG_TEXCTL2, 0x00000014);
- OUTREG(MGAREG_DWGCTL, 0x000c7076);
- OUTREG(MGAREG_TEXFILTER, 0x01e00020);
- OUTREG(MGAREG_ALPHACTRL, 0x00000154);
+
+ texctl = MGA_TW32 | MGA_PITCHLIN | MGA_TAKEY | MGA_CLAMPUV |
+ ((pitch & 0x07FF) << 9);
+ dwgctl = MGADWG_TEXTURE_TRAP | MGADWG_I | MGADWG_ARZERO |
+ MGADWG_SGNZERO | MGADWG_SHIFTZERO | 0xc0000;
+ alphactrl = MGA_SRC_ALPHA | MGA_DST_ONE_MINUS_SRC_ALPHA |
+ MGA_ALPHACHANNEL;
+
+ OUTREG(MGAREG_TEXCTL, texctl);
+ OUTREG(MGAREG_TEXCTL2, MGA_TC2_DECALDIS | MGA_TC2_CKSTRANSDIS);
+ OUTREG(MGAREG_DWGCTL, dwgctl);
+ OUTREG(MGAREG_TEXFILTER, ((0x1e << 20) | MGA_MAG_BILIN));
+ OUTREG(MGAREG_ALPHACTRL, alphactrl);
return TRUE;
}
@@ -383,6 +392,7 @@ MGASetupForCPUToScreenAlphaTexture (
int flags
){
int log2w, log2h, i, pitch, sizeNeeded, offset;
+ unsigned int texctl, dwgctl, alphactrl;
CARD8 *dst;
MGAPtr pMga = MGAPTR(pScrn);
@@ -456,11 +466,20 @@ MGASetupForCPUToScreenAlphaTexture (
((width - 1) << 18));
OUTREG(MGAREG_TEXHEIGHT, log2h | (((8 - log2h) & 63) << 9) |
((height - 1) << 18));
- OUTREG(MGAREG_TEXCTL, 0x3A000107 | ((pitch & 0x07FF) << 9));
- OUTREG(MGAREG_TEXCTL2, 0x00000014);
- OUTREG(MGAREG_DWGCTL, 0x000c7076);
- OUTREG(MGAREG_TEXFILTER, 0x01e00020);
- OUTREG(MGAREG_ALPHACTRL, 0x02000151);
+
+ texctl = MGA_TW8A | MGA_PITCHLIN | MGA_TAKEY | MGA_CLAMPUV |
+ MGA_TEXMODULATE |
+ ((pitch & 0x07FF) << 9);
+ dwgctl = MGADWG_TEXTURE_TRAP | MGADWG_I | MGADWG_ARZERO |
+ MGADWG_SGNZERO | MGADWG_SHIFTZERO | 0xc0000;
+ alphactrl = MGA_SRC_ONE | MGA_DST_ONE_MINUS_SRC_ALPHA |
+ MGA_ALPHACHANNEL | MGA_MODULATEDALPHA;
+
+ OUTREG(MGAREG_TEXCTL, texctl);
+ OUTREG(MGAREG_TEXCTL2, MGA_TC2_DECALDIS | MGA_TC2_CKSTRANSDIS);
+ OUTREG(MGAREG_DWGCTL, dwgctl);
+ OUTREG(MGAREG_TEXFILTER, ((0x1e << 20) | MGA_MAG_BILIN));
+ OUTREG(MGAREG_ALPHACTRL, alphactrl);
return TRUE;
}
@@ -478,6 +497,7 @@ MGASetupForCPUToScreenTexture (
int flags
){
int log2w, log2h, i, pitch, sizeNeeded, offset;
+ unsigned int texctl, dwgctl, alphactrl;
MGAPtr pMga = MGAPTR(pScrn);
if(op != PictOpOver) /* only one tested */
@@ -537,11 +557,19 @@ MGASetupForCPUToScreenTexture (
((width - 1) << 18));
OUTREG(MGAREG_TEXHEIGHT, log2h | (((8 - log2h) & 63) << 9) |
((height - 1) << 18));
- OUTREG(MGAREG_TEXCTL, 0x1A000106 | ((pitch & 0x07FF) << 9));
- OUTREG(MGAREG_TEXCTL2, 0x00000014);
- OUTREG(MGAREG_DWGCTL, 0x000c7076);
- OUTREG(MGAREG_TEXFILTER, 0x01e00020);
- OUTREG(MGAREG_ALPHACTRL, 0x00000151);
+
+ texctl = MGA_TW32 | MGA_PITCHLIN | MGA_TAKEY | MGA_CLAMPUV |
+ ((pitch & 0x07FF) << 9);
+ dwgctl = MGADWG_TEXTURE_TRAP | MGADWG_I | MGADWG_ARZERO |
+ MGADWG_SGNZERO | MGADWG_SHIFTZERO | 0xc0000;
+ alphactrl = MGA_SRC_ONE | MGA_DST_ONE_MINUS_SRC_ALPHA |
+ MGA_ALPHACHANNEL;
+
+ OUTREG(MGAREG_TEXCTL, texctl);
+ OUTREG(MGAREG_TEXCTL2, MGA_TC2_DECALDIS | MGA_TC2_CKSTRANSDIS);
+ OUTREG(MGAREG_DWGCTL, dwgctl);
+ OUTREG(MGAREG_TEXFILTER, ((0x1e << 20) | MGA_MAG_BILIN));
+ OUTREG(MGAREG_ALPHACTRL, alphactrl);
return TRUE;
}