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: 8502671 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 089E1C0553 for ; Fri, 4 Mar 2016 11:04:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0312720218 for ; Fri, 4 Mar 2016 11:04:57 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id CF3C7201C8 for ; Fri, 4 Mar 2016 11:04:55 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A90926E08E; Fri, 4 Mar 2016 11:04:54 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from metanate.com (dougal.metanate.com [90.155.101.14]) by gabe.freedesktop.org (Postfix) with ESMTPS id B2AD06E08E for ; Fri, 4 Mar 2016 11:04:51 +0000 (UTC) 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> Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-rockchip@lists.infradead.org, linux-arm-kernel@lists.infradead.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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=ham 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,