All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: Lucas De Marchi <lucas.demarchi@intel.com>,
	intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH v8 5/7] drm/i915: keep track of used entries in MOCS table
Date: Tue, 22 Jan 2019 14:40:48 +0000	[thread overview]
Message-ID: <154816804825.1277.10148385982387674994@skylake-alporthouse-com> (raw)
In-Reply-To: <20190122051227.8329-6-lucas.demarchi@intel.com>

Quoting Lucas De Marchi (2019-01-22 05:12:25)
> Instead of considering we have defined entries for any index in the
> table, let's keep track of the ones we explicitly defined. This will
> allow Gen 11 to have it's new table defined in which we have holes of
> undefined entries.
> 
> Repeated comments about the meaning of undefined entries were removed
> since they are overly verbose and copy-pasted in several functions: now
> the definition is in the top only.
> 
> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_mocs.c | 88 ++++++++++++++++++++-----------
>  1 file changed, 57 insertions(+), 31 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_mocs.c b/drivers/gpu/drm/i915/intel_mocs.c
> index faae2eefc5cc..af2ae2f396ae 100644
> --- a/drivers/gpu/drm/i915/intel_mocs.c
> +++ b/drivers/gpu/drm/i915/intel_mocs.c
> @@ -28,6 +28,7 @@
>  struct drm_i915_mocs_entry {
>         u32 control_value;
>         u16 l3cc_value;
> +       u16 used;
>  };

> +       /* Set unused values to PTE */
> +       unused_index = I915_MOCS_PTE;
> +
> +       for (i = 0; i < table.size / 2; i++) {
> +               u16 low = table.table[2 * i].used ?
> +                       2 * i : unused_index;
> +               u16 high = table.table[2 * i + 1].used ?
> +                       2 * i + 1 : unused_index;

I'm underwhelmed here.

Could we not do something like

static unsigned int
get_entry_index(struct tbl *tbl, unsigned int idx, unsigned int unused_index)
{
	return tbl->used ? idx : unused_index;
}

		u16 lo = get_entry_index(table.table, 2 * i, unused_index);
		u16 hi = get_entry_index(table.table, 2 * i + 1, unused_index);

That just fits and repeated enough to be worth a little extra effort.
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2019-01-22 14:41 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-22  5:12 [PATCH v8 0/7] Define MOCS table for Icelake Lucas De Marchi
2019-01-22  5:12 ` [PATCH v8 1/7] drm/i915: initialize unused MOCS entries to PTE Lucas De Marchi
2019-01-22 14:28   ` Chris Wilson
2019-01-23 18:33   ` Lis, Tomasz
2019-01-23 18:39     ` Lucas De Marchi
2019-01-22  5:12 ` [PATCH v8 2/7] drm/i915: Simplify MOCS table definition Lucas De Marchi
2019-01-23 18:34   ` Lis, Tomasz
2019-01-22  5:12 ` [PATCH v8 3/7] drm/i915/skl: Rework MOCS tables to keep common part in a define Lucas De Marchi
2019-01-22 14:30   ` Chris Wilson
2019-01-23 18:34   ` Lis, Tomasz
2019-01-22  5:12 ` [PATCH v8 4/7] drm/i915: use a macro to define MOCS entries Lucas De Marchi
2019-01-22 14:32   ` Chris Wilson
2019-01-22 21:33     ` Lucas De Marchi
2019-01-22 21:37       ` Chris Wilson
2019-01-23 18:51         ` Lucas De Marchi
2019-01-23 18:43   ` Lis, Tomasz
2019-01-22  5:12 ` [PATCH v8 5/7] drm/i915: keep track of used entries in MOCS table Lucas De Marchi
2019-01-22 14:40   ` Chris Wilson [this message]
2019-01-23 21:50     ` Lucas De Marchi
2019-01-23 18:48   ` Lis, Tomasz
2019-01-22  5:12 ` [PATCH v8 6/7] drm/i915: cache number of MOCS entries Lucas De Marchi
2019-01-22 14:34   ` Chris Wilson
2019-01-23 19:02   ` Lis, Tomasz
2019-01-22  5:12 ` [PATCH v8 7/7] drm/i915/icl: Define MOCS table for Icelake Lucas De Marchi
2019-01-23 19:07   ` Lis, Tomasz
2019-01-22  5:22 ` ✗ Fi.CI.CHECKPATCH: warning for Define MOCS table for Icelake (rev2) Patchwork
2019-01-22  5:40 ` ✓ Fi.CI.BAT: success " Patchwork
2019-01-22  6:49 ` ✓ Fi.CI.IGT: " 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=154816804825.1277.10148385982387674994@skylake-alporthouse-com \
    --to=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=lucas.demarchi@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.