[Intel-gfx] [PATCH 3/3] drm/i915: Replace "INTEL_INFO->gen == x" checks with IS_GENx

Dave Gordon david.s.gordon at intel.com
Mon May 9 14:18:07 UTC 2016


On 06/05/16 14:43, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
>
> This way optimization from a previous patch works even better.
>
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
> ---
>   drivers/gpu/drm/i915/i915_debugfs.c     | 4 ++--
>   drivers/gpu/drm/i915/i915_dma.c         | 4 ++--
>   drivers/gpu/drm/i915/i915_drv.c         | 2 +-
>   drivers/gpu/drm/i915/i915_drv.h         | 2 +-
>   drivers/gpu/drm/i915/i915_gem.c         | 2 +-
>   drivers/gpu/drm/i915/i915_gem_gtt.c     | 2 +-
>   drivers/gpu/drm/i915/i915_gem_stolen.c  | 2 +-
>   drivers/gpu/drm/i915/i915_gem_tiling.c  | 2 +-
>   drivers/gpu/drm/i915/i915_gpu_error.c   | 2 +-
>   drivers/gpu/drm/i915/i915_irq.c         | 4 ++--
>   drivers/gpu/drm/i915/intel_display.c    | 2 +-
>   drivers/gpu/drm/i915/intel_lrc.c        | 4 ++--
>   drivers/gpu/drm/i915/intel_lvds.c       | 2 +-
>   drivers/gpu/drm/i915/intel_pm.c         | 4 ++--
>   drivers/gpu/drm/i915/intel_ringbuffer.c | 6 +++---
>   15 files changed, 22 insertions(+), 22 deletions(-)

This looked a very small list, I thought, and then realised you've only 
changed tests-for-equality. There are a *far* greater number of tests 
for inequality!

These are the numbers I got for converting *all* instances of 
INTEL_INFO()->gen ...

  i915/i915_debugfs.c          |  68 ++++++-------
  i915/i915_dma.c              |  20 ++--
  i915/i915_drv.c              |   8 +-
  i915/i915_drv.h              |  42 ++++----
  i915/i915_gem.c              |  18 ++--
  i915/i915_gem_context.c      |  14 +--
  i915/i915_gem_execbuffer.c   |  18 ++--
  i915/i915_gem_fence.c        |   8 +-
  i915/i915_gem_gtt.c          |  36 +++----
  i915/i915_gem_render_state.c |   2 +-
  i915/i915_gem_stolen.c       |  10 +-
  i915/i915_gem_tiling.c       |  10 +-
  i915/i915_gpu_error.c        |  38 ++++----
  i915/i915_irq.c              |  72 +++++++-------
  i915/i915_suspend.c          |  20 ++--
  i915/i915_sysfs.c            |   2 +-
  i915/intel_audio.c           |   2 +-
  i915/intel_bios.c            |   2 +-
  i915/intel_color.c           |   2 +-
  i915/intel_crt.c             |   6 +-
  i915/intel_ddi.c             |  10 +-
  i915/intel_display.c         | 182 +++++++++++++++++------------------
  i915/intel_dp.c              |  30 +++---
  i915/intel_dpll_mgr.c        |   2 +-
  i915/intel_fbc.c             |  30 +++---
  i915/intel_guc_loader.c      |   2 +-
  i915/intel_hdmi.c            |   4 +-
  i915/intel_lrc.c             |  22 ++---
  i915/intel_lvds.c            |  14 +--
  i915/intel_mocs.c            |   2 +-
  i915/intel_overlay.c         |   4 +-
  i915/intel_panel.c           |  10 +-
  i915/intel_pm.c              |  68 ++++++-------
  i915/intel_psr.c             |  10 +-
  i915/intel_ringbuffer.c      |  50 +++++-----
  i915/intel_sdvo.c            |  10 +-
  i915/intel_sprite.c          |  12 +--
  i915/intel_tv.c              |   2 +-
  i915/intel_uncore.c          |  20 ++--

So if you want to convert the GEN info to a new representation, it 
should ideally be one that efficiently handles "up to N" and "from N 
onwards" as well as exact matches.

.Dave.


More information about the Intel-gfx mailing list