diff options
| author | Christian König <christian.koenig@amd.com> | 2014-12-03 09:53:24 -0500 |
|---|---|---|
| committer | Alex Deucher <alexander.deucher@amd.com> | 2014-12-03 18:26:53 -0500 |
| commit | 6d2d13dd0e746a2bbdd2159abbdf603f0e37189e (patch) | |
| tree | b4785d60b69a5d686a62967a6b18ec77e95eb65a | |
| parent | 466be3386f1c14451a9a9c0a586a9df5f06eecdf (diff) | |
drm/radeon: use pointers instead of indexes for CS chunks
Nobody is interested at which index the chunk is. What's needed is
a pointer to the chunk. Remove unused chunk_id field as well.
Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
| -rw-r--r-- | drivers/gpu/drm/radeon/evergreen_cs.c | 6 | ||||
| -rw-r--r-- | drivers/gpu/drm/radeon/r100.c | 2 | ||||
| -rw-r--r-- | drivers/gpu/drm/radeon/r300.c | 2 | ||||
| -rw-r--r-- | drivers/gpu/drm/radeon/r600_cs.c | 14 | ||||
| -rw-r--r-- | drivers/gpu/drm/radeon/radeon.h | 11 | ||||
| -rw-r--r-- | drivers/gpu/drm/radeon/radeon_cs.c | 57 | ||||
| -rw-r--r-- | drivers/gpu/drm/radeon/radeon_trace.h | 2 | ||||
| -rw-r--r-- | drivers/gpu/drm/radeon/radeon_uvd.c | 10 | ||||
| -rw-r--r-- | drivers/gpu/drm/radeon/radeon_vce.c | 4 |
9 files changed, 53 insertions, 55 deletions
diff --git a/drivers/gpu/drm/radeon/evergreen_cs.c b/drivers/gpu/drm/radeon/evergreen_cs.c index a1dece6f9b9e..924b1b7ab455 100644 --- a/drivers/gpu/drm/radeon/evergreen_cs.c +++ b/drivers/gpu/drm/radeon/evergreen_cs.c | |||
| @@ -2661,7 +2661,7 @@ int evergreen_cs_parse(struct radeon_cs_parser *p) | |||
| 2661 | p->track = NULL; | 2661 | p->track = NULL; |
| 2662 | return r; | 2662 | return r; |
| 2663 | } | 2663 | } |
| 2664 | } while (p->idx < p->chunks[p->chunk_ib_idx].length_dw); | 2664 | } while (p->idx < p->chunk_ib->length_dw); |
| 2665 | #if 0 | 2665 | #if 0 |
| 2666 | for (r = 0; r < p->ib.length_dw; r++) { | 2666 | for (r = 0; r < p->ib.length_dw; r++) { |
| 2667 | printk(KERN_INFO "%05d 0x%08X\n", r, p->ib.ptr[r]); | 2667 | printk(KERN_INFO "%05d 0x%08X\n", r, p->ib.ptr[r]); |
| @@ -2684,7 +2684,7 @@ int evergreen_cs_parse(struct radeon_cs_parser *p) | |||
| 2684 | **/ | 2684 | **/ |
| 2685 | int evergreen_dma_cs_parse(struct radeon_cs_parser *p) | 2685 | int evergreen_dma_cs_parse(struct radeon_cs_parser *p) |
| 2686 | { | 2686 | { |
| 2687 | struct radeon_cs_chunk *ib_chunk = &p->chunks[p->chunk_ib_idx]; | 2687 | struct radeon_cs_chunk *ib_chunk = p->chunk_ib; |
| 2688 | struct radeon_bo_list *src_reloc, *dst_reloc, *dst2_reloc; | 2688 | struct radeon_bo_list *src_reloc, *dst_reloc, *dst2_reloc; |
| 2689 | u32 header, cmd, count, sub_cmd; | 2689 | u32 header, cmd, count, sub_cmd; |
| 2690 | volatile u32 *ib = p->ib.ptr; | 2690 | volatile u32 *ib = p->ib.ptr; |
| @@ -3100,7 +3100,7 @@ int evergreen_dma_cs_parse(struct radeon_cs_parser *p) | |||
| 3100 | DRM_ERROR("Unknown packet type %d at %d !\n", cmd, idx); | 3100 | DRM_ERROR("Unknown packet type %d at %d !\n", cmd, idx); |
| 3101 | return -EINVAL; | 3101 | return -EINVAL; |
| 3102 | } | 3102 | } |
| 3103 | } while (p->idx < p->chunks[p->chunk_ib_idx].length_dw); | 3103 | } while (p->idx < p->chunk_ib->length_dw); |
| 3104 | #if 0 | 3104 | #if 0 |
| 3105 | for (r = 0; r < p->ib->length_dw; r++) { | 3105 | for (r = 0; r < p->ib->length_dw; r++) { |
| 3106 | printk(KERN_INFO "%05d 0x%08X\n", r, p->ib.ptr[r]); | 3106 | printk(KERN_INFO "%05d 0x%08X\n", r, p->ib.ptr[r]); |
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c index 9314edfb687a..74f06d540591 100644 --- a/drivers/gpu/drm/radeon/r100.c +++ b/drivers/gpu/drm/radeon/r100.c | |||
| @@ -2061,7 +2061,7 @@ int r100_cs_parse(struct radeon_cs_parser *p) | |||
| 2061 | } | 2061 | } |
| 2062 | if (r) | 2062 | if (r) |
| 2063 | return r; | 2063 | return r; |
| 2064 | } while (p->idx < p->chunks[p->chunk_ib_idx].length_dw); | 2064 | } while (p->idx < p->chunk_ib->length_dw); |
| 2065 | return 0; | 2065 | return 0; |
| 2066 | } | 2066 | } |
| 2067 | 2067 | ||
diff --git a/drivers/gpu/drm/radeon/r300.c b/drivers/gpu/drm/radeon/r300.c index 91d2442ca395..064ad5569cca 100644 --- a/drivers/gpu/drm/radeon/r300.c +++ b/drivers/gpu/drm/radeon/r300.c | |||
| @@ -1283,7 +1283,7 @@ int r300_cs_parse(struct radeon_cs_parser *p) | |||
| 1283 | if (r) { | 1283 | if (r) { |
| 1284 | return r; | 1284 | return r; |
| 1285 | } | 1285 | } |
| 1286 | } while (p->idx < p->chunks[p->chunk_ib_idx].length_dw); | 1286 | } while (p->idx < p->chunk_ib->length_dw); |
| 1287 | return 0; | 1287 | return 0; |
| 1288 | } | 1288 | } |
| 1289 | 1289 | ||
diff --git a/drivers/gpu/drm/radeon/r600_cs.c b/drivers/gpu/drm/radeon/r600_cs.c index e5521946cb7a..acc1f99c84d9 100644 --- a/drivers/gpu/drm/radeon/r600_cs.c +++ b/drivers/gpu/drm/radeon/r600_cs.c | |||
| @@ -2316,7 +2316,7 @@ int r600_cs_parse(struct radeon_cs_parser *p) | |||
| 2316 | p->track = NULL; | 2316 | p->track = NULL; |
| 2317 | return r; | 2317 | return r; |
| 2318 | } | 2318 | } |
| 2319 | } while (p->idx < p->chunks[p->chunk_ib_idx].length_dw); | 2319 | } while (p->idx < p->chunk_ib->length_dw); |
| 2320 | #if 0 | 2320 | #if 0 |
| 2321 | for (r = 0; r < p->ib.length_dw; r++) { | 2321 | for (r = 0; r < p->ib.length_dw; r++) { |
| 2322 | printk(KERN_INFO "%05d 0x%08X\n", r, p->ib.ptr[r]); | 2322 | printk(KERN_INFO "%05d 0x%08X\n", r, p->ib.ptr[r]); |
| @@ -2351,7 +2351,7 @@ static void r600_cs_parser_fini(struct radeon_cs_parser *parser, int error) | |||
| 2351 | 2351 | ||
| 2352 | static int r600_cs_parser_relocs_legacy(struct radeon_cs_parser *p) | 2352 | static int r600_cs_parser_relocs_legacy(struct radeon_cs_parser *p) |
| 2353 | { | 2353 | { |
| 2354 | if (p->chunk_relocs_idx == -1) { | 2354 | if (p->chunk_relocs == NULL) { |
| 2355 | return 0; | 2355 | return 0; |
| 2356 | } | 2356 | } |
| 2357 | p->relocs = kzalloc(sizeof(struct radeon_bo_list), GFP_KERNEL); | 2357 | p->relocs = kzalloc(sizeof(struct radeon_bo_list), GFP_KERNEL); |
| @@ -2398,7 +2398,7 @@ int r600_cs_legacy(struct drm_device *dev, void *data, struct drm_file *filp, | |||
| 2398 | /* Copy the packet into the IB, the parser will read from the | 2398 | /* Copy the packet into the IB, the parser will read from the |
| 2399 | * input memory (cached) and write to the IB (which can be | 2399 | * input memory (cached) and write to the IB (which can be |
| 2400 | * uncached). */ | 2400 | * uncached). */ |
| 2401 | ib_chunk = &parser.chunks[parser.chunk_ib_idx]; | 2401 | ib_chunk = parser.chunk_ib; |
| 2402 | parser.ib.length_dw = ib_chunk->length_dw; | 2402 | parser.ib.length_dw = ib_chunk->length_dw; |
| 2403 | *l = parser.ib.length_dw; | 2403 | *l = parser.ib.length_dw; |
| 2404 | if (copy_from_user(ib, ib_chunk->user_ptr, ib_chunk->length_dw * 4)) { | 2404 | if (copy_from_user(ib, ib_chunk->user_ptr, ib_chunk->length_dw * 4)) { |
| @@ -2441,11 +2441,11 @@ int r600_dma_cs_next_reloc(struct radeon_cs_parser *p, | |||
| 2441 | unsigned idx; | 2441 | unsigned idx; |
| 2442 | 2442 | ||
| 2443 | *cs_reloc = NULL; | 2443 | *cs_reloc = NULL; |
| 2444 | if (p->chunk_relocs_idx == -1) { | 2444 | if (p->chunk_relocs == NULL) { |
| 2445 | DRM_ERROR("No relocation chunk !\n"); | 2445 | DRM_ERROR("No relocation chunk !\n"); |
| 2446 | return -EINVAL; | 2446 | return -EINVAL; |
| 2447 | } | 2447 | } |
| 2448 | relocs_chunk = &p->chunks[p->chunk_relocs_idx]; | 2448 | relocs_chunk = p->chunk_relocs; |
| 2449 | idx = p->dma_reloc_idx; | 2449 | idx = p->dma_reloc_idx; |
| 2450 | if (idx >= p->nrelocs) { | 2450 | if (idx >= p->nrelocs) { |
| 2451 | DRM_ERROR("Relocs at %d after relocations chunk end %d !\n", | 2451 | DRM_ERROR("Relocs at %d after relocations chunk end %d !\n", |
| @@ -2472,7 +2472,7 @@ int r600_dma_cs_next_reloc(struct radeon_cs_parser *p, | |||
| 2472 | **/ | 2472 | **/ |
| 2473 | int r600_dma_cs_parse(struct radeon_cs_parser *p) | 2473 | int r600_dma_cs_parse(struct radeon_cs_parser *p) |
| 2474 | { | 2474 | { |
| 2475 | struct radeon_cs_chunk *ib_chunk = &p->chunks[p->chunk_ib_idx]; | 2475 | struct radeon_cs_chunk *ib_chunk = p->chunk_ib; |
| 2476 | struct radeon_bo_list *src_reloc, *dst_reloc; | 2476 | struct radeon_bo_list *src_reloc, *dst_reloc; |
| 2477 | u32 header, cmd, count, tiled; | 2477 | u32 header, cmd, count, tiled; |
| 2478 | volatile u32 *ib = p->ib.ptr; | 2478 | volatile u32 *ib = p->ib.ptr; |
| @@ -2619,7 +2619,7 @@ int r600_dma_cs_parse(struct radeon_cs_parser *p) | |||
| 2619 | DRM_ERROR("Unknown packet type %d at %d !\n", cmd, idx); | 2619 | DRM_ERROR("Unknown packet type %d at %d !\n", cmd, idx); |
| 2620 | return -EINVAL; | 2620 | return -EINVAL; |
| 2621 | } | 2621 | } |
| 2622 | } while (p->idx < p->chunks[p->chunk_ib_idx].length_dw); | 2622 | } while (p->idx < p->chunk_ib->length_dw); |
| 2623 | #if 0 | 2623 | #if 0 |
| 2624 | for (r = 0; r < p->ib->length_dw; r++) { | 2624 | for (r = 0; r < p->ib->length_dw; r++) { |
| 2625 | printk(KERN_INFO "%05d 0x%08X\n", r, p->ib.ptr[r]); | 2625 | printk(KERN_INFO "%05d 0x%08X\n", r, p->ib.ptr[r]); |
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index 1319c9ccde5a..54529b837afa 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h | |||
| @@ -1057,7 +1057,6 @@ void cayman_dma_fini(struct radeon_device *rdev); | |||
| 1057 | * CS. | 1057 | * CS. |
| 1058 | */ | 1058 | */ |
| 1059 | struct radeon_cs_chunk { | 1059 | struct radeon_cs_chunk { |
| 1060 | uint32_t chunk_id; | ||
| 1061 | uint32_t length_dw; | 1060 | uint32_t length_dw; |
| 1062 | uint32_t *kdata; | 1061 | uint32_t *kdata; |
| 1063 | void __user *user_ptr; | 1062 | void __user *user_ptr; |
| @@ -1080,10 +1079,10 @@ struct radeon_cs_parser { | |||
| 1080 | struct list_head validated; | 1079 | struct list_head validated; |
| 1081 | unsigned dma_reloc_idx; | 1080 | unsigned dma_reloc_idx; |
| 1082 | /* indices of various chunks */ | 1081 | /* indices of various chunks */ |
| 1083 | int chunk_ib_idx; | 1082 | struct radeon_cs_chunk *chunk_ib; |
| 1084 | int chunk_relocs_idx; | 1083 | struct radeon_cs_chunk *chunk_relocs; |
| 1085 | int chunk_flags_idx; | 1084 | struct radeon_cs_chunk *chunk_flags; |
| 1086 | int chunk_const_ib_idx; | 1085 | struct radeon_cs_chunk *chunk_const_ib; |
| 1087 | struct radeon_ib ib; | 1086 | struct radeon_ib ib; |
| 1088 | struct radeon_ib const_ib; | 1087 | struct radeon_ib const_ib; |
| 1089 | void *track; | 1088 | void *track; |
| @@ -1097,7 +1096,7 @@ struct radeon_cs_parser { | |||
| 1097 | 1096 | ||
| 1098 | static inline u32 radeon_get_ib_value(struct radeon_cs_parser *p, int idx) | 1097 | static inline u32 radeon_get_ib_value(struct radeon_cs_parser *p, int idx) |
| 1099 | { | 1098 | { |
| 1100 | struct radeon_cs_chunk *ibc = &p->chunks[p->chunk_ib_idx]; | 1099 | struct radeon_cs_chunk *ibc = p->chunk_ib; |
| 1101 | 1100 | ||
| 1102 | if (ibc->kdata) | 1101 | if (ibc->kdata) |
| 1103 | return ibc->kdata[idx]; | 1102 | return ibc->kdata[idx]; |
diff --git a/drivers/gpu/drm/radeon/radeon_cs.c b/drivers/gpu/drm/radeon/radeon_cs.c index 26f7855c3e19..9648e28c4501 100644 --- a/drivers/gpu/drm/radeon/radeon_cs.c +++ b/drivers/gpu/drm/radeon/radeon_cs.c | |||
| @@ -81,10 +81,10 @@ static int radeon_cs_parser_relocs(struct radeon_cs_parser *p) | |||
| 81 | bool need_mmap_lock = false; | 81 | bool need_mmap_lock = false; |
| 82 | int r; | 82 | int r; |
| 83 | 83 | ||
| 84 | if (p->chunk_relocs_idx == -1) { | 84 | if (p->chunk_relocs == NULL) { |
| 85 | return 0; | 85 | return 0; |
| 86 | } | 86 | } |
| 87 | chunk = &p->chunks[p->chunk_relocs_idx]; | 87 | chunk = p->chunk_relocs; |
| 88 | p->dma_reloc_idx = 0; | 88 | p->dma_reloc_idx = 0; |
| 89 | /* FIXME: we assume that each relocs use 4 dwords */ | 89 | /* FIXME: we assume that each relocs use 4 dwords */ |
| 90 | p->nrelocs = chunk->length_dw / 4; | 90 | p->nrelocs = chunk->length_dw / 4; |
| @@ -265,10 +265,10 @@ int radeon_cs_parser_init(struct radeon_cs_parser *p, void *data) | |||
| 265 | p->idx = 0; | 265 | p->idx = 0; |
| 266 | p->ib.sa_bo = NULL; | 266 | p->ib.sa_bo = NULL; |
| 267 | p->const_ib.sa_bo = NULL; | 267 | p->const_ib.sa_bo = NULL; |
| 268 | p->chunk_ib_idx = -1; | 268 | p->chunk_ib = NULL; |
| 269 | p->chunk_relocs_idx = -1; | 269 | p->chunk_relocs = NULL; |
| 270 | p->chunk_flags_idx = -1; | 270 | p->chunk_flags = NULL; |
| 271 | p->chunk_const_ib_idx = -1; | 271 | p->chunk_const_ib = NULL; |
| 272 | p->chunks_array = kcalloc(cs->num_chunks, sizeof(uint64_t), GFP_KERNEL); | 272 | p->chunks_array = kcalloc(cs->num_chunks, sizeof(uint64_t), GFP_KERNEL); |
| 273 | if (p->chunks_array == NULL) { | 273 | if (p->chunks_array == NULL) { |
| 274 | return -ENOMEM; | 274 | return -ENOMEM; |
| @@ -295,24 +295,23 @@ int radeon_cs_parser_init(struct radeon_cs_parser *p, void *data) | |||
| 295 | return -EFAULT; | 295 | return -EFAULT; |
| 296 | } | 296 | } |
| 297 | p->chunks[i].length_dw = user_chunk.length_dw; | 297 | p->chunks[i].length_dw = user_chunk.length_dw; |
| 298 | p->chunks[i].chunk_id = user_chunk.chunk_id; | 298 | if (user_chunk.chunk_id == RADEON_CHUNK_ID_RELOCS) { |
| 299 | if (p->chunks[i].chunk_id == RADEON_CHUNK_ID_RELOCS) { | 299 | p->chunk_relocs = &p->chunks[i]; |
| 300 | p->chunk_relocs_idx = i; | ||
| 301 | } | 300 | } |
| 302 | if (p->chunks[i].chunk_id == RADEON_CHUNK_ID_IB) { | 301 | if (user_chunk.chunk_id == RADEON_CHUNK_ID_IB) { |
| 303 | p->chunk_ib_idx = i; | 302 | p->chunk_ib = &p->chunks[i]; |
| 304 | /* zero length IB isn't useful */ | 303 | /* zero length IB isn't useful */ |
| 305 | if (p->chunks[i].length_dw == 0) | 304 | if (p->chunks[i].length_dw == 0) |
| 306 | return -EINVAL; | 305 | return -EINVAL; |
| 307 | } | 306 | } |
| 308 | if (p->chunks[i].chunk_id == RADEON_CHUNK_ID_CONST_IB) { | 307 | if (user_chunk.chunk_id == RADEON_CHUNK_ID_CONST_IB) { |
| 309 | p->chunk_const_ib_idx = i; | 308 | p->chunk_const_ib = &p->chunks[i]; |
| 310 | /* zero length CONST IB isn't useful */ | 309 | /* zero length CONST IB isn't useful */ |
| 311 | if (p->chunks[i].length_dw == 0) | 310 | if (p->chunks[i].length_dw == 0) |
| 312 | return -EINVAL; | 311 | return -EINVAL; |
| 313 | } | 312 | } |
| 314 | if (p->chunks[i].chunk_id == RADEON_CHUNK_ID_FLAGS) { | 313 | if (user_chunk.chunk_id == RADEON_CHUNK_ID_FLAGS) { |
| 315 | p->chunk_flags_idx = i; | 314 | p->chunk_flags = &p->chunks[i]; |
| 316 | /* zero length flags aren't useful */ | 315 | /* zero length flags aren't useful */ |
| 317 | if (p->chunks[i].length_dw == 0) | 316 | if (p->chunks[i].length_dw == 0) |
| 318 | return -EINVAL; | 317 | return -EINVAL; |
| @@ -321,10 +320,10 @@ int radeon_cs_parser_init(struct radeon_cs_parser *p, void *data) | |||
| 321 | size = p->chunks[i].length_dw; | 320 | size = p->chunks[i].length_dw; |
| 322 | cdata = (void __user *)(unsigned long)user_chunk.chunk_data; | 321 | cdata = (void __user *)(unsigned long)user_chunk.chunk_data; |
| 323 | p->chunks[i].user_ptr = cdata; | 322 | p->chunks[i].user_ptr = cdata; |
| 324 | if (p->chunks[i].chunk_id == RADEON_CHUNK_ID_CONST_IB) | 323 | if (user_chunk.chunk_id == RADEON_CHUNK_ID_CONST_IB) |
| 325 | continue; | 324 | continue; |
| 326 | 325 | ||
| 327 | if (p->chunks[i].chunk_id == RADEON_CHUNK_ID_IB) { | 326 | if (user_chunk.chunk_id == RADEON_CHUNK_ID_IB) { |
| 328 | if (!p->rdev || !(p->rdev->flags & RADEON_IS_AGP)) | 327 | if (!p->rdev || !(p->rdev->flags & RADEON_IS_AGP)) |
| 329 | continue; | 328 | continue; |
| 330 | } | 329 | } |
| @@ -337,7 +336,7 @@ int radeon_cs_parser_init(struct radeon_cs_parser *p, void *data) | |||
| 337 | if (copy_from_user(p->chunks[i].kdata, cdata, size)) { | 336 | if (copy_from_user(p->chunks[i].kdata, cdata, size)) { |
| 338 | return -EFAULT; | 337 | return -EFAULT; |
| 339 | } | 338 | } |
| 340 | if (p->chunks[i].chunk_id == RADEON_CHUNK_ID_FLAGS) { | 339 | if (user_chunk.chunk_id == RADEON_CHUNK_ID_FLAGS) { |
| 341 | p->cs_flags = p->chunks[i].kdata[0]; | 340 | p->cs_flags = p->chunks[i].kdata[0]; |
| 342 | if (p->chunks[i].length_dw > 1) | 341 | if (p->chunks[i].length_dw > 1) |
| 343 | ring = p->chunks[i].kdata[1]; | 342 | ring = p->chunks[i].kdata[1]; |
| @@ -443,7 +442,7 @@ static int radeon_cs_ib_chunk(struct radeon_device *rdev, | |||
| 443 | { | 442 | { |
| 444 | int r; | 443 | int r; |
| 445 | 444 | ||
| 446 | if (parser->chunk_ib_idx == -1) | 445 | if (parser->chunk_ib == NULL) |
| 447 | return 0; | 446 | return 0; |
| 448 | 447 | ||
| 449 | if (parser->cs_flags & RADEON_CS_USE_VM) | 448 | if (parser->cs_flags & RADEON_CS_USE_VM) |
| @@ -527,7 +526,7 @@ static int radeon_cs_ib_vm_chunk(struct radeon_device *rdev, | |||
| 527 | struct radeon_vm *vm = &fpriv->vm; | 526 | struct radeon_vm *vm = &fpriv->vm; |
| 528 | int r; | 527 | int r; |
| 529 | 528 | ||
| 530 | if (parser->chunk_ib_idx == -1) | 529 | if (parser->chunk_ib == NULL) |
| 531 | return 0; | 530 | return 0; |
| 532 | if ((parser->cs_flags & RADEON_CS_USE_VM) == 0) | 531 | if ((parser->cs_flags & RADEON_CS_USE_VM) == 0) |
| 533 | return 0; | 532 | return 0; |
| @@ -561,7 +560,7 @@ static int radeon_cs_ib_vm_chunk(struct radeon_device *rdev, | |||
| 561 | } | 560 | } |
| 562 | 561 | ||
| 563 | if ((rdev->family >= CHIP_TAHITI) && | 562 | if ((rdev->family >= CHIP_TAHITI) && |
| 564 | (parser->chunk_const_ib_idx != -1)) { | 563 | (parser->chunk_const_ib != NULL)) { |
| 565 | r = radeon_ib_schedule(rdev, &parser->ib, &parser->const_ib, true); | 564 | r = radeon_ib_schedule(rdev, &parser->ib, &parser->const_ib, true); |
| 566 | } else { | 565 | } else { |
| 567 | r = radeon_ib_schedule(rdev, &parser->ib, NULL, true); | 566 | r = radeon_ib_schedule(rdev, &parser->ib, NULL, true); |
| @@ -588,7 +587,7 @@ static int radeon_cs_ib_fill(struct radeon_device *rdev, struct radeon_cs_parser | |||
| 588 | struct radeon_vm *vm = NULL; | 587 | struct radeon_vm *vm = NULL; |
| 589 | int r; | 588 | int r; |
| 590 | 589 | ||
| 591 | if (parser->chunk_ib_idx == -1) | 590 | if (parser->chunk_ib == NULL) |
| 592 | return 0; | 591 | return 0; |
| 593 | 592 | ||
| 594 | if (parser->cs_flags & RADEON_CS_USE_VM) { | 593 | if (parser->cs_flags & RADEON_CS_USE_VM) { |
| @@ -596,8 +595,8 @@ static int radeon_cs_ib_fill(struct radeon_device *rdev, struct radeon_cs_parser | |||
| 596 | vm = &fpriv->vm; | 595 | vm = &fpriv->vm; |
| 597 | 596 | ||
| 598 | if ((rdev->family >= CHIP_TAHITI) && | 597 | if ((rdev->family >= CHIP_TAHITI) && |
| 599 | (parser->chunk_const_ib_idx != -1)) { | 598 | (parser->chunk_const_ib != NULL)) { |
| 600 | ib_chunk = &parser->chunks[parser->chunk_const_ib_idx]; | 599 | ib_chunk = parser->chunk_const_ib; |
| 601 | if (ib_chunk->length_dw > RADEON_IB_VM_MAX_SIZE) { | 600 | if (ib_chunk->length_dw > RADEON_IB_VM_MAX_SIZE) { |
| 602 | DRM_ERROR("cs IB CONST too big: %d\n", ib_chunk->length_dw); | 601 | DRM_ERROR("cs IB CONST too big: %d\n", ib_chunk->length_dw); |
| 603 | return -EINVAL; | 602 | return -EINVAL; |
| @@ -616,13 +615,13 @@ static int radeon_cs_ib_fill(struct radeon_device *rdev, struct radeon_cs_parser | |||
| 616 | return -EFAULT; | 615 | return -EFAULT; |
| 617 | } | 616 | } |
| 618 | 617 | ||
| 619 | ib_chunk = &parser->chunks[parser->chunk_ib_idx]; | 618 | ib_chunk = parser->chunk_ib; |
| 620 | if (ib_chunk->length_dw > RADEON_IB_VM_MAX_SIZE) { | 619 | if (ib_chunk->length_dw > RADEON_IB_VM_MAX_SIZE) { |
| 621 | DRM_ERROR("cs IB too big: %d\n", ib_chunk->length_dw); | 620 | DRM_ERROR("cs IB too big: %d\n", ib_chunk->length_dw); |
| 622 | return -EINVAL; | 621 | return -EINVAL; |
| 623 | } | 622 | } |
| 624 | } | 623 | } |
| 625 | ib_chunk = &parser->chunks[parser->chunk_ib_idx]; | 624 | ib_chunk = parser->chunk_ib; |
| 626 | 625 | ||
| 627 | r = radeon_ib_get(rdev, parser->ring, &parser->ib, | 626 | r = radeon_ib_get(rdev, parser->ring, &parser->ib, |
| 628 | vm, ib_chunk->length_dw * 4); | 627 | vm, ib_chunk->length_dw * 4); |
| @@ -714,7 +713,7 @@ int radeon_cs_packet_parse(struct radeon_cs_parser *p, | |||
| 714 | struct radeon_cs_packet *pkt, | 713 | struct radeon_cs_packet *pkt, |
| 715 | unsigned idx) | 714 | unsigned idx) |
| 716 | { | 715 | { |
| 717 | struct radeon_cs_chunk *ib_chunk = &p->chunks[p->chunk_ib_idx]; | 716 | struct radeon_cs_chunk *ib_chunk = p->chunk_ib; |
| 718 | struct radeon_device *rdev = p->rdev; | 717 | struct radeon_device *rdev = p->rdev; |
| 719 | uint32_t header; | 718 | uint32_t header; |
| 720 | 719 | ||
| @@ -816,12 +815,12 @@ int radeon_cs_packet_next_reloc(struct radeon_cs_parser *p, | |||
| 816 | unsigned idx; | 815 | unsigned idx; |
| 817 | int r; | 816 | int r; |
| 818 | 817 | ||
| 819 | if (p->chunk_relocs_idx == -1) { | 818 | if (p->chunk_relocs == NULL) { |
| 820 | DRM_ERROR("No relocation chunk !\n"); | 819 | DRM_ERROR("No relocation chunk !\n"); |
| 821 | return -EINVAL; | 820 | return -EINVAL; |
| 822 | } | 821 | } |
| 823 | *cs_reloc = NULL; | 822 | *cs_reloc = NULL; |
| 824 | relocs_chunk = &p->chunks[p->chunk_relocs_idx]; | 823 | relocs_chunk = p->chunk_relocs; |
| 825 | r = radeon_cs_packet_parse(p, &p3reloc, p->idx); | 824 | r = radeon_cs_packet_parse(p, &p3reloc, p->idx); |
| 826 | if (r) | 825 | if (r) |
| 827 | return r; | 826 | return r; |
diff --git a/drivers/gpu/drm/radeon/radeon_trace.h b/drivers/gpu/drm/radeon/radeon_trace.h index 9db74a96ef61..ce075cb08cb2 100644 --- a/drivers/gpu/drm/radeon/radeon_trace.h +++ b/drivers/gpu/drm/radeon/radeon_trace.h | |||
| @@ -38,7 +38,7 @@ TRACE_EVENT(radeon_cs, | |||
| 38 | 38 | ||
| 39 | TP_fast_assign( | 39 | TP_fast_assign( |
| 40 | __entry->ring = p->ring; | 40 | __entry->ring = p->ring; |
| 41 | __entry->dw = p->chunks[p->chunk_ib_idx].length_dw; | 41 | __entry->dw = p->chunk_ib->length_dw; |
| 42 | __entry->fences = radeon_fence_count_emitted( | 42 | __entry->fences = radeon_fence_count_emitted( |
| 43 | p->rdev, p->ring); | 43 | p->rdev, p->ring); |
| 44 | ), | 44 | ), |
diff --git a/drivers/gpu/drm/radeon/radeon_uvd.c b/drivers/gpu/drm/radeon/radeon_uvd.c index 72cd47d04140..c10b2aec6450 100644 --- a/drivers/gpu/drm/radeon/radeon_uvd.c +++ b/drivers/gpu/drm/radeon/radeon_uvd.c | |||
| @@ -493,7 +493,7 @@ static int radeon_uvd_cs_reloc(struct radeon_cs_parser *p, | |||
| 493 | uint64_t start, end; | 493 | uint64_t start, end; |
| 494 | int r; | 494 | int r; |
| 495 | 495 | ||
| 496 | relocs_chunk = &p->chunks[p->chunk_relocs_idx]; | 496 | relocs_chunk = p->chunk_relocs; |
| 497 | offset = radeon_get_ib_value(p, data0); | 497 | offset = radeon_get_ib_value(p, data0); |
| 498 | idx = radeon_get_ib_value(p, data1); | 498 | idx = radeon_get_ib_value(p, data1); |
| 499 | if (idx >= relocs_chunk->length_dw) { | 499 | if (idx >= relocs_chunk->length_dw) { |
| @@ -610,13 +610,13 @@ int radeon_uvd_cs_parse(struct radeon_cs_parser *p) | |||
| 610 | [0x00000003] = 2048, | 610 | [0x00000003] = 2048, |
| 611 | }; | 611 | }; |
| 612 | 612 | ||
| 613 | if (p->chunks[p->chunk_ib_idx].length_dw % 16) { | 613 | if (p->chunk_ib->length_dw % 16) { |
| 614 | DRM_ERROR("UVD IB length (%d) not 16 dwords aligned!\n", | 614 | DRM_ERROR("UVD IB length (%d) not 16 dwords aligned!\n", |
| 615 | p->chunks[p->chunk_ib_idx].length_dw); | 615 | p->chunk_ib->length_dw); |
| 616 | return -EINVAL; | 616 | return -EINVAL; |
| 617 | } | 617 | } |
| 618 | 618 | ||
| 619 | if (p->chunk_relocs_idx == -1) { | 619 | if (p->chunk_relocs == NULL) { |
| 620 | DRM_ERROR("No relocation chunk !\n"); | 620 | DRM_ERROR("No relocation chunk !\n"); |
| 621 | return -EINVAL; | 621 | return -EINVAL; |
| 622 | } | 622 | } |
| @@ -640,7 +640,7 @@ int radeon_uvd_cs_parse(struct radeon_cs_parser *p) | |||
| 640 | DRM_ERROR("Unknown packet type %d !\n", pkt.type); | 640 | DRM_ERROR("Unknown packet type %d !\n", pkt.type); |
| 641 | return -EINVAL; | 641 | return -EINVAL; |
| 642 | } | 642 | } |
| 643 | } while (p->idx < p->chunks[p->chunk_ib_idx].length_dw); | 643 | } while (p->idx < p->chunk_ib->length_dw); |
| 644 | 644 | ||
| 645 | if (!has_msg_cmd) { | 645 | if (!has_msg_cmd) { |
| 646 | DRM_ERROR("UVD-IBs need a msg command!\n"); | 646 | DRM_ERROR("UVD-IBs need a msg command!\n"); |
diff --git a/drivers/gpu/drm/radeon/radeon_vce.c b/drivers/gpu/drm/radeon/radeon_vce.c index b3a1698e0443..976fe432f4e2 100644 --- a/drivers/gpu/drm/radeon/radeon_vce.c +++ b/drivers/gpu/drm/radeon/radeon_vce.c | |||
| @@ -457,7 +457,7 @@ int radeon_vce_cs_reloc(struct radeon_cs_parser *p, int lo, int hi, | |||
| 457 | uint64_t start, end, offset; | 457 | uint64_t start, end, offset; |
| 458 | unsigned idx; | 458 | unsigned idx; |
| 459 | 459 | ||
| 460 | relocs_chunk = &p->chunks[p->chunk_relocs_idx]; | 460 | relocs_chunk = p->chunk_relocs; |
| 461 | offset = radeon_get_ib_value(p, lo); | 461 | offset = radeon_get_ib_value(p, lo); |
| 462 | idx = radeon_get_ib_value(p, hi); | 462 | idx = radeon_get_ib_value(p, hi); |
| 463 | 463 | ||
| @@ -534,7 +534,7 @@ int radeon_vce_cs_parse(struct radeon_cs_parser *p) | |||
| 534 | uint32_t *size = &tmp; | 534 | uint32_t *size = &tmp; |
| 535 | int i, r; | 535 | int i, r; |
| 536 | 536 | ||
| 537 | while (p->idx < p->chunks[p->chunk_ib_idx].length_dw) { | 537 | while (p->idx < p->chunk_ib->length_dw) { |
| 538 | uint32_t len = radeon_get_ib_value(p, p->idx); | 538 | uint32_t len = radeon_get_ib_value(p, p->idx); |
| 539 | uint32_t cmd = radeon_get_ib_value(p, p->idx + 1); | 539 | uint32_t cmd = radeon_get_ib_value(p, p->idx + 1); |
| 540 | 540 | ||
