From: Chris Wilson <chris@chris-wilson.co.uk>
To: intel-gfx@lists.freedesktop.org
Cc: igt-dev@lists.freedesktop.org
Subject: [Intel-gfx] [PATCH i-g-t 3/4] lib/i915: Don't confuse param.size
Date: Fri, 14 Feb 2020 19:40:15 +0000 [thread overview]
Message-ID: <20200214194016.4054376-3-chris@chris-wilson.co.uk> (raw)
In-Reply-To: <20200214194016.4054376-1-chris@chris-wilson.co.uk>
If the context has no engines, it has no engines -- do not override the
user's setup.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
lib/i915/gem_engine_topology.c | 19 +++++++------------
1 file changed, 7 insertions(+), 12 deletions(-)
diff --git a/lib/i915/gem_engine_topology.c b/lib/i915/gem_engine_topology.c
index 9daa03df4..ca1c1fdb9 100644
--- a/lib/i915/gem_engine_topology.c
+++ b/lib/i915/gem_engine_topology.c
@@ -195,17 +195,6 @@ static int gem_topology_get_param(int fd,
if (__gem_context_get_param(fd, p))
return -1; /* using default engine map */
- if (!p->size)
- return 0;
-
- /* size will store the engine count */
- p->size = (p->size - sizeof(struct i915_context_param_engines)) /
- (offsetof(struct i915_context_param_engines,
- engines[1]) -
- sizeof(struct i915_context_param_engines));
-
- igt_assert_f(p->size <= GEM_MAX_ENGINES, "unsupported engine count\n");
-
return 0;
}
@@ -242,7 +231,13 @@ struct intel_engine_data intel_init_engine_list(int fd, uint32_t ctx_id)
query_engine_list(fd, &engine_data);
ctx_map_engines(fd, &engine_data, ¶m);
} else {
- /* param.size contains the engine count */
+ /* engine count can be inferred from size */
+ param.size -= sizeof(struct i915_context_param_engines);
+ param.size /= sizeof(struct i915_engine_class_instance);
+
+ igt_assert_f(param.size <= GEM_MAX_ENGINES,
+ "unsupported engine count\n");
+
for (i = 0; i < param.size; i++)
init_engine(&engine_data.engines[i],
engines.engines[i].engine_class,
--
2.25.0
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2020-02-14 19:40 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-14 19:40 [Intel-gfx] [PATCH i-g-t 1/4] i915/gem_ctx_engines: Exercise 0 engines[] Chris Wilson
2020-02-14 19:40 ` [Intel-gfx] [PATCH i-g-t 2/4] i915/gem_ctx_engine: Exercise for_each_context_engine() with custom engine[] Chris Wilson
2020-02-14 21:49 ` [Intel-gfx] [igt-dev] " Antonio Argenziano
2020-02-14 21:57 ` Chris Wilson
2020-02-14 19:40 ` Chris Wilson [this message]
2020-02-14 23:16 ` [Intel-gfx] [igt-dev] [PATCH i-g-t 3/4] lib/i915: Don't confuse param.size Stimson, Dale B
2020-02-14 19:40 ` [Intel-gfx] [PATCH i-g-t 4/4] lib/i915/gem_engine_topology.c - intel_get_current_engine invalid result Chris Wilson
2020-02-14 21:22 ` [Intel-gfx] [igt-dev] [PATCH i-g-t 1/4] i915/gem_ctx_engines: Exercise 0 engines[] Antonio Argenziano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200214194016.4054376-3-chris@chris-wilson.co.uk \
--to=chris@chris-wilson.co.uk \
--cc=igt-dev@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).