intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
To: Oscar Mateo <oscar.mateo@intel.com>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 10/12] drm/i915/guc: Refactor the concept "GuC context descriptor" into "GuC stage descriptor"
Date: Wed, 22 Mar 2017 12:05:43 +0200	[thread overview]
Message-ID: <1490177143.2802.22.camel@linux.intel.com> (raw)
In-Reply-To: <1490086977-9282-11-git-send-email-oscar.mateo@intel.com>

On ti, 2017-03-21 at 02:02 -0700, Oscar Mateo wrote:
> A GuC context and a HW context are in no way related, so the name "GuC context descriptor"
> is very unfortunate, because a new reader of the code gets overwhelmed very quickly with
> a lot of things called "context" that refer to different things. We can improve legibility
> a lot by simply renaming a few objects in the GuC code.
> 
> v2:
>   - Rebased
>   - s/ctx_desc_pool/stage_desc_pool
>   - Move some explanations to the definition of the guc_stage_desc struct (Chris)
> 
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Signed-off-by: Oscar Mateo <oscar.mateo@intel.com>

<SNIP>
 
> -static struct guc_context_desc *__get_context_desc(struct i915_guc_client *client)
> +static struct guc_stage_desc *__get_stage_desc(struct i915_guc_client *client)
>  {
> -	return (struct guc_context_desc *)((char *)client->guc->ctx_pool_vaddr +
> -		sizeof(struct guc_context_desc) * client->ctx_index);
> +	return (struct guc_stage_desc *)((char *)client->guc->stage_desc_pool_vaddr +
> +		sizeof(struct guc_stage_desc) * client->stage_id);

Am I missing something or isn't this just a hard way of doing;

	struct guc_stage_desc *stage_descs = client->guc->stage_desc_pool_vaddr;

	return &stage_descs[client->stage_id];

(+/- fixing sparse warnings, if any)

>  }
>  

<SNIP>

