* [PATCH i-g-t] lib/i915: Fix test enumeration on legacy kernels
@ 2019-05-23 8:39 Tvrtko Ursulin
2019-05-23 8:52 ` Andi Shyti
0 siblings, 1 reply; 2+ messages in thread
From: Tvrtko Ursulin @ 2019-05-23 8:39 UTC (permalink / raw)
To: igt-dev; +Cc: Intel-gfx
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Where engine discovery and context engine map are not supported we must
not call the asserting gem_class_instance_to_eb_flags from the engine
list initalizer. (Since not all engines can be addressed using the legacy
execbuf API.)
Instead extract the code into lower level __gem_class_instance_to_eb_flags
helper which can return errors the caller can manually handle then.
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Andi Shyti <andi.shyti@intel.com>
---
lib/i915/gem_engine_topology.c | 17 +++++++++++++----
lib/igt_gt.c | 28 +++++++++++++++++++---------
lib/igt_gt.h | 5 +++++
3 files changed, 37 insertions(+), 13 deletions(-)
diff --git a/lib/i915/gem_engine_topology.c b/lib/i915/gem_engine_topology.c
index d0c8bd5aaeac..1748231a1de0 100644
--- a/lib/i915/gem_engine_topology.c
+++ b/lib/i915/gem_engine_topology.c
@@ -222,15 +222,24 @@ struct intel_engine_data intel_init_engine_list(int fd, uint32_t ctx_id)
__for_each_static_engine(e2) {
struct intel_execution_engine2 *__e2 =
&engine_data.engines[engine_data.nengines];
+ int flags;
+
+ flags = __gem_class_instance_to_eb_flags(fd,
+ e2->class,
+ e2->instance);
+
+ __e2->flags = flags;
if (!igt_only_list_subtests()) {
- __e2->flags = gem_class_instance_to_eb_flags(fd,
- e2->class, e2->instance);
+ /*
+ * Skip engines not suported with legacy
+ * execbuf.
+ */
+ if (flags < 0)
+ continue;
if (!gem_has_ring(fd, __e2->flags))
continue;
- } else {
- __e2->flags = -1; /* 0xfff... */
}
__e2->name = e2->name;
diff --git a/lib/igt_gt.c b/lib/igt_gt.c
index 6b7c037e6d10..1a81a1fb405f 100644
--- a/lib/igt_gt.c
+++ b/lib/igt_gt.c
@@ -611,15 +611,13 @@ int gem_execbuf_flags_to_engine_class(unsigned int flags)
}
}
-unsigned int
-gem_class_instance_to_eb_flags(int gem_fd,
- enum drm_i915_gem_engine_class class,
- unsigned int instance)
+int
+__gem_class_instance_to_eb_flags(int gem_fd,
+ enum drm_i915_gem_engine_class class,
+ unsigned int instance)
{
- if (class != I915_ENGINE_CLASS_VIDEO)
- igt_assert(instance == 0);
- else
- igt_assert(instance >= 0 && instance <= 1);
+ if (instance > 1 || (class != I915_ENGINE_CLASS_VIDEO && instance > 0))
+ return -1;
switch (class) {
case I915_ENGINE_CLASS_RENDER:
@@ -640,10 +638,22 @@ gem_class_instance_to_eb_flags(int gem_fd,
return I915_EXEC_VEBOX;
case I915_ENGINE_CLASS_INVALID:
default:
- igt_assert(0);
+ return -1;
};
}
+unsigned int
+gem_class_instance_to_eb_flags(int gem_fd,
+ enum drm_i915_gem_engine_class class,
+ unsigned int instance)
+{
+ int flags = __gem_class_instance_to_eb_flags(gem_fd, class, instance);
+
+ igt_assert(flags >= 0);
+
+ return flags;
+}
+
bool gem_has_engine(int gem_fd,
enum drm_i915_gem_engine_class class,
unsigned int instance)
diff --git a/lib/igt_gt.h b/lib/igt_gt.h
index 77318e2a82b8..189b9bf70a8b 100644
--- a/lib/igt_gt.h
+++ b/lib/igt_gt.h
@@ -102,6 +102,11 @@ extern const struct intel_execution_engine2 {
int gem_execbuf_flags_to_engine_class(unsigned int flags);
+int
+__gem_class_instance_to_eb_flags(int gem_fd,
+ enum drm_i915_gem_engine_class class,
+ unsigned int instance);
+
unsigned int
gem_class_instance_to_eb_flags(int gem_fd,
enum drm_i915_gem_engine_class class,
--
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] 2+ messages in thread
* Re: [PATCH i-g-t] lib/i915: Fix test enumeration on legacy kernels
2019-05-23 8:39 [PATCH i-g-t] lib/i915: Fix test enumeration on legacy kernels Tvrtko Ursulin
@ 2019-05-23 8:52 ` Andi Shyti
0 siblings, 0 replies; 2+ messages in thread
From: Andi Shyti @ 2019-05-23 8:52 UTC (permalink / raw)
To: Tvrtko Ursulin; +Cc: igt-dev, Intel-gfx
Hi Tvrtko,
On Thu, May 23, 2019 at 09:39:29AM +0100, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>
> Where engine discovery and context engine map are not supported we must
> not call the asserting gem_class_instance_to_eb_flags from the engine
> list initalizer. (Since not all engines can be addressed using the legacy
> execbuf API.)
>
> Instead extract the code into lower level __gem_class_instance_to_eb_flags
> helper which can return errors the caller can manually handle then.
>
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Cc: Andi Shyti <andi.shyti@intel.com>
Chris was after this:
https://patchwork.freedesktop.org/patch/306446/
Andi
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-05-23 8:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-23 8:39 [PATCH i-g-t] lib/i915: Fix test enumeration on legacy kernels Tvrtko Ursulin
2019-05-23 8:52 ` Andi Shyti
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).