* [Intel-gfx] [PATCH i-g-t 1/2] lib/i915: Add helper for copying engine maps from one context to another
@ 2020-01-24 12:17 ` Tvrtko Ursulin
0 siblings, 0 replies; 16+ messages in thread
From: Tvrtko Ursulin @ 2020-01-24 12:17 UTC (permalink / raw)
To: igt-dev; +Cc: Intel-gfx
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
We also need to support copying across file descriptors.
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Sreedhar Telukuntla <sreedhar.telukuntla@intel.com>
---
lib/i915/gem_context.c | 30 ++++++++++++++++++++++++++++++
lib/i915/gem_context.h | 2 ++
2 files changed, 32 insertions(+)
diff --git a/lib/i915/gem_context.c b/lib/i915/gem_context.c
index 0b6a554dfe27..41957b66ca52 100644
--- a/lib/i915/gem_context.c
+++ b/lib/i915/gem_context.c
@@ -462,3 +462,33 @@ bool gem_context_has_engine(int fd, uint32_t ctx, uint64_t engine)
return __gem_execbuf(fd, &execbuf) == -ENOENT;
}
+
+/**
+ * gem_context_copy_engines:
+ * @src_fd: open i915 drm file descriptor where @src context belongs to
+ * @src: source engine map context id
+ * @dst_fd: open i915 drm file descriptor where @dst context belongs to
+ * @dst: destination engine map context id
+ *
+ * Special purpose wrapper for copying engine map from one context to another.
+ *
+ * In can be called regardless of whether the kernel supports context engine
+ * maps and is a no-op if not supported.
+ */
+void
+gem_context_copy_engines(int src_fd, uint32_t src, int dst_fd, uint32_t dst)
+{
+ I915_DEFINE_CONTEXT_PARAM_ENGINES(engines, I915_EXEC_RING_MASK + 1);
+ struct drm_i915_gem_context_param param = {
+ .param = I915_CONTEXT_PARAM_ENGINES,
+ .ctx_id = src,
+ .size = sizeof(engines),
+ .value = to_user_pointer(&engines),
+ };
+
+ if (__gem_context_get_param(src_fd, ¶m) || !param.size)
+ return;
+
+ param.ctx_id = dst;
+ gem_context_set_param(dst_fd, ¶m);
+}
diff --git a/lib/i915/gem_context.h b/lib/i915/gem_context.h
index cf2ba33fee8f..15e5db281b79 100644
--- a/lib/i915/gem_context.h
+++ b/lib/i915/gem_context.h
@@ -42,6 +42,8 @@ uint32_t gem_context_clone(int i915,
uint32_t src, unsigned int share,
unsigned int flags);
uint32_t gem_context_clone_with_engines(int i915, uint32_t src);
+void gem_context_copy_engines(int src_fd, uint32_t src,
+ int dst_fd, uint32_t dst);
uint32_t gem_queue_create(int i915);
uint32_t gem_queue_clone_with_engines(int i915, uint32_t src);
--
2.20.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [igt-dev] [PATCH i-g-t 1/2] lib/i915: Add helper for copying engine maps from one context to another
@ 2020-01-24 12:17 ` Tvrtko Ursulin
0 siblings, 0 replies; 16+ messages in thread
From: Tvrtko Ursulin @ 2020-01-24 12:17 UTC (permalink / raw)
To: igt-dev; +Cc: Intel-gfx, Tvrtko Ursulin
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
We also need to support copying across file descriptors.
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Sreedhar Telukuntla <sreedhar.telukuntla@intel.com>
---
lib/i915/gem_context.c | 30 ++++++++++++++++++++++++++++++
lib/i915/gem_context.h | 2 ++
2 files changed, 32 insertions(+)
diff --git a/lib/i915/gem_context.c b/lib/i915/gem_context.c
index 0b6a554dfe27..41957b66ca52 100644
--- a/lib/i915/gem_context.c
+++ b/lib/i915/gem_context.c
@@ -462,3 +462,33 @@ bool gem_context_has_engine(int fd, uint32_t ctx, uint64_t engine)
return __gem_execbuf(fd, &execbuf) == -ENOENT;
}
+
+/**
+ * gem_context_copy_engines:
+ * @src_fd: open i915 drm file descriptor where @src context belongs to
+ * @src: source engine map context id
+ * @dst_fd: open i915 drm file descriptor where @dst context belongs to
+ * @dst: destination engine map context id
+ *
+ * Special purpose wrapper for copying engine map from one context to another.
+ *
+ * In can be called regardless of whether the kernel supports context engine
+ * maps and is a no-op if not supported.
+ */
+void
+gem_context_copy_engines(int src_fd, uint32_t src, int dst_fd, uint32_t dst)
+{
+ I915_DEFINE_CONTEXT_PARAM_ENGINES(engines, I915_EXEC_RING_MASK + 1);
+ struct drm_i915_gem_context_param param = {
+ .param = I915_CONTEXT_PARAM_ENGINES,
+ .ctx_id = src,
+ .size = sizeof(engines),
+ .value = to_user_pointer(&engines),
+ };
+
+ if (__gem_context_get_param(src_fd, ¶m) || !param.size)
+ return;
+
+ param.ctx_id = dst;
+ gem_context_set_param(dst_fd, ¶m);
+}
diff --git a/lib/i915/gem_context.h b/lib/i915/gem_context.h
index cf2ba33fee8f..15e5db281b79 100644
--- a/lib/i915/gem_context.h
+++ b/lib/i915/gem_context.h
@@ -42,6 +42,8 @@ uint32_t gem_context_clone(int i915,
uint32_t src, unsigned int share,
unsigned int flags);
uint32_t gem_context_clone_with_engines(int i915, uint32_t src);
+void gem_context_copy_engines(int src_fd, uint32_t src,
+ int dst_fd, uint32_t dst);
uint32_t gem_queue_create(int i915);
uint32_t gem_queue_clone_with_engines(int i915, uint32_t src);
--
2.20.1
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [Intel-gfx] [PATCH i-g-t 2/2] tests/i915/gem_exec_parallel:Set engine map to default context
2020-01-24 12:17 ` [igt-dev] " Tvrtko Ursulin
@ 2020-01-24 12:17 ` Tvrtko Ursulin
-1 siblings, 0 replies; 16+ messages in thread
From: Tvrtko Ursulin @ 2020-01-24 12:17 UTC (permalink / raw)
To: igt-dev; +Cc: Intel-gfx
From: Sreedhar Telukuntla <sreedhar.telukuntla@intel.com>
Set the potential engine map of the parent client's default
context to the newly created DRM client's default context.
Without doing so there is a mismatch between the intended
and actual engine used by the *-fds subtests.
v2: Fix FDS flags check
Tvrtko:
v3: Use new helper gem_context_copy_engines.
Signed-off-by: Sreedhar Telukuntla <sreedhar.telukuntla@intel.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
tests/i915/gem_exec_parallel.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/tests/i915/gem_exec_parallel.c b/tests/i915/gem_exec_parallel.c
index cfbe78070873..0d4d6c6283e0 100644
--- a/tests/i915/gem_exec_parallel.c
+++ b/tests/i915/gem_exec_parallel.c
@@ -83,10 +83,12 @@ static void *thread(void *data)
pthread_cond_wait(t->cond, t->mutex);
pthread_mutex_unlock(t->mutex);
- if (t->flags & FDS)
+ if (t->flags & FDS) {
fd = drm_open_driver(DRIVER_INTEL);
- else
+ gem_context_copy_engines(t->fd, 0, fd, 0);
+ } else {
fd = t->fd;
+ }
i = 0;
batch[i] = MI_STORE_DWORD_IMM | (t->gen < 6 ? 1 << 22 : 0);
--
2.20.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [igt-dev] [PATCH i-g-t 2/2] tests/i915/gem_exec_parallel:Set engine map to default context
@ 2020-01-24 12:17 ` Tvrtko Ursulin
0 siblings, 0 replies; 16+ messages in thread
From: Tvrtko Ursulin @ 2020-01-24 12:17 UTC (permalink / raw)
To: igt-dev; +Cc: Intel-gfx, Tvrtko Ursulin
From: Sreedhar Telukuntla <sreedhar.telukuntla@intel.com>
Set the potential engine map of the parent client's default
context to the newly created DRM client's default context.
Without doing so there is a mismatch between the intended
and actual engine used by the *-fds subtests.
v2: Fix FDS flags check
Tvrtko:
v3: Use new helper gem_context_copy_engines.
Signed-off-by: Sreedhar Telukuntla <sreedhar.telukuntla@intel.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
tests/i915/gem_exec_parallel.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/tests/i915/gem_exec_parallel.c b/tests/i915/gem_exec_parallel.c
index cfbe78070873..0d4d6c6283e0 100644
--- a/tests/i915/gem_exec_parallel.c
+++ b/tests/i915/gem_exec_parallel.c
@@ -83,10 +83,12 @@ static void *thread(void *data)
pthread_cond_wait(t->cond, t->mutex);
pthread_mutex_unlock(t->mutex);
- if (t->flags & FDS)
+ if (t->flags & FDS) {
fd = drm_open_driver(DRIVER_INTEL);
- else
+ gem_context_copy_engines(t->fd, 0, fd, 0);
+ } else {
fd = t->fd;
+ }
i = 0;
batch[i] = MI_STORE_DWORD_IMM | (t->gen < 6 ? 1 << 22 : 0);
--
2.20.1
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [Intel-gfx] [PATCH i-g-t 1/2] lib/i915: Add helper for copying engine maps from one context to another
2020-01-24 12:17 ` [igt-dev] " Tvrtko Ursulin
@ 2020-01-24 12:23 ` Chris Wilson
-1 siblings, 0 replies; 16+ messages in thread
From: Chris Wilson @ 2020-01-24 12:23 UTC (permalink / raw)
To: Tvrtko Ursulin, igt-dev; +Cc: Intel-gfx
Quoting Tvrtko Ursulin (2020-01-24 12:17:58)
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>
> We also need to support copying across file descriptors.
>
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Sreedhar Telukuntla <sreedhar.telukuntla@intel.com>
> ---
> lib/i915/gem_context.c | 30 ++++++++++++++++++++++++++++++
> lib/i915/gem_context.h | 2 ++
> 2 files changed, 32 insertions(+)
>
> diff --git a/lib/i915/gem_context.c b/lib/i915/gem_context.c
> index 0b6a554dfe27..41957b66ca52 100644
> --- a/lib/i915/gem_context.c
> +++ b/lib/i915/gem_context.c
> @@ -462,3 +462,33 @@ bool gem_context_has_engine(int fd, uint32_t ctx, uint64_t engine)
>
> return __gem_execbuf(fd, &execbuf) == -ENOENT;
> }
> +
> +/**
> + * gem_context_copy_engines:
> + * @src_fd: open i915 drm file descriptor where @src context belongs to
> + * @src: source engine map context id
> + * @dst_fd: open i915 drm file descriptor where @dst context belongs to
> + * @dst: destination engine map context id
> + *
> + * Special purpose wrapper for copying engine map from one context to another.
> + *
> + * In can be called regardless of whether the kernel supports context engine
> + * maps and is a no-op if not supported.
> + */
> +void
> +gem_context_copy_engines(int src_fd, uint32_t src, int dst_fd, uint32_t dst)
> +{
> + I915_DEFINE_CONTEXT_PARAM_ENGINES(engines, I915_EXEC_RING_MASK + 1);
> + struct drm_i915_gem_context_param param = {
> + .param = I915_CONTEXT_PARAM_ENGINES,
> + .ctx_id = src,
> + .size = sizeof(engines),
> + .value = to_user_pointer(&engines),
> + };
> +
> + if (__gem_context_get_param(src_fd, ¶m) || !param.size)
> + return;
> +
> + param.ctx_id = dst;
> + gem_context_set_param(dst_fd, ¶m);
You don't want to copy across the use-default set? You presume dst is
already using defaults?
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [igt-dev] [PATCH i-g-t 1/2] lib/i915: Add helper for copying engine maps from one context to another
@ 2020-01-24 12:23 ` Chris Wilson
0 siblings, 0 replies; 16+ messages in thread
From: Chris Wilson @ 2020-01-24 12:23 UTC (permalink / raw)
To: Tvrtko Ursulin, igt-dev; +Cc: Intel-gfx, Tvrtko Ursulin
Quoting Tvrtko Ursulin (2020-01-24 12:17:58)
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>
> We also need to support copying across file descriptors.
>
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Sreedhar Telukuntla <sreedhar.telukuntla@intel.com>
> ---
> lib/i915/gem_context.c | 30 ++++++++++++++++++++++++++++++
> lib/i915/gem_context.h | 2 ++
> 2 files changed, 32 insertions(+)
>
> diff --git a/lib/i915/gem_context.c b/lib/i915/gem_context.c
> index 0b6a554dfe27..41957b66ca52 100644
> --- a/lib/i915/gem_context.c
> +++ b/lib/i915/gem_context.c
> @@ -462,3 +462,33 @@ bool gem_context_has_engine(int fd, uint32_t ctx, uint64_t engine)
>
> return __gem_execbuf(fd, &execbuf) == -ENOENT;
> }
> +
> +/**
> + * gem_context_copy_engines:
> + * @src_fd: open i915 drm file descriptor where @src context belongs to
> + * @src: source engine map context id
> + * @dst_fd: open i915 drm file descriptor where @dst context belongs to
> + * @dst: destination engine map context id
> + *
> + * Special purpose wrapper for copying engine map from one context to another.
> + *
> + * In can be called regardless of whether the kernel supports context engine
> + * maps and is a no-op if not supported.
> + */
> +void
> +gem_context_copy_engines(int src_fd, uint32_t src, int dst_fd, uint32_t dst)
> +{
> + I915_DEFINE_CONTEXT_PARAM_ENGINES(engines, I915_EXEC_RING_MASK + 1);
> + struct drm_i915_gem_context_param param = {
> + .param = I915_CONTEXT_PARAM_ENGINES,
> + .ctx_id = src,
> + .size = sizeof(engines),
> + .value = to_user_pointer(&engines),
> + };
> +
> + if (__gem_context_get_param(src_fd, ¶m) || !param.size)
> + return;
> +
> + param.ctx_id = dst;
> + gem_context_set_param(dst_fd, ¶m);
You don't want to copy across the use-default set? You presume dst is
already using defaults?
-Chris
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [Intel-gfx] [igt-dev] [PATCH i-g-t 2/2] tests/i915/gem_exec_parallel:Set engine map to default context
2020-01-24 12:17 ` [igt-dev] " Tvrtko Ursulin
@ 2020-01-24 12:25 ` Chris Wilson
-1 siblings, 0 replies; 16+ messages in thread
From: Chris Wilson @ 2020-01-24 12:25 UTC (permalink / raw)
To: Tvrtko Ursulin, igt-dev; +Cc: Intel-gfx
Quoting Tvrtko Ursulin (2020-01-24 12:17:59)
> From: Sreedhar Telukuntla <sreedhar.telukuntla@intel.com>
>
> Set the potential engine map of the parent client's default
> context to the newly created DRM client's default context.
> Without doing so there is a mismatch between the intended
> and actual engine used by the *-fds subtests.
>
> v2: Fix FDS flags check
>
> Tvrtko:
> v3: Use new helper gem_context_copy_engines.
>
> Signed-off-by: Sreedhar Telukuntla <sreedhar.telukuntla@intel.com>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> ---
> tests/i915/gem_exec_parallel.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/tests/i915/gem_exec_parallel.c b/tests/i915/gem_exec_parallel.c
> index cfbe78070873..0d4d6c6283e0 100644
> --- a/tests/i915/gem_exec_parallel.c
> +++ b/tests/i915/gem_exec_parallel.c
> @@ -83,10 +83,12 @@ static void *thread(void *data)
> pthread_cond_wait(t->cond, t->mutex);
> pthread_mutex_unlock(t->mutex);
>
> - if (t->flags & FDS)
> + if (t->flags & FDS) {
> fd = drm_open_driver(DRIVER_INTEL);
> - else
> + gem_context_copy_engines(t->fd, 0, fd, 0);
Makes sense,
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [igt-dev] [PATCH i-g-t 2/2] tests/i915/gem_exec_parallel:Set engine map to default context
@ 2020-01-24 12:25 ` Chris Wilson
0 siblings, 0 replies; 16+ messages in thread
From: Chris Wilson @ 2020-01-24 12:25 UTC (permalink / raw)
To: Tvrtko Ursulin, igt-dev; +Cc: Intel-gfx, Tvrtko Ursulin
Quoting Tvrtko Ursulin (2020-01-24 12:17:59)
> From: Sreedhar Telukuntla <sreedhar.telukuntla@intel.com>
>
> Set the potential engine map of the parent client's default
> context to the newly created DRM client's default context.
> Without doing so there is a mismatch between the intended
> and actual engine used by the *-fds subtests.
>
> v2: Fix FDS flags check
>
> Tvrtko:
> v3: Use new helper gem_context_copy_engines.
>
> Signed-off-by: Sreedhar Telukuntla <sreedhar.telukuntla@intel.com>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> ---
> tests/i915/gem_exec_parallel.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/tests/i915/gem_exec_parallel.c b/tests/i915/gem_exec_parallel.c
> index cfbe78070873..0d4d6c6283e0 100644
> --- a/tests/i915/gem_exec_parallel.c
> +++ b/tests/i915/gem_exec_parallel.c
> @@ -83,10 +83,12 @@ static void *thread(void *data)
> pthread_cond_wait(t->cond, t->mutex);
> pthread_mutex_unlock(t->mutex);
>
> - if (t->flags & FDS)
> + if (t->flags & FDS) {
> fd = drm_open_driver(DRIVER_INTEL);
> - else
> + gem_context_copy_engines(t->fd, 0, fd, 0);
Makes sense,
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [Intel-gfx] [PATCH i-g-t 1/2] lib/i915: Add helper for copying engine maps from one context to another
2020-01-24 12:23 ` [igt-dev] " Chris Wilson
@ 2020-01-24 12:26 ` Tvrtko Ursulin
-1 siblings, 0 replies; 16+ messages in thread
From: Tvrtko Ursulin @ 2020-01-24 12:26 UTC (permalink / raw)
To: Chris Wilson, igt-dev; +Cc: Intel-gfx
On 24/01/2020 12:23, Chris Wilson wrote:
> Quoting Tvrtko Ursulin (2020-01-24 12:17:58)
>> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>>
>> We also need to support copying across file descriptors.
>>
>> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>> Cc: Chris Wilson <chris@chris-wilson.co.uk>
>> Cc: Sreedhar Telukuntla <sreedhar.telukuntla@intel.com>
>> ---
>> lib/i915/gem_context.c | 30 ++++++++++++++++++++++++++++++
>> lib/i915/gem_context.h | 2 ++
>> 2 files changed, 32 insertions(+)
>>
>> diff --git a/lib/i915/gem_context.c b/lib/i915/gem_context.c
>> index 0b6a554dfe27..41957b66ca52 100644
>> --- a/lib/i915/gem_context.c
>> +++ b/lib/i915/gem_context.c
>> @@ -462,3 +462,33 @@ bool gem_context_has_engine(int fd, uint32_t ctx, uint64_t engine)
>>
>> return __gem_execbuf(fd, &execbuf) == -ENOENT;
>> }
>> +
>> +/**
>> + * gem_context_copy_engines:
>> + * @src_fd: open i915 drm file descriptor where @src context belongs to
>> + * @src: source engine map context id
>> + * @dst_fd: open i915 drm file descriptor where @dst context belongs to
>> + * @dst: destination engine map context id
>> + *
>> + * Special purpose wrapper for copying engine map from one context to another.
>> + *
>> + * In can be called regardless of whether the kernel supports context engine
>> + * maps and is a no-op if not supported.
>> + */
>> +void
>> +gem_context_copy_engines(int src_fd, uint32_t src, int dst_fd, uint32_t dst)
>> +{
>> + I915_DEFINE_CONTEXT_PARAM_ENGINES(engines, I915_EXEC_RING_MASK + 1);
>> + struct drm_i915_gem_context_param param = {
>> + .param = I915_CONTEXT_PARAM_ENGINES,
>> + .ctx_id = src,
>> + .size = sizeof(engines),
>> + .value = to_user_pointer(&engines),
>> + };
>> +
>> + if (__gem_context_get_param(src_fd, ¶m) || !param.size)
>> + return;
>> +
>> + param.ctx_id = dst;
>> + gem_context_set_param(dst_fd, ¶m);
>
> You don't want to copy across the use-default set? You presume dst is
> already using defaults?
Hm hm.. not sure. I guess it would be most in-line with what the helper
say on the tin to copy as is. I'll respin.
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [igt-dev] [PATCH i-g-t 1/2] lib/i915: Add helper for copying engine maps from one context to another
@ 2020-01-24 12:26 ` Tvrtko Ursulin
0 siblings, 0 replies; 16+ messages in thread
From: Tvrtko Ursulin @ 2020-01-24 12:26 UTC (permalink / raw)
To: Chris Wilson, igt-dev; +Cc: Intel-gfx, Tvrtko Ursulin
On 24/01/2020 12:23, Chris Wilson wrote:
> Quoting Tvrtko Ursulin (2020-01-24 12:17:58)
>> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>>
>> We also need to support copying across file descriptors.
>>
>> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>> Cc: Chris Wilson <chris@chris-wilson.co.uk>
>> Cc: Sreedhar Telukuntla <sreedhar.telukuntla@intel.com>
>> ---
>> lib/i915/gem_context.c | 30 ++++++++++++++++++++++++++++++
>> lib/i915/gem_context.h | 2 ++
>> 2 files changed, 32 insertions(+)
>>
>> diff --git a/lib/i915/gem_context.c b/lib/i915/gem_context.c
>> index 0b6a554dfe27..41957b66ca52 100644
>> --- a/lib/i915/gem_context.c
>> +++ b/lib/i915/gem_context.c
>> @@ -462,3 +462,33 @@ bool gem_context_has_engine(int fd, uint32_t ctx, uint64_t engine)
>>
>> return __gem_execbuf(fd, &execbuf) == -ENOENT;
>> }
>> +
>> +/**
>> + * gem_context_copy_engines:
>> + * @src_fd: open i915 drm file descriptor where @src context belongs to
>> + * @src: source engine map context id
>> + * @dst_fd: open i915 drm file descriptor where @dst context belongs to
>> + * @dst: destination engine map context id
>> + *
>> + * Special purpose wrapper for copying engine map from one context to another.
>> + *
>> + * In can be called regardless of whether the kernel supports context engine
>> + * maps and is a no-op if not supported.
>> + */
>> +void
>> +gem_context_copy_engines(int src_fd, uint32_t src, int dst_fd, uint32_t dst)
>> +{
>> + I915_DEFINE_CONTEXT_PARAM_ENGINES(engines, I915_EXEC_RING_MASK + 1);
>> + struct drm_i915_gem_context_param param = {
>> + .param = I915_CONTEXT_PARAM_ENGINES,
>> + .ctx_id = src,
>> + .size = sizeof(engines),
>> + .value = to_user_pointer(&engines),
>> + };
>> +
>> + if (__gem_context_get_param(src_fd, ¶m) || !param.size)
>> + return;
>> +
>> + param.ctx_id = dst;
>> + gem_context_set_param(dst_fd, ¶m);
>
> You don't want to copy across the use-default set? You presume dst is
> already using defaults?
Hm hm.. not sure. I guess it would be most in-line with what the helper
say on the tin to copy as is. I'll respin.
Regards,
Tvrtko
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Intel-gfx] [PATCH i-g-t v2 1/2] lib/i915: Add helper for copying engine maps from one context to another
2020-01-24 12:17 ` [igt-dev] " Tvrtko Ursulin
@ 2020-01-24 12:28 ` Tvrtko Ursulin
-1 siblings, 0 replies; 16+ messages in thread
From: Tvrtko Ursulin @ 2020-01-24 12:28 UTC (permalink / raw)
To: igt-dev; +Cc: Intel-gfx
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
We also need to support copying across file descriptors.
v2:
* Copy over even if src is unset. (Chris)
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Sreedhar Telukuntla <sreedhar.telukuntla@intel.com>
---
lib/i915/gem_context.c | 30 ++++++++++++++++++++++++++++++
lib/i915/gem_context.h | 2 ++
2 files changed, 32 insertions(+)
diff --git a/lib/i915/gem_context.c b/lib/i915/gem_context.c
index 0b6a554dfe27..50dfee3d1030 100644
--- a/lib/i915/gem_context.c
+++ b/lib/i915/gem_context.c
@@ -462,3 +462,33 @@ bool gem_context_has_engine(int fd, uint32_t ctx, uint64_t engine)
return __gem_execbuf(fd, &execbuf) == -ENOENT;
}
+
+/**
+ * gem_context_copy_engines:
+ * @src_fd: open i915 drm file descriptor where @src context belongs to
+ * @src: source engine map context id
+ * @dst_fd: open i915 drm file descriptor where @dst context belongs to
+ * @dst: destination engine map context id
+ *
+ * Special purpose helper for copying engine map from one context to another.
+ *
+ * In can be called regardless of whether the kernel supports context engine
+ * maps and is a no-op if not supported.
+ */
+void
+gem_context_copy_engines(int src_fd, uint32_t src, int dst_fd, uint32_t dst)
+{
+ I915_DEFINE_CONTEXT_PARAM_ENGINES(engines, I915_EXEC_RING_MASK + 1);
+ struct drm_i915_gem_context_param param = {
+ .param = I915_CONTEXT_PARAM_ENGINES,
+ .ctx_id = src,
+ .size = sizeof(engines),
+ .value = to_user_pointer(&engines),
+ };
+
+ if (__gem_context_get_param(src_fd, ¶m))
+ return;
+
+ param.ctx_id = dst;
+ gem_context_set_param(dst_fd, ¶m);
+}
diff --git a/lib/i915/gem_context.h b/lib/i915/gem_context.h
index cf2ba33fee8f..15e5db281b79 100644
--- a/lib/i915/gem_context.h
+++ b/lib/i915/gem_context.h
@@ -42,6 +42,8 @@ uint32_t gem_context_clone(int i915,
uint32_t src, unsigned int share,
unsigned int flags);
uint32_t gem_context_clone_with_engines(int i915, uint32_t src);
+void gem_context_copy_engines(int src_fd, uint32_t src,
+ int dst_fd, uint32_t dst);
uint32_t gem_queue_create(int i915);
uint32_t gem_queue_clone_with_engines(int i915, uint32_t src);
--
2.20.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [igt-dev] [PATCH i-g-t v2 1/2] lib/i915: Add helper for copying engine maps from one context to another
@ 2020-01-24 12:28 ` Tvrtko Ursulin
0 siblings, 0 replies; 16+ messages in thread
From: Tvrtko Ursulin @ 2020-01-24 12:28 UTC (permalink / raw)
To: igt-dev; +Cc: Intel-gfx, Tvrtko Ursulin
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
We also need to support copying across file descriptors.
v2:
* Copy over even if src is unset. (Chris)
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Sreedhar Telukuntla <sreedhar.telukuntla@intel.com>
---
lib/i915/gem_context.c | 30 ++++++++++++++++++++++++++++++
lib/i915/gem_context.h | 2 ++
2 files changed, 32 insertions(+)
diff --git a/lib/i915/gem_context.c b/lib/i915/gem_context.c
index 0b6a554dfe27..50dfee3d1030 100644
--- a/lib/i915/gem_context.c
+++ b/lib/i915/gem_context.c
@@ -462,3 +462,33 @@ bool gem_context_has_engine(int fd, uint32_t ctx, uint64_t engine)
return __gem_execbuf(fd, &execbuf) == -ENOENT;
}
+
+/**
+ * gem_context_copy_engines:
+ * @src_fd: open i915 drm file descriptor where @src context belongs to
+ * @src: source engine map context id
+ * @dst_fd: open i915 drm file descriptor where @dst context belongs to
+ * @dst: destination engine map context id
+ *
+ * Special purpose helper for copying engine map from one context to another.
+ *
+ * In can be called regardless of whether the kernel supports context engine
+ * maps and is a no-op if not supported.
+ */
+void
+gem_context_copy_engines(int src_fd, uint32_t src, int dst_fd, uint32_t dst)
+{
+ I915_DEFINE_CONTEXT_PARAM_ENGINES(engines, I915_EXEC_RING_MASK + 1);
+ struct drm_i915_gem_context_param param = {
+ .param = I915_CONTEXT_PARAM_ENGINES,
+ .ctx_id = src,
+ .size = sizeof(engines),
+ .value = to_user_pointer(&engines),
+ };
+
+ if (__gem_context_get_param(src_fd, ¶m))
+ return;
+
+ param.ctx_id = dst;
+ gem_context_set_param(dst_fd, ¶m);
+}
diff --git a/lib/i915/gem_context.h b/lib/i915/gem_context.h
index cf2ba33fee8f..15e5db281b79 100644
--- a/lib/i915/gem_context.h
+++ b/lib/i915/gem_context.h
@@ -42,6 +42,8 @@ uint32_t gem_context_clone(int i915,
uint32_t src, unsigned int share,
unsigned int flags);
uint32_t gem_context_clone_with_engines(int i915, uint32_t src);
+void gem_context_copy_engines(int src_fd, uint32_t src,
+ int dst_fd, uint32_t dst);
uint32_t gem_queue_create(int i915);
uint32_t gem_queue_clone_with_engines(int i915, uint32_t src);
--
2.20.1
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [Intel-gfx] [PATCH i-g-t 1/2] lib/i915: Add helper for copying engine maps from one context to another
2020-01-24 12:26 ` [igt-dev] " Tvrtko Ursulin
@ 2020-01-24 12:29 ` Chris Wilson
-1 siblings, 0 replies; 16+ messages in thread
From: Chris Wilson @ 2020-01-24 12:29 UTC (permalink / raw)
To: Tvrtko Ursulin, igt-dev; +Cc: Intel-gfx
Quoting Tvrtko Ursulin (2020-01-24 12:26:31)
>
> On 24/01/2020 12:23, Chris Wilson wrote:
> > Quoting Tvrtko Ursulin (2020-01-24 12:17:58)
> >> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> >>
> >> We also need to support copying across file descriptors.
> >>
> >> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> >> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> >> Cc: Sreedhar Telukuntla <sreedhar.telukuntla@intel.com>
> >> ---
> >> lib/i915/gem_context.c | 30 ++++++++++++++++++++++++++++++
> >> lib/i915/gem_context.h | 2 ++
> >> 2 files changed, 32 insertions(+)
> >>
> >> diff --git a/lib/i915/gem_context.c b/lib/i915/gem_context.c
> >> index 0b6a554dfe27..41957b66ca52 100644
> >> --- a/lib/i915/gem_context.c
> >> +++ b/lib/i915/gem_context.c
> >> @@ -462,3 +462,33 @@ bool gem_context_has_engine(int fd, uint32_t ctx, uint64_t engine)
> >>
> >> return __gem_execbuf(fd, &execbuf) == -ENOENT;
> >> }
> >> +
> >> +/**
> >> + * gem_context_copy_engines:
> >> + * @src_fd: open i915 drm file descriptor where @src context belongs to
> >> + * @src: source engine map context id
> >> + * @dst_fd: open i915 drm file descriptor where @dst context belongs to
> >> + * @dst: destination engine map context id
> >> + *
> >> + * Special purpose wrapper for copying engine map from one context to another.
> >> + *
> >> + * In can be called regardless of whether the kernel supports context engine
> >> + * maps and is a no-op if not supported.
> >> + */
> >> +void
> >> +gem_context_copy_engines(int src_fd, uint32_t src, int dst_fd, uint32_t dst)
> >> +{
> >> + I915_DEFINE_CONTEXT_PARAM_ENGINES(engines, I915_EXEC_RING_MASK + 1);
> >> + struct drm_i915_gem_context_param param = {
> >> + .param = I915_CONTEXT_PARAM_ENGINES,
> >> + .ctx_id = src,
> >> + .size = sizeof(engines),
> >> + .value = to_user_pointer(&engines),
> >> + };
> >> +
> >> + if (__gem_context_get_param(src_fd, ¶m) || !param.size)
> >> + return;
> >> +
> >> + param.ctx_id = dst;
> >> + gem_context_set_param(dst_fd, ¶m);
> >
> > You don't want to copy across the use-default set? You presume dst is
> > already using defaults?
>
> Hm hm.. not sure. I guess it would be most in-line with what the helper
> say on the tin to copy as is. I'll respin.
In which case, a preemptive
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [igt-dev] [PATCH i-g-t 1/2] lib/i915: Add helper for copying engine maps from one context to another
@ 2020-01-24 12:29 ` Chris Wilson
0 siblings, 0 replies; 16+ messages in thread
From: Chris Wilson @ 2020-01-24 12:29 UTC (permalink / raw)
To: Tvrtko Ursulin, igt-dev; +Cc: Intel-gfx, Tvrtko Ursulin
Quoting Tvrtko Ursulin (2020-01-24 12:26:31)
>
> On 24/01/2020 12:23, Chris Wilson wrote:
> > Quoting Tvrtko Ursulin (2020-01-24 12:17:58)
> >> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> >>
> >> We also need to support copying across file descriptors.
> >>
> >> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> >> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> >> Cc: Sreedhar Telukuntla <sreedhar.telukuntla@intel.com>
> >> ---
> >> lib/i915/gem_context.c | 30 ++++++++++++++++++++++++++++++
> >> lib/i915/gem_context.h | 2 ++
> >> 2 files changed, 32 insertions(+)
> >>
> >> diff --git a/lib/i915/gem_context.c b/lib/i915/gem_context.c
> >> index 0b6a554dfe27..41957b66ca52 100644
> >> --- a/lib/i915/gem_context.c
> >> +++ b/lib/i915/gem_context.c
> >> @@ -462,3 +462,33 @@ bool gem_context_has_engine(int fd, uint32_t ctx, uint64_t engine)
> >>
> >> return __gem_execbuf(fd, &execbuf) == -ENOENT;
> >> }
> >> +
> >> +/**
> >> + * gem_context_copy_engines:
> >> + * @src_fd: open i915 drm file descriptor where @src context belongs to
> >> + * @src: source engine map context id
> >> + * @dst_fd: open i915 drm file descriptor where @dst context belongs to
> >> + * @dst: destination engine map context id
> >> + *
> >> + * Special purpose wrapper for copying engine map from one context to another.
> >> + *
> >> + * In can be called regardless of whether the kernel supports context engine
> >> + * maps and is a no-op if not supported.
> >> + */
> >> +void
> >> +gem_context_copy_engines(int src_fd, uint32_t src, int dst_fd, uint32_t dst)
> >> +{
> >> + I915_DEFINE_CONTEXT_PARAM_ENGINES(engines, I915_EXEC_RING_MASK + 1);
> >> + struct drm_i915_gem_context_param param = {
> >> + .param = I915_CONTEXT_PARAM_ENGINES,
> >> + .ctx_id = src,
> >> + .size = sizeof(engines),
> >> + .value = to_user_pointer(&engines),
> >> + };
> >> +
> >> + if (__gem_context_get_param(src_fd, ¶m) || !param.size)
> >> + return;
> >> +
> >> + param.ctx_id = dst;
> >> + gem_context_set_param(dst_fd, ¶m);
> >
> > You don't want to copy across the use-default set? You presume dst is
> > already using defaults?
>
> Hm hm.. not sure. I guess it would be most in-line with what the helper
> say on the tin to copy as is. I'll respin.
In which case, a preemptive
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [Intel-gfx] [PATCH i-g-t v2 1/2] lib/i915: Add helper for copying engine maps from one context to another
2020-01-24 12:28 ` [igt-dev] " Tvrtko Ursulin
@ 2020-01-24 12:48 ` Chris Wilson
-1 siblings, 0 replies; 16+ messages in thread
From: Chris Wilson @ 2020-01-24 12:48 UTC (permalink / raw)
To: Tvrtko Ursulin, igt-dev; +Cc: Intel-gfx
Quoting Tvrtko Ursulin (2020-01-24 12:28:33)
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>
> We also need to support copying across file descriptors.
>
> v2:
> * Copy over even if src is unset. (Chris)
>
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Sreedhar Telukuntla <sreedhar.telukuntla@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [igt-dev] [PATCH i-g-t v2 1/2] lib/i915: Add helper for copying engine maps from one context to another
@ 2020-01-24 12:48 ` Chris Wilson
0 siblings, 0 replies; 16+ messages in thread
From: Chris Wilson @ 2020-01-24 12:48 UTC (permalink / raw)
To: Tvrtko Ursulin, igt-dev; +Cc: Intel-gfx, Tvrtko Ursulin
Quoting Tvrtko Ursulin (2020-01-24 12:28:33)
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>
> We also need to support copying across file descriptors.
>
> v2:
> * Copy over even if src is unset. (Chris)
>
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Sreedhar Telukuntla <sreedhar.telukuntla@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2020-01-24 12:49 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-24 12:17 [Intel-gfx] [PATCH i-g-t 1/2] lib/i915: Add helper for copying engine maps from one context to another Tvrtko Ursulin
2020-01-24 12:17 ` [igt-dev] " Tvrtko Ursulin
2020-01-24 12:17 ` [Intel-gfx] [PATCH i-g-t 2/2] tests/i915/gem_exec_parallel:Set engine map to default context Tvrtko Ursulin
2020-01-24 12:17 ` [igt-dev] " Tvrtko Ursulin
2020-01-24 12:25 ` [Intel-gfx] " Chris Wilson
2020-01-24 12:25 ` Chris Wilson
2020-01-24 12:23 ` [Intel-gfx] [PATCH i-g-t 1/2] lib/i915: Add helper for copying engine maps from one context to another Chris Wilson
2020-01-24 12:23 ` [igt-dev] " Chris Wilson
2020-01-24 12:26 ` [Intel-gfx] " Tvrtko Ursulin
2020-01-24 12:26 ` [igt-dev] " Tvrtko Ursulin
2020-01-24 12:29 ` [Intel-gfx] " Chris Wilson
2020-01-24 12:29 ` [igt-dev] " Chris Wilson
2020-01-24 12:28 ` [Intel-gfx] [PATCH i-g-t v2 " Tvrtko Ursulin
2020-01-24 12:28 ` [igt-dev] " Tvrtko Ursulin
2020-01-24 12:48 ` [Intel-gfx] " Chris Wilson
2020-01-24 12:48 ` [igt-dev] " Chris Wilson
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.