&new, &new_map);
if (ret)
return ret;
- } else {
+ } else
+ if (!nvbo->user) {
new_sysmem = malloc(bo->size);
}
if (nvbo->fence)
nouveau_fence_wait(&nvbo->fence);
nouveau_mem_free(bo->device, &nvbo->drm, &nvbo->map);
- if (nvbo->sysmem)
+ if (nvbo->sysmem && !nvbo->user)
free(nvbo->sysmem);
nvbo->drm = new;
nvbo->map = new_map;
- nvbo->sysmem = new_sysmem;
+ if (!nvbo->user)
+ nvbo->sysmem = new_sysmem;
bo->flags = flags;
bo->offset = nvbo->drm.offset;
return 0;
if (nvchan->user_charge + bo->size > nvdev->sa.size)
return 1;
- nvchan->user_charge += bo->size;
if (!(flags & NOUVEAU_BO_GART))
return 1;
r = nouveau_bo_tmp(chan, bo->size, fence);
if (!r)
return 1;
+ nvchan->user_charge += bo->size;
memcpy(nvdev->sa_map + r->start, nvbo->sysmem, bo->size);