Commit cae94b0a authored by Marek Olšák's avatar Marek Olšák Committed by Dave Airlie

drm/radeon/kms: allow R500 regs VAP_ALT_NUM_VERTICES and VAP_INDEX_OFFSET

[airlied: fix V_A_N_V to not be safe and fix check to make sure only r500
 - bump userspace version]
Signed-off-by: default avatarMarek Olšák <maraeo@gmail.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent f12eebb0
...@@ -3011,7 +3011,11 @@ int r100_cs_track_check(struct radeon_device *rdev, struct r100_cs_track *track) ...@@ -3011,7 +3011,11 @@ int r100_cs_track_check(struct radeon_device *rdev, struct r100_cs_track *track)
} }
} }
prim_walk = (track->vap_vf_cntl >> 4) & 0x3; prim_walk = (track->vap_vf_cntl >> 4) & 0x3;
if (track->vap_vf_cntl & (1 << 14)) {
nverts = track->vap_alt_nverts;
} else {
nverts = (track->vap_vf_cntl >> 16) & 0xFFFF; nverts = (track->vap_vf_cntl >> 16) & 0xFFFF;
}
switch (prim_walk) { switch (prim_walk) {
case 1: case 1:
for (i = 0; i < track->num_arrays; i++) { for (i = 0; i < track->num_arrays; i++) {
......
...@@ -64,6 +64,7 @@ struct r100_cs_track { ...@@ -64,6 +64,7 @@ struct r100_cs_track {
unsigned maxy; unsigned maxy;
unsigned vtx_size; unsigned vtx_size;
unsigned vap_vf_cntl; unsigned vap_vf_cntl;
unsigned vap_alt_nverts;
unsigned immd_dwords; unsigned immd_dwords;
unsigned num_arrays; unsigned num_arrays;
unsigned max_indx; unsigned max_indx;
......
...@@ -729,6 +729,12 @@ static int r300_packet0_check(struct radeon_cs_parser *p, ...@@ -729,6 +729,12 @@ static int r300_packet0_check(struct radeon_cs_parser *p,
/* VAP_VF_MAX_VTX_INDX */ /* VAP_VF_MAX_VTX_INDX */
track->max_indx = idx_value & 0x00FFFFFFUL; track->max_indx = idx_value & 0x00FFFFFFUL;
break; break;
case 0x2088:
/* VAP_ALT_NUM_VERTICES - only valid on r500 */
if (p->rdev->family < CHIP_RV515)
goto fail;
track->vap_alt_nverts = idx_value & 0xFFFFFF;
break;
case 0x43E4: case 0x43E4:
/* SC_SCISSOR1 */ /* SC_SCISSOR1 */
track->maxy = ((idx_value >> 13) & 0x1FFF) + 1; track->maxy = ((idx_value >> 13) & 0x1FFF) + 1;
...@@ -766,7 +772,6 @@ static int r300_packet0_check(struct radeon_cs_parser *p, ...@@ -766,7 +772,6 @@ static int r300_packet0_check(struct radeon_cs_parser *p,
tmp = idx_value & ~(0x7 << 16); tmp = idx_value & ~(0x7 << 16);
tmp |= tile_flags; tmp |= tile_flags;
ib[idx] = tmp; ib[idx] = tmp;
i = (reg - 0x4E38) >> 2; i = (reg - 0x4E38) >> 2;
track->cb[i].pitch = idx_value & 0x3FFE; track->cb[i].pitch = idx_value & 0x3FFE;
switch (((idx_value >> 21) & 0xF)) { switch (((idx_value >> 21) & 0xF)) {
...@@ -1051,11 +1056,13 @@ static int r300_packet0_check(struct radeon_cs_parser *p, ...@@ -1051,11 +1056,13 @@ static int r300_packet0_check(struct radeon_cs_parser *p,
break; break;
/* fallthrough do not move */ /* fallthrough do not move */
default: default:
goto fail;
}
return 0;
fail:
printk(KERN_ERR "Forbidden register 0x%04X in cs at %d\n", printk(KERN_ERR "Forbidden register 0x%04X in cs at %d\n",
reg, idx); reg, idx);
return -EINVAL; return -EINVAL;
}
return 0;
} }
static int r300_packet3_check(struct radeon_cs_parser *p, static int r300_packet3_check(struct radeon_cs_parser *p,
......
...@@ -43,9 +43,10 @@ ...@@ -43,9 +43,10 @@
* - 2.0.0 - initial interface * - 2.0.0 - initial interface
* - 2.1.0 - add square tiling interface * - 2.1.0 - add square tiling interface
* - 2.2.0 - add r6xx/r7xx const buffer support * - 2.2.0 - add r6xx/r7xx const buffer support
* - 2.3.0 - add MSPOS + 3D texture + r500 VAP regs
*/ */
#define KMS_DRIVER_MAJOR 2 #define KMS_DRIVER_MAJOR 2
#define KMS_DRIVER_MINOR 2 #define KMS_DRIVER_MINOR 3
#define KMS_DRIVER_PATCHLEVEL 0 #define KMS_DRIVER_PATCHLEVEL 0
int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags); int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags);
int radeon_driver_unload_kms(struct drm_device *dev); int radeon_driver_unload_kms(struct drm_device *dev);
......
...@@ -35,6 +35,7 @@ rv515 0x6d40 ...@@ -35,6 +35,7 @@ rv515 0x6d40
0x1DA8 VAP_VPORT_ZSCALE 0x1DA8 VAP_VPORT_ZSCALE
0x1DAC VAP_VPORT_ZOFFSET 0x1DAC VAP_VPORT_ZOFFSET
0x2080 VAP_CNTL 0x2080 VAP_CNTL
0x208C VAP_INDEX_OFFSET
0x2090 VAP_OUT_VTX_FMT_0 0x2090 VAP_OUT_VTX_FMT_0
0x2094 VAP_OUT_VTX_FMT_1 0x2094 VAP_OUT_VTX_FMT_1
0x20B0 VAP_VTE_CNTL 0x20B0 VAP_VTE_CNTL
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment