From dad50881d545da665191c6681f2acd0ebc3ddbfc Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Thu, 14 Mar 2013 14:53:13 +0000 Subject: sna: Consider placement hints when choosing userptr read path Signed-off-by: Chris Wilson --- src/sna/sna_accel.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c index dfb160b4..19fe1e30 100644 --- a/src/sna/sna_accel.c +++ b/src/sna/sna_accel.c @@ -13468,7 +13468,8 @@ static int sna_create_gc(GCPtr gc) static bool sna_get_image_blt(DrawablePtr drawable, RegionPtr region, - char *dst) + char *dst, + unsigned flags) { PixmapPtr pixmap = get_drawable_pixmap(drawable); struct sna_pixmap *priv = sna_pixmap(pixmap); @@ -13477,9 +13478,6 @@ sna_get_image_blt(DrawablePtr drawable, bool ok = false; int pitch; - if (!USE_USERPTR_DOWNLOADS) - return false; - if (priv == NULL) return false; @@ -13503,7 +13501,10 @@ sna_get_image_blt(DrawablePtr drawable, return true; } - if (!sna->kgem.has_userptr) + if (!sna->kgem.has_userptr || !USE_USERPTR_DOWNLOADS) + return false; + + if (flags & (MOVE_WHOLE_HINT | MOVE_INPLACE_HINT)) return false; if (priv->gpu_damage == NULL) @@ -13575,14 +13576,15 @@ sna_get_image(DrawablePtr drawable, drawable->bitsPerPixel >= 8 && PM_IS_SOLID(drawable, mask); - if (can_blt && sna_get_image_blt(drawable, ®ion, dst)) - return; - flags = MOVE_READ; if ((w | h) == 1) flags |= MOVE_INPLACE_HINT; if (w == drawable->width) flags |= MOVE_WHOLE_HINT; + + if (can_blt && sna_get_image_blt(drawable, ®ion, dst, flags)) + return; + if (!sna_drawable_move_region_to_cpu(drawable, ®ion, flags)) return; -- cgit v1.2.3