aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/drm/r300_cmdbuf.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/drm/r300_cmdbuf.c')
-rw-r--r--drivers/char/drm/r300_cmdbuf.c53
1 files changed, 27 insertions, 26 deletions
diff --git a/drivers/char/drm/r300_cmdbuf.c b/drivers/char/drm/r300_cmdbuf.c
index 032a022ec6a8..4e5aca6ba59a 100644
--- a/drivers/char/drm/r300_cmdbuf.c
+++ b/drivers/char/drm/r300_cmdbuf.c
@@ -55,7 +55,7 @@ static const int r300_cliprect_cntl[4] = {
55static int r300_emit_cliprects(drm_radeon_private_t *dev_priv, 55static int r300_emit_cliprects(drm_radeon_private_t *dev_priv,
56 drm_radeon_kcmd_buffer_t *cmdbuf, int n) 56 drm_radeon_kcmd_buffer_t *cmdbuf, int n)
57{ 57{
58 drm_clip_rect_t box; 58 struct drm_clip_rect box;
59 int nr; 59 int nr;
60 int i; 60 int i;
61 RING_LOCALS; 61 RING_LOCALS;
@@ -148,15 +148,16 @@ void r300_init_reg_flags(void)
148 148
149 /* these match cmducs() command in r300_driver/r300/r300_cmdbuf.c */ 149 /* these match cmducs() command in r300_driver/r300/r300_cmdbuf.c */
150 ADD_RANGE(R300_SE_VPORT_XSCALE, 6); 150 ADD_RANGE(R300_SE_VPORT_XSCALE, 6);
151 ADD_RANGE(0x2080, 1); 151 ADD_RANGE(R300_VAP_CNTL, 1);
152 ADD_RANGE(R300_SE_VTE_CNTL, 2); 152 ADD_RANGE(R300_SE_VTE_CNTL, 2);
153 ADD_RANGE(0x2134, 2); 153 ADD_RANGE(0x2134, 2);
154 ADD_RANGE(0x2140, 1); 154 ADD_RANGE(R300_VAP_CNTL_STATUS, 1);
155 ADD_RANGE(R300_VAP_INPUT_CNTL_0, 2); 155 ADD_RANGE(R300_VAP_INPUT_CNTL_0, 2);
156 ADD_RANGE(0x21DC, 1); 156 ADD_RANGE(0x21DC, 1);
157 ADD_RANGE(0x221C, 1); 157 ADD_RANGE(R300_VAP_UNKNOWN_221C, 1);
158 ADD_RANGE(0x2220, 4); 158 ADD_RANGE(R300_VAP_CLIP_X_0, 4);
159 ADD_RANGE(0x2288, 1); 159 ADD_RANGE(R300_VAP_PVS_WAITIDLE, 1);
160 ADD_RANGE(R300_VAP_UNKNOWN_2288, 1);
160 ADD_RANGE(R300_VAP_OUTPUT_VTX_FMT_0, 2); 161 ADD_RANGE(R300_VAP_OUTPUT_VTX_FMT_0, 2);
161 ADD_RANGE(R300_VAP_PVS_CNTL_1, 3); 162 ADD_RANGE(R300_VAP_PVS_CNTL_1, 3);
162 ADD_RANGE(R300_GB_ENABLE, 1); 163 ADD_RANGE(R300_GB_ENABLE, 1);
@@ -168,13 +169,13 @@ void r300_init_reg_flags(void)
168 ADD_RANGE(R300_RE_POINTSIZE, 1); 169 ADD_RANGE(R300_RE_POINTSIZE, 1);
169 ADD_RANGE(0x4230, 3); 170 ADD_RANGE(0x4230, 3);
170 ADD_RANGE(R300_RE_LINE_CNT, 1); 171 ADD_RANGE(R300_RE_LINE_CNT, 1);
171 ADD_RANGE(0x4238, 1); 172 ADD_RANGE(R300_RE_UNK4238, 1);
172 ADD_RANGE(0x4260, 3); 173 ADD_RANGE(0x4260, 3);
173 ADD_RANGE(0x4274, 4); 174 ADD_RANGE(R300_RE_SHADE, 4);
174 ADD_RANGE(0x4288, 5); 175 ADD_RANGE(R300_RE_POLYGON_MODE, 5);
175 ADD_RANGE(0x42A0, 1); 176 ADD_RANGE(R300_RE_ZBIAS_CNTL, 1);
176 ADD_RANGE(R300_RE_ZBIAS_T_FACTOR, 4); 177 ADD_RANGE(R300_RE_ZBIAS_T_FACTOR, 4);
177 ADD_RANGE(0x42B4, 1); 178 ADD_RANGE(R300_RE_OCCLUSION_CNTL, 1);
178 ADD_RANGE(R300_RE_CULL_CNTL, 1); 179 ADD_RANGE(R300_RE_CULL_CNTL, 1);
179 ADD_RANGE(0x42C0, 2); 180 ADD_RANGE(0x42C0, 2);
180 ADD_RANGE(R300_RS_CNTL_0, 2); 181 ADD_RANGE(R300_RS_CNTL_0, 2);
@@ -190,22 +191,22 @@ void r300_init_reg_flags(void)
190 ADD_RANGE(R300_PFS_INSTR1_0, 64); 191 ADD_RANGE(R300_PFS_INSTR1_0, 64);
191 ADD_RANGE(R300_PFS_INSTR2_0, 64); 192 ADD_RANGE(R300_PFS_INSTR2_0, 64);
192 ADD_RANGE(R300_PFS_INSTR3_0, 64); 193 ADD_RANGE(R300_PFS_INSTR3_0, 64);
193 ADD_RANGE(0x4BC0, 1); 194 ADD_RANGE(R300_RE_FOG_STATE, 1);
194 ADD_RANGE(0x4BC8, 3); 195 ADD_RANGE(R300_FOG_COLOR_R, 3);
195 ADD_RANGE(R300_PP_ALPHA_TEST, 2); 196 ADD_RANGE(R300_PP_ALPHA_TEST, 2);
196 ADD_RANGE(0x4BD8, 1); 197 ADD_RANGE(0x4BD8, 1);
197 ADD_RANGE(R300_PFS_PARAM_0_X, 64); 198 ADD_RANGE(R300_PFS_PARAM_0_X, 64);
198 ADD_RANGE(0x4E00, 1); 199 ADD_RANGE(0x4E00, 1);
199 ADD_RANGE(R300_RB3D_CBLEND, 2); 200 ADD_RANGE(R300_RB3D_CBLEND, 2);
200 ADD_RANGE(R300_RB3D_COLORMASK, 1); 201 ADD_RANGE(R300_RB3D_COLORMASK, 1);
201 ADD_RANGE(0x4E10, 3); 202 ADD_RANGE(R300_RB3D_BLEND_COLOR, 3);
202 ADD_RANGE_MARK(R300_RB3D_COLOROFFSET0, 1, MARK_CHECK_OFFSET); /* check offset */ 203 ADD_RANGE_MARK(R300_RB3D_COLOROFFSET0, 1, MARK_CHECK_OFFSET); /* check offset */
203 ADD_RANGE(R300_RB3D_COLORPITCH0, 1); 204 ADD_RANGE(R300_RB3D_COLORPITCH0, 1);
204 ADD_RANGE(0x4E50, 9); 205 ADD_RANGE(0x4E50, 9);
205 ADD_RANGE(0x4E88, 1); 206 ADD_RANGE(0x4E88, 1);
206 ADD_RANGE(0x4EA0, 2); 207 ADD_RANGE(0x4EA0, 2);
207 ADD_RANGE(R300_RB3D_ZSTENCIL_CNTL_0, 3); 208 ADD_RANGE(R300_RB3D_ZSTENCIL_CNTL_0, 3);
208 ADD_RANGE(0x4F10, 4); 209 ADD_RANGE(R300_RB3D_ZSTENCIL_FORMAT, 4);
209 ADD_RANGE_MARK(R300_RB3D_DEPTHOFFSET, 1, MARK_CHECK_OFFSET); /* check offset */ 210 ADD_RANGE_MARK(R300_RB3D_DEPTHOFFSET, 1, MARK_CHECK_OFFSET); /* check offset */
210 ADD_RANGE(R300_RB3D_DEPTHPITCH, 1); 211 ADD_RANGE(R300_RB3D_DEPTHPITCH, 1);
211 ADD_RANGE(0x4F28, 1); 212 ADD_RANGE(0x4F28, 1);
@@ -224,7 +225,7 @@ void r300_init_reg_flags(void)
224 ADD_RANGE(R300_TX_BORDER_COLOR_0, 16); 225 ADD_RANGE(R300_TX_BORDER_COLOR_0, 16);
225 226
226 /* Sporadic registers used as primitives are emitted */ 227 /* Sporadic registers used as primitives are emitted */
227 ADD_RANGE(0x4f18, 1); 228 ADD_RANGE(R300_RB3D_ZCACHE_CTLSTAT, 1);
228 ADD_RANGE(R300_RB3D_DSTCACHE_CTLSTAT, 1); 229 ADD_RANGE(R300_RB3D_DSTCACHE_CTLSTAT, 1);
229 ADD_RANGE(R300_VAP_INPUT_ROUTE_0_0, 8); 230 ADD_RANGE(R300_VAP_INPUT_ROUTE_0_0, 8);
230 ADD_RANGE(R300_VAP_INPUT_ROUTE_1_0, 8); 231 ADD_RANGE(R300_VAP_INPUT_ROUTE_1_0, 8);
@@ -692,9 +693,9 @@ static __inline__ void r300_pacify(drm_radeon_private_t *dev_priv)
692 693
693 BEGIN_RING(6); 694 BEGIN_RING(6);
694 OUT_RING(CP_PACKET0(R300_RB3D_DSTCACHE_CTLSTAT, 0)); 695 OUT_RING(CP_PACKET0(R300_RB3D_DSTCACHE_CTLSTAT, 0));
695 OUT_RING(0xa); 696 OUT_RING(R300_RB3D_DSTCACHE_UNKNOWN_0A);
696 OUT_RING(CP_PACKET0(0x4f18, 0)); 697 OUT_RING(CP_PACKET0(R300_RB3D_ZCACHE_CTLSTAT, 0));
697 OUT_RING(0x3); 698 OUT_RING(R300_RB3D_ZCACHE_UNKNOWN_03);
698 OUT_RING(CP_PACKET3(RADEON_CP_NOP, 0)); 699 OUT_RING(CP_PACKET3(RADEON_CP_NOP, 0));
699 OUT_RING(0x0); 700 OUT_RING(0x0);
700 ADVANCE_RING(); 701 ADVANCE_RING();
@@ -705,7 +706,7 @@ static __inline__ void r300_pacify(drm_radeon_private_t *dev_priv)
705 * The actual age emit is done by r300_do_cp_cmdbuf, which is why you must 706 * The actual age emit is done by r300_do_cp_cmdbuf, which is why you must
706 * be careful about how this function is called. 707 * be careful about how this function is called.
707 */ 708 */
708static void r300_discard_buffer(drm_device_t * dev, drm_buf_t * buf) 709static void r300_discard_buffer(struct drm_device * dev, struct drm_buf * buf)
709{ 710{
710 drm_radeon_private_t *dev_priv = dev->dev_private; 711 drm_radeon_private_t *dev_priv = dev->dev_private;
711 drm_radeon_buf_priv_t *buf_priv = buf->dev_private; 712 drm_radeon_buf_priv_t *buf_priv = buf->dev_private;
@@ -766,8 +767,8 @@ static int r300_scratch(drm_radeon_private_t *dev_priv,
766 } 767 }
767 768
768 BEGIN_RING(2); 769 BEGIN_RING(2);
769 OUT_RING(CP_PACKET0(RADEON_SCRATCH_REG0 + header.scratch.reg * 4, 0)); 770 OUT_RING( CP_PACKET0( RADEON_SCRATCH_REG0 + header.scratch.reg * 4, 0 ) );
770 OUT_RING(dev_priv->scratch_ages[header.scratch.reg]); 771 OUT_RING( dev_priv->scratch_ages[header.scratch.reg] );
771 ADVANCE_RING(); 772 ADVANCE_RING();
772 773
773 return 0; 774 return 0;
@@ -778,14 +779,14 @@ static int r300_scratch(drm_radeon_private_t *dev_priv,
778 * commands on the DMA ring buffer. 779 * commands on the DMA ring buffer.
779 * Called by the ioctl handler function radeon_cp_cmdbuf. 780 * Called by the ioctl handler function radeon_cp_cmdbuf.
780 */ 781 */
781int r300_do_cp_cmdbuf(drm_device_t *dev, 782int r300_do_cp_cmdbuf(struct drm_device *dev,
782 DRMFILE filp, 783 DRMFILE filp,
783 drm_file_t *filp_priv, 784 struct drm_file *filp_priv,
784 drm_radeon_kcmd_buffer_t *cmdbuf) 785 drm_radeon_kcmd_buffer_t *cmdbuf)
785{ 786{
786 drm_radeon_private_t *dev_priv = dev->dev_private; 787 drm_radeon_private_t *dev_priv = dev->dev_private;
787 drm_device_dma_t *dma = dev->dma; 788 struct drm_device_dma *dma = dev->dma;
788 drm_buf_t *buf = NULL; 789 struct drm_buf *buf = NULL;
789 int emit_dispatch_age = 0; 790 int emit_dispatch_age = 0;
790 int ret = 0; 791 int ret = 0;
791 792