From ccee730e45d8c2490e578d0b85d9e76f3a44f76f Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Sat, 26 Nov 2011 16:47:04 +0000 Subject: [PATCH] sna: Discard the gpu-bo is the entire pixmap is written to by the CPU. Signed-off-by: Chris Wilson --- src/sna/sna_accel.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c index 03020c93..1cb79b8b 100644 --- a/src/sna/sna_accel.c +++ b/src/sna/sna_accel.c @@ -741,6 +741,12 @@ done: DBG(("%s: applying cpu damage\n", __FUNCTION__)); assert_pixmap_contains_box(pixmap, RegionExtents(region)); sna_damage_add(&priv->cpu_damage, region); + if (sna_damage_is_all(&priv->cpu_damage, + pixmap->drawable.width, + pixmap->drawable.height)) { + DBG(("%s: replaced entire pixmap\n", __FUNCTION__)); + sna_pixmap_destroy_gpu_bo(sna, priv); + } if (priv->flush) list_move(&priv->list, &sna->dirty_pixmaps); }