diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2014-04-09 12:26:53 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2014-04-09 12:27:44 +0100 |
commit | 510e5cf3fa4e1db8297be62461b602b13d18d8fc (patch) | |
tree | 050acf546339839fe037a18973e4e0df771c30fd /src | |
parent | f05552cd7a43ea46ac1a37b68b05be2a82abaeb1 (diff) |
sna: Tweak application of WHOLE hint for uploads
This help with the continuing saga of
commit 1de1104064b5898cbed37e836901694a381c1266 [2.99.911]
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date: Fri Feb 21 22:43:04 2014 +0000
sna: Use a hint to do whole image uploads inplace
References: https://bugs.freedesktop.org/show_bug.cgi?id=77178
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src')
-rw-r--r-- | src/sna/sna.h | 7 | ||||
-rw-r--r-- | src/sna/sna_accel.c | 33 |
2 files changed, 17 insertions, 23 deletions
diff --git a/src/sna/sna.h b/src/sna/sna.h index 3d0b1cfa..3d4792ca 100644 --- a/src/sna/sna.h +++ b/src/sna/sna.h @@ -648,6 +648,13 @@ box_inplace(PixmapPtr pixmap, const BoxRec *box) } static inline bool +whole_pixmap_inplace(PixmapPtr pixmap) +{ + struct sna *sna = to_sna_from_pixmap(pixmap); + return ((int)pixmap->drawable.width * (int)pixmap->drawable.height * pixmap->drawable.bitsPerPixel >> 12) >= sna->kgem.half_cpu_cache_pages; +} + +static inline bool region_subsumes_drawable(RegionPtr region, DrawablePtr drawable) { const BoxRec *extents; diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c index 9f455455..10bb1f4f 100644 --- a/src/sna/sna_accel.c +++ b/src/sna/sna_accel.c @@ -2494,37 +2494,23 @@ sna_drawable_move_region_to_cpu(DrawablePtr drawable, if (USE_INPLACE && (priv->create & KGEM_CAN_CREATE_LARGE || ((flags & (MOVE_READ | MOVE_ASYNC_HINT)) == 0 && - (priv->flush || box_inplace(pixmap, ®ion->extents))))) { + (priv->flush || box_inplace(pixmap, ®ion->extents))) || + (flags & MOVE_WHOLE_HINT && whole_pixmap_inplace(pixmap)))) { DBG(("%s: marking for inplace hint (%d, %d)\n", __FUNCTION__, priv->flush, box_inplace(pixmap, ®ion->extents))); flags |= MOVE_INPLACE_HINT; } - 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)) { - DBG(("%s: promoting to whole CPU migration (GPU damage? %d, CPU damage? %d), read? %d, write? %d, whole? %d, can-create-gpu? %d\n", - __FUNCTION__, priv->gpu_damage != NULL, priv->cpu_damage != NULL, flags & MOVE_READ, flags & MOVE_WRITE, flags & MOVE_WHOLE_HINT, priv->create & KGEM_CAN_CREATE_GPU)); - 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)); - RegionTranslate(region, dx, dy); - } - - if (region_subsumes_drawable(region, &pixmap->drawable)) { - DBG(("%s: region (%d, %d), (%d, %d) subsumes pixmap (%dx%d)\n", + if (region_subsumes_pixmap(region, pixmap)) { + DBG(("%s: region (%d, %d), (%d, %d) + (%d, %d) subsumes pixmap (%dx%d)\n", __FUNCTION__, region->extents.x1, region->extents.y1, region->extents.x2, region->extents.y2, + get_drawable_dx(drawable), get_drawable_dy(drawable), pixmap->drawable.width, pixmap->drawable.height)); - if (dx | dy) - RegionTranslate(region, -dx, -dy); return _sna_pixmap_move_to_cpu(pixmap, flags); } @@ -2537,18 +2523,19 @@ sna_drawable_move_region_to_cpu(DrawablePtr drawable, region->extents.y2, pixmap->drawable.width, pixmap->drawable.height)); - if (dx | dy) - RegionTranslate(region, -dx, -dy); return _sna_pixmap_move_to_cpu(pixmap, flags | MOVE_READ); } if (priv->move_to_gpu && !priv->move_to_gpu(sna, priv, MOVE_READ)) { DBG(("%s: move-to-gpu override failed\n", __FUNCTION__)); - if (dx | dy) - RegionTranslate(region, -dx, -dy); return false; } + if (get_drawable_deltas(drawable, pixmap, &dx, &dy)) { + DBG(("%s: delta=(%d, %d)\n", __FUNCTION__, dx, dy)); + RegionTranslate(region, dx, dy); + } + if (USE_INPLACE && operate_inplace(priv, flags) && region_inplace(sna, pixmap, region, priv, flags) && |