Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: "Ville Syrjälä" <ville.syrjala@linux.intel.com>,
	"Mika Kuoppala" <mika.kuoppala@linux.intel.com>
Cc: Intel-gfx@lists.freedesktop.org
Subject: Re: [RFC 14/15] drm/i915: Use new IS_GEN range helpers
Date: Fri, 09 Feb 2018 13:18:49 +0200	[thread overview]
Message-ID: <87h8qq8l7q.fsf@intel.com> (raw)
In-Reply-To: <20180208155326.GD5453@intel.com>

On Thu, 08 Feb 2018, Ville Syrjälä <ville.syrjala@linux.intel.com> wrote:
> On Thu, Feb 08, 2018 at 05:13:02PM +0200, Mika Kuoppala wrote:
>> Chris Wilson <chris@chris-wilson.co.uk> writes:
>> 
>> > Quoting Tvrtko Ursulin (2018-02-08 14:34:38)
>> >> 
>> >> On 08/02/2018 14:22, Ville Syrjälä wrote:
>> >> > On Thu, Feb 08, 2018 at 01:06:05PM +0000, Tvrtko Ursulin wrote:
>> >> >> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>> >> >>
>> >> >> Coccinelle transformation:
>> >> >>
>> >> >>   @@
>> >> >>   expression p, g;
>> >> >>   @@
>> >> >>   (
>> >> >>   -INTEL_GEN(p) > g
>> >> >>   +IS_GEN_GT(p, g)
>> >> > 
>> >> > I think this stuff makes the code pretty close to illegible.
>> >> > In this particular case even more so because "GT" actually
>> >> > means something very different to us.
>> >> 
>> >> Oh how true! And I did not realize it at all while writing it! :)
>> >> 
>> >> Anyway, something like this, regardless of a name, is needed if people 
>> >> want this to be effective. Since the checks have to be moved to known at 
>> >> compile time. Or a completely different approach will be needed.
>> >
>> > IS_GEN_RANGE() doesn't cut it?
>> >
>> 
>> IS_GEN_RANGE(8,9);
>> 
>> short and readable
>
> 'if (IS_GEN_RANGE(...))' reads funny. IS_GEN_IN_RANGE() would be more
> englishy perhaps, but it looks a bit off to me for whatever reason.

We already have IS_GEN(dev_priv, start, end) for inclusive ranges with
GEN_FOREVER as unbound start/end. There's no need to bikeshed the naming
further. (Except perhaps the GEN_FOREVER part.)

With some macro vararg hacking, we could probably make that work for
IS_GEN(dev_priv, exact) too, to replace say IS_GEN5() with one macro if
we like. Just to make more code use similar constructs.

> And it still doesn't tell you anything about inclusive vs. exlusive.
> So it just forces you to waste brain cells on mundane details when
> reading the code. IMO that's a fairly bad tradeoff.

Agreed. I think this patch is by far the worst part in the
series. Especially the _GT, _GTE, _LT, _LTE macros are IMO unacceptable.

Quick greping shows that we have much more inclusive than exclusive
range checks. We could help our brains a bit by switching, uh,
exclusively to inclusive ranges. That's not perfect, by far, as some
checks naturally work better with < and >, but I think I'd rather have
that with IS_GEN() than a bunch of macros you have to stop to think
about.

BR,
Jani.


-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2018-02-09 11:18 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-08 13:05 [RFC 00/15] Selectable platform support Tvrtko Ursulin
2018-02-08 13:05 ` [RFC 01/15] drm/i915: Make I830 platform support optional Tvrtko Ursulin
2018-02-08 13:23   ` Chris Wilson
2018-02-09 11:26   ` Jani Nikula
2018-02-08 13:05 ` [RFC 02/15] drm/i915: Make I845G " Tvrtko Ursulin
2018-02-08 13:05 ` [RFC 03/15] drm/i915: Make I85X " Tvrtko Ursulin
2018-02-08 13:05 ` [RFC 04/15] drm/i915: Make I865G " Tvrtko Ursulin
2018-02-08 13:05 ` [RFC 05/15] drm/i915: Make GEN2 " Tvrtko Ursulin
2018-02-08 13:05 ` [RFC 06/15] drm/i915: Make Gen3 platforms " Tvrtko Ursulin
2018-02-08 13:05 ` [RFC 07/15] drm/i915: Make Gen4 " Tvrtko Ursulin
2018-02-08 13:05 ` [RFC 08/15] drm/i915: Make Ironlake/Gen5 " Tvrtko Ursulin
2018-02-08 13:06 ` [RFC 09/15] drm/i915: Make Sandybridge/Gen6 " Tvrtko Ursulin
2018-02-08 13:06 ` [RFC 10/15] drm/i915: Make Gen7/7.5 platform " Tvrtko Ursulin
2018-02-08 13:06 ` [RFC 11/15] drm/i915: Use INTEL_GEN everywhere Tvrtko Ursulin
2018-02-09 10:14   ` Jani Nikula
2018-02-09 21:59     ` [PATCH] __gen__ Chris Wilson
2018-02-09 10:20   ` [RFC 11/15] drm/i915: Use INTEL_GEN everywhere Chris Wilson
2018-02-08 13:06 ` [RFC 12/15] drm/i915: Favour IS_GENx Tvrtko Ursulin
2018-02-08 13:06 ` [RFC 13/15] drm/i915: IS_GEN range helpers Tvrtko Ursulin
2018-02-08 13:06 ` [RFC 14/15] drm/i915: Use new " Tvrtko Ursulin
2018-02-08 14:22   ` Ville Syrjälä
2018-02-08 14:34     ` Tvrtko Ursulin
2018-02-08 14:46       ` Chris Wilson
2018-02-08 15:13         ` Mika Kuoppala
2018-02-08 15:53           ` Ville Syrjälä
2018-02-09 11:18             ` Jani Nikula [this message]
2018-02-09 14:48               ` Ville Syrjälä
2018-02-09 15:01                 ` Chris Wilson
2018-02-09 15:12                 ` Ville Syrjälä
2018-02-10 22:51                   ` Chris Wilson
2018-02-08 13:06 ` [RFC 15/15] drm/i915: Replace some negative Gen checks Tvrtko Ursulin
2018-02-09 10:18   ` Jani Nikula
2018-02-09 10:19   ` Chris Wilson
2018-02-08 13:26 ` [RFC 00/15] Selectable platform support Chris Wilson
2018-02-08 14:06   ` Tvrtko Ursulin
2018-02-08 15:07     ` Joonas Lahtinen
2018-02-09 11:49       ` Jani Nikula
2018-02-09 12:02         ` Chris Wilson
2018-02-08 15:28 ` ✗ Fi.CI.BAT: failure for " Patchwork
2018-02-09 10:48 ` [RFC 00/15] " Tvrtko Ursulin
2018-02-09 10:50   ` Chris Wilson
2018-02-09 11:01     ` Tvrtko Ursulin
2018-02-09 11:19       ` Chris Wilson
2018-02-09 21:14         ` Chris Wilson
2018-02-09 11:32   ` Jani Nikula
2018-02-09 22:23 ` ✗ Fi.CI.BAT: failure for Selectable platform support (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=87h8qq8l7q.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=Intel-gfx@lists.freedesktop.org \
    --cc=mika.kuoppala@linux.intel.com \
    --cc=ville.syrjala@linux.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