Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754511AbcCNCjh (ORCPT ); Sun, 13 Mar 2016 22:39:37 -0400 Received: from regular1.263xmail.com ([211.150.99.140]:35568 "EHLO regular1.263xmail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754184AbcCNCj3 (ORCPT ); Sun, 13 Mar 2016 22:39:29 -0400 X-263anti-spam: KSV:0;BIG:0;ABS:1;DNS:0;ATT:0;SPF:S; X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-KSVirus-check: 0 X-ABS-CHECKED: 1 X-SKE-CHECKED: 1 X-ADDR-CHECKED: 0 X-RL-SENDER: mark.yao@rock-chips.com X-FST-TO: linux-kernel@vger.kernel.org X-SENDER-IP: 58.22.7.114 X-LOGIN-NAME: mark.yao@rock-chips.com X-UNIQUE-TAG: X-ATTACHMENT-NUM: 0 X-DNS-TYPE: 0 Message-ID: <56E62454.1070808@rock-chips.com> Date: Mon, 14 Mar 2016 10:39:16 +0800 From: Mark yao User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.8.0 MIME-Version: 1.0 To: John Keeping CC: Heiko Stuebner , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] drm/rockchip: vop: fix crtc size in plane check References: <56D8DF39.8020104@rock-chips.com> <1457089443-6069-1-git-send-email-john@metanate.com> In-Reply-To: <1457089443-6069-1-git-send-email-john@metanate.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2674 Lines: 69 On 2016年03月04日 19:04, John Keeping wrote: > 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 > --- > On Fri, 04 Mar 2016 09:04:57 +0800, Mark yao wrote: >> On 2016年02月22日 20:22, John Keeping wrote: >>> If the geometry of a crtc is changing in an atomic update then we much >> I think "we much validate" should be "we must validate".:-) > Yes, here's v2 with that fixed. > >>> 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. > drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 14 ++++++++------ > 1 file changed, 8 insertions(+), 6 deletions(-) > > diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c > index fd37054..82d55bd 100644 > --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c > +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c > @@ -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); > @@ -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; > @@ -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, Looks good for me, applied into my drm-fixes. Thanks for the fix. -- Mark Yao