Commit 6d2d13dd authored by Christian König's avatar Christian König Committed by Alex Deucher

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: default avatarChristian König <christian.koenig@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 466be338
...@@ -2661,7 +2661,7 @@ int evergreen_cs_parse(struct radeon_cs_parser *p) ...@@ -2661,7 +2661,7 @@ int evergreen_cs_parse(struct radeon_cs_parser *p)
p->track = NULL; p->track = NULL;
return r; return r;
} }
} while (p->idx < p->chunks[p->chunk_ib_idx].length_dw); } while (p->idx < p->chunk_ib->length_dw);
#if 0 #if 0
for (r = 0; r < p->ib.length_dw; r++) { for (r = 0; r < p->ib.length_dw; r++) {
printk(KERN_INFO "%05d 0x%08X\n", r, p->ib.ptr[r]); 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,7 +2684,7 @@ int evergreen_cs_parse(struct radeon_cs_parser *p)
**/ **/
int evergreen_dma_cs_parse(struct radeon_cs_parser *p) int evergreen_dma_cs_parse(struct radeon_cs_parser *p)
{ {
struct radeon_cs_chunk *ib_chunk = &p->chunks[p->chunk_ib_idx]; struct radeon_cs_chunk *ib_chunk = p->chunk_ib;
struct radeon_bo_list *src_reloc, *dst_reloc, *dst2_reloc; struct radeon_bo_list *src_reloc, *dst_reloc, *dst2_reloc;
u32 header, cmd, count, sub_cmd; u32 header, cmd, count, sub_cmd;
volatile u32 *ib = p->ib.ptr; volatile u32 *ib = p->ib.ptr;
...@@ -3100,7 +3100,7 @@ int evergreen_dma_cs_parse(struct radeon_cs_parser *p) ...@@ -3100,7 +3100,7 @@ int evergreen_dma_cs_parse(struct radeon_cs_parser *p)
DRM_ERROR("Unknown packet type %d at %d !\n", cmd, idx); DRM_ERROR("Unknown packet type %d at %d !\n", cmd, idx);
return -EINVAL; return -EINVAL;
} }
} while (p->idx < p->chunks[p->chunk_ib_idx].length_dw); } while (p->idx < p->chunk_ib->length_dw);
#if 0 #if 0
for (r = 0; r < p->ib->length_dw; r++) { for (r = 0; r < p->ib->length_dw; r++) {
printk(KERN_INFO "%05d 0x%08X\n", r, p->ib.ptr[r]); printk(KERN_INFO "%05d 0x%08X\n", r, p->ib.ptr[r]);
......
...@@ -2061,7 +2061,7 @@ int r100_cs_parse(struct radeon_cs_parser *p) ...@@ -2061,7 +2061,7 @@ int r100_cs_parse(struct radeon_cs_parser *p)
} }
if (r) if (r)
return r; return r;
} while (p->idx < p->chunks[p->chunk_ib_idx].length_dw); } while (p->idx < p->chunk_ib->length_dw);
return 0; return 0;
} }
......
...@@ -1283,7 +1283,7 @@ int r300_cs_parse(struct radeon_cs_parser *p) ...@@ -1283,7 +1283,7 @@ int r300_cs_parse(struct radeon_cs_parser *p)
if (r) { if (r) {
return r; return r;
} }
} while (p->idx < p->chunks[p->chunk_ib_idx].length_dw); } while (p->idx < p->chunk_ib->length_dw);
return 0; return 0;
} }
......
...@@ -2316,7 +2316,7 @@ int r600_cs_parse(struct radeon_cs_parser *p) ...@@ -2316,7 +2316,7 @@ int r600_cs_parse(struct radeon_cs_parser *p)
p->track = NULL; p->track = NULL;
return r; return r;
} }
} while (p->idx < p->chunks[p->chunk_ib_idx].length_dw); } while (p->idx < p->chunk_ib->length_dw);
#if 0 #if 0
for (r = 0; r < p->ib.length_dw; r++) { for (r = 0; r < p->ib.length_dw; r++) {
printk(KERN_INFO "%05d 0x%08X\n", r, p->ib.ptr[r]); 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,7 +2351,7 @@ static void r600_cs_parser_fini(struct radeon_cs_parser *parser, int error)
static int r600_cs_parser_relocs_legacy(struct radeon_cs_parser *p) static int r600_cs_parser_relocs_legacy(struct radeon_cs_parser *p)
{ {
if (p->chunk_relocs_idx == -1) { if (p->chunk_relocs == NULL) {
return 0; return 0;
} }
p->relocs = kzalloc(sizeof(struct radeon_bo_list), GFP_KERNEL); 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,7 +2398,7 @@ int r600_cs_legacy(struct drm_device *dev, void *data, struct drm_file *filp,
/* Copy the packet into the IB, the parser will read from the /* Copy the packet into the IB, the parser will read from the
* input memory (cached) and write to the IB (which can be * input memory (cached) and write to the IB (which can be
* uncached). */ * uncached). */
ib_chunk = &parser.chunks[parser.chunk_ib_idx]; ib_chunk = parser.chunk_ib;
parser.ib.length_dw = ib_chunk->length_dw; parser.ib.length_dw = ib_chunk->length_dw;
*l = parser.ib.length_dw; *l = parser.ib.length_dw;
if (copy_from_user(ib, ib_chunk->user_ptr, ib_chunk->length_dw * 4)) { 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,11 +2441,11 @@ int r600_dma_cs_next_reloc(struct radeon_cs_parser *p,
unsigned idx; unsigned idx;
*cs_reloc = NULL; *cs_reloc = NULL;
if (p->chunk_relocs_idx == -1) { if (p->chunk_relocs == NULL) {
DRM_ERROR("No relocation chunk !\n"); DRM_ERROR("No relocation chunk !\n");
return -EINVAL; return -EINVAL;
} }
relocs_chunk = &p->chunks[p->chunk_relocs_idx]; relocs_chunk = p->chunk_relocs;
idx = p->dma_reloc_idx; idx = p->dma_reloc_idx;
if (idx >= p->nrelocs) { if (idx >= p->nrelocs) {
DRM_ERROR("Relocs at %d after relocations chunk end %d !\n", 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,7 +2472,7 @@ int r600_dma_cs_next_reloc(struct radeon_cs_parser *p,
**/ **/
int r600_dma_cs_parse(struct radeon_cs_parser *p) int r600_dma_cs_parse(struct radeon_cs_parser *p)
{ {
struct radeon_cs_chunk *ib_chunk = &p->chunks[p->chunk_ib_idx]; struct radeon_cs_chunk *ib_chunk = p->chunk_ib;
struct radeon_bo_list *src_reloc, *dst_reloc; struct radeon_bo_list *src_reloc, *dst_reloc;
u32 header, cmd, count, tiled; u32 header, cmd, count, tiled;
volatile u32 *ib = p->ib.ptr; volatile u32 *ib = p->ib.ptr;
...@@ -2619,7 +2619,7 @@ int r600_dma_cs_parse(struct radeon_cs_parser *p) ...@@ -2619,7 +2619,7 @@ int r600_dma_cs_parse(struct radeon_cs_parser *p)
DRM_ERROR("Unknown packet type %d at %d !\n", cmd, idx); DRM_ERROR("Unknown packet type %d at %d !\n", cmd, idx);
return -EINVAL; return -EINVAL;
} }
} while (p->idx < p->chunks[p->chunk_ib_idx].length_dw); } while (p->idx < p->chunk_ib->length_dw);
#if 0 #if 0
for (r = 0; r < p->ib->length_dw; r++) { for (r = 0; r < p->ib->length_dw; r++) {
printk(KERN_INFO "%05d 0x%08X\n", r, p->ib.ptr[r]); printk(KERN_INFO "%05d 0x%08X\n", r, p->ib.ptr[r]);
......
...@@ -1057,7 +1057,6 @@ void cayman_dma_fini(struct radeon_device *rdev); ...@@ -1057,7 +1057,6 @@ void cayman_dma_fini(struct radeon_device *rdev);
* CS. * CS.
*/ */
struct radeon_cs_chunk { struct radeon_cs_chunk {
uint32_t chunk_id;
uint32_t length_dw; uint32_t length_dw;
uint32_t *kdata; uint32_t *kdata;
void __user *user_ptr; void __user *user_ptr;
...@@ -1080,10 +1079,10 @@ struct radeon_cs_parser { ...@@ -1080,10 +1079,10 @@ struct radeon_cs_parser {
struct list_head validated; struct list_head validated;
unsigned dma_reloc_idx; unsigned dma_reloc_idx;
/* indices of various chunks */ /* indices of various chunks */
int chunk_ib_idx; struct radeon_cs_chunk *chunk_ib;
int chunk_relocs_idx; struct radeon_cs_chunk *chunk_relocs;
int chunk_flags_idx; struct radeon_cs_chunk *chunk_flags;
int chunk_const_ib_idx; struct radeon_cs_chunk *chunk_const_ib;
struct radeon_ib ib; struct radeon_ib ib;
struct radeon_ib const_ib; struct radeon_ib const_ib;
void *track; void *track;
...@@ -1097,7 +1096,7 @@ struct radeon_cs_parser { ...@@ -1097,7 +1096,7 @@ struct radeon_cs_parser {
static inline u32 radeon_get_ib_value(struct radeon_cs_parser *p, int idx) static inline u32 radeon_get_ib_value(struct radeon_cs_parser *p, int idx)
{ {
struct radeon_cs_chunk *ibc = &p->chunks[p->chunk_ib_idx]; struct radeon_cs_chunk *ibc = p->chunk_ib;
if (ibc->kdata) if (ibc->kdata)
return ibc->kdata[idx]; return ibc->kdata[idx];
......
...@@ -81,10 +81,10 @@ static int radeon_cs_parser_relocs(struct radeon_cs_parser *p) ...@@ -81,10 +81,10 @@ static int radeon_cs_parser_relocs(struct radeon_cs_parser *p)
bool need_mmap_lock = false; bool need_mmap_lock = false;
int r; int r;
if (p->chunk_relocs_idx == -1) { if (p->chunk_relocs == NULL) {
return 0; return 0;
} }
chunk = &p->chunks[p->chunk_relocs_idx]; chunk = p->chunk_relocs;
p->dma_reloc_idx = 0; p->dma_reloc_idx = 0;
/* FIXME: we assume that each relocs use 4 dwords */ /* FIXME: we assume that each relocs use 4 dwords */
p->nrelocs = chunk->length_dw / 4; p->nrelocs = chunk->length_dw / 4;
...@@ -265,10 +265,10 @@ int radeon_cs_parser_init(struct radeon_cs_parser *p, void *data) ...@@ -265,10 +265,10 @@ int radeon_cs_parser_init(struct radeon_cs_parser *p, void *data)
p->idx = 0; p->idx = 0;
p->ib.sa_bo = NULL; p->ib.sa_bo = NULL;
p->const_ib.sa_bo = NULL; p->const_ib.sa_bo = NULL;
p->chunk_ib_idx = -1; p->chunk_ib = NULL;
p->chunk_relocs_idx = -1; p->chunk_relocs = NULL;
p->chunk_flags_idx = -1; p->chunk_flags = NULL;
p->chunk_const_ib_idx = -1; p->chunk_const_ib = NULL;
p->chunks_array = kcalloc(cs->num_chunks, sizeof(uint64_t), GFP_KERNEL); p->chunks_array = kcalloc(cs->num_chunks, sizeof(uint64_t), GFP_KERNEL);
if (p->chunks_array == NULL) { if (p->chunks_array == NULL) {
return -ENOMEM; return -ENOMEM;
...@@ -295,24 +295,23 @@ int radeon_cs_parser_init(struct radeon_cs_parser *p, void *data) ...@@ -295,24 +295,23 @@ int radeon_cs_parser_init(struct radeon_cs_parser *p, void *data)
return -EFAULT; return -EFAULT;
} }
p->chunks[i].length_dw = user_chunk.length_dw; p->chunks[i].length_dw = user_chunk.length_dw;
p->chunks[i].chunk_id = user_chunk.chunk_id; if (user_chunk.chunk_id == RADEON_CHUNK_ID_RELOCS) {
if (p->chunks[i].chunk_id == RADEON_CHUNK_ID_RELOCS) { p->chunk_relocs = &p->chunks[i];
p->chunk_relocs_idx = i;
} }
if (p->chunks[i].chunk_id == RADEON_CHUNK_ID_IB) { if (user_chunk.chunk_id == RADEON_CHUNK_ID_IB) {
p->chunk_ib_idx = i; p->chunk_ib = &p->chunks[i];
/* zero length IB isn't useful */ /* zero length IB isn't useful */
if (p->chunks[i].length_dw == 0) if (p->chunks[i].length_dw == 0)
return -EINVAL; return -EINVAL;
} }
if (p->chunks[i].chunk_id == RADEON_CHUNK_ID_CONST_IB) { if (user_chunk.chunk_id == RADEON_CHUNK_ID_CONST_IB) {
p->chunk_const_ib_idx = i; p->chunk_const_ib = &p->chunks[i];
/* zero length CONST IB isn't useful */ /* zero length CONST IB isn't useful */
if (p->chunks[i].length_dw == 0) if (p->chunks[i].length_dw == 0)
return -EINVAL; return -EINVAL;
} }
if (p->chunks[i].chunk_id == RADEON_CHUNK_ID_FLAGS) { if (user_chunk.chunk_id == RADEON_CHUNK_ID_FLAGS) {
p->chunk_flags_idx = i; p->chunk_flags = &p->chunks[i];
/* zero length flags aren't useful */ /* zero length flags aren't useful */
if (p->chunks[i].length_dw == 0) if (p->chunks[i].length_dw == 0)
return -EINVAL; return -EINVAL;
...@@ -321,10 +320,10 @@ int radeon_cs_parser_init(struct radeon_cs_parser *p, void *data) ...@@ -321,10 +320,10 @@ int radeon_cs_parser_init(struct radeon_cs_parser *p, void *data)
size = p->chunks[i].length_dw; size = p->chunks[i].length_dw;
cdata = (void __user *)(unsigned long)user_chunk.chunk_data; cdata = (void __user *)(unsigned long)user_chunk.chunk_data;
p->chunks[i].user_ptr = cdata; p->chunks[i].user_ptr = cdata;
if (p->chunks[i].chunk_id == RADEON_CHUNK_ID_CONST_IB) if (user_chunk.chunk_id == RADEON_CHUNK_ID_CONST_IB)
continue; continue;
if (p->chunks[i].chunk_id == RADEON_CHUNK_ID_IB) { if (user_chunk.chunk_id == RADEON_CHUNK_ID_IB) {
if (!p->rdev || !(p->rdev->flags & RADEON_IS_AGP)) if (!p->rdev || !(p->rdev->flags & RADEON_IS_AGP))
continue; continue;
} }
...@@ -337,7 +336,7 @@ int radeon_cs_parser_init(struct radeon_cs_parser *p, void *data) ...@@ -337,7 +336,7 @@ int radeon_cs_parser_init(struct radeon_cs_parser *p, void *data)
if (copy_from_user(p->chunks[i].kdata, cdata, size)) { if (copy_from_user(p->chunks[i].kdata, cdata, size)) {
return -EFAULT; return -EFAULT;
} }
if (p->chunks[i].chunk_id == RADEON_CHUNK_ID_FLAGS) { if (user_chunk.chunk_id == RADEON_CHUNK_ID_FLAGS) {
p->cs_flags = p->chunks[i].kdata[0]; p->cs_flags = p->chunks[i].kdata[0];
if (p->chunks[i].length_dw > 1) if (p->chunks[i].length_dw > 1)
ring = p->chunks[i].kdata[1]; ring = p->chunks[i].kdata[1];
...@@ -443,7 +442,7 @@ static int radeon_cs_ib_chunk(struct radeon_device *rdev, ...@@ -443,7 +442,7 @@ static int radeon_cs_ib_chunk(struct radeon_device *rdev,
{ {
int r; int r;
if (parser->chunk_ib_idx == -1) if (parser->chunk_ib == NULL)
return 0; return 0;
if (parser->cs_flags & RADEON_CS_USE_VM) if (parser->cs_flags & RADEON_CS_USE_VM)
...@@ -527,7 +526,7 @@ static int radeon_cs_ib_vm_chunk(struct radeon_device *rdev, ...@@ -527,7 +526,7 @@ static int radeon_cs_ib_vm_chunk(struct radeon_device *rdev,
struct radeon_vm *vm = &fpriv->vm; struct radeon_vm *vm = &fpriv->vm;
int r; int r;
if (parser->chunk_ib_idx == -1) if (parser->chunk_ib == NULL)
return 0; return 0;
if ((parser->cs_flags & RADEON_CS_USE_VM) == 0) if ((parser->cs_flags & RADEON_CS_USE_VM) == 0)
return 0; return 0;
...@@ -561,7 +560,7 @@ static int radeon_cs_ib_vm_chunk(struct radeon_device *rdev, ...@@ -561,7 +560,7 @@ static int radeon_cs_ib_vm_chunk(struct radeon_device *rdev,
} }
if ((rdev->family >= CHIP_TAHITI) && if ((rdev->family >= CHIP_TAHITI) &&
(parser->chunk_const_ib_idx != -1)) { (parser->chunk_const_ib != NULL)) {
r = radeon_ib_schedule(rdev, &parser->ib, &parser->const_ib, true); r = radeon_ib_schedule(rdev, &parser->ib, &parser->const_ib, true);
} else { } else {
r = radeon_ib_schedule(rdev, &parser->ib, NULL, true); 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,7 +587,7 @@ static int radeon_cs_ib_fill(struct radeon_device *rdev, struct radeon_cs_parser
struct radeon_vm *vm = NULL; struct radeon_vm *vm = NULL;
int r; int r;
if (parser->chunk_ib_idx == -1) if (parser->chunk_ib == NULL)
return 0; return 0;
if (parser->cs_flags & RADEON_CS_USE_VM) { 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,8 +595,8 @@ static int radeon_cs_ib_fill(struct radeon_device *rdev, struct radeon_cs_parser
vm = &fpriv->vm; vm = &fpriv->vm;
if ((rdev->family >= CHIP_TAHITI) && if ((rdev->family >= CHIP_TAHITI) &&
(parser->chunk_const_ib_idx != -1)) { (parser->chunk_const_ib != NULL)) {
ib_chunk = &parser->chunks[parser->chunk_const_ib_idx]; ib_chunk = parser->chunk_const_ib;
if (ib_chunk->length_dw > RADEON_IB_VM_MAX_SIZE) { if (ib_chunk->length_dw > RADEON_IB_VM_MAX_SIZE) {
DRM_ERROR("cs IB CONST too big: %d\n", ib_chunk->length_dw); DRM_ERROR("cs IB CONST too big: %d\n", ib_chunk->length_dw);
return -EINVAL; return -EINVAL;
...@@ -616,13 +615,13 @@ static int radeon_cs_ib_fill(struct radeon_device *rdev, struct radeon_cs_parser ...@@ -616,13 +615,13 @@ static int radeon_cs_ib_fill(struct radeon_device *rdev, struct radeon_cs_parser
return -EFAULT; return -EFAULT;
} }
ib_chunk = &parser->chunks[parser->chunk_ib_idx]; ib_chunk = parser->chunk_ib;
if (ib_chunk->length_dw > RADEON_IB_VM_MAX_SIZE) { if (ib_chunk->length_dw > RADEON_IB_VM_MAX_SIZE) {
DRM_ERROR("cs IB too big: %d\n", ib_chunk->length_dw); DRM_ERROR("cs IB too big: %d\n", ib_chunk->length_dw);
return -EINVAL; return -EINVAL;
} }
} }
ib_chunk = &parser->chunks[parser->chunk_ib_idx]; ib_chunk = parser->chunk_ib;
r = radeon_ib_get(rdev, parser->ring, &parser->ib, r = radeon_ib_get(rdev, parser->ring, &parser->ib,
vm, ib_chunk->length_dw * 4); vm, ib_chunk->length_dw * 4);
...@@ -714,7 +713,7 @@ int radeon_cs_packet_parse(struct radeon_cs_parser *p, ...@@ -714,7 +713,7 @@ int radeon_cs_packet_parse(struct radeon_cs_parser *p,
struct radeon_cs_packet *pkt, struct radeon_cs_packet *pkt,
unsigned idx) unsigned idx)
{ {
struct radeon_cs_chunk *ib_chunk = &p->chunks[p->chunk_ib_idx]; struct radeon_cs_chunk *ib_chunk = p->chunk_ib;
struct radeon_device *rdev = p->rdev; struct radeon_device *rdev = p->rdev;
uint32_t header; uint32_t header;
...@@ -816,12 +815,12 @@ int radeon_cs_packet_next_reloc(struct radeon_cs_parser *p, ...@@ -816,12 +815,12 @@ int radeon_cs_packet_next_reloc(struct radeon_cs_parser *p,
unsigned idx; unsigned idx;
int r; int r;
if (p->chunk_relocs_idx == -1) { if (p->chunk_relocs == NULL) {
DRM_ERROR("No relocation chunk !\n"); DRM_ERROR("No relocation chunk !\n");
return -EINVAL; return -EINVAL;
} }
*cs_reloc = NULL; *cs_reloc = NULL;
relocs_chunk = &p->chunks[p->chunk_relocs_idx]; relocs_chunk = p->chunk_relocs;
r = radeon_cs_packet_parse(p, &p3reloc, p->idx); r = radeon_cs_packet_parse(p, &p3reloc, p->idx);
if (r) if (r)
return r; return r;
......
...@@ -38,7 +38,7 @@ TRACE_EVENT(radeon_cs, ...@@ -38,7 +38,7 @@ TRACE_EVENT(radeon_cs,
TP_fast_assign( TP_fast_assign(
__entry->ring = p->ring; __entry->ring = p->ring;
__entry->dw = p->chunks[p->chunk_ib_idx].length_dw; __entry->dw = p->chunk_ib->length_dw;
__entry->fences = radeon_fence_count_emitted( __entry->fences = radeon_fence_count_emitted(
p->rdev, p->ring); p->rdev, p->ring);
), ),
......
...@@ -493,7 +493,7 @@ static int radeon_uvd_cs_reloc(struct radeon_cs_parser *p, ...@@ -493,7 +493,7 @@ static int radeon_uvd_cs_reloc(struct radeon_cs_parser *p,
uint64_t start, end; uint64_t start, end;
int r; int r;
relocs_chunk = &p->chunks[p->chunk_relocs_idx]; relocs_chunk = p->chunk_relocs;
offset = radeon_get_ib_value(p, data0); offset = radeon_get_ib_value(p, data0);
idx = radeon_get_ib_value(p, data1); idx = radeon_get_ib_value(p, data1);
if (idx >= relocs_chunk->length_dw) { if (idx >= relocs_chunk->length_dw) {
...@@ -610,13 +610,13 @@ int radeon_uvd_cs_parse(struct radeon_cs_parser *p) ...@@ -610,13 +610,13 @@ int radeon_uvd_cs_parse(struct radeon_cs_parser *p)
[0x00000003] = 2048, [0x00000003] = 2048,
}; };
if (p->chunks[p->chunk_ib_idx].length_dw % 16) { if (p->chunk_ib->length_dw % 16) {
DRM_ERROR("UVD IB length (%d) not 16 dwords aligned!\n", DRM_ERROR("UVD IB length (%d) not 16 dwords aligned!\n",
p->chunks[p->chunk_ib_idx].length_dw); p->chunk_ib->length_dw);
return -EINVAL; return -EINVAL;
} }
if (p->chunk_relocs_idx == -1) { if (p->chunk_relocs == NULL) {
DRM_ERROR("No relocation chunk !\n"); DRM_ERROR("No relocation chunk !\n");
return -EINVAL; return -EINVAL;
} }
...@@ -640,7 +640,7 @@ int radeon_uvd_cs_parse(struct radeon_cs_parser *p) ...@@ -640,7 +640,7 @@ int radeon_uvd_cs_parse(struct radeon_cs_parser *p)
DRM_ERROR("Unknown packet type %d !\n", pkt.type); DRM_ERROR("Unknown packet type %d !\n", pkt.type);
return -EINVAL; return -EINVAL;
} }
} while (p->idx < p->chunks[p->chunk_ib_idx].length_dw); } while (p->idx < p->chunk_ib->length_dw);
if (!has_msg_cmd) { if (!has_msg_cmd) {
DRM_ERROR("UVD-IBs need a msg command!\n"); DRM_ERROR("UVD-IBs need a msg command!\n");
......
...@@ -457,7 +457,7 @@ int radeon_vce_cs_reloc(struct radeon_cs_parser *p, int lo, int hi, ...@@ -457,7 +457,7 @@ int radeon_vce_cs_reloc(struct radeon_cs_parser *p, int lo, int hi,
uint64_t start, end, offset; uint64_t start, end, offset;
unsigned idx; unsigned idx;
relocs_chunk = &p->chunks[p->chunk_relocs_idx]; relocs_chunk = p->chunk_relocs;
offset = radeon_get_ib_value(p, lo); offset = radeon_get_ib_value(p, lo);
idx = radeon_get_ib_value(p, hi); idx = radeon_get_ib_value(p, hi);
...@@ -534,7 +534,7 @@ int radeon_vce_cs_parse(struct radeon_cs_parser *p) ...@@ -534,7 +534,7 @@ int radeon_vce_cs_parse(struct radeon_cs_parser *p)
uint32_t *size = &tmp; uint32_t *size = &tmp;
int i, r; int i, r;
while (p->idx < p->chunks[p->chunk_ib_idx].length_dw) { while (p->idx < p->chunk_ib->length_dw) {
uint32_t len = radeon_get_ib_value(p, p->idx); uint32_t len = radeon_get_ib_value(p, p->idx);
uint32_t cmd = radeon_get_ib_value(p, p->idx + 1); uint32_t cmd = radeon_get_ib_value(p, p->idx + 1);
......
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