drm: Check crtc viewport correctly with rotated primary plane on atomic drivers
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Fri, 16 Oct 2015 15:38:39 +0000 (18:38 +0300)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Mon, 19 Oct 2015 09:00:47 +0000 (11:00 +0200)
On atomic drivers we can dig out the primary plane rotation from the
plane state instead of looking at the legacy crtc->invert_dimensions
flag. The flag is not set by anyone except omapdrm, and it would be
racy to set it the same way in the atomic helpers.

v2: Kill crtc->invert_dimensions totally since omap is state based
    already and no one else ever used it (Matt)

Cc: Matt Roper <matthew.d.roper@intel.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: Rob Clark <robdclark@gmail.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1445009919-22746-1-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_crtc.c
drivers/gpu/drm/omapdrm/omap_crtc.c
include/drm/drm_crtc.h

index 4003bdb8126353de10c5470ea6fadd8256660762..8eec726c106ecf015f43924616c39ac6c3787039 100644 (file)
@@ -676,7 +676,6 @@ int drm_crtc_init_with_planes(struct drm_device *dev, struct drm_crtc *crtc,
 
        crtc->dev = dev;
        crtc->funcs = funcs;
-       crtc->invert_dimensions = false;
 
        drm_modeset_lock_init(&crtc->mutex);
        ret = drm_mode_object_get(dev, &crtc->base, DRM_MODE_OBJECT_CRTC);
@@ -2563,7 +2562,9 @@ int drm_crtc_check_viewport(const struct drm_crtc *crtc,
 
        drm_crtc_get_hv_timing(mode, &hdisplay, &vdisplay);
 
-       if (crtc->invert_dimensions)
+       if (crtc->state &&
+           crtc->primary->state->rotation & (BIT(DRM_ROTATE_90) |
+                                             BIT(DRM_ROTATE_270)))
                swap(hdisplay, vdisplay);
 
        return check_src_coords(x << 16, y << 16,
index 9a4ba4f035673e859c6687fcc76bc507b4ab8996..ad09590e8a4688d22756217542b6716157d5e37d 100644 (file)
@@ -412,9 +412,6 @@ static void omap_crtc_atomic_flush(struct drm_crtc *crtc,
                dispc_mgr_go(omap_crtc->channel);
                omap_irq_register(crtc->dev, &omap_crtc->vblank_irq);
        }
-
-       crtc->invert_dimensions = !!(crtc->primary->state->rotation &
-                                   (BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270)));
 }
 
 static int omap_crtc_atomic_set_property(struct drm_crtc *crtc,
index 33ddedd3603871545cdcb009f9f48d08e88bb79a..3f0c6909dda17f9ec14959353a440da171a87ca6 100644 (file)
@@ -407,9 +407,6 @@ struct drm_crtc_funcs {
  * @enabled: is this CRTC enabled?
  * @mode: current mode timings
  * @hwmode: mode timings as programmed to hw regs
- * @invert_dimensions: for purposes of error checking crtc vs fb sizes,
- *    invert the width/height of the crtc.  This is used if the driver
- *    is performing 90 or 270 degree rotated scanout
  * @x: x position on screen
  * @y: y position on screen
  * @funcs: CRTC control functions
@@ -458,8 +455,6 @@ struct drm_crtc {
         */
        struct drm_display_mode hwmode;
 
-       bool invert_dimensions;
-
        int x, y;
        const struct drm_crtc_funcs *funcs;