summaryrefslogtreecommitdiff
path: root/src/sna
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2013-08-10 08:59:33 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2013-08-10 08:59:33 +0100
commit4d5483c253a9a29f54f2eed9b40623c8e9de6c22 (patch)
tree70d59c375cf552f9df037efa97eb7d8274d07afe /src/sna
parentde379943b49b94cc065fd55ad7ca1067e1802a31 (diff)
sna: Tune pixmap_inplace() not to use a pinned busy GPU bo for replacement
Obviously we can only replace the bo if it is not pinned and so just incur a stall when we could have instead rerouted the rendering through its CPU bo. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna')
-rw-r--r--src/sna/sna_accel.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 040c0093..04b063c1 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -1406,6 +1406,7 @@ static inline bool has_coherent_map(struct sna *sna,
struct kgem_bo *bo,
unsigned flags)
{
+ assert(bo);
assert(bo->map);
if (!IS_CPU_MAP(bo->map))
@@ -1446,10 +1447,13 @@ static inline bool pixmap_inplace(struct sna *sna,
if (wedged(sna) && !priv->pinned)
return false;
- if (priv->gpu_damage &&
- (priv->clear || (flags & MOVE_READ) == 0) &&
- kgem_bo_is_busy(priv->gpu_bo))
- return false;
+ if (priv->gpu_bo && kgem_bo_is_busy(priv->gpu_bo)) {
+ if ((flags & (MOVE_WRITE | MOVE_READ)) == (MOVE_WRITE | MOVE_READ))
+ return false;
+
+ if ((flags & MOVE_READ) == 0)
+ return !priv->pinned;
+ }
if (priv->mapped)
return has_coherent_map(sna, priv->gpu_bo, flags);
@@ -1845,8 +1849,8 @@ _sna_pixmap_move_to_cpu(PixmapPtr pixmap, unsigned int flags)
DBG(("%s: no readbck, discarding gpu damage [%d], pending clear[%d]\n",
__FUNCTION__, priv->gpu_damage != NULL, priv->clear));
- if (priv->create & KGEM_CAN_CREATE_GPU &&
- pixmap_inplace(sna, pixmap, priv, true) &&
+ if ((priv->gpu_bo || priv->create & KGEM_CAN_CREATE_GPU) &&
+ pixmap_inplace(sna, pixmap, priv, flags) &&
sna_pixmap_create_mappable_gpu(pixmap, true)) {
DBG(("%s: write inplace\n", __FUNCTION__));
assert(priv->cow == NULL || (flags & MOVE_WRITE) == 0);