summaryrefslogtreecommitdiff
path: root/vmwgfx_resource.c
diff options
context:
space:
mode:
authorThomas Hellstrom <thellstrom@vmware.com>2015-06-01 00:22:22 -0700
committerThomas Hellstrom <thellstrom@vmware.com>2015-09-07 01:20:11 -0700
commit34598d45dc2a81187d31ea81a2e512f440e152dc (patch)
treea15fc8f0a95a6fa9c6be51404e6b42d739861dbb /vmwgfx_resource.c
parent41fa749e21acfe2409ca7aceeeb5ad3742403951 (diff)
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 'vmwgfx_resource.c')
-rw-r--r--vmwgfx_resource.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/vmwgfx_resource.c b/vmwgfx_resource.c
index 36bc8c5..4688da4 100644
--- a/vmwgfx_resource.c
+++ b/vmwgfx_resource.c
@@ -1289,7 +1289,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;
@@ -1300,7 +1301,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;
}
@@ -1629,14 +1630,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;
@@ -1645,13 +1646,13 @@ int vmw_resource_pin(struct vmw_resource *res)
if (res->backup) {
vbo = res->backup;
- ttm_bo_reserve(&vbo->base, false, false, false,
+ ttm_bo_reserve(&vbo->base, interruptible, false, false,
0);
if (!vbo->pin_count) {
ret = ttm_bo_validate
(&vbo->base,
res->func->backup_placement,
- false, false, false);
+ interruptible, false, false);
if (ret) {
ttm_bo_unreserve(&vbo->base);
goto out_no_validate;
@@ -1693,7 +1694,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);