/* * Copyright 2013 Red Hat Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Authors: Dave Airlie * Alon Levy
*/
/* * Reserve the BO before pinning the object. If the BO was reserved * beforehand, use the internal version directly qxl_bo_pin_locked. *
*/ int qxl_bo_pin(struct qxl_bo *bo)
{ int r;
r = qxl_bo_reserve(bo); if (r) return r;
r = qxl_bo_pin_locked(bo);
qxl_bo_unreserve(bo); return r;
}
/* * Reserve the BO before pinning the object. If the BO was reserved * beforehand, use the internal version directly qxl_bo_unpin_locked. *
*/ int qxl_bo_unpin(struct qxl_bo *bo)
{ int r;
if (list_empty(&qdev->gem.objects)) return;
dev_err(qdev->ddev.dev, "Userspace still has active objects !\n");
list_for_each_entry_safe(bo, n, &qdev->gem.objects, list) {
dev_err(qdev->ddev.dev, "%p %p %lu %lu force free\n",
&bo->tbo.base, bo, (unsignedlong)bo->tbo.base.size,
*((unsignedlong *)&bo->tbo.base.refcount));
mutex_lock(&qdev->gem.mutex);
list_del_init(&bo->list);
mutex_unlock(&qdev->gem.mutex); /* this should unref the ttm bo */
drm_gem_object_put(&bo->tbo.base);
}
}
int qxl_bo_init(struct qxl_device *qdev)
{ return qxl_ttm_init(qdev);
}
int qxl_bo_check_id(struct qxl_device *qdev, struct qxl_bo *bo)
{ int ret;
if (bo->type == QXL_GEM_DOMAIN_SURFACE && bo->surface_id == 0) { /* allocate a surface id for this surface now */
ret = qxl_surface_id_alloc(qdev, bo); if (ret) return ret;
ret = qxl_hw_surface_alloc(qdev, bo); if (ret) return ret;
} return 0;
}
int qxl_surf_evict(struct qxl_device *qdev)
{ struct ttm_resource_manager *man;
man = ttm_manager_type(&qdev->mman.bdev, TTM_PL_PRIV); return ttm_resource_manager_evict_all(&qdev->mman.bdev, man);
}
int qxl_vram_evict(struct qxl_device *qdev)
{ struct ttm_resource_manager *man;
man = ttm_manager_type(&qdev->mman.bdev, TTM_PL_VRAM); return ttm_resource_manager_evict_all(&qdev->mman.bdev, man);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.