Re: [RFC] drm/i915: Smarten up and use to_i915() everywhere

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Mar 17, 2016 at 04:00:58PM +0000, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx>
> 
> There is a lot of ways to get to our dev_priv depending on which
> object is at hand and often what was chosen by the developer.
> 
> We can make to_i915() accept different pointers by using compile
> time magic. Like:
> 
>   dev_priv = to_i915(request);
>   dev_priv = to_i915(engine);
>   dev_priv = to_i915(ctx);
>   dev_priv = to_i915(dev);
>   dev_priv = to_i915(guc);
>   dev_priv = to_i915(device);
> 
> If an unknown pointer is passed to the function it will cause
> a compile time failure.
> 
> Main advantage is that with this in place we could add and
> remove shourtcuts to dev_priv from supported structures easily
> and without touching the code which uses it. If we wanted to
> fiddle with the balance of structure sizes and number of pointer
> dereferencing for example. And it makes the code a bit tidier
> and uniform.
> 
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx>
> Cc: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
> --
> However the churn is huge so I don't really think this is a
> must have.

Oh, you missed the magic of doing things like

if (HAS_FOO(engine))

for_each_engine(engine, req)

etc

I was hooked. Let's do this in chunks.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux