Skip to content

Commit

Permalink
drm/rockchip: vop: fix crtc size in plane check
Browse files Browse the repository at this point in the history
If the geometry of a crtc is changing in an atomic update then we must
validate the plane size against the new state of the crtc and not the
current size, otherwise if the crtc size is increasing the plane will be
cropped at the previous size and will not fill the screen.

Signed-off-by: John Keeping <john@metanate.com>
  • Loading branch information
John Keeping authored and Mark Yao committed Mar 28, 2016
1 parent 4604202 commit 92915da
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions drivers/gpu/drm/rockchip/rockchip_drm_vop.c
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,7 @@ static int vop_plane_atomic_check(struct drm_plane *plane,
struct drm_plane_state *state)
{
struct drm_crtc *crtc = state->crtc;
struct drm_crtc_state *crtc_state;
struct drm_framebuffer *fb = state->fb;
struct vop_win *vop_win = to_vop_win(plane);
struct vop_plane_state *vop_plane_state = to_vop_plane_state(state);
Expand All @@ -563,12 +564,13 @@ static int vop_plane_atomic_check(struct drm_plane *plane,
int max_scale = win->phy->scl ? FRAC_16_16(8, 1) :
DRM_PLANE_HELPER_NO_SCALING;

crtc = crtc ? crtc : plane->state->crtc;
/*
* Both crtc or plane->state->crtc can be null.
*/
if (!crtc || !fb)
goto out_disable;

crtc_state = drm_atomic_get_existing_crtc_state(state->state, crtc);
if (WARN_ON(!crtc_state))
return -EINVAL;

src->x1 = state->src_x;
src->y1 = state->src_y;
src->x2 = state->src_x + state->src_w;
Expand All @@ -580,8 +582,8 @@ static int vop_plane_atomic_check(struct drm_plane *plane,

clip.x1 = 0;
clip.y1 = 0;
clip.x2 = crtc->mode.hdisplay;
clip.y2 = crtc->mode.vdisplay;
clip.x2 = crtc_state->adjusted_mode.hdisplay;
clip.y2 = crtc_state->adjusted_mode.vdisplay;

ret = drm_plane_helper_check_update(plane, crtc, state->fb,
src, dest, &clip,
Expand Down

0 comments on commit 92915da

Please sign in to comment.