aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVille Syrjälä <ville.syrjala@linux.intel.com>2016-09-26 12:30:56 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2016-10-21 12:27:20 -0400
commit93ca7e00667063a8dc86f04373e85e89a09efef4 (patch)
treefcd2b63ea328bef2e92c3e87924f33ca3ad4bf05
parent0da88db14034e8b309f1c4188123ca1a02f4b354 (diff)
drm/i915: Use the per-plane rotation property
On certain platforms not all planes support the same set of rotations/reflections, so let's use the per-plane property for this. This is already a problem on SKL when we use the legay cursor plane as it only supports 0|180 whereas the universal planes support 0|90|180|270, and it will be a problem on CHV soon. v2: Use drm_plane_create_rotation_property() helper v3: Drop the BIT(), use INTEL_GEN() Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> (v1) Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/1474907460-10717-12-git-send-email-ville.syrjala@linux.intel.com
-rw-r--r--drivers/gpu/drm/i915/intel_display.c52
-rw-r--r--drivers/gpu/drm/i915/intel_drv.h3
-rw-r--r--drivers/gpu/drm/i915/intel_sprite.c14
3 files changed, 34 insertions, 35 deletions
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index af18e2cce34b..6c5c36eba6cb 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -14886,6 +14886,7 @@ static struct drm_plane *intel_primary_plane_create(struct drm_device *dev,
14886 struct intel_plane *primary = NULL; 14886 struct intel_plane *primary = NULL;
14887 struct intel_plane_state *state = NULL; 14887 struct intel_plane_state *state = NULL;
14888 const uint32_t *intel_primary_formats; 14888 const uint32_t *intel_primary_formats;
14889 unsigned int supported_rotations;
14889 unsigned int num_formats; 14890 unsigned int num_formats;
14890 int ret; 14891 int ret;
14891 14892
@@ -14958,8 +14959,21 @@ static struct drm_plane *intel_primary_plane_create(struct drm_device *dev,
14958 if (ret) 14959 if (ret)
14959 goto fail; 14960 goto fail;
14960 14961
14961 if (INTEL_INFO(dev)->gen >= 4) 14962 if (INTEL_GEN(dev) >= 9) {
14962 intel_create_rotation_property(dev, primary); 14963 supported_rotations =
14964 DRM_ROTATE_0 | DRM_ROTATE_90 |
14965 DRM_ROTATE_180 | DRM_ROTATE_270;
14966 } else if (INTEL_GEN(dev) >= 4) {
14967 supported_rotations =
14968 DRM_ROTATE_0 | DRM_ROTATE_180;
14969 } else {
14970 supported_rotations = DRM_ROTATE_0;
14971 }
14972
14973 if (INTEL_GEN(dev) >= 4)
14974 drm_plane_create_rotation_property(&primary->base,
14975 DRM_ROTATE_0,
14976 supported_rotations);
14963 14977
14964 drm_plane_helper_add(&primary->base, &intel_plane_helper_funcs); 14978 drm_plane_helper_add(&primary->base, &intel_plane_helper_funcs);
14965 14979
@@ -14972,24 +14986,6 @@ fail:
14972 return NULL; 14986 return NULL;
14973} 14987}
14974 14988
14975void intel_create_rotation_property(struct drm_device *dev, struct intel_plane *plane)
14976{
14977 if (!dev->mode_config.rotation_property) {
14978 unsigned long flags = DRM_ROTATE_0 |
14979 DRM_ROTATE_180;
14980
14981 if (INTEL_INFO(dev)->gen >= 9)
14982 flags |= DRM_ROTATE_90 | DRM_ROTATE_270;
14983
14984 dev->mode_config.rotation_property =
14985 drm_mode_create_rotation_property(dev, flags);
14986 }
14987 if (dev->mode_config.rotation_property)
14988 drm_object_attach_property(&plane->base.base,
14989 dev->mode_config.rotation_property,
14990 plane->base.state->rotation);
14991}
14992
14993static int 14989static int
14994intel_check_cursor_plane(struct drm_plane *plane, 14990intel_check_cursor_plane(struct drm_plane *plane,
14995 struct intel_crtc_state *crtc_state, 14991 struct intel_crtc_state *crtc_state,
@@ -15116,17 +15112,11 @@ static struct drm_plane *intel_cursor_plane_create(struct drm_device *dev,
15116 if (ret) 15112 if (ret)
15117 goto fail; 15113 goto fail;
15118 15114
15119 if (INTEL_INFO(dev)->gen >= 4) { 15115 if (INTEL_GEN(dev) >= 4)
15120 if (!dev->mode_config.rotation_property) 15116 drm_plane_create_rotation_property(&cursor->base,
15121 dev->mode_config.rotation_property = 15117 DRM_ROTATE_0,
15122 drm_mode_create_rotation_property(dev, 15118 DRM_ROTATE_0 |
15123 DRM_ROTATE_0 | 15119 DRM_ROTATE_180);
15124 DRM_ROTATE_180);
15125 if (dev->mode_config.rotation_property)
15126 drm_object_attach_property(&cursor->base.base,
15127 dev->mode_config.rotation_property,
15128 state->base.rotation);
15129 }
15130 15120
15131 if (INTEL_INFO(dev)->gen >=9) 15121 if (INTEL_INFO(dev)->gen >=9)
15132 state->scaler_id = -1; 15122 state->scaler_id = -1;
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index c6ae525fe1f5..5145ff264c8e 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -1284,9 +1284,6 @@ int intel_plane_atomic_calc_changes(struct drm_crtc_state *crtc_state,
1284unsigned int intel_tile_height(const struct drm_i915_private *dev_priv, 1284unsigned int intel_tile_height(const struct drm_i915_private *dev_priv,
1285 uint64_t fb_modifier, unsigned int cpp); 1285 uint64_t fb_modifier, unsigned int cpp);
1286 1286
1287void intel_create_rotation_property(struct drm_device *dev,
1288 struct intel_plane *plane);
1289
1290void assert_pch_transcoder_disabled(struct drm_i915_private *dev_priv, 1287void assert_pch_transcoder_disabled(struct drm_i915_private *dev_priv,
1291 enum pipe pipe); 1288 enum pipe pipe);
1292 1289
diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
index be3e04623e2a..3ea6419e18b9 100644
--- a/drivers/gpu/drm/i915/intel_sprite.c
+++ b/drivers/gpu/drm/i915/intel_sprite.c
@@ -1044,6 +1044,7 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane)
1044 struct intel_plane_state *state = NULL; 1044 struct intel_plane_state *state = NULL;
1045 unsigned long possible_crtcs; 1045 unsigned long possible_crtcs;
1046 const uint32_t *plane_formats; 1046 const uint32_t *plane_formats;
1047 unsigned int supported_rotations;
1047 int num_plane_formats; 1048 int num_plane_formats;
1048 int ret; 1049 int ret;
1049 1050
@@ -1119,6 +1120,15 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane)
1119 goto fail; 1120 goto fail;
1120 } 1121 }
1121 1122
1123 if (INTEL_GEN(dev) >= 9) {
1124 supported_rotations =
1125 DRM_ROTATE_0 | DRM_ROTATE_90 |
1126 DRM_ROTATE_180 | DRM_ROTATE_270;
1127 } else {
1128 supported_rotations =
1129 DRM_ROTATE_0 | DRM_ROTATE_180;
1130 }
1131
1122 intel_plane->pipe = pipe; 1132 intel_plane->pipe = pipe;
1123 intel_plane->plane = plane; 1133 intel_plane->plane = plane;
1124 intel_plane->frontbuffer_bit = INTEL_FRONTBUFFER_SPRITE(pipe, plane); 1134 intel_plane->frontbuffer_bit = INTEL_FRONTBUFFER_SPRITE(pipe, plane);
@@ -1141,7 +1151,9 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane)
1141 if (ret) 1151 if (ret)
1142 goto fail; 1152 goto fail;
1143 1153
1144 intel_create_rotation_property(dev, intel_plane); 1154 drm_plane_create_rotation_property(&intel_plane->base,
1155 DRM_ROTATE_0,
1156 supported_rotations);
1145 1157
1146 drm_plane_helper_add(&intel_plane->base, &intel_plane_helper_funcs); 1158 drm_plane_helper_add(&intel_plane->base, &intel_plane_helper_funcs);
1147 1159