From patchwork Mon Nov 21 18:16:16 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 9439915 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 827DD60469 for ; Mon, 21 Nov 2016 18:18:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6B73928487 for ; Mon, 21 Nov 2016 18:18:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5F9F3285D4; Mon, 21 Nov 2016 18:18:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 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.wl.linuxfoundation.org (Postfix) with ESMTPS id C4EC328487 for ; Mon, 21 Nov 2016 18:18:22 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1c8t9A-0007Bl-UG; Mon, 21 Nov 2016 18:16:52 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:3201:214:fdff:fe10:1be6]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1c8t95-00076d-HR for linux-arm-kernel@lists.infradead.org; Mon, 21 Nov 2016 18:16:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2014; h=Sender:In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=KITq7QzizT+Q0WFN+nnXghlHOYX5NVd9BY0yrKx1RuA=; b=cWAy9UgwjHl/1/pPyc9tsyHHXekuJhUaY+2uIxrzoeBtbAlVXZpYHRUJekfQ72MQcOzfVqz/G1W3yEQGz8NkslFvhcOA6qIAosicjEqFbLDYQWj3GkDgG8kqbA7xQbPRoYUwckF55aXotXkwuCeLVl7sudr4p9hiWqqNWMWxCWA=; Received: from n2100.armlinux.org.uk ([2002:4e20:1eda:1:214:fdff:fe10:4f86]:46517) by pandora.armlinux.org.uk with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1c8t8e-0001KH-21; Mon, 21 Nov 2016 18:16:20 +0000 Received: from linux by n2100.armlinux.org.uk with local (Exim 4.76) (envelope-from ) id 1c8t8b-00009e-3F; Mon, 21 Nov 2016 18:16:17 +0000 Date: Mon, 21 Nov 2016 18:16:16 +0000 From: Russell King - ARM Linux To: Liviu Dudau Subject: Re: [BUG] hdlcd gets confused about base address Message-ID: <20161121181616.GN1041@n2100.armlinux.org.uk> References: <20161121110604.GC1005@e106497-lin.cambridge.arm.com> <20161121112030.GC1041@n2100.armlinux.org.uk> <20161121113212.GF1005@e106497-lin.cambridge.arm.com> <20161121122556.GE1041@n2100.armlinux.org.uk> <20161121125653.GJ1005@e106497-lin.cambridge.arm.com> <20161121132419.GF1041@n2100.armlinux.org.uk> <20161121135031.GK1005@e106497-lin.cambridge.arm.com> <20161121140349.GG1041@n2100.armlinux.org.uk> <20161121173231.GM1005@e106497-lin.cambridge.arm.com> <20161121175602.GM1041@n2100.armlinux.org.uk> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20161121175602.GM1041@n2100.armlinux.org.uk> User-Agent: Mutt/1.5.23 (2014-03-12) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161121_101647_910906_F521C979 X-CRM114-Status: GOOD ( 17.92 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , Mali DP Maintainers , Brian Starkey , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP On Mon, Nov 21, 2016 at 05:56:02PM +0000, Russell King - ARM Linux wrote: > For me, the image shift was 100% reproducable. With the above patch > and a call to drm_crtc_vblank_on() in the enable path, it seems to > behave correctly - I can alternately switch between 1920x1080 and > 1280x1024 and it behaves correctly. Indeed, my debug prints show that > the right thing is happening wrt disabling the controller: Here's my version of your patch: 8<============= From: Russell King Subject: [PATCH] drm/arm: hdlcd: fix plane base address update While testing HDMI with Xorg on the Juno board, I find that when Xorg starts up or shuts down, the display is shifted significantly to the right and wrapped in the active region. (No sync bars are visible.) The timings are correct, it behaves as if the start address has been shifted many pixels _into_ the framebuffer. This occurs whenever the display mode size is changed - using xrandr in Xorg shows that changing the resolution triggers the problem almost every time, but changing the refresh rate does not. Using devmem2 to disable and re-enable the HDLCD resolves the issue, and repeated disable/enable cycles do not make the issue re-appear. Further debugging shows that we try to update the controller configuration while enabled. Alwys ensure that the HDLCD is disabled prior to updating the controller timings, and use drm_crtc_vblank_off()/drm_crtc_vblank_on() so that DRM knows whether it can expect vblank interrupts. Signed-off-by: Russell King Acked-by: Liviu Dudau --- drivers/gpu/drm/arm/hdlcd_crtc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/arm/hdlcd_crtc.c b/drivers/gpu/drm/arm/hdlcd_crtc.c index c239616f5334..9d683be2e5d3 100644 --- a/drivers/gpu/drm/arm/hdlcd_crtc.c +++ b/drivers/gpu/drm/arm/hdlcd_crtc.c @@ -151,15 +151,14 @@ static void hdlcd_crtc_enable(struct drm_crtc *crtc) clk_prepare_enable(hdlcd->clk); hdlcd_crtc_mode_set_nofb(crtc); hdlcd_write(hdlcd, HDLCD_REG_COMMAND, 1); + drm_crtc_vblank_on(crtc); } static void hdlcd_crtc_disable(struct drm_crtc *crtc) { struct hdlcd_drm_private *hdlcd = crtc_to_hdlcd_priv(crtc); - if (!crtc->state->active) - return; - + drm_crtc_vblank_off(crtc); hdlcd_write(hdlcd, HDLCD_REG_COMMAND, 0); clk_disable_unprepare(hdlcd->clk); }