summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTilman Sauerbeck <tilman@code-monkey.de>2006-09-15 16:01:28 +0200
committerTilman Sauerbeck <tilman@code-monkey.de>2006-09-15 16:01:28 +0200
commit2eae7c98fcd3f452f9b9c2eef4a9cf820edf69aa (patch)
tree19e17cee3d03defa1dc5749e00dd895f671c7354
parentb1031689212bfbbe832dd73337ea8cd5d66ae2ff (diff)
More DUALSTAGE0 fixes related to A8 writes.
When writing from a texture without an alpha channel to an A8 texture, we now set the alpha channel to 0xff via FCOL.
-rw-r--r--src/mga_exa.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/src/mga_exa.c b/src/mga_exa.c
index ef170f4..cc73895 100644
--- a/src/mga_exa.c
+++ b/src/mga_exa.c
@@ -535,10 +535,9 @@ mgaPrepareComposite(int op, PicturePtr pSrcPict, PicturePtr pMaskPict,
PixmapPtr pDst)
{
PMGA(pDst);
- CARD32 ds0 = 0, ds1 = 0, cmd, blendcntl;
+ CARD32 fcol = 0xff000000, ds0 = 0, ds1 = 0, cmd, blendcntl;
- mgaSetup(pMga, pDst, pDstPict, 3);
- OUTREG(MGAREG_FCOL, 0xff000000);
+ mgaSetup(pMga, pDst, pDstPict, 2);
OUTREG(MGAREG_DSTORG, exaGetPixmapOffset(pDst));
OUTREG(MGAREG_PITCH, mgaGetPixmapPitch(pDst));
@@ -549,14 +548,19 @@ mgaPrepareComposite(int op, PicturePtr pSrcPict, PicturePtr pMaskPict,
else
PrepareSourceTexture(1, pSrcPict, pSrc);
- /* Only use the color channels if they are set up properly.
- * For A8 writes, replicate the alpha color to the color channels,
- * otherwise, set the color to black (FCOL).
+ /* For A8 writes, the desired alpha value needs to be replicated
+ * to the color channels - if the source texture doesn't have an
+ * alpha channel, set it to 0xff instead.
+ * Otherwise, use the color channels if available, or set them
+ * to black.
*/
- if (pSrcPict->format != PICT_a8)
- ds0 |= C_ARG1_CUR | COLOR_ARG1; /* C = Cs */
- else if (pDstPict->format == PICT_a8)
+ if (pDstPict->format == PICT_a8 && !PICT_FORMAT_A(pSrcPict->format)) {
+ fcol = 0xffffffff;
+ ds0 |= C_ARG2_FCOL | COLOR_ARG2; /* C = 0xff */
+ } else if (pDstPict->format == PICT_a8)
ds0 |= C_ARG1_ALPHA | COLOR_ARG1; /* C = As */
+ else if (pSrcPict->format != PICT_a8)
+ ds0 |= C_ARG1_CUR | COLOR_ARG1; /* C = Cs */
else
ds0 |= C_ARG2_FCOL | COLOR_ARG2; /* C = 0 */
@@ -609,7 +613,8 @@ mgaPrepareComposite(int op, PicturePtr pSrcPict, PicturePtr pMaskPict,
blendcntl = (blendcntl & ~MGA_DST_BLEND_MASK) | MGA_DST_ZERO;
}
- WAITFIFO(4);
+ WAITFIFO(5);
+ OUTREG(MGAREG_FCOL, fcol);
OUTREG(MGAREG_TDUALSTAGE0, ds0);
OUTREG(MGAREG_TDUALSTAGE1, ds1);
OUTREG(MGAREG_DWGCTL, cmd);