[igt-dev] [PATCH i-g-t 56/81] lib/i915: Require a context config in gem_submission_measure
Jason Ekstrand
jason at jlekstrand.net
Wed Jul 7 14:46:18 UTC 2021
Now all tests are converted to provide a context config to
gem_submission_measure so we can require it. This gets rid of its use
of __for_each_physical_engine().
Signed-off-by: Jason Ekstrand <jason at jlekstrand.net>
Reviewed-by: Ashutosh Dixit <ashutosh.dixit at intel.com>
---
lib/i915/gem_submission.c | 38 ++++++++++++--------------------------
1 file changed, 12 insertions(+), 26 deletions(-)
diff --git a/lib/i915/gem_submission.c b/lib/i915/gem_submission.c
index 9c6cc8146..69cf1f16a 100644
--- a/lib/i915/gem_submission.c
+++ b/lib/i915/gem_submission.c
@@ -372,7 +372,7 @@ __measure_ringsize(int i915, uint32_t ctx_id, unsigned int engine)
unsigned int gem_submission_measure(int i915, const intel_ctx_cfg_t *cfg,
unsigned int engine)
{
- const intel_ctx_t *ctx = NULL;
+ const intel_ctx_t *ctx;
unsigned int size;
bool nonblock;
@@ -380,40 +380,26 @@ unsigned int gem_submission_measure(int i915, const intel_ctx_cfg_t *cfg,
if (!nonblock)
fcntl(i915, F_SETFL, fcntl(i915, F_GETFL) | O_NONBLOCK);
- if (cfg) {
- if (gem_has_contexts(i915))
- ctx = intel_ctx_create(i915, cfg);
- else
- ctx = intel_ctx_0(i915);
- }
+ igt_assert(cfg);
+ if (gem_has_contexts(i915))
+ ctx = intel_ctx_create(i915, cfg);
+ else
+ ctx = intel_ctx_0(i915);
if (engine == ALL_ENGINES) {
struct intel_execution_engine2 *e;
size = -1;
- if (ctx) {
- for_each_ctx_engine(i915, ctx, e) {
- unsigned int this = __measure_ringsize(i915, ctx->id, e->flags);
- if (this < size)
- size = this;
- }
- } else {
- __for_each_physical_engine(i915, e) {
- unsigned int this = __measure_ringsize(i915, 0, e->flags);
- if (this < size)
- size = this;
- }
+ for_each_ctx_engine(i915, ctx, e) {
+ unsigned int this = __measure_ringsize(i915, ctx->id, e->flags);
+ if (this < size)
+ size = this;
}
} else {
- if (ctx)
- size = __measure_ringsize(i915, ctx->id, engine);
- else
- size = __measure_ringsize(i915, 0, engine);
+ size = __measure_ringsize(i915, ctx->id, engine);
}
- if (ctx)
- intel_ctx_destroy(i915, ctx);
-
+ intel_ctx_destroy(i915, ctx);
if (!nonblock)
fcntl(i915, F_SETFL, fcntl(i915, F_GETFL) & ~O_NONBLOCK);
--
2.31.1
More information about the igt-dev
mailing list