aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/radeon
diff options
context:
space:
mode:
authorAlex Deucher <alexdeucher@gmail.com>2011-06-08 15:26:45 -0400
committerDave Airlie <airlied@redhat.com>2011-06-20 22:36:39 -0400
commit033b5650010652c069494df58424c4b98412fe3b (patch)
treeb3a5204f19648d6e02821f29b4cf9817c2d6ca33 /drivers/gpu/drm/radeon
parent0d74f86f37306da8619eb049d88ab7ee523eec9c (diff)
drm/radeon/kms: add initial CS checker support for compute
- Add some new compute regs - Add new dispatch packets for evergreen/cayman Signed-off-by: Alex Deucher <alexdeucher@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/radeon')
-rw-r--r--drivers/gpu/drm/radeon/evergreen_cs.c57
-rw-r--r--drivers/gpu/drm/radeon/evergreend.h2
-rw-r--r--drivers/gpu/drm/radeon/r600_cs.c9
-rw-r--r--drivers/gpu/drm/radeon/radeon_drv.c2
-rw-r--r--drivers/gpu/drm/radeon/reg_srcs/cayman2
-rw-r--r--drivers/gpu/drm/radeon/reg_srcs/evergreen3
-rw-r--r--drivers/gpu/drm/radeon/reg_srcs/r6001
7 files changed, 74 insertions, 2 deletions
diff --git a/drivers/gpu/drm/radeon/evergreen_cs.c b/drivers/gpu/drm/radeon/evergreen_cs.c
index 23d36417158d..189e86522b5b 100644
--- a/drivers/gpu/drm/radeon/evergreen_cs.c
+++ b/drivers/gpu/drm/radeon/evergreen_cs.c
@@ -856,7 +856,6 @@ static inline int evergreen_cs_check_reg(struct radeon_cs_parser *p, u32 reg, u3
856 case SQ_PGM_START_PS: 856 case SQ_PGM_START_PS:
857 case SQ_PGM_START_HS: 857 case SQ_PGM_START_HS:
858 case SQ_PGM_START_LS: 858 case SQ_PGM_START_LS:
859 case GDS_ADDR_BASE:
860 case SQ_CONST_MEM_BASE: 859 case SQ_CONST_MEM_BASE:
861 case SQ_ALU_CONST_CACHE_GS_0: 860 case SQ_ALU_CONST_CACHE_GS_0:
862 case SQ_ALU_CONST_CACHE_GS_1: 861 case SQ_ALU_CONST_CACHE_GS_1:
@@ -946,6 +945,34 @@ static inline int evergreen_cs_check_reg(struct radeon_cs_parser *p, u32 reg, u3
946 } 945 }
947 ib[idx] += (u32)((reloc->lobj.gpu_offset >> 8) & 0xffffffff); 946 ib[idx] += (u32)((reloc->lobj.gpu_offset >> 8) & 0xffffffff);
948 break; 947 break;
948 case SX_MEMORY_EXPORT_BASE:
949 if (p->rdev->family >= CHIP_CAYMAN) {
950 dev_warn(p->dev, "bad SET_CONFIG_REG "
951 "0x%04X\n", reg);
952 return -EINVAL;
953 }
954 r = evergreen_cs_packet_next_reloc(p, &reloc);
955 if (r) {
956 dev_warn(p->dev, "bad SET_CONFIG_REG "
957 "0x%04X\n", reg);
958 return -EINVAL;
959 }
960 ib[idx] += (u32)((reloc->lobj.gpu_offset >> 8) & 0xffffffff);
961 break;
962 case CAYMAN_SX_SCATTER_EXPORT_BASE:
963 if (p->rdev->family < CHIP_CAYMAN) {
964 dev_warn(p->dev, "bad SET_CONTEXT_REG "
965 "0x%04X\n", reg);
966 return -EINVAL;
967 }
968 r = evergreen_cs_packet_next_reloc(p, &reloc);
969 if (r) {
970 dev_warn(p->dev, "bad SET_CONTEXT_REG "
971 "0x%04X\n", reg);
972 return -EINVAL;
973 }
974 ib[idx] += (u32)((reloc->lobj.gpu_offset >> 8) & 0xffffffff);
975 break;
949 default: 976 default:
950 dev_warn(p->dev, "forbidden register 0x%08x at %d\n", reg, idx); 977 dev_warn(p->dev, "forbidden register 0x%08x at %d\n", reg, idx);
951 return -EINVAL; 978 return -EINVAL;
@@ -1153,6 +1180,34 @@ static int evergreen_packet3_check(struct radeon_cs_parser *p,
1153 return r; 1180 return r;
1154 } 1181 }
1155 break; 1182 break;
1183 case PACKET3_DISPATCH_DIRECT:
1184 if (pkt->count != 3) {
1185 DRM_ERROR("bad DISPATCH_DIRECT\n");
1186 return -EINVAL;
1187 }
1188 r = evergreen_cs_track_check(p);
1189 if (r) {
1190 dev_warn(p->dev, "%s:%d invalid cmd stream %d\n", __func__, __LINE__, idx);
1191 return r;
1192 }
1193 break;
1194 case PACKET3_DISPATCH_INDIRECT:
1195 if (pkt->count != 1) {
1196 DRM_ERROR("bad DISPATCH_INDIRECT\n");
1197 return -EINVAL;
1198 }
1199 r = evergreen_cs_packet_next_reloc(p, &reloc);
1200 if (r) {
1201 DRM_ERROR("bad DISPATCH_INDIRECT\n");
1202 return -EINVAL;
1203 }
1204 ib[idx+0] = idx_value + (u32)(reloc->lobj.gpu_offset & 0xffffffff);
1205 r = evergreen_cs_track_check(p);
1206 if (r) {
1207 dev_warn(p->dev, "%s:%d invalid cmd stream\n", __func__, __LINE__);
1208 return r;
1209 }
1210 break;
1156 case PACKET3_WAIT_REG_MEM: 1211 case PACKET3_WAIT_REG_MEM:
1157 if (pkt->count != 5) { 1212 if (pkt->count != 5) {
1158 DRM_ERROR("bad WAIT_REG_MEM\n"); 1213 DRM_ERROR("bad WAIT_REG_MEM\n");
diff --git a/drivers/gpu/drm/radeon/evergreend.h b/drivers/gpu/drm/radeon/evergreend.h
index 1636e3449825..321c822065fc 100644
--- a/drivers/gpu/drm/radeon/evergreend.h
+++ b/drivers/gpu/drm/radeon/evergreend.h
@@ -351,6 +351,7 @@
351#define COLOR_BUFFER_SIZE(x) ((x) << 0) 351#define COLOR_BUFFER_SIZE(x) ((x) << 0)
352#define POSITION_BUFFER_SIZE(x) ((x) << 8) 352#define POSITION_BUFFER_SIZE(x) ((x) << 8)
353#define SMX_BUFFER_SIZE(x) ((x) << 16) 353#define SMX_BUFFER_SIZE(x) ((x) << 16)
354#define SX_MEMORY_EXPORT_BASE 0x9010
354#define SX_MISC 0x28350 355#define SX_MISC 0x28350
355 356
356#define CB_PERF_CTR0_SEL_0 0x9A20 357#define CB_PERF_CTR0_SEL_0 0x9A20
@@ -1122,6 +1123,7 @@
1122#define CAYMAN_PA_SC_AA_CONFIG 0x28BE0 1123#define CAYMAN_PA_SC_AA_CONFIG 0x28BE0
1123#define CAYMAN_MSAA_NUM_SAMPLES_SHIFT 0 1124#define CAYMAN_MSAA_NUM_SAMPLES_SHIFT 0
1124#define CAYMAN_MSAA_NUM_SAMPLES_MASK 0x7 1125#define CAYMAN_MSAA_NUM_SAMPLES_MASK 0x7
1126#define CAYMAN_SX_SCATTER_EXPORT_BASE 0x28358
1125/* cayman packet3 addition */ 1127/* cayman packet3 addition */
1126#define CAYMAN_PACKET3_DEALLOC_STATE 0x14 1128#define CAYMAN_PACKET3_DEALLOC_STATE 0x14
1127 1129
diff --git a/drivers/gpu/drm/radeon/r600_cs.c b/drivers/gpu/drm/radeon/r600_cs.c
index 909bda8dd550..db8ef1905d5f 100644
--- a/drivers/gpu/drm/radeon/r600_cs.c
+++ b/drivers/gpu/drm/radeon/r600_cs.c
@@ -1200,6 +1200,15 @@ static inline int r600_cs_check_reg(struct radeon_cs_parser *p, u32 reg, u32 idx
1200 } 1200 }
1201 ib[idx] += (u32)((reloc->lobj.gpu_offset >> 8) & 0xffffffff); 1201 ib[idx] += (u32)((reloc->lobj.gpu_offset >> 8) & 0xffffffff);
1202 break; 1202 break;
1203 case SX_MEMORY_EXPORT_BASE:
1204 r = r600_cs_packet_next_reloc(p, &reloc);
1205 if (r) {
1206 dev_warn(p->dev, "bad SET_CONFIG_REG "
1207 "0x%04X\n", reg);
1208 return -EINVAL;
1209 }
1210 ib[idx] += (u32)((reloc->lobj.gpu_offset >> 8) & 0xffffffff);
1211 break;
1203 default: 1212 default:
1204 dev_warn(p->dev, "forbidden register 0x%08x at %d\n", reg, idx); 1213 dev_warn(p->dev, "forbidden register 0x%08x at %d\n", reg, idx);
1205 return -EINVAL; 1214 return -EINVAL;
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
index 73dfbe8e5f9e..cbb4584a4a23 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -50,7 +50,7 @@
50 * 2.7.0 - fixups for r600 2D tiling support. (no external ABI change), add eg dyn gpr regs 50 * 2.7.0 - fixups for r600 2D tiling support. (no external ABI change), add eg dyn gpr regs
51 * 2.8.0 - pageflip support, r500 US_FORMAT regs. r500 ARGB2101010 colorbuf, r300->r500 CMASK, clock crystal query 51 * 2.8.0 - pageflip support, r500 US_FORMAT regs. r500 ARGB2101010 colorbuf, r300->r500 CMASK, clock crystal query
52 * 2.9.0 - r600 tiling (s3tc,rgtc) working, SET_PREDICATION packet 3 on r600 + eg, backend query 52 * 2.9.0 - r600 tiling (s3tc,rgtc) working, SET_PREDICATION packet 3 on r600 + eg, backend query
53 * 2.10.0 - fusion 2D tiling 53 * 2.10.0 - fusion 2D tiling, initial compute support for the CS checker
54 */ 54 */
55#define KMS_DRIVER_MAJOR 2 55#define KMS_DRIVER_MAJOR 2
56#define KMS_DRIVER_MINOR 10 56#define KMS_DRIVER_MINOR 10
diff --git a/drivers/gpu/drm/radeon/reg_srcs/cayman b/drivers/gpu/drm/radeon/reg_srcs/cayman
index 0aa8e85a9457..2316977eb924 100644
--- a/drivers/gpu/drm/radeon/reg_srcs/cayman
+++ b/drivers/gpu/drm/radeon/reg_srcs/cayman
@@ -208,6 +208,7 @@ cayman 0x9400
2080x0002834C PA_SC_VPORT_ZMAX_15 2080x0002834C PA_SC_VPORT_ZMAX_15
2090x00028350 SX_MISC 2090x00028350 SX_MISC
2100x00028354 SX_SURFACE_SYNC 2100x00028354 SX_SURFACE_SYNC
2110x0002835C SX_SCATTER_EXPORT_SIZE
2110x00028380 SQ_VTX_SEMANTIC_0 2120x00028380 SQ_VTX_SEMANTIC_0
2120x00028384 SQ_VTX_SEMANTIC_1 2130x00028384 SQ_VTX_SEMANTIC_1
2130x00028388 SQ_VTX_SEMANTIC_2 2140x00028388 SQ_VTX_SEMANTIC_2
@@ -432,6 +433,7 @@ cayman 0x9400
4320x00028700 SPI_STACK_MGMT 4330x00028700 SPI_STACK_MGMT
4330x00028704 SPI_WAVE_MGMT_1 4340x00028704 SPI_WAVE_MGMT_1
4340x00028708 SPI_WAVE_MGMT_2 4350x00028708 SPI_WAVE_MGMT_2
4360x00028720 GDS_ADDR_BASE
4350x00028724 GDS_ADDR_SIZE 4370x00028724 GDS_ADDR_SIZE
4360x00028780 CB_BLEND0_CONTROL 4380x00028780 CB_BLEND0_CONTROL
4370x00028784 CB_BLEND1_CONTROL 4390x00028784 CB_BLEND1_CONTROL
diff --git a/drivers/gpu/drm/radeon/reg_srcs/evergreen b/drivers/gpu/drm/radeon/reg_srcs/evergreen
index 0e28cae7ea43..161737a28c23 100644
--- a/drivers/gpu/drm/radeon/reg_srcs/evergreen
+++ b/drivers/gpu/drm/radeon/reg_srcs/evergreen
@@ -44,6 +44,7 @@ evergreen 0x9400
440x00008E28 SQ_STATIC_THREAD_MGMT_3 440x00008E28 SQ_STATIC_THREAD_MGMT_3
450x00008E2C SQ_LDS_RESOURCE_MGMT 450x00008E2C SQ_LDS_RESOURCE_MGMT
460x00008E48 SQ_EX_ALLOC_TABLE_SLOTS 460x00008E48 SQ_EX_ALLOC_TABLE_SLOTS
470x00009014 SX_MEMORY_EXPORT_SIZE
470x00009100 SPI_CONFIG_CNTL 480x00009100 SPI_CONFIG_CNTL
480x0000913C SPI_CONFIG_CNTL_1 490x0000913C SPI_CONFIG_CNTL_1
490x00009508 TA_CNTL_AUX 500x00009508 TA_CNTL_AUX
@@ -442,7 +443,9 @@ evergreen 0x9400
4420x000286EC SPI_COMPUTE_NUM_THREAD_X 4430x000286EC SPI_COMPUTE_NUM_THREAD_X
4430x000286F0 SPI_COMPUTE_NUM_THREAD_Y 4440x000286F0 SPI_COMPUTE_NUM_THREAD_Y
4440x000286F4 SPI_COMPUTE_NUM_THREAD_Z 4450x000286F4 SPI_COMPUTE_NUM_THREAD_Z
4460x00028720 GDS_ADDR_BASE
4450x00028724 GDS_ADDR_SIZE 4470x00028724 GDS_ADDR_SIZE
4480x00028728 GDS_ORDERED_WAVE_PER_SE
4460x00028780 CB_BLEND0_CONTROL 4490x00028780 CB_BLEND0_CONTROL
4470x00028784 CB_BLEND1_CONTROL 4500x00028784 CB_BLEND1_CONTROL
4480x00028788 CB_BLEND2_CONTROL 4510x00028788 CB_BLEND2_CONTROL
diff --git a/drivers/gpu/drm/radeon/reg_srcs/r600 b/drivers/gpu/drm/radeon/reg_srcs/r600
index ea49752ee99c..0380c5c15f80 100644
--- a/drivers/gpu/drm/radeon/reg_srcs/r600
+++ b/drivers/gpu/drm/radeon/reg_srcs/r600
@@ -429,6 +429,7 @@ r600 0x9400
4290x00028438 SX_ALPHA_REF 4290x00028438 SX_ALPHA_REF
4300x00028410 SX_ALPHA_TEST_CONTROL 4300x00028410 SX_ALPHA_TEST_CONTROL
4310x00028350 SX_MISC 4310x00028350 SX_MISC
4320x00009014 SX_MEMORY_EXPORT_SIZE
4320x00009604 TC_INVALIDATE 4330x00009604 TC_INVALIDATE
4330x00009400 TD_FILTER4 4340x00009400 TD_FILTER4
4340x00009404 TD_FILTER4_1 4350x00009404 TD_FILTER4_1