sna: Promote an unattached pixmap to the GPU for inplace copies

If we would prefer to perform the copy on the GPU and if the pixmap is
virgin, create a GPU bo for the operation.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2011-12-24 09:32:18 +00:00
parent 8c0e7ff5ac
commit efc8d04fc1
1 changed files with 5 additions and 1 deletions

View File

@ -2379,9 +2379,13 @@ sna_copy_boxes(DrawablePtr src, DrawablePtr dst, GCPtr gc,
src_priv ? src_priv->cpu_bo : NULL,
replaces));
if (replaces)
sna_damage_destroy(&dst_priv->cpu_damage);
/* Try to maintain the data on the GPU */
if (dst_priv && dst_priv->gpu_bo == NULL &&
src_priv && (src_priv->gpu_bo != NULL || (src_priv->cpu_bo && kgem_bo_is_busy(src_priv->cpu_bo)))) {
((dst_priv->cpu_damage == NULL && copy_use_gpu_bo(sna, dst_priv, &region)) ||
(src_priv && (src_priv->gpu_bo != NULL || (src_priv->cpu_bo && kgem_bo_is_busy(src_priv->cpu_bo)))))) {
uint32_t tiling = sna_pixmap_choose_tiling(dst_pixmap);
DBG(("%s: create dst GPU bo for upload\n", __FUNCTION__));