aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVille Syrjälä <ville.syrjala@linux.intel.com>2016-10-21 15:22:44 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2016-10-22 04:42:06 -0400
commit574a37b1bb07499778e6f46b56b6dda18151ad04 (patch)
treee489c0edbeac2979fe391cd5f84df861cccdc8c7
parent5b560c3a99a0d1a65132ce6f2f5a8505536613e4 (diff)
drm/msm/mdp5: Advertize 180 degree rotation
Since the hardware can apparently do both X and Y reflection, we can advertize also 180 degree rotation as thats just X+Y reflection. v2: Drop the BIT() Cc: Rob Clark <robdclark@gmail.com> Cc: Jilai Wang <jilaiw@codeaurora.org> Cc: Archit Taneja <architt@codeaurora.org> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Rob Clark <robdclark@gmail.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/1477077768-4274-3-git-send-email-ville.syrjala@linux.intel.com
-rw-r--r--drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
index 2653ad893ebc..cf50d3ec8d1b 100644
--- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
+++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
@@ -78,6 +78,7 @@ static void mdp5_plane_install_rotation_property(struct drm_device *dev,
78 drm_plane_create_rotation_property(plane, 78 drm_plane_create_rotation_property(plane,
79 DRM_ROTATE_0, 79 DRM_ROTATE_0,
80 DRM_ROTATE_0 | 80 DRM_ROTATE_0 |
81 DRM_ROTATE_180 |
81 DRM_REFLECT_X | 82 DRM_REFLECT_X |
82 DRM_REFLECT_Y); 83 DRM_REFLECT_Y);
83} 84}
@@ -285,6 +286,8 @@ static int mdp5_plane_atomic_check(struct drm_plane *plane,
285 plane_enabled(old_state), plane_enabled(state)); 286 plane_enabled(old_state), plane_enabled(state));
286 287
287 if (plane_enabled(state)) { 288 if (plane_enabled(state)) {
289 unsigned int rotation;
290
288 format = to_mdp_format(msm_framebuffer_format(state->fb)); 291 format = to_mdp_format(msm_framebuffer_format(state->fb));
289 if (MDP_FORMAT_IS_YUV(format) && 292 if (MDP_FORMAT_IS_YUV(format) &&
290 !pipe_supports_yuv(mdp5_plane->caps)) { 293 !pipe_supports_yuv(mdp5_plane->caps)) {
@@ -305,8 +308,13 @@ static int mdp5_plane_atomic_check(struct drm_plane *plane,
305 return -EINVAL; 308 return -EINVAL;
306 } 309 }
307 310
308 hflip = !!(state->rotation & DRM_REFLECT_X); 311 rotation = drm_rotation_simplify(state->rotation,
309 vflip = !!(state->rotation & DRM_REFLECT_Y); 312 DRM_ROTATE_0 |
313 DRM_REFLECT_X |
314 DRM_REFLECT_Y);
315 hflip = !!(rotation & DRM_REFLECT_X);
316 vflip = !!(rotation & DRM_REFLECT_Y);
317
310 if ((vflip && !(mdp5_plane->caps & MDP_PIPE_CAP_VFLIP)) || 318 if ((vflip && !(mdp5_plane->caps & MDP_PIPE_CAP_VFLIP)) ||
311 (hflip && !(mdp5_plane->caps & MDP_PIPE_CAP_HFLIP))) { 319 (hflip && !(mdp5_plane->caps & MDP_PIPE_CAP_HFLIP))) {
312 dev_err(plane->dev->dev, 320 dev_err(plane->dev->dev,
@@ -677,6 +685,7 @@ static int mdp5_plane_mode_set(struct drm_plane *plane,
677 int pe_top[COMP_MAX], pe_bottom[COMP_MAX]; 685 int pe_top[COMP_MAX], pe_bottom[COMP_MAX];
678 uint32_t hdecm = 0, vdecm = 0; 686 uint32_t hdecm = 0, vdecm = 0;
679 uint32_t pix_format; 687 uint32_t pix_format;
688 unsigned int rotation;
680 bool vflip, hflip; 689 bool vflip, hflip;
681 unsigned long flags; 690 unsigned long flags;
682 int ret; 691 int ret;
@@ -739,8 +748,12 @@ static int mdp5_plane_mode_set(struct drm_plane *plane,
739 config |= get_scale_config(format, src_h, crtc_h, false); 748 config |= get_scale_config(format, src_h, crtc_h, false);
740 DBG("scale config = %x", config); 749 DBG("scale config = %x", config);
741 750
742 hflip = !!(pstate->rotation & DRM_REFLECT_X); 751 rotation = drm_rotation_simplify(pstate->rotation,
743 vflip = !!(pstate->rotation & DRM_REFLECT_Y); 752 DRM_ROTATE_0 |
753 DRM_REFLECT_X |
754 DRM_REFLECT_Y);
755 hflip = !!(rotation & DRM_REFLECT_X);
756 vflip = !!(rotation & DRM_REFLECT_Y);
744 757
745 spin_lock_irqsave(&mdp5_plane->pipe_lock, flags); 758 spin_lock_irqsave(&mdp5_plane->pipe_lock, flags);
746 759