sna: Always reset the source counter after rendering to with the CPU

The goal is to avoid moving to the GPU too early for a frequently
modified CPU buffer.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2012-03-12 20:34:42 +00:00
parent 7bde1f55a1
commit 1e2d6ee31a
2 changed files with 7 additions and 4 deletions

View File

@ -1061,11 +1061,12 @@ skip_inplace_map:
if (priv->flush)
list_move(&priv->list, &sna->dirty_pixmaps);
priv->source_count = SOURCE_BIAS;
}
done:
if (flags & MOVE_WRITE)
priv->source_count = SOURCE_BIAS;
if ((flags & MOVE_ASYNC_HINT) == 0 && priv->cpu_bo) {
DBG(("%s: syncing CPU bo\n", __FUNCTION__));
kgem_bo_sync__cpu(&sna->kgem, priv->cpu_bo);
@ -1580,6 +1581,8 @@ done:
RegionTranslate(region, -dx, -dy);
out:
if (flags & MOVE_WRITE)
priv->source_count = SOURCE_BIAS;
if (priv->cpu_bo) {
DBG(("%s: syncing cpu bo\n", __FUNCTION__));
kgem_bo_sync__cpu(&sna->kgem, priv->cpu_bo);

View File

@ -393,10 +393,10 @@ move_to_gpu(PixmapPtr pixmap, const BoxRec *box)
pixmap->drawable.bitsPerPixel) == I915_TILING_NONE)
upload = priv->source_count++ > SOURCE_BIAS;
DBG(("%s: migrating whole pixmap (%dx%d) for source (%d,%d),(%d,%d)? %d\n",
DBG(("%s: migrating whole pixmap (%dx%d) for source (%d,%d),(%d,%d), count %d? %d\n",
__FUNCTION__,
pixmap->drawable.width, pixmap->drawable.height,
box->x1, box->y1, box->x2, box->y2,
box->x1, box->y1, box->x2, box->y2, priv->source_count,
upload));
return upload;
}