summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Hellstrom <thellstrom@vmware.com>2018-08-21 13:30:53 +0200
committerThomas Hellstrom <thellstrom@vmware.com>2018-08-27 15:04:09 +0200
commitb2ebf342b7e088c9ddfa017a63a13eaa10800920 (patch)
tree253d39d98dda9c59a8cd6f8b1f2170fef6d7c2b1
parent98ad631db98d8538f4ccd230a83cb3ff5805ceb1 (diff)
vmwgfx: Modify the resource validation interface
Allow selecting interruptible or uninterruptible waits to match expectations of callers. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Deepak Rawat <drawat@vmware.com> Reviewed-by: Sinclair Yeh <syeh@vmware.com>
-rw-r--r--vmwgfx_drv.h2
-rw-r--r--vmwgfx_execbuf.c2
-rw-r--r--vmwgfx_kms.c2
-rw-r--r--vmwgfx_resource.c13
-rw-r--r--vmwgfx_validation.c2
5 files changed, 12 insertions, 9 deletions
diff --git a/vmwgfx_drv.h b/vmwgfx_drv.h
index 6ae819f..6e1129b 100644
--- a/vmwgfx_drv.h
+++ b/vmwgfx_drv.h
@@ -627,7 +627,7 @@ extern void vmw_resource_unreference(struct vmw_resource **p_res);
extern struct vmw_resource *vmw_resource_reference(struct vmw_resource *res);
extern struct vmw_resource *
vmw_resource_reference_unless_doomed(struct vmw_resource *res);
-extern int vmw_resource_validate(struct vmw_resource *res);
+extern int vmw_resource_validate(struct vmw_resource *res, bool intr);
extern int vmw_resource_reserve(struct vmw_resource *res, bool interruptible,
bool no_backup);
extern bool vmw_resource_needs_backup(const struct vmw_resource *res);
diff --git a/vmwgfx_execbuf.c b/vmwgfx_execbuf.c
index baa6d43..77d0738 100644
--- a/vmwgfx_execbuf.c
+++ b/vmwgfx_execbuf.c
@@ -659,7 +659,7 @@ static int vmw_resources_validate(struct vmw_sw_context *sw_context)
struct vmw_resource *res = val->res;
struct vmw_buffer_object *backup = res->backup;
- ret = vmw_resource_validate(res);
+ ret = vmw_resource_validate(res, true);
if (unlikely(ret != 0)) {
if (ret != -ERESTARTSYS)
DRM_ERROR("Failed to validate resource.\n");
diff --git a/vmwgfx_kms.c b/vmwgfx_kms.c
index b2b652a..dbcb137 100644
--- a/vmwgfx_kms.c
+++ b/vmwgfx_kms.c
@@ -2774,7 +2774,7 @@ int vmw_kms_helper_resource_prepare(struct vmw_resource *res,
ctx->buf = vmw_bo_reference(res->backup);
}
- ret = vmw_resource_validate(res);
+ ret = vmw_resource_validate(res, interruptible);
if (ret)
goto out_revert;
return 0;
diff --git a/vmwgfx_resource.c b/vmwgfx_resource.c
index bf89fce..a365a68 100644
--- a/vmwgfx_resource.c
+++ b/vmwgfx_resource.c
@@ -579,15 +579,18 @@ out_no_unbind:
/**
* vmw_resource_validate - Make a resource up-to-date and visible
* to the device.
- *
- * @res: The resource to make visible to the device.
+ * @res: The resource to make visible to the device.
+ * @intr: Perform waits interruptible if possible.
*
* On succesful return, any backup DMA buffer pointed to by @res->backup will
* be reserved and validated.
* On hardware resource shortage, this function will repeatedly evict
* resources of the same type until the validation succeeds.
+ *
+ * Return: Zero on success, -ERESTARTSYS if interrupted, negative error code
+ * on failure.
*/
-int vmw_resource_validate(struct vmw_resource *res)
+int vmw_resource_validate(struct vmw_resource *res, bool intr)
{
int ret;
struct vmw_resource *evict_res;
@@ -625,7 +628,7 @@ int vmw_resource_validate(struct vmw_resource *res)
write_unlock(&dev_priv->resource_lock);
/* Trylock backup buffers with a NULL ticket. */
- ret = vmw_resource_do_evict(NULL, evict_res, true);
+ ret = vmw_resource_do_evict(NULL, evict_res, intr);
if (unlikely(ret != 0)) {
write_lock(&dev_priv->resource_lock);
list_add_tail(&evict_res->lru_head, lru_list);
@@ -905,7 +908,7 @@ int vmw_resource_pin(struct vmw_resource *res, bool interruptible)
/* Do we really need to pin the MOB as well? */
vmw_bo_pin_reserved(vbo, true);
}
- ret = vmw_resource_validate(res);
+ ret = vmw_resource_validate(res, interruptible);
if (vbo)
ttm_bo_unreserve(&vbo->base);
if (ret)
diff --git a/vmwgfx_validation.c b/vmwgfx_validation.c
index 3033b1b..329ad8a 100644
--- a/vmwgfx_validation.c
+++ b/vmwgfx_validation.c
@@ -472,7 +472,7 @@ int vmw_validation_res_validate(struct vmw_validation_context *ctx, bool intr)
struct vmw_resource *res = val->res;
struct vmw_buffer_object *backup = res->backup;
- ret = vmw_resource_validate(res);
+ ret = vmw_resource_validate(res, intr);
if (ret) {
if (ret != -ERESTARTSYS)
DRM_ERROR("Failed to validate resource.\n");