Commit bfeece55 authored by Tomi Valkeinen's avatar Tomi Valkeinen

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: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
parent 6bdad6cf
...@@ -189,6 +189,7 @@ void omap_framebuffer_update_scanout(struct drm_framebuffer *fb, ...@@ -189,6 +189,7 @@ void omap_framebuffer_update_scanout(struct drm_framebuffer *fb,
struct omap_drm_window *win, struct omap_overlay_info *info); struct omap_drm_window *win, struct omap_overlay_info *info);
struct drm_connector *omap_framebuffer_get_next_connector( struct drm_connector *omap_framebuffer_get_next_connector(
struct drm_framebuffer *fb, struct drm_connector *from); struct drm_framebuffer *fb, struct drm_connector *from);
bool omap_framebuffer_supports_rotation(struct drm_framebuffer *fb);
void omap_gem_init(struct drm_device *dev); void omap_gem_init(struct drm_device *dev);
void omap_gem_deinit(struct drm_device *dev); void omap_gem_deinit(struct drm_device *dev);
......
...@@ -145,6 +145,14 @@ static uint32_t get_linear_addr(struct plane *plane, ...@@ -145,6 +145,14 @@ static uint32_t get_linear_addr(struct plane *plane,
return plane->paddr + offset; return plane->paddr + offset;
} }
bool omap_framebuffer_supports_rotation(struct drm_framebuffer *fb)
{
struct omap_framebuffer *omap_fb = to_omap_framebuffer(fb);
struct plane *plane = &omap_fb->planes[0];
return omap_gem_flags(plane->bo) & OMAP_BO_TILED;
}
/* update ovl info for scanout, handles cases of multi-planar fb's, etc. /* update ovl info for scanout, handles cases of multi-planar fb's, etc.
*/ */
void omap_framebuffer_update_scanout(struct drm_framebuffer *fb, void omap_framebuffer_update_scanout(struct drm_framebuffer *fb,
......
...@@ -177,6 +177,12 @@ static int omap_plane_atomic_check(struct drm_plane *plane, ...@@ -177,6 +177,12 @@ static int omap_plane_atomic_check(struct drm_plane *plane,
if (state->crtc_y + state->crtc_h > crtc_state->adjusted_mode.vdisplay) if (state->crtc_y + state->crtc_h > crtc_state->adjusted_mode.vdisplay)
return -EINVAL; return -EINVAL;
if (state->fb) {
if (state->rotation != BIT(DRM_ROTATE_0) &&
!omap_framebuffer_supports_rotation(state->fb))
return -EINVAL;
}
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment