return dst;
}
-bool kgem_bo_convert_to_gpu(struct kgem *kgem, struct kgem_bo *bo)
+bool kgem_bo_convert_to_gpu(struct kgem *kgem,
+ struct kgem_bo *bo,
+ unsigned flags)
{
- DBG(("%s: converting handle=%d from CPU to GPU\n", __FUNCTION__, bo->handle));
+ DBG(("%s: converting handle=%d from CPU to GPU, flags=%x\n", __FUNCTION__, bo->handle));
assert(bo->tiling == I915_TILING_NONE);
if (kgem->has_llc)
return true;
+ if (flags & MOVE_ASYNC_HINT && __kgem_bo_is_busy(kgem, bo))
+ return false;
+
assert(bo->snoop);
kgem_bo_submit(kgem, bo);
int bpp,
uint32_t flags);
-bool kgem_bo_convert_to_gpu(struct kgem *kgem, struct kgem_bo *bo);
+bool kgem_bo_convert_to_gpu(struct kgem *kgem,
+ struct kgem_bo *bo,
+ unsigned flags);
uint32_t kgem_bo_get_binding(struct kgem_bo *bo, uint32_t format);
void kgem_bo_set_binding(struct kgem_bo *bo, uint32_t format, uint16_t offset);
if (tiling == I915_TILING_NONE &&
priv->cpu_bo && !priv->shm &&
- kgem_bo_convert_to_gpu(&sna->kgem, priv->cpu_bo)) {
+ kgem_bo_convert_to_gpu(&sna->kgem, priv->cpu_bo, flags)) {
assert(!priv->mapped);
assert(!IS_STATIC_PTR(priv->ptr));
#ifdef DEBUG_MEMORY
if (priv->cpu_damage == NULL)
goto done;
+ if (DAMAGE_IS_ALL(priv->cpu_damage) &&
+ priv->gpu_bo->tiling == I915_TILING_NONE &&
+ priv->cpu_bo && !priv->shm &&
+ kgem_bo_convert_to_gpu(&sna->kgem, priv->cpu_bo, flags)) {
+ assert(!priv->mapped);
+ assert(!IS_STATIC_PTR(priv->ptr));
+#ifdef DEBUG_MEMORY
+ sna->debug_memory.cpu_bo_allocs--;
+ sna->debug_memory.cpu_bo_bytes -= kgem_bo_size(priv->cpu_bo);
+#endif
+ sna_pixmap_free_gpu(sna, priv);
+ priv->gpu_bo = priv->cpu_bo;
+ priv->cpu_bo = NULL;
+ priv->ptr = NULL;
+ pixmap->devPrivate.ptr = NULL;
+ sna_damage_all(&priv->gpu_damage,
+ pixmap->drawable.width,
+ pixmap->drawable.height);
+ sna_damage_destroy(&priv->cpu_damage);
+ goto done;
+ }
+
if (priv->shm) {
assert(!priv->flush);
sna_add_flush_pixmap(sna, priv, priv->cpu_bo);