[Intel-gfx] [RFC 2/3] drm/i915: Prefer IS_GEN<n> check with bitmask.

Rodrigo Vivi rodrigo.vivi at intel.com
Fri Oct 26 19:55:43 UTC 2018


On Fri, Oct 26, 2018 at 09:47:05PM +0200, Julia Lawall wrote:
> 
> 
> On Fri, 26 Oct 2018, Rodrigo Vivi wrote:
> 
> > On Thu, Oct 25, 2018 at 12:11:57PM +0100, Julia Lawall wrote:
> > >
> > >
> > > On Thu, 25 Oct 2018, Ville Syrjälä wrote:
> > >
> > > > On Wed, Oct 24, 2018 at 04:41:06PM -0700, Rodrigo Vivi wrote:
> > > > > On Wed, Oct 24, 2018 at 01:22:57PM +0300, Ville Syrjälä wrote:
> > > > > > On Tue, Oct 23, 2018 at 04:36:19PM -0700, Rodrigo Vivi wrote:
> > > > > > > Whenever possible we should stick with IS_GEN<n> checks.
> > > > > > >
> > > > > > > Bitmaks has been introduced on commit ae7617f0ef18 ("drm/i915:
> > > > > > > Allow optimized platform checks") for efficiency.
> > > > > > >
> > > > > > > Let's stick with it whenever possible.
> > > > > > >
> > > > > > > This patch was generated with coccinelle:
> > > > > > >
> > > > > > > spatch -sp_file is_gen.cocci *{c,h} --in-place
> > > > > > >
> > > > > > > is_gen.cocci:
> > > > > > > @gen2@ expression e; @@
> > > > > > > -INTEL_GEN(e) == 2
> > > > > > > +IS_GEN2(e)
> > > > > > > @gen3@ expression e; @@
> > > > > > > -INTEL_GEN(e) == 3
> > > > > > > +IS_GEN3(e)
> > > > > > > @gen4@ expression e; @@
> > > > > > > -INTEL_GEN(e) == 4
> > > > > > > +IS_GEN4(e)
> > > > > > > @gen5@ expression e; @@
> > > > > > > -INTEL_GEN(e) == 5
> > > > > > > +IS_GEN5(e)
> > > > > > > @gen6@ expression e; @@
> > > > > > > -INTEL_GEN(e) == 6
> > > > > > > +IS_GEN6(e)
> > > > > > > @gen7@ expression e; @@
> > > > > > > -INTEL_GEN(e) == 7
> > > > > > > +IS_GEN7(e)
> > > > > > > @gen8@ expression e; @@
> > > > > > > -INTEL_GEN(e) == 8
> > > > > > > +IS_GEN8(e)
> > > > > > > @gen9@ expression e; @@
> > > > > > > -INTEL_GEN(e) == 9
> > > > > > > +IS_GEN9(e)
> > > > > > > @gen10@ expression e; @@
> > > > > > > -INTEL_GEN(e) == 10
> > > > > > > +IS_GEN10(e)
> > > > > > > @gen11@ expression e; @@
> > > > > > > -INTEL_GEN(e) == 11
> > > > > > > +IS_GEN11(e)
> > > > > >
> > > > > > Slightly less repetitive version.
> > > > >
> > > > > Thanks. I'm supper newbie on coccinelle and it was
> > > > > easier to duplicate then trying to learn all this new lang.
> > > > >
> > > > > But I really appreciate you sharing this. I'd like
> > > > > to go with this so the better rule keeps on commit message.
> > > > >
> > > > > > Sadly not super neat on
> > > > > > account of having to use the python stuff.
> > > > >
> > > > > however it seems python version didn't work so well here:
> > > > >
> > > > > init_defs_builtins: /usr/lib64/coccinelle/standard.h
> > > > > Python error: No module named coccilib.elems
> > > > >
> > > > > do you have any idea about it?
> > > >
> > > > Never seen it. On gentoo it just works when I have the python
> > > > use flag enabled.
> > > >
> > > > Maybe your distro doesn't include the python support in the
> > > > build, or maybe some kind of python version issue?
> > >
> > > Thanks for the report.  I will have someone look into it.  It's an
> > > internal Coccinelle thing.  Perhaps python is not enabled.  Do you have
> > > the version of Coccinelle from github?
> >
> > I just tried with coccinelle from github but got same result.
> >
> > But with this commit before the bump to automake1.16:
> >
> > commit 4db95998768557c66d6e337be2253032b5d810bc (HEAD -> master)
> > Author: Thierry Martinez <thierry.martinez at inria.fr>
> > Date:   Wed Sep 12 14:43:41 2018 +0200
> >
> >     Compute depend by calling make recursilevy
> >
> >     The set of files in $(source_files) may change when the tarball is
> >     unpacked.
> >
> > ----
> >
> > $ python --version
> > Python 2.7.15
> > $ python3 --version
> > Python 3.6.6
> >
> > ----
> >
> > I believe I'm moving this patch with the repetitive bad
> > rule for now that I'm sure it works in most of the distros.
> 
> Sorry, I'm not sure to understand the last sentence. Are things ok now, or
> not?

Well, I'd like to learn more and be able to run the python rules
on my system. So if you still have any idea I'd like to listen.

But I don't see any rush on that since for this patch
we can go with the simple repetitive rule that works on default
coccinelle that comes with fedora 28.

In other words, for this patch we are good.

For the future I'd like to learn, but with no pressure or rush!

I really appreciate your support

Thanks a lot,
Rodrigo.

> 
> thanks,
> julia



More information about the Intel-gfx mailing list