diff options
author | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2015-08-27 06:09:22 -0400 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2016-03-03 10:36:44 -0500 |
commit | bfeece553335f9b9bf0d4dc9ea8a602a2248dfd6 (patch) | |
tree | d1a83329d4cc2be8ed3a89de3ebda42e889ac430 /drivers/gpu/drm/omapdrm | |
parent | 6bdad6cf98844e76f678da35dea09193bfb78be1 (diff) |
drm/omap: check if rotation is supported before commit
omapdrm is missing a check on the validity of the rotation property.
This leads to omapdrm possibly trying to use rotation on non-rotateable
framebuffer, which causes the overlay setup to fail.
This patch adds the necessary check to omap_plane_atomic_check().
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'drivers/gpu/drm/omapdrm')
-rw-r--r-- | drivers/gpu/drm/omapdrm/omap_drv.h | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/omapdrm/omap_fb.c | 8 | ||||
-rw-r--r-- | drivers/gpu/drm/omapdrm/omap_plane.c | 6 |
3 files changed, 15 insertions, 0 deletions
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.h b/drivers/gpu/drm/omapdrm/omap_drv.h index c077367dcb1a..16c3eeeae668 100644 --- a/drivers/gpu/drm/omapdrm/omap_drv.h +++ b/drivers/gpu/drm/omapdrm/omap_drv.h | |||
@@ -189,6 +189,7 @@ void omap_framebuffer_update_scanout(struct drm_framebuffer *fb, | |||
189 | struct omap_drm_window *win, struct omap_overlay_info *info); | 189 | struct omap_drm_window *win, struct omap_overlay_info *info); |
190 | struct drm_connector *omap_framebuffer_get_next_connector( | 190 | struct drm_connector *omap_framebuffer_get_next_connector( |
191 | struct drm_framebuffer *fb, struct drm_connector *from); | 191 | struct drm_framebuffer *fb, struct drm_connector *from); |
192 | bool omap_framebuffer_supports_rotation(struct drm_framebuffer *fb); | ||
192 | 193 | ||
193 | void omap_gem_init(struct drm_device *dev); | 194 | void omap_gem_init(struct drm_device *dev); |
194 | void omap_gem_deinit(struct drm_device *dev); | 195 | void omap_gem_deinit(struct drm_device *dev); |
diff --git a/drivers/gpu/drm/omapdrm/omap_fb.c b/drivers/gpu/drm/omapdrm/omap_fb.c index 481512db2656..610962396eb0 100644 --- a/drivers/gpu/drm/omapdrm/omap_fb.c +++ b/drivers/gpu/drm/omapdrm/omap_fb.c | |||
@@ -145,6 +145,14 @@ static uint32_t get_linear_addr(struct plane *plane, | |||
145 | return plane->paddr + offset; | 145 | return plane->paddr + offset; |
146 | } | 146 | } |
147 | 147 | ||
148 | bool omap_framebuffer_supports_rotation(struct drm_framebuffer *fb) | ||
149 | { | ||
150 | struct omap_framebuffer *omap_fb = to_omap_framebuffer(fb); | ||
151 | struct plane *plane = &omap_fb->planes[0]; | ||
152 | |||
153 | return omap_gem_flags(plane->bo) & OMAP_BO_TILED; | ||
154 | } | ||
155 | |||
148 | /* update ovl info for scanout, handles cases of multi-planar fb's, etc. | 156 | /* update ovl info for scanout, handles cases of multi-planar fb's, etc. |
149 | */ | 157 | */ |
150 | void omap_framebuffer_update_scanout(struct drm_framebuffer *fb, | 158 | void omap_framebuffer_update_scanout(struct drm_framebuffer *fb, |
diff --git a/drivers/gpu/drm/omapdrm/omap_plane.c b/drivers/gpu/drm/omapdrm/omap_plane.c index d75b197eff46..93ee538a99f5 100644 --- a/drivers/gpu/drm/omapdrm/omap_plane.c +++ b/drivers/gpu/drm/omapdrm/omap_plane.c | |||
@@ -177,6 +177,12 @@ static int omap_plane_atomic_check(struct drm_plane *plane, | |||
177 | if (state->crtc_y + state->crtc_h > crtc_state->adjusted_mode.vdisplay) | 177 | if (state->crtc_y + state->crtc_h > crtc_state->adjusted_mode.vdisplay) |
178 | return -EINVAL; | 178 | return -EINVAL; |
179 | 179 | ||
180 | if (state->fb) { | ||
181 | if (state->rotation != BIT(DRM_ROTATE_0) && | ||
182 | !omap_framebuffer_supports_rotation(state->fb)) | ||
183 | return -EINVAL; | ||
184 | } | ||
185 | |||
180 | return 0; | 186 | return 0; |
181 | } | 187 | } |
182 | 188 | ||