drm/radeon/kms: fix coherency issues on AGP cards.
authorDave Airlie <airlied@redhat.com>
Fri, 30 Oct 2009 03:31:26 +0000 (13:31 +1000)
committerDave Airlie <airlied@redhat.com>
Tue, 3 Nov 2009 23:53:14 +0000 (09:53 +1000)
When we are evicting from VRAM->RAM we allocate the ttm object,
but we don't set the caching policy on it before blitting into it.
This means on AGP we end up blitting into cached pages, and
the CPU later flushes out on top of them. This was mostly seen as
font corruption.

The other question is why we don't evict VRAM->GTT in a lot of cases,
this would save us some cache transitions since a lot of objects
that are evicted from VRAM will probably end up being pulled back in
a few operations later, and evicting them to system memory involves
2 unnecessary cache transitions.

Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/radeon/radeon_ttm.c
drivers/gpu/drm/ttm/ttm_tt.c

index c729cd1a750662c22f77074bcb990dfdb8372eba..f489c0de6f1330ed3596f1d06d8a99461f1f483e 100644 (file)
@@ -295,6 +295,12 @@ static int radeon_move_vram_ram(struct ttm_buffer_object *bo,
        if (unlikely(r)) {
                return r;
        }
+
+       r = ttm_tt_set_placement_caching(bo->ttm, tmp_mem.placement);
+       if (unlikely(r)) {
+               goto out_cleanup;
+       }
+
        r = ttm_tt_bind(bo->ttm, &tmp_mem);
        if (unlikely(r)) {
                goto out_cleanup;
index a55ee1a56c167a0dde9c53fc492deee1a61096bc..7bcb89f39ce8912b79d565e8b60228e542a08301 100644 (file)
@@ -279,6 +279,7 @@ int ttm_tt_set_placement_caching(struct ttm_tt *ttm, uint32_t placement)
 
        return ttm_tt_set_caching(ttm, state);
 }
+EXPORT_SYMBOL(ttm_tt_set_placement_caching);
 
 static void ttm_tt_free_alloced_pages(struct ttm_tt *ttm)
 {