> @@ -1089,30 +1092,30 @@ static void guc_ads_destroy(struct intel_guc *guc)
>   */
>  int i915_guc_submission_init(struct drm_i915_private *dev_priv)
>  {
> -	const size_t ctxsize = sizeof(struct guc_context_desc);
> -	const size_t poolsize = GUC_MAX_GPU_CONTEXTS * ctxsize;
> +	const size_t ctxsize = sizeof(struct guc_stage_desc);

I was about to comment to rename ctxsize -> stagesize, but;

> +	const size_t poolsize = GUC_MAX_STAGE_DESCRIPTORS * ctxsize;
>  	const size_t gemsize = round_up(poolsize, PAGE_SIZE);

The above are only used once, so instead:

>  	struct intel_guc *guc = &dev_priv->guc;
>  	struct i915_vma *vma;
>  	void *vaddr;
>  	int ret;
>  
> -	if (guc->ctx_pool)
> +	if (guc->stage_desc_pool)
>  		return 0;
>  
>  	vma = intel_guc_allocate_vma(guc, gemsize);

Do

	vma = intel_guc_allocate_vma(guc,
				     PAGE_ALIGN(sizeof(struct guc_stage_desc) *
				     		GUC_MAX_GPU_CONTEXTS));
>  	if (IS_ERR(vma))
>  		return PTR_ERR(vma);

<SNIP>

 
> -#define GUC_CTX_DESC_ATTR_ACTIVE	(1 << 0)
> -#define GUC_CTX_DESC_ATTR_PENDING_DB	(1 << 1)
> -#define GUC_CTX_DESC_ATTR_KERNEL	(1 << 2)
> -#define GUC_CTX_DESC_ATTR_PREEMPT	(1 << 3)
> -#define GUC_CTX_DESC_ATTR_RESET		(1 << 4)
> -#define GUC_CTX_DESC_ATTR_WQLOCKED	(1 << 5)
> -#define GUC_CTX_DESC_ATTR_PCH		(1 << 6)
> -#define GUC_CTX_DESC_ATTR_TERMINATED	(1 << 7)
> +#define GUC_STAGE_DESC_ATTR_ACTIVE	(1 << 0)
> +#define GUC_STAGE_DESC_ATTR_PENDING_DB	(1 << 1)
> +#define GUC_STAGE_DESC_ATTR_KERNEL	(1 << 2)
> +#define GUC_STAGE_DESC_ATTR_PREEMPT	(1 << 3)
> +#define GUC_STAGE_DESC_ATTR_RESET	(1 << 4)
> +#define GUC_STAGE_DESC_ATTR_WQLOCKED	(1 << 5)
> +#define GUC_STAGE_DESC_ATTR_PCH		(1 << 6)
> +#define GUC_STAGE_DESC_ATTR_TERMINATED	(1 << 7)

While here, make 'em BIT()

With above, this is;

Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

Regards, Joonas
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2017-03-22 10:05 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-21  9:02 [PATCH 00/12] Various improvements around the GuC topic Oscar Mateo
2017-03-21  9:02 ` [PATCH 01/12] drm/i915/guc: Sanitize GuC client initialization Oscar Mateo
2017-03-22  9:28   ` Joonas Lahtinen
2017-03-22  9:46     ` Oscar Mateo
2017-03-21  9:02 ` [PATCH 02/12] drm/i915/guc: Keep the ctx_pool_vaddr mapped, for easy access Oscar Mateo
2017-03-22  9:45   ` Chris Wilson
2017-03-22  9:42     ` Oscar Mateo
2017-03-22 16:57       ` Chris Wilson
2017-03-21  9:02 ` [PATCH 03/12] drm/i915/guc: Add onion teardown to the GuC setup Oscar Mateo
2017-03-21  9:02 ` [PATCH 04/12] drm/i915/guc: The Additional Data Struct (ADS) should get enabled together with GuC submission Oscar Mateo
2017-03-21 17:51   ` Ceraolo Spurio, Daniele
2017-03-21  9:02 ` [PATCH 05/12] drm/i915/guc: Break out the GuC log extras into their own "runtime" struct Oscar Mateo
2017-03-21  9:02 ` [PATCH 06/12] drm/i915/guc: Make intel_guc_send a function pointer Oscar Mateo
2017-03-21  9:02 ` [PATCH 07/12] drm/i915/guc: Improve the GuC documentation & comments about proxy submissions Oscar Mateo
2017-03-21 17:54   ` Ceraolo Spurio, Daniele
2017-03-21  9:02 ` [PATCH 08/12] drm/i915/guc: Wait for doorbell to be inactive before deallocating Oscar Mateo
2017-03-21 18:20   ` Ceraolo Spurio, Daniele
2017-03-21 11:24     ` Oscar Mateo
2017-03-22  9:33       ` Joonas Lahtinen
2017-03-21  9:02 ` [PATCH 09/12] drm/i915/guc: A little bit more of doorbell sanitization Oscar Mateo
2017-03-21  9:02 ` [PATCH 10/12] drm/i915/guc: Refactor the concept "GuC context descriptor" into "GuC stage descriptor" Oscar Mateo
2017-03-22 10:05   ` Joonas Lahtinen [this message]
2017-03-21  9:02 ` [PATCH 11/12] drm/i915/guc: Split out the mmio_white_list struct Oscar Mateo
2017-03-21 18:04   ` Ceraolo Spurio, Daniele
2017-03-21  9:02 ` [PATCH 12/12] drm/i915/guc: Move guc_interrupts_release next to guc_interrupts_capture Oscar Mateo
2017-03-21 18:08   ` Ceraolo Spurio, Daniele
2017-03-21 17:42 ` ✗ Fi.CI.BAT: warning for Various improvements around the GuC topic Patchwork
2017-03-22 10:08   ` Joonas Lahtinen

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=1490177143.2802.22.camel@linux.intel.com \
    --to=joonas.lahtinen@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=oscar.mateo@intel.com \
    /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).