diff options
author | Xiang, Haihao <haihao.xiang@intel.com> | 2008-09-27 11:01:24 +0800 |
---|---|---|
committer | Xiang, Haihao <haihao.xiang@intel.com> | 2008-09-27 11:01:24 +0800 |
commit | 073cb5ee1d12a7f1a18b7d732f346c16eb740f49 (patch) | |
tree | f6434feb84c46640cab0db29ddddc76b1d5b3ea9 /libdrm | |
parent | 2db8e0c8ef8c7a66460fceda129533b364f6418c (diff) |
intel: Copy data from card memory back to backing store when mapping.
Fixes http://bugs.freedesktop.org/show_bug.cgi?id=17705
Diffstat (limited to 'libdrm')
-rw-r--r-- | libdrm/intel/intel_bufmgr_fake.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/libdrm/intel/intel_bufmgr_fake.c b/libdrm/intel/intel_bufmgr_fake.c index a5b183aa..b9c3c87c 100644 --- a/libdrm/intel/intel_bufmgr_fake.c +++ b/libdrm/intel/intel_bufmgr_fake.c @@ -448,9 +448,9 @@ static void free_block(dri_bufmgr_fake *bufmgr_fake, struct block *block) return; bo_fake = (dri_bo_fake *)block->bo; - if (!(bo_fake->flags & BM_NO_BACKING_STORE) && (bo_fake->card_dirty == 1)) { + if (!(bo_fake->flags & (BM_PINNED | BM_NO_BACKING_STORE)) && (bo_fake->card_dirty == 1)) { memcpy(bo_fake->backing_store, block->virtual, block->bo->size); - bo_fake->card_dirty = 1; + bo_fake->card_dirty = 0; bo_fake->dirty = 1; } @@ -944,6 +944,11 @@ dri_fake_bo_map(dri_bo *bo, int write_enable) if (bo_fake->backing_store == 0) alloc_backing_store(bo); + if ((bo_fake->card_dirty == 1) && bo_fake->block) { + memcpy(bo_fake->backing_store, bo_fake->block->virtual, bo_fake->block->bo->size); + bo_fake->card_dirty = 0; + } + bo->virtual = bo_fake->backing_store; } } |