Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 03/23] drm/i915: Remove lrc default desc from GEM context
Date: Thu, 1 Aug 2019 17:22:27 +0100	[thread overview]
Message-ID: <fc2a1eb2-253c-f727-bb89-b72585b43568@linux.intel.com> (raw)
In-Reply-To: <156467525946.6045.18296866780043609699@skylake-alporthouse-com>


On 01/08/2019 17:00, Chris Wilson wrote:
> Quoting Chris Wilson (2019-08-01 16:48:33)
>> Quoting Tvrtko Ursulin (2019-08-01 16:29:53)
>>> For instance Icelake engine dependent stuff sneaked into
>>> intel_lrc.c/lrc_desriptors at some point, which is also against the
>>> spirit of caching. If we were to move the cached value in ce then we
>>> would be able to remove that and have it once again minimal in there.
>>
>> Well we can set all bits but hw_id/lrca at init time. How about if I run
>> that past you?
> 
>   static u64
> -lrc_descriptor(struct intel_context *ce, struct intel_engine_cs *engine)
> +base_lrc_descriptor(struct intel_context *ce, struct intel_engine_cs *engine)
>   {
> -       struct i915_gem_context *ctx = ce->gem_context;
>          u64 desc;
> 
>          BUILD_BUG_ON(MAX_CONTEXT_HW_ID > (BIT(GEN8_CTX_ID_WIDTH)));
> @@ -426,18 +425,12 @@ lrc_descriptor(struct intel_context *ce, struct intel_engine_cs *engine)
>          if (IS_GEN(engine->i915, 8))
>                  desc |= GEN8_CTX_L3LLC_COHERENT;
> 
> -       desc |= i915_ggtt_offset(ce->state) + LRC_HEADER_PAGES * PAGE_SIZE;
> -                                                               /* bits 12-31 */
>          /*
>           * The following 32bits are copied into the OA reports (dword 2).
>           * Consider updating oa_get_render_ctx_id in i915_perf.c when changing
>           * anything below.
>           */
>          if (INTEL_GEN(engine->i915) >= 11) {
> -               GEM_BUG_ON(ctx->hw_id >= BIT(GEN11_SW_CTX_ID_WIDTH));
> -               desc |= (u64)ctx->hw_id << GEN11_SW_CTX_ID_SHIFT;
> -                                                               /* bits 37-47 */
> -
>                  desc |= (u64)engine->instance << GEN11_ENGINE_INSTANCE_SHIFT;
>                                                                  /* bits 48-53 */
> 
> @@ -445,8 +438,29 @@ lrc_descriptor(struct intel_context *ce, struct intel_engine_cs *engine)
> 
>                  desc |= (u64)engine->class << GEN11_ENGINE_CLASS_SHIFT;
>                                                                  /* bits 61-63 */
> +       }
> +
> +       return desc;
> +}
> +
> +static u64
> +update_lrc_descriptor(struct intel_context *ce, struct intel_engine_cs *engine)
> +{
> +       struct i915_gem_context *ctx = ce->gem_context;
> +       u64 desc = ce->lrc_desc;
> +
> +       desc &= ~GENMASK_ULL(31, 12);
> +       desc |= i915_ggtt_offset(ce->state) + LRC_HEADER_PAGES * PAGE_SIZE;
> +
> +       if (INTEL_GEN(engine->i915) >= 11) {
> +               GEM_BUG_ON(ctx->hw_id >= BIT(GEN11_SW_CTX_ID_WIDTH));
> +
> +               desc &= ~GENMASK_ULL(47, 37);
> +               desc |= (u64)ctx->hw_id << GEN11_SW_CTX_ID_SHIFT;
>          } else {
>                  GEM_BUG_ON(ctx->hw_id >= BIT(GEN8_CTX_ID_WIDTH));
> +
> +               desc &= ~GENMASK_ULL(52, 32);
>                  desc |= (u64)ctx->hw_id << GEN8_CTX_ID_SHIFT;   /* bits 32-52 */
>          }
> 
> @@ -1631,7 +1645,7 @@ __execlists_context_pin(struct intel_context *ce,
>          if (ret)
>                  goto unpin_map;
> 
> -       ce->lrc_desc = lrc_descriptor(ce, engine);
> +       ce->lrc_desc = update_lrc_descriptor(ce, engine);
>          ce->lrc_reg_state = vaddr + LRC_STATE_PN * PAGE_SIZE;
>          __execlists_update_reg_state(ce, engine);
> 
> @@ -3126,6 +3140,8 @@ static int execlists_context_deferred_alloc(struct intel_context *ce,
>          ce->ring = ring;
>          ce->state = vma;
> 
> +       ce->lrc_desc = base_lrc_descriptor(ce, engine);
> +
>          return 0;
> 
>   error_ring_free:
> 
> That's pretty much the same amount of work in context_pin. I'm not
> convinced that caching between pins achieves very much.
> 
> Concur?

Who kidnapped real Chris? :D We could merge the mask clearing and reduce 
pin to one conditional and one and, shift, or. :)

Okay, have it your way.

Regards,

Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2019-08-01 16:22 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-23 18:38 [PATCH 01/23] drm/i915: Move aliasing_ppgtt underneath its i915_ggtt Chris Wilson
2019-07-23 18:38 ` [PATCH 02/23] drm/i915/gt: Provide a local intel_context.vm Chris Wilson
2019-07-23 18:38 ` [PATCH 03/23] drm/i915: Remove lrc default desc from GEM context Chris Wilson
2019-07-24  9:20   ` Tvrtko Ursulin
2019-08-01  8:37     ` Tvrtko Ursulin
2019-08-01  8:41       ` Chris Wilson
2019-08-01  8:53         ` Tvrtko Ursulin
2019-08-01 10:57           ` Chris Wilson
2019-08-01 11:13             ` Chris Wilson
2019-08-01 15:29               ` Tvrtko Ursulin
2019-08-01 15:48                 ` Chris Wilson
2019-08-01 16:00                   ` Chris Wilson
2019-08-01 16:22                     ` Tvrtko Ursulin [this message]
2019-08-01 16:36                       ` Chris Wilson
2019-07-23 18:38 ` [PATCH 04/23] drm/i915: Push the ring creation flags to the backend Chris Wilson
2019-07-24 11:11   ` Tvrtko Ursulin
2019-07-26  8:43     ` Chris Wilson
2019-07-29 12:59       ` Tvrtko Ursulin
2019-07-30  9:38         ` Chris Wilson
2019-08-01  8:42           ` Tvrtko Ursulin
2019-08-01  8:45             ` Chris Wilson
2019-08-01  8:46             ` Chris Wilson
2019-07-23 18:38 ` [PATCH 05/23] drm/i915: Flush extra hard after writing relocations through the GTT Chris Wilson
2019-07-23 18:38 ` [PATCH 06/23] drm/i915: Hide unshrinkable context objects from the shrinker Chris Wilson
2019-07-23 18:38 ` [PATCH 07/23] drm/i915/gt: Move the [class][inst] lookup for engines onto the GT Chris Wilson
2019-07-25 21:21   ` Daniele Ceraolo Spurio
2019-07-26  9:22   ` Tvrtko Ursulin
2019-07-26  9:33     ` Chris Wilson
2019-07-26  9:51       ` Tvrtko Ursulin
2019-07-26  9:57         ` Chris Wilson
2019-07-23 18:38 ` [PATCH 08/23] drm/i915: Introduce for_each_user_engine() Chris Wilson
2019-07-23 18:38 ` [PATCH 09/23] drm/i915: Use intel_engine_lookup_user for probing HAS_BSD etc Chris Wilson
2019-07-23 18:38 ` [PATCH 10/23] drm/i915: Isolate i915_getparam_ioctl() Chris Wilson
2019-07-23 18:38 ` [PATCH 11/23] drm/i915: Only include active engines in the capture state Chris Wilson
2019-07-23 18:38 ` [PATCH 12/23] drm/i915: Teach execbuffer to take the engine wakeref not GT Chris Wilson
2019-07-23 18:38 ` [PATCH 13/23] drm/i915/gt: Track timeline activeness in enter/exit Chris Wilson
2019-07-23 18:38 ` [PATCH 14/23] drm/i915/gt: Convert timeline tracking to spinlock Chris Wilson
2019-07-23 18:38 ` [PATCH 15/23] drm/i915/gt: Guard timeline pinning with its own mutex Chris Wilson
2019-07-23 18:38 ` [PATCH 16/23] drm/i915/gt: Add to timeline requires the timeline mutex Chris Wilson
2019-07-23 18:38 ` [PATCH 17/23] drm/i915: Protect request retirement with timeline->mutex Chris Wilson
2019-07-23 18:38 ` [PATCH 18/23] drm/i915: Replace struct_mutex for batch pool serialisation Chris Wilson
2019-07-23 18:38 ` [PATCH 19/23] drm/i915/gt: Mark context->active_count as protected by timeline->mutex Chris Wilson
2019-07-23 18:38 ` [PATCH 20/23] drm/i915: Forgo last_fence active request tracking Chris Wilson
2019-07-23 18:38 ` [PATCH 21/23] drm/i915/overlay: Switch to using i915_active tracking Chris Wilson
2019-07-23 18:38 ` [PATCH 22/23] drm/i915: Extract intel_frontbuffer active tracking Chris Wilson
2019-07-23 18:38 ` [PATCH 23/23] drm/i915: Markup expected timeline locks for i915_active Chris Wilson
2019-07-23 20:16 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [01/23] drm/i915: Move aliasing_ppgtt underneath its i915_ggtt Patchwork
2019-07-23 20:27 ` ✗ Fi.CI.SPARSE: " Patchwork
2019-07-23 20:38 ` ✓ Fi.CI.BAT: success " Patchwork
2019-07-24  4:13 ` ✗ Fi.CI.IGT: failure " Patchwork
2019-07-24  8:56 ` [PATCH 01/23] " Tvrtko Ursulin
2019-07-24  9:27   ` Chris Wilson
2019-07-24  9:37     ` Chris Wilson
2019-07-24  9:47       ` Chris Wilson
2019-07-24  9:54         ` Tvrtko Ursulin

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=fc2a1eb2-253c-f727-bb89-b72585b43568@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