Commit 1890ae64 authored by Ville Syrjälä's avatar Ville Syrjälä

drm/i915: Reorganize sprite init

Kill the switch statement from the sprite init code and replace with a
more straightforward if ladder. Now each significant evolution of the
sprite hardware is in its own neat box.
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1477411083-19255-5-git-send-email-ville.syrjala@linux.intel.comReviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent b079bd17
...@@ -1067,60 +1067,52 @@ intel_sprite_plane_create(struct drm_device *dev, enum pipe pipe, int plane) ...@@ -1067,60 +1067,52 @@ intel_sprite_plane_create(struct drm_device *dev, enum pipe pipe, int plane)
} }
intel_plane->base.state = &state->base; intel_plane->base.state = &state->base;
switch (INTEL_INFO(dev)->gen) { if (INTEL_GEN(dev_priv) >= 9) {
case 5:
case 6:
intel_plane->can_scale = true; intel_plane->can_scale = true;
intel_plane->max_downscale = 16; state->scaler_id = -1;
intel_plane->update_plane = ilk_update_plane;
intel_plane->disable_plane = ilk_disable_plane;
if (IS_GEN6(dev_priv)) { intel_plane->update_plane = skl_update_plane;
plane_formats = snb_plane_formats; intel_plane->disable_plane = skl_disable_plane;
num_plane_formats = ARRAY_SIZE(snb_plane_formats);
} else {
plane_formats = ilk_plane_formats;
num_plane_formats = ARRAY_SIZE(ilk_plane_formats);
}
break;
case 7: plane_formats = skl_plane_formats;
case 8: num_plane_formats = ARRAY_SIZE(skl_plane_formats);
if (IS_IVYBRIDGE(dev_priv)) { } else if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) {
intel_plane->can_scale = true;
intel_plane->max_downscale = 2;
} else {
intel_plane->can_scale = false; intel_plane->can_scale = false;
intel_plane->max_downscale = 1; intel_plane->max_downscale = 1;
}
if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) {
intel_plane->update_plane = vlv_update_plane; intel_plane->update_plane = vlv_update_plane;
intel_plane->disable_plane = vlv_disable_plane; intel_plane->disable_plane = vlv_disable_plane;
plane_formats = vlv_plane_formats; plane_formats = vlv_plane_formats;
num_plane_formats = ARRAY_SIZE(vlv_plane_formats); num_plane_formats = ARRAY_SIZE(vlv_plane_formats);
} else if (INTEL_GEN(dev_priv) >= 7) {
if (IS_IVYBRIDGE(dev_priv)) {
intel_plane->can_scale = true;
intel_plane->max_downscale = 2;
} else { } else {
intel_plane->can_scale = false;
intel_plane->max_downscale = 1;
}
intel_plane->update_plane = ivb_update_plane; intel_plane->update_plane = ivb_update_plane;
intel_plane->disable_plane = ivb_disable_plane; intel_plane->disable_plane = ivb_disable_plane;
plane_formats = snb_plane_formats; plane_formats = snb_plane_formats;
num_plane_formats = ARRAY_SIZE(snb_plane_formats); num_plane_formats = ARRAY_SIZE(snb_plane_formats);
} } else {
break;
case 9:
intel_plane->can_scale = true; intel_plane->can_scale = true;
intel_plane->update_plane = skl_update_plane; intel_plane->max_downscale = 16;
intel_plane->disable_plane = skl_disable_plane;
state->scaler_id = -1;
plane_formats = skl_plane_formats; intel_plane->update_plane = ilk_update_plane;
num_plane_formats = ARRAY_SIZE(skl_plane_formats); intel_plane->disable_plane = ilk_disable_plane;
break;
default: if (IS_GEN6(dev_priv)) {
MISSING_CASE(INTEL_INFO(dev)->gen); plane_formats = snb_plane_formats;
ret = -ENODEV; num_plane_formats = ARRAY_SIZE(snb_plane_formats);
goto fail; } else {
plane_formats = ilk_plane_formats;
num_plane_formats = ARRAY_SIZE(ilk_plane_formats);
}
} }
if (INTEL_GEN(dev_priv) >= 9) { if (INTEL_GEN(dev_priv) >= 9) {
...@@ -1139,7 +1131,7 @@ intel_sprite_plane_create(struct drm_device *dev, enum pipe pipe, int plane) ...@@ -1139,7 +1131,7 @@ intel_sprite_plane_create(struct drm_device *dev, enum pipe pipe, int plane)
possible_crtcs = (1 << pipe); possible_crtcs = (1 << pipe);
if (INTEL_INFO(dev)->gen >= 9) if (INTEL_GEN(dev_priv) >= 9)
ret = drm_universal_plane_init(dev, &intel_plane->base, possible_crtcs, ret = drm_universal_plane_init(dev, &intel_plane->base, possible_crtcs,
&intel_plane_funcs, &intel_plane_funcs,
plane_formats, num_plane_formats, plane_formats, num_plane_formats,
......
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