From 1a4b172ac96edd7f571772e83c09c5a18718a4fa Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Fri, 26 Jun 2015 02:03:53 -0700 Subject: drm/vmwgfx: Add kms helpers for dirty- and readback functions We need to make the dirty- and readback functions callable without a struct drm_file pointer. We also need to unify the handling of dirty- and readback cliprects that are now implemented in various places across the kms system, som add helpers to facilitate this. Signed-off-by: Thomas Hellstrom Reviewed-by: Sinclair Yeh --- drivers/gpu/drm/vmwgfx/vmwgfx_resource.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'drivers/gpu/drm/vmwgfx/vmwgfx_resource.c') diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c index 271bc900d83a..521f1947b4e9 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c @@ -1259,7 +1259,8 @@ out_no_reserve: * the buffer may not be bound to the resource at this point. * */ -int vmw_resource_reserve(struct vmw_resource *res, bool no_backup) +int vmw_resource_reserve(struct vmw_resource *res, bool interruptible, + bool no_backup) { struct vmw_private *dev_priv = res->dev_priv; int ret; @@ -1270,7 +1271,7 @@ int vmw_resource_reserve(struct vmw_resource *res, bool no_backup) if (res->func->needs_backup && res->backup == NULL && !no_backup) { - ret = vmw_resource_buf_alloc(res, true); + ret = vmw_resource_buf_alloc(res, interruptible); if (unlikely(ret != 0)) return ret; } @@ -1584,14 +1585,14 @@ void vmw_resource_evict_all(struct vmw_private *dev_priv) * its id will never change as long as there is a pin reference. * This function returns 0 on success and a negative error code on failure. */ -int vmw_resource_pin(struct vmw_resource *res) +int vmw_resource_pin(struct vmw_resource *res, bool interruptible) { struct vmw_private *dev_priv = res->dev_priv; int ret; - ttm_write_lock(&dev_priv->reservation_sem, false); + ttm_write_lock(&dev_priv->reservation_sem, interruptible); mutex_lock(&dev_priv->cmdbuf_mutex); - ret = vmw_resource_reserve(res, false); + ret = vmw_resource_reserve(res, interruptible, false); if (ret) goto out_no_reserve; @@ -1601,12 +1602,13 @@ int vmw_resource_pin(struct vmw_resource *res) if (res->backup) { vbo = res->backup; - ttm_bo_reserve(&vbo->base, false, false, false, NULL); + ttm_bo_reserve(&vbo->base, interruptible, false, false, + NULL); if (!vbo->pin_count) { ret = ttm_bo_validate (&vbo->base, res->func->backup_placement, - false, false); + interruptible, false); if (ret) { ttm_bo_unreserve(&vbo->base); goto out_no_validate; @@ -1649,7 +1651,7 @@ void vmw_resource_unpin(struct vmw_resource *res) ttm_read_lock(&dev_priv->reservation_sem, false); mutex_lock(&dev_priv->cmdbuf_mutex); - ret = vmw_resource_reserve(res, true); + ret = vmw_resource_reserve(res, false, true); WARN_ON(ret); WARN_ON(res->pin_count == 0); -- cgit v1.2.3