Commit 1fe47785 authored by Damien Lespiau's avatar Damien Lespiau Committed by Daniel Vetter

drm/i915: Add a for_each_sprite() macro

This macro is similar to for_each_pipe() we already have. Convert the
two call sites we have at the same time.
Signed-off-by: default avatarDamien Lespiau <damien.lespiau@intel.com>
Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 07d27e20
...@@ -159,6 +159,7 @@ enum hpd_pin { ...@@ -159,6 +159,7 @@ enum hpd_pin {
I915_GEM_DOMAIN_VERTEX) I915_GEM_DOMAIN_VERTEX)
#define for_each_pipe(p) for ((p) = 0; (p) < INTEL_INFO(dev)->num_pipes; (p)++) #define for_each_pipe(p) for ((p) = 0; (p) < INTEL_INFO(dev)->num_pipes; (p)++)
#define for_each_sprite(p, s) for ((s) = 0; (s) < INTEL_INFO(dev)->num_sprites; (s)++)
#define for_each_encoder_on_crtc(dev, __crtc, intel_encoder) \ #define for_each_encoder_on_crtc(dev, __crtc, intel_encoder) \
list_for_each_entry((intel_encoder), &(dev)->mode_config.encoder_list, base.head) \ list_for_each_entry((intel_encoder), &(dev)->mode_config.encoder_list, base.head) \
......
...@@ -1188,16 +1188,16 @@ static void assert_sprites_disabled(struct drm_i915_private *dev_priv, ...@@ -1188,16 +1188,16 @@ static void assert_sprites_disabled(struct drm_i915_private *dev_priv,
enum pipe pipe) enum pipe pipe)
{ {
struct drm_device *dev = dev_priv->dev; struct drm_device *dev = dev_priv->dev;
int reg, i; int reg, sprite;
u32 val; u32 val;
if (IS_VALLEYVIEW(dev)) { if (IS_VALLEYVIEW(dev)) {
for (i = 0; i < INTEL_INFO(dev)->num_sprites; i++) { for_each_sprite(pipe, sprite) {
reg = SPCNTR(pipe, i); reg = SPCNTR(pipe, sprite);
val = I915_READ(reg); val = I915_READ(reg);
WARN((val & SP_ENABLE), WARN((val & SP_ENABLE),
"sprite %c assertion failure, should be off on pipe %c but is still active\n", "sprite %c assertion failure, should be off on pipe %c but is still active\n",
sprite_name(pipe, i), pipe_name(pipe)); sprite_name(pipe, sprite), pipe_name(pipe));
} }
} else if (INTEL_INFO(dev)->gen >= 7) { } else if (INTEL_INFO(dev)->gen >= 7) {
reg = SPRCTL(pipe); reg = SPRCTL(pipe);
...@@ -10981,7 +10981,7 @@ void intel_modeset_suspend_hw(struct drm_device *dev) ...@@ -10981,7 +10981,7 @@ void intel_modeset_suspend_hw(struct drm_device *dev)
void intel_modeset_init(struct drm_device *dev) void intel_modeset_init(struct drm_device *dev)
{ {
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
int j, ret; int sprite, ret;
enum pipe pipe; enum pipe pipe;
drm_mode_config_init(dev); drm_mode_config_init(dev);
...@@ -11021,11 +11021,11 @@ void intel_modeset_init(struct drm_device *dev) ...@@ -11021,11 +11021,11 @@ void intel_modeset_init(struct drm_device *dev)
for_each_pipe(pipe) { for_each_pipe(pipe) {
intel_crtc_init(dev, pipe); intel_crtc_init(dev, pipe);
for (j = 0; j < INTEL_INFO(dev)->num_sprites; j++) { for_each_sprite(pipe, sprite) {
ret = intel_plane_init(dev, pipe, j); ret = intel_plane_init(dev, pipe, sprite);
if (ret) if (ret)
DRM_DEBUG_KMS("pipe %c sprite %c init failed: %d\n", DRM_DEBUG_KMS("pipe %c sprite %c init failed: %d\n",
pipe_name(pipe), sprite_name(pipe, j), ret); pipe_name(pipe), sprite_name(pipe, sprite), ret);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment