aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/radeon/r600_blit_kms.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@linux.ie>2009-09-17 02:11:31 -0400
committerDave Airlie <airlied@redhat.com>2009-09-18 02:01:56 -0400
commit7cbb355e947b3b426cefd9a3dc0dda3af9f9345a (patch)
treedb448cd1d25f5554e419d6a72ff9582b56337b5f /drivers/gpu/drm/radeon/r600_blit_kms.c
parent41456df2d45299c2eea5aaabafbaa2430ab9a124 (diff)
drm/r600/kms: fixup number of loops per blit calculation.
Some people were seeing *ERROR* radeon: writting more dword to ring than expected after certain blits, the loops calculation didn't take into account that we do a separate blit for the remainder after doing the aligned blits. Acked-by: Alex Deucher <alexdeucher@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/radeon/r600_blit_kms.c')
-rw-r--r--drivers/gpu/drm/radeon/r600_blit_kms.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/drivers/gpu/drm/radeon/r600_blit_kms.c b/drivers/gpu/drm/radeon/r600_blit_kms.c
index 4f0d181a690..1287f4d3fb2 100644
--- a/drivers/gpu/drm/radeon/r600_blit_kms.c
+++ b/drivers/gpu/drm/radeon/r600_blit_kms.c
@@ -548,10 +548,13 @@ void r600_vb_ib_put(struct radeon_device *rdev)
548int r600_blit_prepare_copy(struct radeon_device *rdev, int size_bytes) 548int r600_blit_prepare_copy(struct radeon_device *rdev, int size_bytes)
549{ 549{
550 int r; 550 int r;
551 int ring_size; 551 int ring_size, line_size;
552 int max_size; 552 int max_size;
553 /* loops of emits 64 + fence emit possible */ 553 /* loops of emits 64 + fence emit possible */
554 int dwords_per_loop = 76; 554 int dwords_per_loop = 76, num_loops;
555
556 r = r600_vb_ib_get(rdev);
557 WARN_ON(r);
555 558
556 /* set_render_target emits 2 extra dwords on rv6xx */ 559 /* set_render_target emits 2 extra dwords on rv6xx */
557 if (rdev->family > CHIP_R600 && rdev->family < CHIP_RV770) 560 if (rdev->family > CHIP_R600 && rdev->family < CHIP_RV770)
@@ -559,14 +562,18 @@ int r600_blit_prepare_copy(struct radeon_device *rdev, int size_bytes)
559 562
560 /* 8 bpp vs 32 bpp for xfer unit */ 563 /* 8 bpp vs 32 bpp for xfer unit */
561 if (size_bytes & 3) 564 if (size_bytes & 3)
562 max_size = 8192*8192; 565 line_size = 8192;
563 else 566 else
564 max_size = 8192*8192*4; 567 line_size = 8192*4;
565 568
566 r = r600_vb_ib_get(rdev); 569 max_size = 8192 * line_size;
567 WARN_ON(r);
568 570
569 ring_size = ((size_bytes + max_size) / max_size) * dwords_per_loop; 571 /* major loops cover the max size transfer */
572 num_loops = ((size_bytes + max_size) / max_size);
573 /* minor loops cover the extra non aligned bits */
574 num_loops += ((size_bytes % line_size) ? 1 : 0);
575 /* calculate number of loops correctly */
576 ring_size = num_loops * dwords_per_loop;
570 /* set default + shaders */ 577 /* set default + shaders */
571 ring_size += 40; /* shaders + def state */ 578 ring_size += 40; /* shaders + def state */
572 ring_size += 3; /* fence emit for VB IB */ 579 ring_size += 3; /* fence emit for VB IB */