summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
diff options
context:
space:
mode:
authorThomas Hellstrom <thellstrom@vmware.com>2015-06-26 02:03:53 -0700
committerThomas Hellstrom <thellstrom@vmware.com>2015-08-05 14:01:08 +0200
commit1a4b172ac96edd7f571772e83c09c5a18718a4fa (patch)
tree9df78f20167a9d71299b367c71438e6f24cb1fe7 /drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
parent459d0fa7359654e5e076e84fc58512f00f70fee9 (diff)
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 <thellstrom@vmware.com> Reviewed-by: Sinclair Yeh <syeh@vmware.com>
Diffstat (limited to 'drivers/gpu/drm/vmwgfx/vmwgfx_resource.c')
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_resource.c18
1 files changed, 10 insertions, 8 deletions
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);