Bliting data while some of engines is still running or 2D engine as dirty
cache may cause pixmap or font glyph corruption.

Fix is to wait for 3D engine to be idle. Then we have to also flush 2D engine
in case if cache has outdated data for system memory where we are going to blit.

While it would be better only to flush when necessary it is very hard to know
when it is required. So we do flush every time because it is better to be safe
than sorry.

Signed-off-by: Pauli Nieminen <[email protected]>
---
 drivers/gpu/drm/radeon/r100.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c
index b6a7472..8becc68 100644
--- a/drivers/gpu/drm/radeon/r100.c
+++ b/drivers/gpu/drm/radeon/r100.c
@@ -431,12 +431,21 @@ int r100_copy_blit(struct radeon_device *rdev,
        num_loops = DIV_ROUND_UP(num_pages, 8191);
 
        /* Ask for enough room for blit + flush + fence */
-       ndw = 64 + (10 * num_loops);
+       ndw = 70 + (10 * num_loops);
        r = radeon_ring_lock(rdev, ndw);
        if (r) {
                DRM_ERROR("radeon: moving bo (%d) asking for %u dw.\n", r, ndw);
                return -EINVAL;
        }
+
+       radeon_ring_write(rdev, PACKET0(RADEON_WAIT_UNTIL, 0));
+       radeon_ring_write(rdev,
+                         RADEON_WAIT_3D_IDLECLEAN);
+       radeon_ring_write(rdev, PACKET0(RADEON_DSTCACHE_CTLSTAT, 0));
+       radeon_ring_write(rdev, RADEON_RB2D_DC_FLUSH_ALL);
+       radeon_ring_write(rdev, PACKET0(RADEON_WAIT_UNTIL, 0));
+       radeon_ring_write(rdev,
+                         RADEON_WAIT_2D_IDLECLEAN);
        while (num_pages > 0) {
                cur_pages = num_pages;
                if (cur_pages > 8191) {
-- 
1.6.3.3


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
--
_______________________________________________
Dri-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dri-devel

Reply via email to