From f68a99a55e1e63d7e76a13a7b77b4bb3f7802b9e Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Thu, 22 Dec 2011 15:04:22 +0000 Subject: [PATCH] sna: Mark fresh GPU only bo as being all damaged Presume that we will not fallback and so treat a GPU only bo (one that is initially created on the GPU) as being all-damaged. This makes future operations cheaper as the damage tracking overhead is much reduced, and the cost of the first readback will mainly be in the synchronisation overhead. Signed-off-by: Chris Wilson --- src/sna/sna_accel.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c index 27fd3546..8756fab3 100644 --- a/src/sna/sna_accel.c +++ b/src/sna/sna_accel.c @@ -1347,6 +1347,18 @@ sna_pixmap_move_to_gpu(PixmapPtr pixmap) assert(list_is_empty(&priv->list)); return NULL; } + + if (priv->cpu_damage == NULL) { + /* Presume that we will only ever write to the GPU + * bo. Readbacks are expensive but fairly constant + * in cost for all sizes i.e. it is the act of + * synchronisation that takes the most time. This is + * mitigated by avoiding fallbacks in the first place. + */ + sna_damage_all(&priv->gpu_damage, + pixmap->drawable.width, + pixmap->drawable.height); + } } if (priv->cpu_damage == NULL)