Late last year, there were discussions on updating the for_each_ring() macro -- now renamed for_each_engine() -- to eliminate the third (index) parameter, which is mostly unused at the macro callsites. In particular, Chris Wilson and Daniel Vetter mentioned that we would like the flexibility to eventually move away from a linear indexed array-of-engines to some more sophisticated structure. So here's a patchset that does just that. First we locate all the places where the third argument to the macro *is* used, and change the macro to a new version "for_each_engine_id()", at the same time updating the third argument from an (int) index (usually 'i') to an intel_engine_id. This replacement makes no functional change in itself, because at present (dev_priv->engine[i].id == i for all i in 0..I915_NUM_ENGINES-1), but it opens the way to using something other than an embedded array in future. Then, we can replace all remaining instances with a simpler two-parameter version. Along the way, all the engine-iterator macros are updated to the form suggested by Chris Wilson, where the pointer into the array (rather than the index variable) is used to compute loop termination, and many redundant loop-counter variables are eliminated :) Dave Gordon (2): drm/i915: introduce for_each_engine_id() drm/i915: replace for_each_engine() drivers/gpu/drm/i915/i915_debugfs.c | 94 +++++++++++++++--------------- drivers/gpu/drm/i915/i915_drv.h | 28 ++++++--- drivers/gpu/drm/i915/i915_gem.c | 50 +++++++--------- drivers/gpu/drm/i915/i915_gem_context.c | 6 +- drivers/gpu/drm/i915/i915_gem_debug.c | 3 +- drivers/gpu/drm/i915/i915_gem_gtt.c | 9 +-- drivers/gpu/drm/i915/i915_gpu_error.c | 6 +- drivers/gpu/drm/i915/i915_guc_submission.c | 14 ++--- drivers/gpu/drm/i915/i915_irq.c | 24 ++++---- drivers/gpu/drm/i915/intel_guc_loader.c | 8 +-- drivers/gpu/drm/i915/intel_lrc.c | 3 +- drivers/gpu/drm/i915/intel_mocs.c | 6 +- drivers/gpu/drm/i915/intel_pm.c | 19 +++--- drivers/gpu/drm/i915/intel_ringbuffer.c | 21 ++++--- 14 files changed, 143 insertions(+), 148 deletions(-) -- 1.9.1 _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx