aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorVille Syrjälä <ville.syrjala@linux.intel.com>2016-11-14 11:54:00 -0500
committerVille Syrjälä <ville.syrjala@linux.intel.com>2016-11-14 12:58:48 -0500
commit4ea7be2b562802c42f0dd232220f38119a0b9431 (patch)
tree1966e1a4998f96f6f0e5223e096cfe46e76905d3 /drivers
parentdf0cd455e720e4c0a04a85eb8ec4d2dab2e37795 (diff)
drm/i915: Add horizontal mirroring support for CHV pipe B planes
The primary and sprite planes on CHV pipe B support horizontal mirroring. Expose it to the world. Sadly the hardware ignores the mirror bit when the rotate bit is set, so we'll have to reject the 180+X case. v2: Drop the BIT() v3: Pass dev_priv instead of dev to IS_CHERRYVIEW() Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Link: http://patchwork.freedesktop.org/patch/msgid/1479142440-25283-4-git-send-email-ville.syrjala@linux.intel.com
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/i915/intel_atomic_plane.c9
-rw-r--r--drivers/gpu/drm/i915/intel_display.c9
-rw-r--r--drivers/gpu/drm/i915/intel_sprite.c9
3 files changed, 27 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/intel_atomic_plane.c b/drivers/gpu/drm/i915/intel_atomic_plane.c
index cb5594411bb6..71a0433cd6c3 100644
--- a/drivers/gpu/drm/i915/intel_atomic_plane.c
+++ b/drivers/gpu/drm/i915/intel_atomic_plane.c
@@ -106,6 +106,7 @@ intel_plane_destroy_state(struct drm_plane *plane,
106static int intel_plane_atomic_check(struct drm_plane *plane, 106static int intel_plane_atomic_check(struct drm_plane *plane,
107 struct drm_plane_state *state) 107 struct drm_plane_state *state)
108{ 108{
109 struct drm_i915_private *dev_priv = to_i915(plane->dev);
109 struct drm_crtc *crtc = state->crtc; 110 struct drm_crtc *crtc = state->crtc;
110 struct intel_crtc *intel_crtc; 111 struct intel_crtc *intel_crtc;
111 struct intel_crtc_state *crtc_state; 112 struct intel_crtc_state *crtc_state;
@@ -167,6 +168,14 @@ static int intel_plane_atomic_check(struct drm_plane *plane,
167 } 168 }
168 } 169 }
169 170
171 /* CHV ignores the mirror bit when the rotate bit is set :( */
172 if (IS_CHERRYVIEW(dev_priv) &&
173 state->rotation & DRM_ROTATE_180 &&
174 state->rotation & DRM_REFLECT_X) {
175 DRM_DEBUG_KMS("Cannot rotate and reflect at the same time\n");
176 return -EINVAL;
177 }
178
170 intel_state->base.visible = false; 179 intel_state->base.visible = false;
171 ret = intel_plane->check_plane(plane, crtc_state, intel_state); 180 ret = intel_plane->check_plane(plane, crtc_state, intel_state);
172 if (ret) 181 if (ret)
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index ecc7b5b444f6..c2ba36b37fba 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -3078,6 +3078,9 @@ static void i9xx_update_primary_plane(struct drm_plane *primary,
3078 if (rotation & DRM_ROTATE_180) 3078 if (rotation & DRM_ROTATE_180)
3079 dspcntr |= DISPPLANE_ROTATE_180; 3079 dspcntr |= DISPPLANE_ROTATE_180;
3080 3080
3081 if (rotation & DRM_REFLECT_X)
3082 dspcntr |= DISPPLANE_MIRROR;
3083
3081 if (IS_G4X(dev_priv)) 3084 if (IS_G4X(dev_priv))
3082 dspcntr |= DISPPLANE_TRICKLE_FEED_DISABLE; 3085 dspcntr |= DISPPLANE_TRICKLE_FEED_DISABLE;
3083 3086
@@ -3090,6 +3093,8 @@ static void i9xx_update_primary_plane(struct drm_plane *primary,
3090 if (rotation & DRM_ROTATE_180) { 3093 if (rotation & DRM_ROTATE_180) {
3091 x += crtc_state->pipe_src_w - 1; 3094 x += crtc_state->pipe_src_w - 1;
3092 y += crtc_state->pipe_src_h - 1; 3095 y += crtc_state->pipe_src_h - 1;
3096 } else if (rotation & DRM_REFLECT_X) {
3097 x += crtc_state->pipe_src_w - 1;
3093 } 3098 }
3094 3099
3095 linear_offset = intel_fb_xy_to_linear(x, y, plane_state, 0); 3100 linear_offset = intel_fb_xy_to_linear(x, y, plane_state, 0);
@@ -15065,6 +15070,10 @@ intel_primary_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe)
15065 supported_rotations = 15070 supported_rotations =
15066 DRM_ROTATE_0 | DRM_ROTATE_90 | 15071 DRM_ROTATE_0 | DRM_ROTATE_90 |
15067 DRM_ROTATE_180 | DRM_ROTATE_270; 15072 DRM_ROTATE_180 | DRM_ROTATE_270;
15073 } else if (IS_CHERRYVIEW(dev_priv) && pipe == PIPE_B) {
15074 supported_rotations =
15075 DRM_ROTATE_0 | DRM_ROTATE_180 |
15076 DRM_REFLECT_X;
15068 } else if (INTEL_GEN(dev_priv) >= 4) { 15077 } else if (INTEL_GEN(dev_priv) >= 4) {
15069 supported_rotations = 15078 supported_rotations =
15070 DRM_ROTATE_0 | DRM_ROTATE_180; 15079 DRM_ROTATE_0 | DRM_ROTATE_180;
diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
index 7951b70bf792..7b761826a738 100644
--- a/drivers/gpu/drm/i915/intel_sprite.c
+++ b/drivers/gpu/drm/i915/intel_sprite.c
@@ -430,6 +430,9 @@ vlv_update_plane(struct drm_plane *dplane,
430 if (rotation & DRM_ROTATE_180) 430 if (rotation & DRM_ROTATE_180)
431 sprctl |= SP_ROTATE_180; 431 sprctl |= SP_ROTATE_180;
432 432
433 if (rotation & DRM_REFLECT_X)
434 sprctl |= SP_MIRROR;
435
433 /* Sizes are 0 based */ 436 /* Sizes are 0 based */
434 src_w--; 437 src_w--;
435 src_h--; 438 src_h--;
@@ -442,6 +445,8 @@ vlv_update_plane(struct drm_plane *dplane,
442 if (rotation & DRM_ROTATE_180) { 445 if (rotation & DRM_ROTATE_180) {
443 x += src_w; 446 x += src_w;
444 y += src_h; 447 y += src_h;
448 } else if (rotation & DRM_REFLECT_X) {
449 x += src_w;
445 } 450 }
446 451
447 linear_offset = intel_fb_xy_to_linear(x, y, plane_state, 0); 452 linear_offset = intel_fb_xy_to_linear(x, y, plane_state, 0);
@@ -1121,6 +1126,10 @@ intel_sprite_plane_create(struct drm_i915_private *dev_priv,
1121 supported_rotations = 1126 supported_rotations =
1122 DRM_ROTATE_0 | DRM_ROTATE_90 | 1127 DRM_ROTATE_0 | DRM_ROTATE_90 |
1123 DRM_ROTATE_180 | DRM_ROTATE_270; 1128 DRM_ROTATE_180 | DRM_ROTATE_270;
1129 } else if (IS_CHERRYVIEW(dev_priv) && pipe == PIPE_B) {
1130 supported_rotations =
1131 DRM_ROTATE_0 | DRM_ROTATE_180 |
1132 DRM_REFLECT_X;
1124 } else { 1133 } else {
1125 supported_rotations = 1134 supported_rotations =
1126 DRM_ROTATE_0 | DRM_ROTATE_180; 1135 DRM_ROTATE_0 | DRM_ROTATE_180;