summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2008-10-16 10:52:53 +1000
committerDave Airlie <airlied@redhat.com>2008-10-16 10:52:53 +1000
commitb18e6b0a0d9ef6902e4be1809ba710200f4c37be (patch)
treef551f0c3f643bf0d1baffb10b2c1c54bfb9dbeba
parent3e3280eccc38cd080cbab7b471aad1b9cd12fd1b (diff)
radeon: fix buffer copying for VRAM->TT
-rw-r--r--linux-core/radeon_buffer.c28
1 files changed, 19 insertions, 9 deletions
diff --git a/linux-core/radeon_buffer.c b/linux-core/radeon_buffer.c
index c375100c..9090000e 100644
--- a/linux-core/radeon_buffer.c
+++ b/linux-core/radeon_buffer.c
@@ -306,22 +306,32 @@ static int radeon_move_flip(struct drm_buffer_object * bo,
int ret;
tmp_mem = *new_mem;
- tmp_mem.mm_node = NULL;
- tmp_mem.proposed_flags = DRM_BO_FLAG_MEM_TT;
- ret = drm_bo_mem_space(bo, &tmp_mem, no_wait);
- if (ret)
- return ret;
+ /* if we are flipping into LOCAL memory we have no TTM so create one */
+ if (new_mem->mem_type == DRM_BO_MEM_LOCAL) {
+ tmp_mem.mm_node = NULL;
+ tmp_mem.proposed_flags = DRM_BO_FLAG_MEM_TT;
- ret = drm_ttm_bind(bo->ttm, &tmp_mem);
- if (ret)
- goto out_cleanup;
+ ret = drm_bo_mem_space(bo, &tmp_mem, no_wait);
+ if (ret)
+ return ret;
+
+ ret = drm_ttm_bind(bo->ttm, &tmp_mem);
+ if (ret)
+ goto out_cleanup;
+ }
ret = radeon_move_blit(bo, 1, no_wait, &tmp_mem, &bo->mem);
if (ret)
goto out_cleanup;
- ret = drm_bo_move_ttm(bo, evict, no_wait, new_mem);
+ if (new_mem->mem_type == DRM_BO_MEM_LOCAL) {
+ ret = drm_bo_move_ttm(bo, evict, no_wait, new_mem);
+ } else {
+ tmp_mem.mm_node = NULL;
+ new_mem->mm_node = NULL;
+ }
+
out_cleanup:
if (tmp_mem.mm_node) {
mutex_lock(&dev->struct_mutex);