[Intel-gfx] [RFC] drm/i915: Smarten up and use to_i915() everywhere
Arun Siluvery
arun.siluvery at linux.intel.com
Fri Mar 18 00:36:55 UTC 2016
On 17/03/2016 16:00, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
>
> 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.
>
I get the readability aspect but is it advisable to hide too many things
under macros? In the new code is it expected to always use these macros?
if yes then in that case aren't we forcing certain usage? good or bad.
This has even wider impact than ring/engine renaming. If we must go this
route then we should at least do it in stages to minimize impact.
regards
Arun
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
> Cc: Chris Wilson <chris at chris-wilson.co.uk>
> --
> However the churn is huge so I don't really think this is a
> must have.
> ---
> drivers/gpu/drm/i915/i915_debugfs.c | 174 ++++++++---------
> drivers/gpu/drm/i915/i915_dma.c | 22 +--
> drivers/gpu/drm/i915/i915_drv.c | 24 +--
> drivers/gpu/drm/i915/i915_drv.h | 68 +++++--
> drivers/gpu/drm/i915/i915_gem.c | 70 +++----
> drivers/gpu/drm/i915/i915_gem_context.c | 18 +-
> drivers/gpu/drm/i915/i915_gem_execbuffer.c | 8 +-
> drivers/gpu/drm/i915/i915_gem_fence.c | 16 +-
> drivers/gpu/drm/i915/i915_gem_gtt.c | 48 ++---
> drivers/gpu/drm/i915/i915_gem_stolen.c | 12 +-
> drivers/gpu/drm/i915/i915_gem_tiling.c | 4 +-
> drivers/gpu/drm/i915/i915_gpu_error.c | 20 +-
> drivers/gpu/drm/i915/i915_guc_submission.c | 30 +--
> drivers/gpu/drm/i915/i915_irq.c | 158 +++++++--------
> drivers/gpu/drm/i915/i915_suspend.c | 8 +-
> drivers/gpu/drm/i915/i915_sysfs.c | 18 +-
> drivers/gpu/drm/i915/intel_audio.c | 20 +-
> drivers/gpu/drm/i915/intel_crt.c | 20 +-
> drivers/gpu/drm/i915/intel_ddi.c | 26 +--
> drivers/gpu/drm/i915/intel_display.c | 300 ++++++++++++++---------------
> drivers/gpu/drm/i915/intel_dp.c | 110 +++++------
> drivers/gpu/drm/i915/intel_dp_mst.c | 8 +-
> drivers/gpu/drm/i915/intel_dpll_mgr.c | 10 +-
> drivers/gpu/drm/i915/intel_drv.h | 6 +-
> drivers/gpu/drm/i915/intel_dsi.c | 22 +--
> drivers/gpu/drm/i915/intel_dsi_panel_vbt.c | 6 +-
> drivers/gpu/drm/i915/intel_dsi_pll.c | 4 +-
> drivers/gpu/drm/i915/intel_dvo.c | 10 +-
> drivers/gpu/drm/i915/intel_fbdev.c | 12 +-
> drivers/gpu/drm/i915/intel_fifo_underrun.c | 18 +-
> drivers/gpu/drm/i915/intel_guc_loader.c | 6 +-
> drivers/gpu/drm/i915/intel_hdmi.c | 38 ++--
> drivers/gpu/drm/i915/intel_hotplug.c | 2 +-
> drivers/gpu/drm/i915/intel_i2c.c | 6 +-
> drivers/gpu/drm/i915/intel_lrc.c | 70 +++----
> drivers/gpu/drm/i915/intel_lvds.c | 16 +-
> drivers/gpu/drm/i915/intel_mocs.c | 2 +-
> drivers/gpu/drm/i915/intel_modes.c | 4 +-
> drivers/gpu/drm/i915/intel_opregion.c | 18 +-
> drivers/gpu/drm/i915/intel_overlay.c | 22 +--
> drivers/gpu/drm/i915/intel_panel.c | 6 +-
> drivers/gpu/drm/i915/intel_pm.c | 177 ++++++++---------
> drivers/gpu/drm/i915/intel_psr.c | 36 ++--
> drivers/gpu/drm/i915/intel_ringbuffer.c | 88 ++++-----
> drivers/gpu/drm/i915/intel_sdvo.c | 14 +-
> drivers/gpu/drm/i915/intel_sprite.c | 16 +-
> drivers/gpu/drm/i915/intel_tv.c | 12 +-
> drivers/gpu/drm/i915/intel_uncore.c | 26 +--
> 48 files changed, 935 insertions(+), 894 deletions(-)
>
More information about the Intel-gfx
mailing list