diff options
author | Christian König <christian.koenig@amd.com> | 2014-12-03 09:46:48 -0500 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2014-12-03 18:26:52 -0500 |
commit | aa35071c590461f95d0179cc8e730d49d610f773 (patch) | |
tree | 72f9c722700be9a265857bff56f3843c7f0e298d | |
parent | 5e5c21cac1001089007260c48b0c89ebaace0e71 (diff) |
drm/ttm: optionally move duplicates to a separate list
This patch adds an optional list_head parameter to ttm_eu_reserve_buffers.
If specified duplicates in the execbuf list are no longer reported as errors,
but moved to this list instead.
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r-- | drivers/gpu/drm/qxl/qxl_release.c | 3 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_gem.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_object.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/ttm/ttm_execbuf_util.c | 10 | ||||
-rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c | 6 | ||||
-rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_resource.c | 2 | ||||
-rw-r--r-- | include/drm/ttm/ttm_execbuf_util.h | 9 |
7 files changed, 26 insertions, 8 deletions
diff --git a/drivers/gpu/drm/qxl/qxl_release.c b/drivers/gpu/drm/qxl/qxl_release.c index 446e71ca36cb..d9b25684ac98 100644 --- a/drivers/gpu/drm/qxl/qxl_release.c +++ b/drivers/gpu/drm/qxl/qxl_release.c | |||
@@ -264,7 +264,8 @@ int qxl_release_reserve_list(struct qxl_release *release, bool no_intr) | |||
264 | if (list_is_singular(&release->bos)) | 264 | if (list_is_singular(&release->bos)) |
265 | return 0; | 265 | return 0; |
266 | 266 | ||
267 | ret = ttm_eu_reserve_buffers(&release->ticket, &release->bos, !no_intr); | 267 | ret = ttm_eu_reserve_buffers(&release->ticket, &release->bos, |
268 | !no_intr, NULL); | ||
268 | if (ret) | 269 | if (ret) |
269 | return ret; | 270 | return ret; |
270 | 271 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_gem.c b/drivers/gpu/drm/radeon/radeon_gem.c index 6162bd29a598..fe48f229043e 100644 --- a/drivers/gpu/drm/radeon/radeon_gem.c +++ b/drivers/gpu/drm/radeon/radeon_gem.c | |||
@@ -564,7 +564,7 @@ static void radeon_gem_va_update_vm(struct radeon_device *rdev, | |||
564 | if (!vm_bos) | 564 | if (!vm_bos) |
565 | return; | 565 | return; |
566 | 566 | ||
567 | r = ttm_eu_reserve_buffers(&ticket, &list, true); | 567 | r = ttm_eu_reserve_buffers(&ticket, &list, true, NULL); |
568 | if (r) | 568 | if (r) |
569 | goto error_free; | 569 | goto error_free; |
570 | 570 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c index 4ab07473bb28..a4a3ac824b45 100644 --- a/drivers/gpu/drm/radeon/radeon_object.c +++ b/drivers/gpu/drm/radeon/radeon_object.c | |||
@@ -508,7 +508,7 @@ int radeon_bo_list_validate(struct radeon_device *rdev, | |||
508 | u64 bytes_moved = 0, initial_bytes_moved; | 508 | u64 bytes_moved = 0, initial_bytes_moved; |
509 | u64 bytes_moved_threshold = radeon_bo_get_threshold_for_moves(rdev); | 509 | u64 bytes_moved_threshold = radeon_bo_get_threshold_for_moves(rdev); |
510 | 510 | ||
511 | r = ttm_eu_reserve_buffers(ticket, head, true); | 511 | r = ttm_eu_reserve_buffers(ticket, head, true, NULL); |
512 | if (unlikely(r != 0)) { | 512 | if (unlikely(r != 0)) { |
513 | return r; | 513 | return r; |
514 | } | 514 | } |
diff --git a/drivers/gpu/drm/ttm/ttm_execbuf_util.c b/drivers/gpu/drm/ttm/ttm_execbuf_util.c index 8ce508e76208..3820ae97a030 100644 --- a/drivers/gpu/drm/ttm/ttm_execbuf_util.c +++ b/drivers/gpu/drm/ttm/ttm_execbuf_util.c | |||
@@ -93,7 +93,8 @@ EXPORT_SYMBOL(ttm_eu_backoff_reservation); | |||
93 | */ | 93 | */ |
94 | 94 | ||
95 | int ttm_eu_reserve_buffers(struct ww_acquire_ctx *ticket, | 95 | int ttm_eu_reserve_buffers(struct ww_acquire_ctx *ticket, |
96 | struct list_head *list, bool intr) | 96 | struct list_head *list, bool intr, |
97 | struct list_head *dups) | ||
97 | { | 98 | { |
98 | struct ttm_bo_global *glob; | 99 | struct ttm_bo_global *glob; |
99 | struct ttm_validate_buffer *entry; | 100 | struct ttm_validate_buffer *entry; |
@@ -117,6 +118,13 @@ int ttm_eu_reserve_buffers(struct ww_acquire_ctx *ticket, | |||
117 | __ttm_bo_unreserve(bo); | 118 | __ttm_bo_unreserve(bo); |
118 | 119 | ||
119 | ret = -EBUSY; | 120 | ret = -EBUSY; |
121 | |||
122 | } else if (ret == -EALREADY && dups) { | ||
123 | struct ttm_validate_buffer *safe = entry; | ||
124 | entry = list_prev_entry(entry, head); | ||
125 | list_del(&safe->head); | ||
126 | list_add(&safe->head, dups); | ||
127 | continue; | ||
120 | } | 128 | } |
121 | 129 | ||
122 | if (!ret) { | 130 | if (!ret) { |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c index 596cd6dafd33..33176d05db35 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c | |||
@@ -2487,7 +2487,8 @@ int vmw_execbuf_process(struct drm_file *file_priv, | |||
2487 | if (unlikely(ret != 0)) | 2487 | if (unlikely(ret != 0)) |
2488 | goto out_err_nores; | 2488 | goto out_err_nores; |
2489 | 2489 | ||
2490 | ret = ttm_eu_reserve_buffers(&ticket, &sw_context->validate_nodes, true); | 2490 | ret = ttm_eu_reserve_buffers(&ticket, &sw_context->validate_nodes, |
2491 | true, NULL); | ||
2491 | if (unlikely(ret != 0)) | 2492 | if (unlikely(ret != 0)) |
2492 | goto out_err; | 2493 | goto out_err; |
2493 | 2494 | ||
@@ -2677,7 +2678,8 @@ void __vmw_execbuf_release_pinned_bo(struct vmw_private *dev_priv, | |||
2677 | query_val.shared = false; | 2678 | query_val.shared = false; |
2678 | list_add_tail(&query_val.head, &validate_list); | 2679 | list_add_tail(&query_val.head, &validate_list); |
2679 | 2680 | ||
2680 | ret = ttm_eu_reserve_buffers(&ticket, &validate_list, false); | 2681 | ret = ttm_eu_reserve_buffers(&ticket, &validate_list, |
2682 | false, NULL); | ||
2681 | if (unlikely(ret != 0)) { | 2683 | if (unlikely(ret != 0)) { |
2682 | vmw_execbuf_unpin_panic(dev_priv); | 2684 | vmw_execbuf_unpin_panic(dev_priv); |
2683 | goto out_no_reserve; | 2685 | goto out_no_reserve; |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c index 026de7cea0f6..210ef15b1d09 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c | |||
@@ -1222,7 +1222,7 @@ vmw_resource_check_buffer(struct vmw_resource *res, | |||
1222 | val_buf->bo = ttm_bo_reference(&res->backup->base); | 1222 | val_buf->bo = ttm_bo_reference(&res->backup->base); |
1223 | val_buf->shared = false; | 1223 | val_buf->shared = false; |
1224 | list_add_tail(&val_buf->head, &val_list); | 1224 | list_add_tail(&val_buf->head, &val_list); |
1225 | ret = ttm_eu_reserve_buffers(NULL, &val_list, interruptible); | 1225 | ret = ttm_eu_reserve_buffers(NULL, &val_list, interruptible, NULL); |
1226 | if (unlikely(ret != 0)) | 1226 | if (unlikely(ret != 0)) |
1227 | goto out_no_reserve; | 1227 | goto out_no_reserve; |
1228 | 1228 | ||
diff --git a/include/drm/ttm/ttm_execbuf_util.h b/include/drm/ttm/ttm_execbuf_util.h index 460441714413..b620c317c772 100644 --- a/include/drm/ttm/ttm_execbuf_util.h +++ b/include/drm/ttm/ttm_execbuf_util.h | |||
@@ -68,6 +68,7 @@ extern void ttm_eu_backoff_reservation(struct ww_acquire_ctx *ticket, | |||
68 | * non-blocking reserves should be tried. | 68 | * non-blocking reserves should be tried. |
69 | * @list: thread private list of ttm_validate_buffer structs. | 69 | * @list: thread private list of ttm_validate_buffer structs. |
70 | * @intr: should the wait be interruptible | 70 | * @intr: should the wait be interruptible |
71 | * @dups: [out] optional list of duplicates. | ||
71 | * | 72 | * |
72 | * Tries to reserve bos pointed to by the list entries for validation. | 73 | * Tries to reserve bos pointed to by the list entries for validation. |
73 | * If the function returns 0, all buffers are marked as "unfenced", | 74 | * If the function returns 0, all buffers are marked as "unfenced", |
@@ -83,6 +84,11 @@ extern void ttm_eu_backoff_reservation(struct ww_acquire_ctx *ticket, | |||
83 | * calling process receives a signal while waiting. In that case, no | 84 | * calling process receives a signal while waiting. In that case, no |
84 | * buffers on the list will be reserved upon return. | 85 | * buffers on the list will be reserved upon return. |
85 | * | 86 | * |
87 | * If dups is non NULL all buffers already reserved by the current thread | ||
88 | * (e.g. duplicates) are added to this list, otherwise -EALREADY is returned | ||
89 | * on the first already reserved buffer and all buffers from the list are | ||
90 | * unreserved again. | ||
91 | * | ||
86 | * Buffers reserved by this function should be unreserved by | 92 | * Buffers reserved by this function should be unreserved by |
87 | * a call to either ttm_eu_backoff_reservation() or | 93 | * a call to either ttm_eu_backoff_reservation() or |
88 | * ttm_eu_fence_buffer_objects() when command submission is complete or | 94 | * ttm_eu_fence_buffer_objects() when command submission is complete or |
@@ -90,7 +96,8 @@ extern void ttm_eu_backoff_reservation(struct ww_acquire_ctx *ticket, | |||
90 | */ | 96 | */ |
91 | 97 | ||
92 | extern int ttm_eu_reserve_buffers(struct ww_acquire_ctx *ticket, | 98 | extern int ttm_eu_reserve_buffers(struct ww_acquire_ctx *ticket, |
93 | struct list_head *list, bool intr); | 99 | struct list_head *list, bool intr, |
100 | struct list_head *dups); | ||
94 | 101 | ||
95 | /** | 102 | /** |
96 | * function ttm_eu_fence_buffer_objects. | 103 | * function ttm_eu_fence_buffer_objects. |