diff options
author | Alex Deucher <alexander.deucher@amd.com> | 2011-11-17 14:25:56 -0500 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2011-12-20 14:51:46 -0500 |
commit | 78c5560a08114d7bbbce04cee1628049a22ea104 (patch) | |
tree | d0ad0e7e02e71ec66b9972f50d6c6dd3b3c65d40 /drivers/gpu/drm/radeon/radeon_ring.c | |
parent | ce9548843756d2fc64bf11c7208de52be5774863 (diff) |
drm/radeon/kms: add some new ring params to better handle other ring types
Some rptr/wptrs fields have different offsets and not all rings are pm4
so add a new nop field.
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Christian König <deathsimple@vodafone.de>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/radeon/radeon_ring.c')
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_ring.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_ring.c b/drivers/gpu/drm/radeon/radeon_ring.c index b39a1d9306e5..133e2636cea0 100644 --- a/drivers/gpu/drm/radeon/radeon_ring.c +++ b/drivers/gpu/drm/radeon/radeon_ring.c | |||
@@ -305,10 +305,13 @@ int radeon_ring_index(struct radeon_device *rdev, struct radeon_ring *ring) | |||
305 | 305 | ||
306 | void radeon_ring_free_size(struct radeon_device *rdev, struct radeon_ring *ring) | 306 | void radeon_ring_free_size(struct radeon_device *rdev, struct radeon_ring *ring) |
307 | { | 307 | { |
308 | u32 rptr; | ||
309 | |||
308 | if (rdev->wb.enabled) | 310 | if (rdev->wb.enabled) |
309 | ring->rptr = le32_to_cpu(rdev->wb.wb[ring->rptr_offs/4]); | 311 | rptr = le32_to_cpu(rdev->wb.wb[ring->rptr_offs/4]); |
310 | else | 312 | else |
311 | ring->rptr = RREG32(ring->rptr_reg); | 313 | rptr = RREG32(ring->rptr_reg); |
314 | ring->rptr = (rptr & ring->ptr_reg_mask) >> ring->ptr_reg_shift; | ||
312 | /* This works because ring_size is a power of 2 */ | 315 | /* This works because ring_size is a power of 2 */ |
313 | ring->ring_free_dw = (ring->rptr + (ring->ring_size / 4)); | 316 | ring->ring_free_dw = (ring->rptr + (ring->ring_size / 4)); |
314 | ring->ring_free_dw -= ring->wptr; | 317 | ring->ring_free_dw -= ring->wptr; |
@@ -362,10 +365,10 @@ void radeon_ring_commit(struct radeon_device *rdev, struct radeon_ring *ring) | |||
362 | count_dw_pad = (ring->align_mask + 1) - | 365 | count_dw_pad = (ring->align_mask + 1) - |
363 | (ring->wptr & ring->align_mask); | 366 | (ring->wptr & ring->align_mask); |
364 | for (i = 0; i < count_dw_pad; i++) { | 367 | for (i = 0; i < count_dw_pad; i++) { |
365 | radeon_ring_write(ring, 2 << 30); | 368 | radeon_ring_write(ring, ring->nop); |
366 | } | 369 | } |
367 | DRM_MEMORYBARRIER(); | 370 | DRM_MEMORYBARRIER(); |
368 | WREG32(ring->wptr_reg, ring->wptr); | 371 | WREG32(ring->wptr_reg, (ring->wptr << ring->ptr_reg_shift) & ring->ptr_reg_mask); |
369 | (void)RREG32(ring->wptr_reg); | 372 | (void)RREG32(ring->wptr_reg); |
370 | } | 373 | } |
371 | 374 | ||
@@ -382,7 +385,8 @@ void radeon_ring_unlock_undo(struct radeon_device *rdev, struct radeon_ring *rin | |||
382 | } | 385 | } |
383 | 386 | ||
384 | int radeon_ring_init(struct radeon_device *rdev, struct radeon_ring *ring, unsigned ring_size, | 387 | int radeon_ring_init(struct radeon_device *rdev, struct radeon_ring *ring, unsigned ring_size, |
385 | unsigned rptr_offs, unsigned rptr_reg, unsigned wptr_reg) | 388 | unsigned rptr_offs, unsigned rptr_reg, unsigned wptr_reg, |
389 | u32 ptr_reg_shift, u32 ptr_reg_mask, u32 nop) | ||
386 | { | 390 | { |
387 | int r; | 391 | int r; |
388 | 392 | ||
@@ -390,6 +394,9 @@ int radeon_ring_init(struct radeon_device *rdev, struct radeon_ring *ring, unsig | |||
390 | ring->rptr_offs = rptr_offs; | 394 | ring->rptr_offs = rptr_offs; |
391 | ring->rptr_reg = rptr_reg; | 395 | ring->rptr_reg = rptr_reg; |
392 | ring->wptr_reg = wptr_reg; | 396 | ring->wptr_reg = wptr_reg; |
397 | ring->ptr_reg_shift = ptr_reg_shift; | ||
398 | ring->ptr_reg_mask = ptr_reg_mask; | ||
399 | ring->nop = nop; | ||
393 | /* Allocate ring buffer */ | 400 | /* Allocate ring buffer */ |
394 | if (ring->ring_obj == NULL) { | 401 | if (ring->ring_obj == NULL) { |
395 | r = radeon_bo_create(rdev, ring->ring_size, PAGE_SIZE, true, | 402 | r = radeon_bo_create(rdev, ring->ring_size, PAGE_SIZE, true, |