From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 18/29] drm/i915/selftests: Pass around intel_context for sseu
Date: Wed, 10 Apr 2019 13:25:59 +0100 [thread overview]
Message-ID: <d8ce598d-c254-ded0-d940-adcff42f6d4a@linux.intel.com> (raw)
In-Reply-To: <20190408091728.20207-18-chris@chris-wilson.co.uk>
On 08/04/2019 10:17, Chris Wilson wrote:
> Combine the (i915_gem_context, intel_engine) into a single parameter,
> the intel_context for convenience and later simplification.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
> .../gpu/drm/i915/selftests/i915_gem_context.c | 74 +++++++++++--------
> 1 file changed, 44 insertions(+), 30 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_context.c b/drivers/gpu/drm/i915/selftests/i915_gem_context.c
> index 807644ae6877..8e2a94333559 100644
> --- a/drivers/gpu/drm/i915/selftests/i915_gem_context.c
> +++ b/drivers/gpu/drm/i915/selftests/i915_gem_context.c
> @@ -755,8 +755,7 @@ static struct i915_vma *rpcs_query_batch(struct i915_vma *vma)
>
> static int
> emit_rpcs_query(struct drm_i915_gem_object *obj,
> - struct i915_gem_context *ctx,
> - struct intel_engine_cs *engine,
> + struct intel_context *ce,
> struct i915_request **rq_out)
> {
> struct i915_request *rq;
> @@ -764,9 +763,9 @@ emit_rpcs_query(struct drm_i915_gem_object *obj,
> struct i915_vma *vma;
> int err;
>
> - GEM_BUG_ON(!intel_engine_can_store_dword(engine));
> + GEM_BUG_ON(!intel_engine_can_store_dword(ce->engine));
>
> - vma = i915_vma_instance(obj, &ctx->ppgtt->vm, NULL);
> + vma = i915_vma_instance(obj, &ce->gem_context->ppgtt->vm, NULL);
> if (IS_ERR(vma))
> return PTR_ERR(vma);
>
> @@ -784,13 +783,15 @@ emit_rpcs_query(struct drm_i915_gem_object *obj,
> goto err_vma;
> }
>
> - rq = i915_request_alloc(engine, ctx);
> + rq = i915_request_create(ce);
> if (IS_ERR(rq)) {
> err = PTR_ERR(rq);
> goto err_batch;
> }
>
> - err = engine->emit_bb_start(rq, batch->node.start, batch->node.size, 0);
> + err = rq->engine->emit_bb_start(rq,
> + batch->node.start, batch->node.size,
> + 0);
> if (err)
> goto err_request;
>
> @@ -834,8 +835,7 @@ static int
> __sseu_prepare(struct drm_i915_private *i915,
> const char *name,
> unsigned int flags,
> - struct i915_gem_context *ctx,
> - struct intel_engine_cs *engine,
> + struct intel_context *ce,
> struct igt_spinner **spin)
> {
> struct i915_request *rq;
> @@ -853,7 +853,10 @@ __sseu_prepare(struct drm_i915_private *i915,
> if (ret)
> goto err_free;
>
> - rq = igt_spinner_create_request(*spin, ctx, engine, MI_NOOP);
> + rq = igt_spinner_create_request(*spin,
> + ce->gem_context,
> + ce->engine,
> + MI_NOOP);
> if (IS_ERR(rq)) {
> ret = PTR_ERR(rq);
> goto err_fini;
> @@ -880,8 +883,7 @@ __sseu_prepare(struct drm_i915_private *i915,
>
> static int
> __read_slice_count(struct drm_i915_private *i915,
> - struct i915_gem_context *ctx,
> - struct intel_engine_cs *engine,
> + struct intel_context *ce,
> struct drm_i915_gem_object *obj,
> struct igt_spinner *spin,
> u32 *rpcs)
> @@ -892,7 +894,7 @@ __read_slice_count(struct drm_i915_private *i915,
> u32 *buf, val;
> long ret;
>
> - ret = emit_rpcs_query(obj, ctx, engine, &rq);
> + ret = emit_rpcs_query(obj, ce, &rq);
> if (ret)
> return ret;
>
> @@ -956,29 +958,28 @@ static int
> __sseu_finish(struct drm_i915_private *i915,
> const char *name,
> unsigned int flags,
> - struct i915_gem_context *ctx,
> - struct intel_engine_cs *engine,
> + struct intel_context *ce,
> struct drm_i915_gem_object *obj,
> unsigned int expected,
> struct igt_spinner *spin)
> {
> - unsigned int slices = hweight32(engine->sseu.slice_mask);
> + unsigned int slices = hweight32(ce->engine->sseu.slice_mask);
> u32 rpcs = 0;
> int ret = 0;
>
> if (flags & TEST_RESET) {
> - ret = i915_reset_engine(engine, "sseu");
> + ret = i915_reset_engine(ce->engine, "sseu");
> if (ret)
> goto out;
> }
>
> - ret = __read_slice_count(i915, ctx, engine, obj,
> + ret = __read_slice_count(i915, ce, obj,
> flags & TEST_RESET ? NULL : spin, &rpcs);
> ret = __check_rpcs(name, rpcs, ret, expected, "Context", "!");
> if (ret)
> goto out;
>
> - ret = __read_slice_count(i915, i915->kernel_context, engine, obj,
> + ret = __read_slice_count(i915, ce->engine->kernel_context, obj,
> NULL, &rpcs);
> ret = __check_rpcs(name, rpcs, ret, slices, "Kernel context", "!");
>
> @@ -993,7 +994,7 @@ __sseu_finish(struct drm_i915_private *i915,
> if (ret)
> return ret;
>
> - ret = __read_slice_count(i915, ctx, engine, obj, NULL, &rpcs);
> + ret = __read_slice_count(i915, ce, obj, NULL, &rpcs);
> ret = __check_rpcs(name, rpcs, ret, expected,
> "Context", " after idle!");
> }
> @@ -1005,23 +1006,22 @@ static int
> __sseu_test(struct drm_i915_private *i915,
> const char *name,
> unsigned int flags,
> - struct i915_gem_context *ctx,
> - struct intel_engine_cs *engine,
> + struct intel_context *ce,
> struct drm_i915_gem_object *obj,
> struct intel_sseu sseu)
> {
> struct igt_spinner *spin = NULL;
> int ret;
>
> - ret = __sseu_prepare(i915, name, flags, ctx, engine, &spin);
> + ret = __sseu_prepare(i915, name, flags, ce, &spin);
> if (ret)
> return ret;
>
> - ret = __i915_gem_context_reconfigure_sseu(ctx, engine, sseu);
> + ret = __i915_gem_context_reconfigure_sseu(ce->gem_context, ce->engine, sseu);
> if (ret)
> goto out_spin;
>
> - ret = __sseu_finish(i915, name, flags, ctx, engine, obj,
> + ret = __sseu_finish(i915, name, flags, ce, obj,
> hweight32(sseu.slice_mask), spin);
>
> out_spin:
> @@ -1042,6 +1042,7 @@ __igt_ctx_sseu(struct drm_i915_private *i915,
> struct intel_sseu default_sseu = engine->sseu;
> struct drm_i915_gem_object *obj;
> struct i915_gem_context *ctx;
> + struct intel_context *ce;
> struct intel_sseu pg_sseu;
> intel_wakeref_t wakeref;
> struct drm_file *file;
> @@ -1093,23 +1094,33 @@ __igt_ctx_sseu(struct drm_i915_private *i915,
>
> wakeref = intel_runtime_pm_get(i915);
>
> + ce = intel_context_instance(ctx, i915->engine[RCS0]);
> + if (IS_ERR(ce)) {
> + ret = PTR_ERR(ce);
> + goto out_rpm;
> + }
> +
> + ret = intel_context_pin(ce);
> + if (ret)
> + goto out_context;
> +
> /* First set the default mask. */
> - ret = __sseu_test(i915, name, flags, ctx, engine, obj, default_sseu);
> + ret = __sseu_test(i915, name, flags, ce, obj, default_sseu);
> if (ret)
> goto out_fail;
>
> /* Then set a power-gated configuration. */
> - ret = __sseu_test(i915, name, flags, ctx, engine, obj, pg_sseu);
> + ret = __sseu_test(i915, name, flags, ce, obj, pg_sseu);
> if (ret)
> goto out_fail;
>
> /* Back to defaults. */
> - ret = __sseu_test(i915, name, flags, ctx, engine, obj, default_sseu);
> + ret = __sseu_test(i915, name, flags, ce, obj, default_sseu);
> if (ret)
> goto out_fail;
>
> /* One last power-gated configuration for the road. */
> - ret = __sseu_test(i915, name, flags, ctx, engine, obj, pg_sseu);
> + ret = __sseu_test(i915, name, flags, ce, obj, pg_sseu);
> if (ret)
> goto out_fail;
>
> @@ -1117,9 +1128,12 @@ __igt_ctx_sseu(struct drm_i915_private *i915,
> if (igt_flush_test(i915, I915_WAIT_LOCKED))
> ret = -EIO;
>
> - i915_gem_object_put(obj);
> -
> + intel_context_unpin(ce);
> +out_context:
> + intel_context_put(ce);
> +out_rpm:
> intel_runtime_pm_put(i915, wakeref);
> + i915_gem_object_put(obj);
>
> out_unlock:
> mutex_unlock(&i915->drm.struct_mutex);
>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2019-04-10 12:26 UTC|newest]
Thread overview: 71+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-08 9:17 [PATCH 01/29] drm/i915: Mark up ips for RCU protection Chris Wilson
2019-04-08 9:17 ` [PATCH 02/29] drm/i915/guc: Replace WARN with a DRM_ERROR Chris Wilson
2019-04-08 14:26 ` Tvrtko Ursulin
2019-04-08 9:17 ` [PATCH 03/29] drm/i915: Use static allocation for i915_globals_park() Chris Wilson
2019-04-08 14:31 ` Tvrtko Ursulin
2019-04-08 9:17 ` [PATCH 04/29] drm/i915: Consolidate the timeline->barrier Chris Wilson
2019-04-08 14:42 ` Tvrtko Ursulin
2019-04-08 9:17 ` [PATCH 05/29] drm/i915: Store the default sseu setup on the engine Chris Wilson
2019-04-08 14:54 ` Tvrtko Ursulin
2019-04-08 15:57 ` Chris Wilson
2019-04-08 16:04 ` Tvrtko Ursulin
2019-04-08 9:17 ` [PATCH 06/29] drm/i915: Move GraphicsTechnology files under gt/ Chris Wilson
2019-04-08 9:17 ` [PATCH 07/29] drm/i915: Only reset the pinned kernel contexts on resume Chris Wilson
2019-04-10 9:39 ` Tvrtko Ursulin
2019-04-08 9:17 ` [PATCH 08/29] drm/i915: Introduce struct intel_wakeref Chris Wilson
2019-04-10 9:49 ` Tvrtko Ursulin
2019-04-10 10:01 ` Chris Wilson
2019-04-10 10:07 ` Tvrtko Ursulin
2019-04-08 9:17 ` [PATCH 09/29] drm/i915: Pull the GEM powermangement coupling into its own file Chris Wilson
2019-04-08 14:56 ` Tvrtko Ursulin
2019-04-08 16:00 ` Chris Wilson
2019-04-10 9:57 ` Tvrtko Ursulin
2019-04-08 9:17 ` [PATCH 10/29] drm/i915: Introduce context->enter() and context->exit() Chris Wilson
2019-04-10 10:05 ` Tvrtko Ursulin
2019-04-10 10:13 ` Chris Wilson
2019-04-10 11:06 ` Tvrtko Ursulin
2019-04-10 19:19 ` Chris Wilson
2019-04-08 9:17 ` [PATCH 11/29] drm/i915: Pass intel_context to i915_request_create() Chris Wilson
2019-04-10 10:38 ` Tvrtko Ursulin
2019-04-08 9:17 ` [PATCH 12/29] drm/i915: Invert the GEM wakeref hierarchy Chris Wilson
2019-04-08 9:17 ` [PATCH 13/29] drm/i915/gvt: Pin the per-engine GVT shadow contexts Chris Wilson
2019-04-08 9:17 ` [PATCH 14/29] drm/i915: Explicitly pin the logical context for execbuf Chris Wilson
2019-04-08 15:17 ` Tvrtko Ursulin
2019-04-08 9:17 ` [PATCH 15/29] drm/i915/guc: Replace preempt_client lookup with engine->preempt_context Chris Wilson
2019-04-08 14:57 ` Tvrtko Ursulin
2019-04-08 9:17 ` [PATCH 16/29] drm/i915: Export intel_context_instance() Chris Wilson
2019-04-10 12:06 ` Tvrtko Ursulin
2019-04-10 19:32 ` Chris Wilson
2019-04-11 12:57 ` Tvrtko Ursulin
2019-04-08 9:17 ` [PATCH 17/29] drm/i915/selftests: Use the real kernel context for sseu isolation tests Chris Wilson
2019-04-08 15:00 ` Tvrtko Ursulin
2019-04-08 9:17 ` [PATCH 18/29] drm/i915/selftests: Pass around intel_context for sseu Chris Wilson
2019-04-10 12:25 ` Tvrtko Ursulin [this message]
2019-04-08 9:17 ` [PATCH 19/29] drm/i915: Pass intel_context to intel_context_pin_lock() Chris Wilson
2019-04-10 12:45 ` Tvrtko Ursulin
2019-04-10 12:49 ` Chris Wilson
2019-04-10 13:04 ` Chris Wilson
2019-04-10 14:53 ` Tvrtko Ursulin
2019-04-08 9:17 ` [PATCH 20/29] drm/i915: Split engine setup/init into two phases Chris Wilson
2019-04-10 13:30 ` Tvrtko Ursulin
2019-04-08 9:17 ` [PATCH 21/29] drm/i915: Switch back to an array of logical per-engine HW contexts Chris Wilson
2019-04-10 15:32 ` Tvrtko Ursulin
2019-04-10 16:18 ` Chris Wilson
2019-04-11 13:05 ` Tvrtko Ursulin
2019-04-11 13:25 ` Chris Wilson
2019-04-11 13:33 ` [PATCH] " Chris Wilson
2019-04-08 9:17 ` [PATCH 22/29] drm/i915: Remove intel_context.active_link Chris Wilson
2019-04-08 9:17 ` [PATCH 23/29] drm/i915: Move i915_request_alloc into selftests/ Chris Wilson
2019-04-12 7:05 ` Tvrtko Ursulin
2019-04-08 9:17 ` [PATCH 24/29] drm/i915: Allow multiple user handles to the same VM Chris Wilson
2019-04-12 7:21 ` Tvrtko Ursulin
2019-04-08 9:17 ` [PATCH 25/29] drm/i915: Restore control over ppgtt for context creation ABI Chris Wilson
2019-04-08 9:17 ` [PATCH 26/29] drm/i915: Allow a context to define its set of engines Chris Wilson
2019-04-08 9:17 ` [PATCH 27/29] drm/i915: Allow userspace to clone contexts on creation Chris Wilson
2019-04-08 9:17 ` [PATCH 28/29] drm/i915: Re-expose SINGLE_TIMELINE flags for context creation Chris Wilson
2019-04-08 9:17 ` [PATCH 29/29] drm/i915: Load balancing across a virtual engine Chris Wilson
2019-04-08 9:59 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [01/29] drm/i915: Mark up ips for RCU protection Patchwork
2019-04-08 10:13 ` ✗ Fi.CI.SPARSE: " Patchwork
2019-04-08 10:28 ` ✗ Fi.CI.BAT: failure " Patchwork
2019-04-08 10:37 ` Chris Wilson
2019-04-11 22:20 ` ✗ Fi.CI.BAT: failure for series starting with [01/29] drm/i915: Mark up ips for RCU protection (rev2) Patchwork
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=d8ce598d-c254-ded0-d940-adcff42f6d4a@linux.intel.com \
--to=tvrtko.ursulin@linux.intel.com \
--cc=chris@chris-wilson.co.uk \
--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