From 073cb5ee1d12a7f1a18b7d732f346c16eb740f49 Mon Sep 17 00:00:00 2001 From: "Xiang, Haihao" Date: Sat, 27 Sep 2008 11:01:24 +0800 Subject: intel: Copy data from card memory back to backing store when mapping. Fixes http://bugs.freedesktop.org/show_bug.cgi?id=17705 --- libdrm/intel/intel_bufmgr_fake.c | 9 +++++++-- 1 file 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; } } -- cgit v1.2.3