aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/drm
diff options
context:
space:
mode:
authorAlex Deucher <alexdeucher@gmail.com>2008-05-27 21:51:12 -0400
committerDave Airlie <airlied@redhat.com>2008-06-18 21:27:39 -0400
commit259434acccbc823ee8bc00b2d2689ccccd25e1fd (patch)
tree0911c4f17d334ac981680b7da684a8c217957fd8 /drivers/char/drm
parentd7463eb41d88a39de2653fd41857c4ccddb8707b (diff)
drm/radeon: fix pixcache and purge/cache flushing registers
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/char/drm')
-rw-r--r--drivers/char/drm/r300_reg.h2
-rw-r--r--drivers/char/drm/radeon_cp.c38
-rw-r--r--drivers/char/drm/radeon_drv.h43
3 files changed, 65 insertions, 18 deletions
diff --git a/drivers/char/drm/r300_reg.h b/drivers/char/drm/r300_reg.h
index 8f664af9c4a4..a72c70322483 100644
--- a/drivers/char/drm/r300_reg.h
+++ b/drivers/char/drm/r300_reg.h
@@ -1346,7 +1346,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
1346/* Guess by Vladimir. 1346/* Guess by Vladimir.
1347 * Set to 0A before 3D operations, set to 02 afterwards. 1347 * Set to 0A before 3D operations, set to 02 afterwards.
1348 */ 1348 */
1349#define R300_RB3D_DSTCACHE_CTLSTAT 0x4E4C 1349/*#define R300_RB3D_DSTCACHE_CTLSTAT 0x4E4C*/
1350# define R300_RB3D_DSTCACHE_UNKNOWN_02 0x00000002 1350# define R300_RB3D_DSTCACHE_UNKNOWN_02 0x00000002
1351# define R300_RB3D_DSTCACHE_UNKNOWN_0A 0x0000000A 1351# define R300_RB3D_DSTCACHE_UNKNOWN_0A 0x0000000A
1352 1352
diff --git a/drivers/char/drm/radeon_cp.c b/drivers/char/drm/radeon_cp.c
index fc0820c2b4b4..8fce12e73403 100644
--- a/drivers/char/drm/radeon_cp.c
+++ b/drivers/char/drm/radeon_cp.c
@@ -161,16 +161,36 @@ static int radeon_do_pixcache_flush(drm_radeon_private_t * dev_priv)
161 161
162 dev_priv->stats.boxes |= RADEON_BOX_WAIT_IDLE; 162 dev_priv->stats.boxes |= RADEON_BOX_WAIT_IDLE;
163 163
164 tmp = RADEON_READ(RADEON_RB3D_DSTCACHE_CTLSTAT); 164 if ((dev_priv->flags & RADEON_FAMILY_MASK) <= CHIP_RV280) {
165 tmp |= RADEON_RB3D_DC_FLUSH_ALL; 165 tmp = RADEON_READ(RADEON_RB3D_DSTCACHE_CTLSTAT);
166 RADEON_WRITE(RADEON_RB3D_DSTCACHE_CTLSTAT, tmp); 166 tmp |= RADEON_RB3D_DC_FLUSH_ALL;
167 167 RADEON_WRITE(RADEON_RB3D_DSTCACHE_CTLSTAT, tmp);
168 for (i = 0; i < dev_priv->usec_timeout; i++) { 168
169 if (!(RADEON_READ(RADEON_RB3D_DSTCACHE_CTLSTAT) 169 for (i = 0; i < dev_priv->usec_timeout; i++) {
170 & RADEON_RB3D_DC_BUSY)) { 170 if (!(RADEON_READ(RADEON_RB3D_DSTCACHE_CTLSTAT)
171 return 0; 171 & RADEON_RB3D_DC_BUSY)) {
172 return 0;
173 }
174 DRM_UDELAY(1);
175 }
176 } else {
177 /* 3D */
178 tmp = RADEON_READ(R300_RB3D_DSTCACHE_CTLSTAT);
179 tmp |= RADEON_RB3D_DC_FLUSH_ALL;
180 RADEON_WRITE(R300_RB3D_DSTCACHE_CTLSTAT, tmp);
181
182 /* 2D */
183 tmp = RADEON_READ(RADEON_RB2D_DSTCACHE_CTLSTAT);
184 tmp |= RADEON_RB3D_DC_FLUSH_ALL;
185 RADEON_WRITE(RADEON_RB3D_DSTCACHE_CTLSTAT, tmp);
186
187 for (i = 0; i < dev_priv->usec_timeout; i++) {
188 if (!(RADEON_READ(RADEON_RB2D_DSTCACHE_CTLSTAT)
189 & RADEON_RB3D_DC_BUSY)) {
190 return 0;
191 }
192 DRM_UDELAY(1);
172 } 193 }
173 DRM_UDELAY(1);
174 } 194 }
175 195
176#if RADEON_FIFO_DEBUG 196#if RADEON_FIFO_DEBUG
diff --git a/drivers/char/drm/radeon_drv.h b/drivers/char/drm/radeon_drv.h
index 3063b0fa512f..5e6f4612adba 100644
--- a/drivers/char/drm/radeon_drv.h
+++ b/drivers/char/drm/radeon_drv.h
@@ -659,11 +659,18 @@ extern int r300_do_cp_cmdbuf(struct drm_device * dev,
659# define RADEON_RB3D_ZC_FREE (1 << 2) 659# define RADEON_RB3D_ZC_FREE (1 << 2)
660# define RADEON_RB3D_ZC_FLUSH_ALL 0x5 660# define RADEON_RB3D_ZC_FLUSH_ALL 0x5
661# define RADEON_RB3D_ZC_BUSY (1 << 31) 661# define RADEON_RB3D_ZC_BUSY (1 << 31)
662#define R300_ZB_ZCACHE_CTLSTAT 0x4f18
663# define R300_ZC_FLUSH (1 << 0)
664# define R300_ZC_FREE (1 << 1)
665# define R300_ZC_FLUSH_ALL 0x3
666# define R300_ZC_BUSY (1 << 31)
662#define RADEON_RB3D_DSTCACHE_CTLSTAT 0x325c 667#define RADEON_RB3D_DSTCACHE_CTLSTAT 0x325c
663# define RADEON_RB3D_DC_FLUSH (3 << 0) 668# define RADEON_RB3D_DC_FLUSH (3 << 0)
664# define RADEON_RB3D_DC_FREE (3 << 2) 669# define RADEON_RB3D_DC_FREE (3 << 2)
665# define RADEON_RB3D_DC_FLUSH_ALL 0xf 670# define RADEON_RB3D_DC_FLUSH_ALL 0xf
666# define RADEON_RB3D_DC_BUSY (1 << 31) 671# define RADEON_RB3D_DC_BUSY (1 << 31)
672#define R300_RB3D_DSTCACHE_CTLSTAT 0x4e4c
673# define R300_RB3D_DC_FINISH (1 << 4)
667#define RADEON_RB3D_ZSTENCILCNTL 0x1c2c 674#define RADEON_RB3D_ZSTENCILCNTL 0x1c2c
668# define RADEON_Z_TEST_MASK (7 << 4) 675# define RADEON_Z_TEST_MASK (7 << 4)
669# define RADEON_Z_TEST_ALWAYS (7 << 4) 676# define RADEON_Z_TEST_ALWAYS (7 << 4)
@@ -1178,23 +1185,43 @@ do { \
1178} while (0) 1185} while (0)
1179 1186
1180#define RADEON_FLUSH_CACHE() do { \ 1187#define RADEON_FLUSH_CACHE() do { \
1181 OUT_RING( CP_PACKET0( RADEON_RB3D_DSTCACHE_CTLSTAT, 0 ) ); \ 1188 if ((dev_priv->flags & RADEON_FAMILY_MASK) <= CHIP_RV280) { \
1182 OUT_RING( RADEON_RB3D_DC_FLUSH ); \ 1189 OUT_RING(CP_PACKET0(RADEON_RB3D_DSTCACHE_CTLSTAT, 0)); \
1190 OUT_RING(RADEON_RB3D_DC_FLUSH); \
1191 } else { \
1192 OUT_RING(CP_PACKET0(R300_RB3D_DSTCACHE_CTLSTAT, 0)); \
1193 OUT_RING(RADEON_RB3D_DC_FLUSH); \
1194 } \
1183} while (0) 1195} while (0)
1184 1196
1185#define RADEON_PURGE_CACHE() do { \ 1197#define RADEON_PURGE_CACHE() do { \
1186 OUT_RING( CP_PACKET0( RADEON_RB3D_DSTCACHE_CTLSTAT, 0 ) ); \ 1198 if ((dev_priv->flags & RADEON_FAMILY_MASK) <= CHIP_RV280) { \
1187 OUT_RING( RADEON_RB3D_DC_FLUSH_ALL ); \ 1199 OUT_RING(CP_PACKET0(RADEON_RB3D_DSTCACHE_CTLSTAT, 0)); \
1200 OUT_RING(RADEON_RB3D_DC_FLUSH_ALL); \
1201 } else { \
1202 OUT_RING(CP_PACKET0(R300_RB3D_DSTCACHE_CTLSTAT, 0)); \
1203 OUT_RING(RADEON_RB3D_DC_FLUSH_ALL); \
1204 } \
1188} while (0) 1205} while (0)
1189 1206
1190#define RADEON_FLUSH_ZCACHE() do { \ 1207#define RADEON_FLUSH_ZCACHE() do { \
1191 OUT_RING( CP_PACKET0( RADEON_RB3D_ZCACHE_CTLSTAT, 0 ) ); \ 1208 if ((dev_priv->flags & RADEON_FAMILY_MASK) <= CHIP_RV280) { \
1192 OUT_RING( RADEON_RB3D_ZC_FLUSH ); \ 1209 OUT_RING(CP_PACKET0(RADEON_RB3D_ZCACHE_CTLSTAT, 0)); \
1210 OUT_RING(RADEON_RB3D_ZC_FLUSH); \
1211 } else { \
1212 OUT_RING(CP_PACKET0(R300_ZB_ZCACHE_CTLSTAT, 0)); \
1213 OUT_RING(R300_ZC_FLUSH); \
1214 } \
1193} while (0) 1215} while (0)
1194 1216
1195#define RADEON_PURGE_ZCACHE() do { \ 1217#define RADEON_PURGE_ZCACHE() do { \
1196 OUT_RING( CP_PACKET0( RADEON_RB3D_ZCACHE_CTLSTAT, 0 ) ); \ 1218 if ((dev_priv->flags & RADEON_FAMILY_MASK) <= CHIP_RV280) { \
1197 OUT_RING( RADEON_RB3D_ZC_FLUSH_ALL ); \ 1219 OUT_RING(CP_PACKET0(RADEON_RB3D_ZCACHE_CTLSTAT, 0)); \
1220 OUT_RING(RADEON_RB3D_ZC_FLUSH_ALL); \
1221 } else { \
1222 OUT_RING(CP_PACKET0(R300_RB3D_DSTCACHE_CTLSTAT, 0)); \
1223 OUT_RING(R300_ZC_FLUSH_ALL); \
1224 } \
1198} while (0) 1225} while (0)
1199 1226
1200/* ================================================================ 1227/* ================================================================