From 5db8717b8d9f089412b9a7529725c9c41e3e44fb Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Tue, 8 Apr 2014 18:00:47 +0100 Subject: [PATCH] sna: Refactor 3 similar CPU migration promotion checks into one References: https://bugs.freedesktop.org/show_bug.cgi?id=77178 Signed-off-by: Chris Wilson --- src/sna/sna_accel.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c index 55eef79..8abfdd0 100644 --- a/src/sna/sna_accel.c +++ b/src/sna/sna_accel.c @@ -2500,16 +2500,11 @@ sna_drawable_move_region_to_cpu(DrawablePtr drawable, flags |= MOVE_INPLACE_HINT; } - if ((flags & (MOVE_WHOLE_HINT | MOVE_READ)) == (MOVE_WHOLE_HINT | MOVE_READ)) - return _sna_pixmap_move_to_cpu(pixmap, flags); - - if (flags & MOVE_WHOLE_HINT && priv->gpu_damage == NULL && priv->cpu_damage == NULL) - return _sna_pixmap_move_to_cpu(pixmap, flags); - - if (priv->gpu_damage == NULL && - (priv->create & KGEM_CAN_CREATE_GPU) == 0 && - flags & MOVE_WRITE) - return _sna_pixmap_move_to_cpu(pixmap, flags); + if (flags & MOVE_READ || (priv->gpu_damage == NULL && priv->cpu_damage == NULL)) { + if (flags & MOVE_WHOLE_HINT || + (flags & MOVE_WRITE && (priv->create & KGEM_CAN_CREATE_GPU) == 0)) + return _sna_pixmap_move_to_cpu(pixmap, flags); + } if (get_drawable_deltas(drawable, pixmap, &dx, &dy)) { DBG(("%s: delta=(%d, %d)\n", __FUNCTION__, dx, dy)); -- 1.9.1