From patchwork Fri Mar 4 11:04:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Keeping X-Patchwork-Id: 8502691 Return-Path: X-Original-To: patchwork-linux-rockchip@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id B7CB39F659 for ; Fri, 4 Mar 2016 11:05:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CE911201C8 for ; Fri, 4 Mar 2016 11:05:44 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E59CB200F3 for ; Fri, 4 Mar 2016 11:05:43 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1abnYE-0007uU-5f; Fri, 04 Mar 2016 11:05:42 +0000 Received: from dougal.metanate.com ([90.155.101.14] helo=metanate.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1abnXq-0005yq-HH; Fri, 04 Mar 2016 11:05:24 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=simple/simple; d=metanate.com; s=stronger; h=Content-Transfer-Encoding:Content-Type:References:In-Reply-To:MIME-Version:Message-Id:Date:Subject:Cc:To:From; bh=6azcudpDQdWIrm80/zy0fLxY20xz6h+FM/mklq2fZrQ=; b=f/vSlFwrMpgs6gvqAbqiS8LnIK3s8BT4HYhB/xeuNsfkLisD2gIY0IcjKW2zvtpetg+r94anjUIgT9SFVVXPvdOzIaHT/jG68UE5H0bRCfJ+Rp3fS4SB+O6JtblV4JAvZwQGghWmZ4+Ty87egnU3p0+FVGdWFAuwLf79P8ryYsPe4X4+gjiT0ul6GXffMinPhZeJMfGTMjmDRUIjIWN4ac/hvzjXx7PknMoZ9V9s2akyb95WNYcQ1tqXkrM0/ZXZKCRg1eGXbtshS3yHLSm7BaSSq4EVA+iarMZCQCEqBHi8XdHhUUQzT9RmvkUOKzBLjSFRhgSaMRnrP6IBpS/ArQ==; Received: from brian ([192.168.88.1] helo=leela.metanate.com) by shrek.metanate.com with esmtpsa (TLSv1.2:AES128-SHA256:128) (Exim 4.83_RC2) (envelope-from ) id 1abnWw-00027W-NX; Fri, 04 Mar 2016 11:04:22 +0000 From: John Keeping To: Mark yao Subject: [PATCH v2] drm/rockchip: vop: fix crtc size in plane check Date: Fri, 4 Mar 2016 11:04:03 +0000 Message-Id: <1457089443-6069-1-git-send-email-john@metanate.com> X-Mailer: git-send-email 2.7.0.226.gfe986fe MIME-Version: 1.0 In-Reply-To: <56D8DF39.8020104@rock-chips.com> References: <56D8DF39.8020104@rock-chips.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160304_030519_100225_3E99053B X-CRM114-Status: GOOD ( 14.49 ) X-Spam-Score: -2.0 (--) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Heiko Stuebner , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-rockchip@lists.infradead.org, John Keeping , linux-arm-kernel@lists.infradead.org Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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,