From: Ben Widawsky <benjamin.widawsky@xxxxxxxxx> for_each_ring() iterates over all rings supported by the hardware, not just those which have been initialized as in for_each_active_ring() Signed-off-by: Ben Widawsky <ben@xxxxxxxxxxxx> Acked-by: Oscar Mateo <oscar.mateo@xxxxxxxxx> --- drivers/gpu/drm/i915/i915_drv.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index a53a028..b1725c6 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -1544,6 +1544,17 @@ static inline struct drm_i915_private *to_i915(const struct drm_device *dev) return dev->dev_private; } +/* NB: Typically you want to use for_each_ring in init code before ringbuffers + * are setup, or in debug code. for_each_active_ring is more suited for code + * which is dynamically handling active rings, ie. normal code. In most + * (currently all cases except on pre-production hardware) for_each_ring will + * work even if it's a bad idea to use it - so be careful. + */ +#define for_each_ring(ring__, dev_priv__, i__) \ + for ((i__) = 0; (i__) < I915_NUM_RINGS; (i__)++) \ + if (((ring__) = &(dev_priv__)->ring[(i__)]), \ + INTEL_INFO((dev_priv__)->dev)->ring_mask & (1<<(i__))) + /* Iterate over initialised rings */ #define for_each_active_ring(ring__, dev_priv__, i__) \ for ((i__) = 0; (i__) < I915_NUM_RINGS; (i__)++) \ -- 1.9.0 _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/intel-gfx