summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Hellstrom2013-11-18 08:30:38 +0100
committerThomas Hellstrom2013-11-20 12:43:28 +0100
commit0bc254257bfd9b25f64a68b719ee70a303b6d051 (patch)
treea0ee8aa093f279b1c21af6f8c467767b950ddadd
parentdrm: check for !kdev in drm_unplug_minor() (diff)
downloadkernel-qcow2-linux-0bc254257bfd9b25f64a68b719ee70a303b6d051.tar.gz
kernel-qcow2-linux-0bc254257bfd9b25f64a68b719ee70a303b6d051.tar.xz
kernel-qcow2-linux-0bc254257bfd9b25f64a68b719ee70a303b6d051.zip
drm/ttm: Don't move non-existing data
If ttm_bo_move_memcpy was instructed to move a non-populated ttm to io memory, it would first populate the ttm, then move the data and then destroy the ttm. That's stupid. However, some drivers might have relied on this to clear io memory from old stuff. So instead of a NOP, which would be the most efficient, just clear the destination. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
-rw-r--r--drivers/gpu/drm/ttm/ttm_bo_util.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c
index 4834c463c38b..15b86a94949d 100644
--- a/drivers/gpu/drm/ttm/ttm_bo_util.c
+++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
@@ -350,10 +350,13 @@ int ttm_bo_move_memcpy(struct ttm_buffer_object *bo,
goto out2;
/*
- * Move nonexistent data. NOP.
+ * Don't move nonexistent data. Clear destination instead.
*/
- if (old_iomap == NULL && ttm == NULL)
+ if (old_iomap == NULL &&
+ (ttm == NULL || ttm->state == tt_unpopulated)) {
+ memset_io(new_iomap, 0, new_mem->num_pages*PAGE_SIZE);
goto out2;
+ }
/*
* TTM might be null for moves within the same region.