* [PATCH 1/2] drm/ttm: optionally move duplicates to a separate list
@ 2014-12-03 14:46 Christian König
2014-12-03 14:46 ` [PATCH 2/2] drm/radeon: remove duplicates check Christian König
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Christian König @ 2014-12-03 14:46 UTC (permalink / raw)
To: alexdeucher; +Cc: dri-devel
From: Christian König <christian.koenig@amd.com>
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.
Signed-off-by: Christian König <christian.koenig@amd.com>
---
drivers/gpu/drm/qxl/qxl_release.c | 3 ++-
drivers/gpu/drm/radeon/radeon_gem.c | 2 +-
drivers/gpu/drm/radeon/radeon_object.c | 2 +-
drivers/gpu/drm/ttm/ttm_execbuf_util.c | 10 +++++++++-
drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c | 6 ++++--
drivers/gpu/drm/vmwgfx/vmwgfx_resource.c | 2 +-
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 446e71c..d9b2568 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)
if (list_is_singular(&release->bos))
return 0;
- ret = ttm_eu_reserve_buffers(&release->ticket, &release->bos, !no_intr);
+ ret = ttm_eu_reserve_buffers(&release->ticket, &release->bos,
+ !no_intr, NULL);
if (ret)
return ret;
diff --git a/drivers/gpu/drm/radeon/radeon_gem.c b/drivers/gpu/drm/radeon/radeon_gem.c
index 6162bd2..fe48f22 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,
if (!vm_bos)
return;
- r = ttm_eu_reserve_buffers(&ticket, &list, true);
+ r = ttm_eu_reserve_buffers(&ticket, &list, true, NULL);
if (r)
goto error_free;
diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c
index 4ab0747..a4a3ac8 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,
u64 bytes_moved = 0, initial_bytes_moved;
u64 bytes_moved_threshold = radeon_bo_get_threshold_for_moves(rdev);
- r = ttm_eu_reserve_buffers(ticket, head, true);
+ r = ttm_eu_reserve_buffers(ticket, head, true, NULL);
if (unlikely(r != 0)) {
return r;
}
diff --git a/drivers/gpu/drm/ttm/ttm_execbuf_util.c b/drivers/gpu/drm/ttm/ttm_execbuf_util.c
index 8ce508e..3820ae9 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);
*/
int ttm_eu_reserve_buffers(struct ww_acquire_ctx *ticket,
- struct list_head *list, bool intr)
+ struct list_head *list, bool intr,
+ struct list_head *dups)
{
struct ttm_bo_global *glob;
struct ttm_validate_buffer *entry;
@@ -117,6 +118,13 @@ int ttm_eu_reserve_buffers(struct ww_acquire_ctx *ticket,
__ttm_bo_unreserve(bo);
ret = -EBUSY;
+
+ } else if (ret == -EALREADY && dups) {
+ struct ttm_validate_buffer *safe = entry;
+ entry = list_prev_entry(entry, head);
+ list_del(&safe->head);
+ list_add(&safe->head, dups);
+ continue;
}
if (!ret) {
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
index 596cd6d..33176d0 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,
if (unlikely(ret != 0))
goto out_err_nores;
- ret = ttm_eu_reserve_buffers(&ticket, &sw_context->validate_nodes, true);
+ ret = ttm_eu_reserve_buffers(&ticket, &sw_context->validate_nodes,
+ true, NULL);
if (unlikely(ret != 0))
goto out_err;
@@ -2677,7 +2678,8 @@ void __vmw_execbuf_release_pinned_bo(struct vmw_private *dev_priv,
query_val.shared = false;
list_add_tail(&query_val.head, &validate_list);
- ret = ttm_eu_reserve_buffers(&ticket, &validate_list, false);
+ ret = ttm_eu_reserve_buffers(&ticket, &validate_list,
+ false, NULL);
if (unlikely(ret != 0)) {
vmw_execbuf_unpin_panic(dev_priv);
goto out_no_reserve;
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
index 026de7c..210ef15 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,
val_buf->bo = ttm_bo_reference(&res->backup->base);
val_buf->shared = false;
list_add_tail(&val_buf->head, &val_list);
- ret = ttm_eu_reserve_buffers(NULL, &val_list, interruptible);
+ ret = ttm_eu_reserve_buffers(NULL, &val_list, interruptible, NULL);
if (unlikely(ret != 0))
goto out_no_reserve;
diff --git a/include/drm/ttm/ttm_execbuf_util.h b/include/drm/ttm/ttm_execbuf_util.h
index 4604417..b620c31 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,
* non-blocking reserves should be tried.
* @list: thread private list of ttm_validate_buffer structs.
* @intr: should the wait be interruptible
+ * @dups: [out] optional list of duplicates.
*
* Tries to reserve bos pointed to by the list entries for validation.
* 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,
* calling process receives a signal while waiting. In that case, no
* buffers on the list will be reserved upon return.
*
+ * If dups is non NULL all buffers already reserved by the current thread
+ * (e.g. duplicates) are added to this list, otherwise -EALREADY is returned
+ * on the first already reserved buffer and all buffers from the list are
+ * unreserved again.
+ *
* Buffers reserved by this function should be unreserved by
* a call to either ttm_eu_backoff_reservation() or
* 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,
*/
extern int ttm_eu_reserve_buffers(struct ww_acquire_ctx *ticket,
- struct list_head *list, bool intr);
+ struct list_head *list, bool intr,
+ struct list_head *dups);
/**
* function ttm_eu_fence_buffer_objects.
--
1.9.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] drm/radeon: remove duplicates check
2014-12-03 14:46 [PATCH 1/2] drm/ttm: optionally move duplicates to a separate list Christian König
@ 2014-12-03 14:46 ` Christian König
2014-12-03 18:15 ` [PATCH 1/2] drm/ttm: optionally move duplicates to a separate list Thomas Hellstrom
2014-12-03 19:31 ` Alex Deucher
2 siblings, 0 replies; 4+ messages in thread
From: Christian König @ 2014-12-03 14:46 UTC (permalink / raw)
To: alexdeucher; +Cc: dri-devel
From: Christian König <christian.koenig@amd.com>
Completely unnecessary since the ww_mutex used to reserve a buffer
can detect double reservations from the same thread anyway.
Signed-off-by: Christian König <christian.koenig@amd.com>
---
drivers/gpu/drm/radeon/r600_cs.c | 2 +-
drivers/gpu/drm/radeon/radeon.h | 1 -
drivers/gpu/drm/radeon/radeon_cs.c | 30 +++---------------------------
drivers/gpu/drm/radeon/radeon_object.c | 13 ++++++++++---
drivers/gpu/drm/radeon/radeon_uvd.c | 2 +-
drivers/gpu/drm/radeon/radeon_vce.c | 2 +-
6 files changed, 16 insertions(+), 34 deletions(-)
diff --git a/drivers/gpu/drm/radeon/r600_cs.c b/drivers/gpu/drm/radeon/r600_cs.c
index b81ba19..e5521946 100644
--- a/drivers/gpu/drm/radeon/r600_cs.c
+++ b/drivers/gpu/drm/radeon/r600_cs.c
@@ -2452,7 +2452,7 @@ int r600_dma_cs_next_reloc(struct radeon_cs_parser *p,
idx, p->nrelocs);
return -EINVAL;
}
- *cs_reloc = p->relocs_ptr[idx];
+ *cs_reloc = &p->relocs[idx];
p->dma_reloc_idx++;
return 0;
}
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index b59a4de..1319c9c 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -1076,7 +1076,6 @@ struct radeon_cs_parser {
/* relocations */
unsigned nrelocs;
struct radeon_bo_list *relocs;
- struct radeon_bo_list **relocs_ptr;
struct radeon_bo_list *vm_bos;
struct list_head validated;
unsigned dma_reloc_idx;
diff --git a/drivers/gpu/drm/radeon/radeon_cs.c b/drivers/gpu/drm/radeon/radeon_cs.c
index fb776cb..26f7855 100644
--- a/drivers/gpu/drm/radeon/radeon_cs.c
+++ b/drivers/gpu/drm/radeon/radeon_cs.c
@@ -77,8 +77,8 @@ static int radeon_cs_parser_relocs(struct radeon_cs_parser *p)
struct drm_device *ddev = p->rdev->ddev;
struct radeon_cs_chunk *chunk;
struct radeon_cs_buckets buckets;
- unsigned i, j;
- bool duplicate, need_mmap_lock = false;
+ unsigned i;
+ bool need_mmap_lock = false;
int r;
if (p->chunk_relocs_idx == -1) {
@@ -88,10 +88,6 @@ static int radeon_cs_parser_relocs(struct radeon_cs_parser *p)
p->dma_reloc_idx = 0;
/* FIXME: we assume that each relocs use 4 dwords */
p->nrelocs = chunk->length_dw / 4;
- p->relocs_ptr = kcalloc(p->nrelocs, sizeof(void *), GFP_KERNEL);
- if (p->relocs_ptr == NULL) {
- return -ENOMEM;
- }
p->relocs = kcalloc(p->nrelocs, sizeof(struct radeon_bo_list), GFP_KERNEL);
if (p->relocs == NULL) {
return -ENOMEM;
@@ -104,28 +100,13 @@ static int radeon_cs_parser_relocs(struct radeon_cs_parser *p)
struct drm_gem_object *gobj;
unsigned priority;
- duplicate = false;
r = (struct drm_radeon_cs_reloc *)&chunk->kdata[i*4];
- for (j = 0; j < i; j++) {
- struct drm_radeon_cs_reloc *other;
- other = (void *)&chunk->kdata[j*4];
- if (r->handle == other->handle) {
- p->relocs_ptr[i] = &p->relocs[j];
- duplicate = true;
- break;
- }
- }
- if (duplicate) {
- continue;
- }
-
gobj = drm_gem_object_lookup(ddev, p->filp, r->handle);
if (gobj == NULL) {
DRM_ERROR("gem object lookup failed 0x%x\n",
r->handle);
return -ENOENT;
}
- p->relocs_ptr[i] = &p->relocs[i];
p->relocs[i].robj = gem_to_radeon_bo(gobj);
/* The userspace buffer priorities are from 0 to 15. A higher
@@ -448,7 +429,6 @@ static void radeon_cs_parser_fini(struct radeon_cs_parser *parser, int error, bo
}
kfree(parser->track);
kfree(parser->relocs);
- kfree(parser->relocs_ptr);
drm_free_large(parser->vm_bos);
for (i = 0; i < parser->nchunks; i++)
drm_free_large(parser->chunks[i].kdata);
@@ -523,10 +503,6 @@ static int radeon_bo_vm_update_pte(struct radeon_cs_parser *p,
for (i = 0; i < p->nrelocs; i++) {
struct radeon_bo *bo;
- /* ignore duplicates */
- if (p->relocs_ptr[i] != &p->relocs[i])
- continue;
-
bo = p->relocs[i].robj;
bo_va = radeon_vm_bo_find(vm, bo);
if (bo_va == NULL) {
@@ -871,6 +847,6 @@ int radeon_cs_packet_next_reloc(struct radeon_cs_parser *p,
(u64)relocs_chunk->kdata[idx + 3] << 32;
(*cs_reloc)->gpu_offset |= relocs_chunk->kdata[idx + 0];
} else
- *cs_reloc = p->relocs_ptr[(idx / 4)];
+ *cs_reloc = &p->relocs[(idx / 4)];
return 0;
}
diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c
index a4a3ac8..0a8ef9e 100644
--- a/drivers/gpu/drm/radeon/radeon_object.c
+++ b/drivers/gpu/drm/radeon/radeon_object.c
@@ -503,18 +503,19 @@ int radeon_bo_list_validate(struct radeon_device *rdev,
struct list_head *head, int ring)
{
struct radeon_bo_list *lobj;
- struct radeon_bo *bo;
+ struct list_head duplicates;
int r;
u64 bytes_moved = 0, initial_bytes_moved;
u64 bytes_moved_threshold = radeon_bo_get_threshold_for_moves(rdev);
- r = ttm_eu_reserve_buffers(ticket, head, true, NULL);
+ INIT_LIST_HEAD(&duplicates);
+ r = ttm_eu_reserve_buffers(ticket, head, true, &duplicates);
if (unlikely(r != 0)) {
return r;
}
list_for_each_entry(lobj, head, tv.head) {
- bo = lobj->robj;
+ struct radeon_bo *bo = lobj->robj;
if (!bo->pin_count) {
u32 domain = lobj->prefered_domains;
u32 allowed = lobj->allowed_domains;
@@ -562,6 +563,12 @@ int radeon_bo_list_validate(struct radeon_device *rdev,
lobj->gpu_offset = radeon_bo_gpu_offset(bo);
lobj->tiling_flags = bo->tiling_flags;
}
+
+ list_for_each_entry(lobj, &duplicates, tv.head) {
+ lobj->gpu_offset = radeon_bo_gpu_offset(lobj->robj);
+ lobj->tiling_flags = lobj->robj->tiling_flags;
+ }
+
return 0;
}
diff --git a/drivers/gpu/drm/radeon/radeon_uvd.c b/drivers/gpu/drm/radeon/radeon_uvd.c
index 7c22b93..72cd47d 100644
--- a/drivers/gpu/drm/radeon/radeon_uvd.c
+++ b/drivers/gpu/drm/radeon/radeon_uvd.c
@@ -502,7 +502,7 @@ static int radeon_uvd_cs_reloc(struct radeon_cs_parser *p,
return -EINVAL;
}
- reloc = p->relocs_ptr[(idx / 4)];
+ reloc = &p->relocs[(idx / 4)];
start = reloc->gpu_offset;
end = start + radeon_bo_size(reloc->robj);
start += offset;
diff --git a/drivers/gpu/drm/radeon/radeon_vce.c b/drivers/gpu/drm/radeon/radeon_vce.c
index 8b4eea4..b3a1698 100644
--- a/drivers/gpu/drm/radeon/radeon_vce.c
+++ b/drivers/gpu/drm/radeon/radeon_vce.c
@@ -467,7 +467,7 @@ int radeon_vce_cs_reloc(struct radeon_cs_parser *p, int lo, int hi,
return -EINVAL;
}
- reloc = p->relocs_ptr[(idx / 4)];
+ reloc = &p->relocs[(idx / 4)];
start = reloc->gpu_offset;
end = start + radeon_bo_size(reloc->robj);
start += offset;
--
1.9.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] drm/ttm: optionally move duplicates to a separate list
2014-12-03 14:46 [PATCH 1/2] drm/ttm: optionally move duplicates to a separate list Christian König
2014-12-03 14:46 ` [PATCH 2/2] drm/radeon: remove duplicates check Christian König
@ 2014-12-03 18:15 ` Thomas Hellstrom
2014-12-03 19:31 ` Alex Deucher
2 siblings, 0 replies; 4+ messages in thread
From: Thomas Hellstrom @ 2014-12-03 18:15 UTC (permalink / raw)
To: Christian König; +Cc: dri-devel
LTGM
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
On 12/03/2014 03:46 PM, Christian König wrote:
> From: Christian König <christian.koenig@amd.com>
>
> 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.
>
> Signed-off-by: Christian König <christian.koenig@amd.com>
> ---
> drivers/gpu/drm/qxl/qxl_release.c | 3 ++-
> drivers/gpu/drm/radeon/radeon_gem.c | 2 +-
> drivers/gpu/drm/radeon/radeon_object.c | 2 +-
> drivers/gpu/drm/ttm/ttm_execbuf_util.c | 10 +++++++++-
> drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c | 6 ++++--
> drivers/gpu/drm/vmwgfx/vmwgfx_resource.c | 2 +-
> 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 446e71c..d9b2568 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)
> if (list_is_singular(&release->bos))
> return 0;
>
> - ret = ttm_eu_reserve_buffers(&release->ticket, &release->bos, !no_intr);
> + ret = ttm_eu_reserve_buffers(&release->ticket, &release->bos,
> + !no_intr, NULL);
> if (ret)
> return ret;
>
> diff --git a/drivers/gpu/drm/radeon/radeon_gem.c b/drivers/gpu/drm/radeon/radeon_gem.c
> index 6162bd2..fe48f22 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,
> if (!vm_bos)
> return;
>
> - r = ttm_eu_reserve_buffers(&ticket, &list, true);
> + r = ttm_eu_reserve_buffers(&ticket, &list, true, NULL);
> if (r)
> goto error_free;
>
> diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c
> index 4ab0747..a4a3ac8 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,
> u64 bytes_moved = 0, initial_bytes_moved;
> u64 bytes_moved_threshold = radeon_bo_get_threshold_for_moves(rdev);
>
> - r = ttm_eu_reserve_buffers(ticket, head, true);
> + r = ttm_eu_reserve_buffers(ticket, head, true, NULL);
> if (unlikely(r != 0)) {
> return r;
> }
> diff --git a/drivers/gpu/drm/ttm/ttm_execbuf_util.c b/drivers/gpu/drm/ttm/ttm_execbuf_util.c
> index 8ce508e..3820ae9 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);
> */
>
> int ttm_eu_reserve_buffers(struct ww_acquire_ctx *ticket,
> - struct list_head *list, bool intr)
> + struct list_head *list, bool intr,
> + struct list_head *dups)
> {
> struct ttm_bo_global *glob;
> struct ttm_validate_buffer *entry;
> @@ -117,6 +118,13 @@ int ttm_eu_reserve_buffers(struct ww_acquire_ctx *ticket,
> __ttm_bo_unreserve(bo);
>
> ret = -EBUSY;
> +
> + } else if (ret == -EALREADY && dups) {
> + struct ttm_validate_buffer *safe = entry;
> + entry = list_prev_entry(entry, head);
> + list_del(&safe->head);
> + list_add(&safe->head, dups);
> + continue;
> }
>
> if (!ret) {
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
> index 596cd6d..33176d0 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,
> if (unlikely(ret != 0))
> goto out_err_nores;
>
> - ret = ttm_eu_reserve_buffers(&ticket, &sw_context->validate_nodes, true);
> + ret = ttm_eu_reserve_buffers(&ticket, &sw_context->validate_nodes,
> + true, NULL);
> if (unlikely(ret != 0))
> goto out_err;
>
> @@ -2677,7 +2678,8 @@ void __vmw_execbuf_release_pinned_bo(struct vmw_private *dev_priv,
> query_val.shared = false;
> list_add_tail(&query_val.head, &validate_list);
>
> - ret = ttm_eu_reserve_buffers(&ticket, &validate_list, false);
> + ret = ttm_eu_reserve_buffers(&ticket, &validate_list,
> + false, NULL);
> if (unlikely(ret != 0)) {
> vmw_execbuf_unpin_panic(dev_priv);
> goto out_no_reserve;
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
> index 026de7c..210ef15 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,
> val_buf->bo = ttm_bo_reference(&res->backup->base);
> val_buf->shared = false;
> list_add_tail(&val_buf->head, &val_list);
> - ret = ttm_eu_reserve_buffers(NULL, &val_list, interruptible);
> + ret = ttm_eu_reserve_buffers(NULL, &val_list, interruptible, NULL);
> if (unlikely(ret != 0))
> goto out_no_reserve;
>
> diff --git a/include/drm/ttm/ttm_execbuf_util.h b/include/drm/ttm/ttm_execbuf_util.h
> index 4604417..b620c31 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,
> * non-blocking reserves should be tried.
> * @list: thread private list of ttm_validate_buffer structs.
> * @intr: should the wait be interruptible
> + * @dups: [out] optional list of duplicates.
> *
> * Tries to reserve bos pointed to by the list entries for validation.
> * 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,
> * calling process receives a signal while waiting. In that case, no
> * buffers on the list will be reserved upon return.
> *
> + * If dups is non NULL all buffers already reserved by the current thread
> + * (e.g. duplicates) are added to this list, otherwise -EALREADY is returned
> + * on the first already reserved buffer and all buffers from the list are
> + * unreserved again.
> + *
> * Buffers reserved by this function should be unreserved by
> * a call to either ttm_eu_backoff_reservation() or
> * 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,
> */
>
> extern int ttm_eu_reserve_buffers(struct ww_acquire_ctx *ticket,
> - struct list_head *list, bool intr);
> + struct list_head *list, bool intr,
> + struct list_head *dups);
>
> /**
> * function ttm_eu_fence_buffer_objects.
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] drm/ttm: optionally move duplicates to a separate list
2014-12-03 14:46 [PATCH 1/2] drm/ttm: optionally move duplicates to a separate list Christian König
2014-12-03 14:46 ` [PATCH 2/2] drm/radeon: remove duplicates check Christian König
2014-12-03 18:15 ` [PATCH 1/2] drm/ttm: optionally move duplicates to a separate list Thomas Hellstrom
@ 2014-12-03 19:31 ` Alex Deucher
2 siblings, 0 replies; 4+ messages in thread
From: Alex Deucher @ 2014-12-03 19:31 UTC (permalink / raw)
To: Christian König; +Cc: Maling list - DRI developers
On Wed, Dec 3, 2014 at 9:46 AM, Christian König <deathsimple@vodafone.de> wrote:
> From: Christian König <christian.koenig@amd.com>
>
> 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.
>
> Signed-off-by: Christian König <christian.koenig@amd.com>
Applied the series to my -next tree.
Thanks,
Alex
> ---
> drivers/gpu/drm/qxl/qxl_release.c | 3 ++-
> drivers/gpu/drm/radeon/radeon_gem.c | 2 +-
> drivers/gpu/drm/radeon/radeon_object.c | 2 +-
> drivers/gpu/drm/ttm/ttm_execbuf_util.c | 10 +++++++++-
> drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c | 6 ++++--
> drivers/gpu/drm/vmwgfx/vmwgfx_resource.c | 2 +-
> 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 446e71c..d9b2568 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)
> if (list_is_singular(&release->bos))
> return 0;
>
> - ret = ttm_eu_reserve_buffers(&release->ticket, &release->bos, !no_intr);
> + ret = ttm_eu_reserve_buffers(&release->ticket, &release->bos,
> + !no_intr, NULL);
> if (ret)
> return ret;
>
> diff --git a/drivers/gpu/drm/radeon/radeon_gem.c b/drivers/gpu/drm/radeon/radeon_gem.c
> index 6162bd2..fe48f22 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,
> if (!vm_bos)
> return;
>
> - r = ttm_eu_reserve_buffers(&ticket, &list, true);
> + r = ttm_eu_reserve_buffers(&ticket, &list, true, NULL);
> if (r)
> goto error_free;
>
> diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c
> index 4ab0747..a4a3ac8 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,
> u64 bytes_moved = 0, initial_bytes_moved;
> u64 bytes_moved_threshold = radeon_bo_get_threshold_for_moves(rdev);
>
> - r = ttm_eu_reserve_buffers(ticket, head, true);
> + r = ttm_eu_reserve_buffers(ticket, head, true, NULL);
> if (unlikely(r != 0)) {
> return r;
> }
> diff --git a/drivers/gpu/drm/ttm/ttm_execbuf_util.c b/drivers/gpu/drm/ttm/ttm_execbuf_util.c
> index 8ce508e..3820ae9 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);
> */
>
> int ttm_eu_reserve_buffers(struct ww_acquire_ctx *ticket,
> - struct list_head *list, bool intr)
> + struct list_head *list, bool intr,
> + struct list_head *dups)
> {
> struct ttm_bo_global *glob;
> struct ttm_validate_buffer *entry;
> @@ -117,6 +118,13 @@ int ttm_eu_reserve_buffers(struct ww_acquire_ctx *ticket,
> __ttm_bo_unreserve(bo);
>
> ret = -EBUSY;
> +
> + } else if (ret == -EALREADY && dups) {
> + struct ttm_validate_buffer *safe = entry;
> + entry = list_prev_entry(entry, head);
> + list_del(&safe->head);
> + list_add(&safe->head, dups);
> + continue;
> }
>
> if (!ret) {
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
> index 596cd6d..33176d0 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,
> if (unlikely(ret != 0))
> goto out_err_nores;
>
> - ret = ttm_eu_reserve_buffers(&ticket, &sw_context->validate_nodes, true);
> + ret = ttm_eu_reserve_buffers(&ticket, &sw_context->validate_nodes,
> + true, NULL);
> if (unlikely(ret != 0))
> goto out_err;
>
> @@ -2677,7 +2678,8 @@ void __vmw_execbuf_release_pinned_bo(struct vmw_private *dev_priv,
> query_val.shared = false;
> list_add_tail(&query_val.head, &validate_list);
>
> - ret = ttm_eu_reserve_buffers(&ticket, &validate_list, false);
> + ret = ttm_eu_reserve_buffers(&ticket, &validate_list,
> + false, NULL);
> if (unlikely(ret != 0)) {
> vmw_execbuf_unpin_panic(dev_priv);
> goto out_no_reserve;
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
> index 026de7c..210ef15 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,
> val_buf->bo = ttm_bo_reference(&res->backup->base);
> val_buf->shared = false;
> list_add_tail(&val_buf->head, &val_list);
> - ret = ttm_eu_reserve_buffers(NULL, &val_list, interruptible);
> + ret = ttm_eu_reserve_buffers(NULL, &val_list, interruptible, NULL);
> if (unlikely(ret != 0))
> goto out_no_reserve;
>
> diff --git a/include/drm/ttm/ttm_execbuf_util.h b/include/drm/ttm/ttm_execbuf_util.h
> index 4604417..b620c31 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,
> * non-blocking reserves should be tried.
> * @list: thread private list of ttm_validate_buffer structs.
> * @intr: should the wait be interruptible
> + * @dups: [out] optional list of duplicates.
> *
> * Tries to reserve bos pointed to by the list entries for validation.
> * 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,
> * calling process receives a signal while waiting. In that case, no
> * buffers on the list will be reserved upon return.
> *
> + * If dups is non NULL all buffers already reserved by the current thread
> + * (e.g. duplicates) are added to this list, otherwise -EALREADY is returned
> + * on the first already reserved buffer and all buffers from the list are
> + * unreserved again.
> + *
> * Buffers reserved by this function should be unreserved by
> * a call to either ttm_eu_backoff_reservation() or
> * 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,
> */
>
> extern int ttm_eu_reserve_buffers(struct ww_acquire_ctx *ticket,
> - struct list_head *list, bool intr);
> + struct list_head *list, bool intr,
> + struct list_head *dups);
>
> /**
> * function ttm_eu_fence_buffer_objects.
> --
> 1.9.1
>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-12-03 19:31 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-03 14:46 [PATCH 1/2] drm/ttm: optionally move duplicates to a separate list Christian König
2014-12-03 14:46 ` [PATCH 2/2] drm/radeon: remove duplicates check Christian König
2014-12-03 18:15 ` [PATCH 1/2] drm/ttm: optionally move duplicates to a separate list Thomas Hellstrom
2014-12-03 19:31 ` Alex Deucher
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.