[Intel-gfx] [PATCH 2/2] drm/i915: generate address mode bit from PPGTT instance

Chris Wilson chris at chris-wilson.co.uk
Tue Apr 26 15:56:22 UTC 2016


On Tue, Apr 26, 2016 at 04:17:52PM +0100, Matthew Auld wrote:
> From: "Wang, Zhi A" <zhi.a.wang at intel.com>
> 
> After the per-PPGTT address mode gets support, the LRC submission should
> generate the address mode bit from PPGTT instance, instead of the
> hard-coded system configuration.
> 
> v2:
> (Matthew Auld)
>   - rebase on latest -nightly
> 
> Cc: Chris Wilson <chris at chris-wilson.co.uk>
> Cc: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>
> Signed-off-by: Matthew Auld <matthew.auld at intel.com>
> Signed-off-by: Zhi Wang <zhi.a.wang at intel.com>
> ---
>  drivers/gpu/drm/i915/intel_lrc.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
> index 13cb1b3..17bd811 100644
> --- a/drivers/gpu/drm/i915/intel_lrc.c
> +++ b/drivers/gpu/drm/i915/intel_lrc.c
> @@ -214,7 +214,7 @@ enum {
>  	LEGACY_64B_CONTEXT
>  };
>  #define GEN8_CTX_ADDRESSING_MODE_SHIFT 3
> -#define GEN8_CTX_ADDRESSING_MODE(dev)  (USES_FULL_48BIT_PPGTT(dev) ?\
> +#define GEN8_CTX_ADDRESSING_MODE(ppgtt) (IS_48BIT_PPGTT(ppgtt) ? \
>  		LEGACY_64B_CONTEXT :\
>  		LEGACY_32B_CONTEXT)
>  enum {
> @@ -276,8 +276,6 @@ logical_ring_init_platform_invariants(struct intel_engine_cs *engine)
>  					(engine->id == VCS || engine->id == VCS2);
>  
>  	engine->ctx_desc_template = GEN8_CTX_VALID;
> -	engine->ctx_desc_template |= GEN8_CTX_ADDRESSING_MODE(dev) <<
> -				   GEN8_CTX_ADDRESSING_MODE_SHIFT;
>  	if (IS_GEN8(dev))
>  		engine->ctx_desc_template |= GEN8_CTX_L3LLC_COHERENT;
>  	engine->ctx_desc_template |= GEN8_CTX_PRIVILEGE;
> @@ -319,7 +317,9 @@ intel_lr_context_descriptor_update(struct intel_context *ctx,
>  	lrca = ctx->engine[engine->id].lrc_vma->node.start +
>  	       LRC_PPHWSP_PN * PAGE_SIZE;
>  
> -	desc = engine->ctx_desc_template;			   /* bits  0-11 */
> +	desc = engine->ctx_desc_template;		   /* bits  0-11 */
> +	desc |= GEN8_CTX_ADDRESSING_MODE(ctx->ppgtt) <<	   /* bits  3-4 */
> +			GEN8_CTX_ADDRESSING_MODE_SHIFT;

Would it not be simpler for us to use the GEN8_CTX_ADDRESSING_MODE() as
our enum, then we would just do
desc |= ctx->ppgtt->addressing_mode << GEN8_CTX_ADDRESSING_MODE_SHIFT;

And then we would have an enum already defined!
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list