drm: Swap w/h when converting the mode to src coordidates for a rotated primary plane
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Thu, 15 Oct 2015 17:39:59 +0000 (20:39 +0300)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Mon, 19 Oct 2015 09:00:46 +0000 (11:00 +0200)
When converting the mode hdisplay/vdisplay to primary plane src
coordinates we need to take into account the current plane
rotation.

Cc: Matt Roper <matthew.d.roper@intel.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1444930802-8515-2-git-send-email-ville.syrjala@linux.intel.com
Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/drm_atomic_helper.c

index 87a2a446d2b759c6b1b8418187f5288003aff2d3..0c6f62168776ee378ff0906d2269cd10221fb535 100644 (file)
@@ -1790,8 +1790,13 @@ int __drm_atomic_helper_set_config(struct drm_mode_set *set,
        primary_state->crtc_w = set->mode->hdisplay;
        primary_state->src_x = set->x << 16;
        primary_state->src_y = set->y << 16;
-       primary_state->src_h = set->mode->vdisplay << 16;
-       primary_state->src_w = set->mode->hdisplay << 16;
+       if (primary_state->rotation & (BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270))) {
+               primary_state->src_h = set->mode->hdisplay << 16;
+               primary_state->src_w = set->mode->vdisplay << 16;
+       } else {
+               primary_state->src_h = set->mode->vdisplay << 16;
+               primary_state->src_w = set->mode->hdisplay << 16;
+       }
 
 commit:
        ret = update_output_state(state, set);