On 2 Jul 2002, Michel D�nzer wrote:
> On Tue, 2002-07-02 at 09:36, James Ralston wrote:
>
> > Unfortunately, not all of the changes were cosmetic. :(
> >
> > I've attached the hunks which I couldn't reconcile. There's only
> > one hunk which I think is still important, and it's this one:
> >
> > ***************
> > *** 1496,1501 ****
> >
> > ADVANCE_RING();
> >
> > }
> >
> >
> > --- 1518,1524 ----
> >
> > ADVANCE_RING();
> >
> > + info->trans_color = -1;
> > }
> >
> >
> >
> > Michel, what function was this hunk trying to append to? (I
> > suspect it was RADEONCPSetupForSolidLine(), but it's now
> > impossible to tell for certain).
>
> Yeah, but basically each SetupFor function which doesn't get a
> trans_color argument needs to set info->trans_color to -1.
Ok, I had missed one other. I fixed it.
Attached is an updated version of your patch, which should apply
cleanly to current CVS. I tested it briefly on my 8500, and although
I don't think it gets rid of all of the display glitches, it gets rid
of most of them, and it doesn't appear to break anything. I'll test
it on the 64 DDR and Mobility M6 LY later tonight.
Could someone with the ability to do so please apply this patch to
current CVS?
Thanks,
--
James Ralston, Information Technology
Software Engineering Institute
Carnegie Mellon University, Pittsburgh, PA, USA
---
XFree86-4.2.0/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accel.c.ati-radeon-danzer
Sat Jun 1 23:00:47 2002
+++ XFree86-4.2.0/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accel.c Tue
+Jul 2 04:17:10 2002
@@ -111,6 +111,13 @@
extern int gRADEONEntityIndex;
+/* Shift operation for padding the pattern of dashed lines */
+#if X_BYTE_ORDER == X_LITTLE_ENDIAN
+# define DASH_SHIFT(pat,n) pat << n
+#else
+# define DASH_SHIFT(pat,n) pat >> n
+#endif
+
/* The FIFO has 64 slots. This routines waits until at least `entries'
* of these slots are empty.
*/
@@ -347,9 +354,11 @@
OUTREG(RADEON_DEFAULT_SC_BOTTOM_RIGHT, (RADEON_DEFAULT_SC_RIGHT_MAX
| RADEON_DEFAULT_SC_BOTTOM_MAX));
RADEONWaitForFifo(pScrn, 1);
- OUTREG(RADEON_DP_GUI_MASTER_CNTL, (info->dp_gui_master_cntl
+ OUTREG(RADEON_DP_GUI_MASTER_CNTL, info->dp_gui_master_cntl_cache =
+ ( info->dp_gui_master_cntl
| RADEON_GMC_BRUSH_SOLID_COLOR
| RADEON_GMC_SRC_DATATYPE_COLOR));
+ info->trans_color = -1;
RADEONWaitForFifo(pScrn, 7);
OUTREG(RADEON_DST_LINE_START, 0);
@@ -456,6 +465,8 @@
((info->datatype << RADEON_GMC_DST_DATATYPE_SHIFT)
| RADEON_GMC_CLR_CMP_CNTL_DIS);
+ info->trans_color = -1;
+
#ifdef XF86DRI
info->sc_left = 0x00000000;
info->sc_right = RADEON_DEFAULT_SC_RIGHT_MAX;
@@ -472,6 +483,25 @@
RADEONEngineRestore(pScrn);
}
+/* Set up for transparency */
+static void RADEONSetTransparency(ScrnInfoPtr pScrn)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+
+ if ((info->trans_color != -1) || (info->XAAForceTransBlit == TRUE)) {
+ unsigned char *RADEONMMIO = info->MMIO;
+ RADEONWaitForFifo(pScrn, 3);
+ OUTREG(RADEON_CLR_CMP_CLR_SRC, info->trans_color);
+ OUTREG(RADEON_CLR_CMP_MASK, RADEON_CLR_CMP_MSK);
+ /* Mmmm, seems as though the transparency compare is opposite to r128
+ * It should only draw when source != trans_color, this is the opposite
+ * of that.
+ */
+ OUTREG(RADEON_CLR_CMP_CNTL, (RADEON_SRC_CMP_EQ_COLOR
+ | RADEON_CLR_CMP_SRC_SOURCE));
+ }
+}
+
/* Setup for XAA SolidFill */
static void RADEONSetupForSolidFill(ScrnInfoPtr pScrn,
int color, int rop, unsigned int planemask)
@@ -480,7 +510,8 @@
unsigned char *RADEONMMIO = info->MMIO;
RADEONWaitForFifo(pScrn, 4);
- OUTREG(RADEON_DP_GUI_MASTER_CNTL, (info->dp_gui_master_cntl
+ OUTREG(RADEON_DP_GUI_MASTER_CNTL, info->dp_gui_master_cntl_cache =
+ (info->dp_gui_master_cntl
| RADEON_GMC_BRUSH_SOLID_COLOR
| RADEON_GMC_SRC_DATATYPE_COLOR
| RADEON_ROP[rop].pattern));
@@ -488,6 +519,7 @@
OUTREG(RADEON_DP_WRITE_MASK, planemask);
OUTREG(RADEON_DP_CNTL, (RADEON_DST_X_LEFT_TO_RIGHT
| RADEON_DST_Y_TOP_TO_BOTTOM));
+ info->trans_color = -1;
}
/* Subsequent XAA SolidFillRect
@@ -551,12 +583,14 @@
unsigned char *RADEONMMIO = info->MMIO;
RADEONWaitForFifo(pScrn, 3);
- OUTREG(RADEON_DP_GUI_MASTER_CNTL, (info->dp_gui_master_cntl
+ OUTREG(RADEON_DP_GUI_MASTER_CNTL, info->dp_gui_master_cntl_cache =
+ (info->dp_gui_master_cntl
| RADEON_GMC_BRUSH_SOLID_COLOR
| RADEON_GMC_SRC_DATATYPE_COLOR
| RADEON_ROP[rop].pattern));
OUTREG(RADEON_DP_BRUSH_FRGD_CLR, color);
OUTREG(RADEON_DP_WRITE_MASK, planemask);
+ info->trans_color = -1;
}
@@ -619,14 +653,15 @@
CARD32 pat = *(CARD32 *)(pointer)pattern;
switch (length) {
- case 2: pat |= pat << 2; /* fall through */
- case 4: pat |= pat << 4; /* fall through */
- case 8: pat |= pat << 8; /* fall through */
- case 16: pat |= pat << 16;
+ case 2: pat |= DASH_SHIFT(pat,2); /* fall through */
+ case 4: pat |= DASH_SHIFT(pat,4); /* fall through */
+ case 8: pat |= DASH_SHIFT(pat,8); /* fall through */
+ case 16: pat |= DASH_SHIFT(pat,16);
}
RADEONWaitForFifo(pScrn, 5);
- OUTREG(RADEON_DP_GUI_MASTER_CNTL, (info->dp_gui_master_cntl
+ OUTREG(RADEON_DP_GUI_MASTER_CNTL, info->dp_gui_master_cntl_cache =
+ (info->dp_gui_master_cntl
| (bg == -1
? RADEON_GMC_BRUSH_32x1_MONO_FG_LA
: RADEON_GMC_BRUSH_32x1_MONO_FG_BG)
@@ -636,6 +671,7 @@
OUTREG(RADEON_DP_BRUSH_FRGD_CLR, fg);
OUTREG(RADEON_DP_BRUSH_BKGD_CLR, bg);
OUTREG(RADEON_BRUSH_DATA0, pat);
+ info->trans_color = -1;
}
/* Subsequent XAA dashed line */
@@ -674,7 +710,8 @@
info->xdir = xdir;
info->ydir = ydir;
RADEONWaitForFifo(pScrn, 3);
- OUTREG(RADEON_DP_GUI_MASTER_CNTL, (info->dp_gui_master_cntl
+ OUTREG(RADEON_DP_GUI_MASTER_CNTL, info->dp_gui_master_cntl_cache =
+ (info->dp_gui_master_cntl
| RADEON_GMC_BRUSH_NONE
| RADEON_GMC_SRC_DATATYPE_COLOR
| RADEON_ROP[rop].rop
@@ -687,18 +724,8 @@
? RADEON_DST_Y_TOP_TO_BOTTOM
: 0)));
- if ((trans_color != -1) || (info->XAAForceTransBlit == TRUE)) {
- /* Set up for transparency */
- RADEONWaitForFifo(pScrn, 3);
- OUTREG(RADEON_CLR_CMP_CLR_SRC, trans_color);
- OUTREG(RADEON_CLR_CMP_MASK, RADEON_CLR_CMP_MSK);
- /* Mmmm, Seems as though the transparency compare is opposite to
- * r128 It should only draw when source != trans_color, this is
- * the opposite of that.
- */
- OUTREG(RADEON_CLR_CMP_CNTL, (RADEON_SRC_CMP_EQ_COLOR
- | RADEON_CLR_CMP_SRC_SOURCE));
- }
+ info->trans_color = trans_color;
+ RADEONSetTransparency(pScrn);
}
/* Subsequent XAA screen-to-screen copy */
@@ -735,7 +762,8 @@
unsigned char *RADEONMMIO = info->MMIO;
RADEONWaitForFifo(pScrn, 6);
- OUTREG(RADEON_DP_GUI_MASTER_CNTL, (info->dp_gui_master_cntl
+ OUTREG(RADEON_DP_GUI_MASTER_CNTL, info->dp_gui_master_cntl_cache =
+ (info->dp_gui_master_cntl
| (bg == -1
? RADEON_GMC_BRUSH_8X8_MONO_FG_LA
: RADEON_GMC_BRUSH_8X8_MONO_FG_BG)
@@ -746,6 +774,7 @@
OUTREG(RADEON_DP_BRUSH_BKGD_CLR, bg);
OUTREG(RADEON_BRUSH_DATA0, patternx);
OUTREG(RADEON_BRUSH_DATA1, patterny);
+ info->trans_color = -1;
}
/* Subsequent XAA 8x8 pattern color expansion. Because they are used in
@@ -778,7 +807,8 @@
unsigned char *RADEONMMIO = info->MMIO;
RADEONWaitForFifo(pScrn, 3);
- OUTREG(RADEON_DP_GUI_MASTER_CNTL, (info->dp_gui_master_cntl
+ OUTREG(RADEON_DP_GUI_MASTER_CNTL, info->dp_gui_master_cntl_cache =
+ (info->dp_gui_master_cntl
| RADEON_GMC_BRUSH_8x8_COLOR
| RADEON_GMC_SRC_DATATYPE_COLOR
| RADEON_ROP[rop].pattern
@@ -786,18 +816,8 @@
OUTREG(RADEON_DP_WRITE_MASK, planemask);
OUTREG(RADEON_SRC_Y_X, (paty << 16) | patx);
- if (trans_color != -1) {
- /* Set up for transparency */
- RADEONWaitForFifo(pScrn, 3);
- OUTREG(RADEON_CLR_CMP_CLR_SRC, trans_color);
- OUTREG(RADEON_CLR_CMP_MASK, RADEON_CLR_CMP_MSK);
- /* Mmmm, Seems as though the transparency compare is opposite to
- * r128 It should only draw when source != trans_color, this is
- * the opposite of that.
- */
- OUTREG(RADEON_CLR_CMP_CNTL, (RADEON_SRC_CMP_EQ_COLOR
- | RADEON_CLR_CMP_SRC_SOURCE));
- }
+ info->trans_color = trans_color;
+ RADEONSetTransparency(pScrn);
}
/* Subsequent XAA 8x8 pattern color expansion */
@@ -830,7 +850,8 @@
unsigned char *RADEONMMIO = info->MMIO;
RADEONWaitForFifo(pScrn, 4);
- OUTREG(RADEON_DP_GUI_MASTER_CNTL, (info->dp_gui_master_cntl
+ OUTREG(RADEON_DP_GUI_MASTER_CNTL, info->dp_gui_master_cntl_cache =
+ (info->dp_gui_master_cntl
| RADEON_GMC_DST_CLIPPING
| RADEON_GMC_BRUSH_NONE
| (bg == -1
@@ -842,6 +863,7 @@
OUTREG(RADEON_DP_WRITE_MASK, planemask);
OUTREG(RADEON_DP_SRC_FRGD_CLR, fg);
OUTREG(RADEON_DP_SRC_BKGD_CLR, bg);
+ info->trans_color = -1;
}
/* Subsequent XAA indirect CPU-to-screen color expansion. This is only
@@ -942,7 +964,8 @@
info->scanline_bpp = bpp;
RADEONWaitForFifo(pScrn, 2);
- OUTREG(RADEON_DP_GUI_MASTER_CNTL, (info->dp_gui_master_cntl
+ OUTREG(RADEON_DP_GUI_MASTER_CNTL, info->dp_gui_master_cntl_cache =
+ (info->dp_gui_master_cntl
| RADEON_GMC_DST_CLIPPING
| RADEON_GMC_BRUSH_NONE
| RADEON_GMC_SRC_DATATYPE_COLOR
@@ -951,18 +974,8 @@
| RADEON_DP_SRC_SOURCE_HOST_DATA));
OUTREG(RADEON_DP_WRITE_MASK, planemask);
- if (trans_color != -1) {
- /* Set up for transparency */
- RADEONWaitForFifo(pScrn, 3);
- OUTREG(RADEON_CLR_CMP_CLR_SRC, trans_color);
- OUTREG(RADEON_CLR_CMP_MASK, RADEON_CLR_CMP_MSK);
- /* Mmmm, Seems as though the transparency compare is opposite to
- * r128 It should only draw when source != trans_color, this is
- * the opposite of that.
- */
- OUTREG(RADEON_CLR_CMP_CNTL, (RADEON_SRC_CMP_EQ_COLOR
- | RADEON_CLR_CMP_SRC_SOURCE));
- }
+ info->trans_color = trans_color;
+ RADEONSetTransparency(pScrn);
}
/* Subsequent XAA indirect image write. This is only called once for
@@ -1091,8 +1104,12 @@
}
OUTREG(RADEON_SC_BOTTOM_RIGHT, tmp & 0x3fff3fff);
- OUTREG(RADEON_DP_GUI_MASTER_CNTL, (info->dp_gui_master_cntl
- | RADEON_GMC_DST_CLIPPING));
+
+ if (!(info->dp_gui_master_cntl_cache & RADEON_GMC_DST_CLIPPING)) {
+ OUTREG(RADEON_DP_GUI_MASTER_CNTL, (info->dp_gui_master_cntl_cache
+ | RADEON_GMC_DST_CLIPPING));
+ RADEONSetTransparency(pScrn);
+ }
}
/* Disable the clipping rectangle */
@@ -1101,7 +1118,7 @@
RADEONInfoPtr info = RADEONPTR(pScrn);
unsigned char *RADEONMMIO = info->MMIO;
- OUTREG(RADEON_DP_GUI_MASTER_CNTL, (info->dp_gui_master_cntl
+ OUTREG(RADEON_DP_GUI_MASTER_CNTL, (info->dp_gui_master_cntl_cache
& ~(CARD32)RADEON_GMC_DST_CLIPPING));
OUTREG(RADEON_SC_TOP_LEFT, 0);
OUTREG(RADEON_SC_BOTTOM_RIGHT, INREG(RADEON_DEFAULT_SC_BOTTOM_RIGHT));
@@ -1113,6 +1130,27 @@
*/
#ifdef XF86DRI
+/* Set up for transparency */
+static void RADEONCPSetTransparency(ScrnInfoPtr pScrn)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+
+ if ((info->trans_color != -1) || (info->XAAForceTransBlit == TRUE)) {
+ RING_LOCALS;
+
+ BEGIN_RING(6);
+ OUT_RING_REG(RADEON_CLR_CMP_CLR_SRC, info->trans_color);
+ OUT_RING_REG(RADEON_CLR_CMP_MASK, RADEON_CLR_CMP_MSK);
+ /* Mmmm, seems as though the transparency compare is opposite to r128
+ * It should only draw when source != trans_color, this is the opposite
+ * of that.
+ */
+ OUT_RING_REG(RADEON_CLR_CMP_CNTL, (RADEON_SRC_CMP_EQ_COLOR
+ | RADEON_CLR_CMP_SRC_SOURCE));
+ ADVANCE_RING();
+ }
+}
+
/* Setup for XAA SolidFill */
static void RADEONCPSetupForSolidFill(ScrnInfoPtr pScrn,
int color, int rop,
@@ -1125,15 +1163,18 @@
BEGIN_RING(8);
- OUT_RING_REG(RADEON_DP_GUI_MASTER_CNTL, (info->dp_gui_master_cntl
- | RADEON_GMC_BRUSH_SOLID_COLOR
- | RADEON_GMC_SRC_DATATYPE_COLOR
- | RADEON_ROP[rop].pattern));
+ OUT_RING_REG(RADEON_DP_GUI_MASTER_CNTL,
+ info->dp_gui_master_cntl_cache = (info->dp_gui_master_cntl
+ | RADEON_GMC_BRUSH_SOLID_COLOR
+ | RADEON_GMC_SRC_DATATYPE_COLOR
+ | RADEON_ROP[rop].pattern));
OUT_RING_REG(RADEON_DP_BRUSH_FRGD_CLR, color);
OUT_RING_REG(RADEON_DP_WRITE_MASK, planemask);
OUT_RING_REG(RADEON_DP_CNTL, (RADEON_DST_X_LEFT_TO_RIGHT |
RADEON_DST_Y_TOP_TO_BOTTOM));
ADVANCE_RING();
+
+ info->trans_color = -1;
}
/* Subsequent XAA SolidFillRect
@@ -1154,6 +1195,8 @@
OUT_RING_REG(RADEON_DST_WIDTH_HEIGHT, (w << 16) | h);
ADVANCE_RING();
+
+ info->trans_color = -1;
}
/* Setup for XAA screen-to-screen copy
@@ -1175,11 +1218,12 @@
BEGIN_RING(6);
- OUT_RING_REG(RADEON_DP_GUI_MASTER_CNTL, (info->dp_gui_master_cntl
- | RADEON_GMC_BRUSH_NONE
- | RADEON_GMC_SRC_DATATYPE_COLOR
- | RADEON_ROP[rop].rop
- | RADEON_DP_SRC_SOURCE_MEMORY));
+ OUT_RING_REG(RADEON_DP_GUI_MASTER_CNTL,
+ info->dp_gui_master_cntl_cache = (info->dp_gui_master_cntl
+ | RADEON_GMC_BRUSH_NONE
+ | RADEON_GMC_SRC_DATATYPE_COLOR
+ | RADEON_ROP[rop].rop
+ | RADEON_DP_SRC_SOURCE_MEMORY));
OUT_RING_REG(RADEON_DP_WRITE_MASK, planemask);
OUT_RING_REG(RADEON_DP_CNTL,
((xdir >= 0 ? RADEON_DST_X_LEFT_TO_RIGHT : 0) |
@@ -1187,20 +1231,8 @@
ADVANCE_RING();
- if ((trans_color != -1) || (info->XAAForceTransBlit == TRUE)) {
- BEGIN_RING(6);
-
- OUT_RING_REG(RADEON_CLR_CMP_CLR_SRC, trans_color);
- OUT_RING_REG(RADEON_CLR_CMP_MASK, RADEON_CLR_CMP_MSK);
- /* Mmmm, Seems as though the transparency compare is opposite to
- * r128 It should only draw when source != trans_color, this is
- * the opposite of that.
- */
- OUT_RING_REG(RADEON_CLR_CMP_CNTL, (RADEON_SRC_CMP_EQ_COLOR |
- RADEON_CLR_CMP_SRC_SOURCE));
-
- ADVANCE_RING();
- }
+ info->trans_color = trans_color;
+ RADEONCPSetTransparency(pScrn);
}
/* Subsequent XAA screen-to-screen copy */
@@ -1236,14 +1268,17 @@
BEGIN_RING(6);
- OUT_RING_REG(RADEON_DP_GUI_MASTER_CNTL, (info->dp_gui_master_cntl
- | RADEON_GMC_BRUSH_SOLID_COLOR
- | RADEON_GMC_SRC_DATATYPE_COLOR
- | RADEON_ROP[rop].pattern));
+ OUT_RING_REG(RADEON_DP_GUI_MASTER_CNTL,
+ info->dp_gui_master_cntl_cache = (info->dp_gui_master_cntl
+ | RADEON_GMC_BRUSH_SOLID_COLOR
+ | RADEON_GMC_SRC_DATATYPE_COLOR
+ | RADEON_ROP[rop].pattern));
OUT_RING_REG(RADEON_DP_BRUSH_FRGD_CLR, color);
OUT_RING_REG(RADEON_DP_WRITE_MASK, planemask);
ADVANCE_RING();
+
+ info->trans_color = -1;
}
@@ -1315,27 +1350,29 @@
RING_LOCALS;
switch (length) {
- case 2: pat |= pat << 2; /* fall through */
- case 4: pat |= pat << 4; /* fall through */
- case 8: pat |= pat << 8; /* fall through */
- case 16: pat |= pat << 16;
+ case 2: pat |= DASH_SHIFT(pat,2); /* fall through */
+ case 4: pat |= DASH_SHIFT(pat,4); /* fall through */
+ case 8: pat |= DASH_SHIFT(pat,8); /* fall through */
+ case 16: pat |= DASH_SHIFT(pat,16);
}
- BEGIN_RING(10);
+ BEGIN_RING((bg != -1) ? 10 : 8);
OUT_RING_REG(RADEON_DP_GUI_MASTER_CNTL,
- (info->dp_gui_master_cntl
- | (bg == -1
- ? RADEON_GMC_BRUSH_32x1_MONO_FG_LA
- : RADEON_GMC_BRUSH_32x1_MONO_FG_BG)
- | RADEON_ROP[rop].pattern
- | RADEON_GMC_BYTE_LSB_TO_MSB));
+ info->dp_gui_master_cntl_cache = (info->dp_gui_master_cntl
+ | (bg == -1
+ ?
+RADEON_GMC_BRUSH_32x1_MONO_FG_LA
+ :
+RADEON_GMC_BRUSH_32x1_MONO_FG_BG)
+ | RADEON_ROP[rop].pattern
+ | RADEON_GMC_BYTE_LSB_TO_MSB));
OUT_RING_REG(RADEON_DP_WRITE_MASK, planemask);
OUT_RING_REG(RADEON_DP_BRUSH_FRGD_CLR, fg);
OUT_RING_REG(RADEON_DP_BRUSH_BKGD_CLR, bg);
OUT_RING_REG(RADEON_BRUSH_DATA0, pat);
ADVANCE_RING();
+
+ info->trans_color = -1;
}
/* Subsequent XAA dashed line */
@@ -1405,10 +1442,12 @@
OUT_RING_REG(RADEON_SC_TOP_LEFT, tmp1 & 0x3fff3fff);
OUT_RING_REG(RADEON_SC_BOTTOM_RIGHT, tmp2 & 0x3fff3fff);
- OUT_RING_REG(RADEON_DP_GUI_MASTER_CNTL, (info->dp_gui_master_cntl
+ OUT_RING_REG(RADEON_DP_GUI_MASTER_CNTL, (info->dp_gui_master_cntl_cache
| RADEON_GMC_DST_CLIPPING));
ADVANCE_RING();
+
+ RADEONCPSetTransparency(pScrn);
}
/* Disable clipping rectangle */
---
XFree86-4.2.0/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h.ati-radeon-danzer
Wed May 29 18:48:38 2002
+++ XFree86-4.2.0/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h Tue Jul 2
+04:14:57 2002
@@ -331,6 +331,8 @@
int pitch;
int datatype;
CARD32 dp_gui_master_cntl;
+ CARD32 dp_gui_master_cntl_cache;
+ int trans_color;
/* Saved values for ScreenToScreenCopy */
int xdir;