From patchwork Mon Feb 20 17:53:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liviu Dudau X-Patchwork-Id: 9583423 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 163DA60578 for ; Mon, 20 Feb 2017 17:54:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1A13F28549 for ; Mon, 20 Feb 2017 17:54:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0E043286A0; Mon, 20 Feb 2017 17:54:30 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7BCF928549 for ; Mon, 20 Feb 2017 17:54:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To: Content-Transfer-Encoding:Content-Type:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=armYemSEOKal5D/rtH6LVBtBb4mFEtisrrmJYONe8mU=; b=RK9HHHcg+PxPkr66kJXT8Htfj xGSv42IxQjEPrTkr8xZhUQqz/SV7uatjMR6/Vtvh62nugrWU2vrxOS3d9Hl82IgeXUmeV5DoNgGcU UHn+4/ZpCumsTz6X0xL0t/fc+UAVM0KkuCP3Tti3kiOS1eQ4+mpibVXGnSXplZ3UKQc08VgQSzu8d /GzEmonCz6sLj+mf6mQQaTSDM+85CjaKzMICZyjSQRXNDNjV4GVr4/sQzbyjk3Bkwo6NmlmRlAi+b UZbSRo9Yz6/uVxAUnwL/ezpkI7m07bQaIAGrgwff0RQ30p7k/z68TQJVDEugJ5tRARg3blncXw8HS cMffcZEfg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cfsAG-0007s5-Hd; Mon, 20 Feb 2017 17:54:22 +0000 Received: from foss.arm.com ([217.140.101.70]) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cfs9q-0007qn-0A for linux-arm-kernel@lists.infradead.org; Mon, 20 Feb 2017 17:53:56 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 266742B; Mon, 20 Feb 2017 09:53:33 -0800 (PST) Received: from e110455-lin.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id EE3323F483; Mon, 20 Feb 2017 09:53:32 -0800 (PST) Received: by e110455-lin.cambridge.arm.com (Postfix, from userid 1000) id 6B28A6804AA; Mon, 20 Feb 2017 17:53:31 +0000 (GMT) Date: Mon, 20 Feb 2017 17:53:31 +0000 From: Liviu Dudau To: Russell King - ARM Linux Subject: Re: [BUG] hdlcd gets confused about base address Message-ID: <20170220175331.GC963@e110455-lin.cambridge.arm.com> References: <20161118233733.GP1041@n2100.armlinux.org.uk> <20170220121603.GA1132@n2100.armlinux.org.uk> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20170220121603.GA1132@n2100.armlinux.org.uk> User-Agent: Mutt/1.7.2 (2016-11-26) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170220_095354_152887_6C7B92EC X-CRM114-Status: GOOD ( 19.82 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , dri-devel@lists.freedesktop.org, Mali DP Maintainers , Brian Starkey , 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 Hi Russell, On Mon, Feb 20, 2017 at 12:16:03PM +0000, Russell King - ARM Linux wrote: > On Fri, Nov 18, 2016 at 11:37:33PM +0000, Russell King - ARM Linux wrote: > > Something I also noticed is this: > > > > scanout_start = gem->paddr + plane->state->fb->offsets[0] + > > plane->state->crtc_y * plane->state->fb->pitches[0] + > > plane->state->crtc_x * bpp / 8; > > > > Surely this should be using src_[xy] (which are the position in the > > source - iow, memory, and not crtc_[xy] which is the position on the > > CRTC displayed window. To put it another way, the src_* define the > > region of the source material that is mapped onto a rectangular area > > on the display defined by crtc_*. > > This problem still exists... Sorry, looks like this fell through the cracks of us trying to fix the other issues you were seeing. I'm attaching a patch, please let me know if this works for you. Best regards, Liviu > > -- > RMK's Patch system: http://www.armlinux.org.uk/developer/patches/ > FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up > according to speedtest.net. From a495d262cb91fdeccb00685646ddb71774c18e7e Mon Sep 17 00:00:00 2001 From: Liviu Dudau Date: Mon, 20 Feb 2017 17:44:42 +0000 Subject: [PATCH] arm: hdlcd: Fix the calculation of scanout start address The framebuffer start address uses the CRTC's x,y position rather than the source framebuffer's. Fix that. Reported-by: Russell King Signed-off-by: Liviu Dudau --- drivers/gpu/drm/arm/hdlcd_crtc.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/arm/hdlcd_crtc.c b/drivers/gpu/drm/arm/hdlcd_crtc.c index 798a3cc480a2..4c1ab73d9e07 100644 --- a/drivers/gpu/drm/arm/hdlcd_crtc.c +++ b/drivers/gpu/drm/arm/hdlcd_crtc.c @@ -244,21 +244,20 @@ static void hdlcd_plane_atomic_update(struct drm_plane *plane, struct drm_framebuffer *fb = plane->state->fb; struct hdlcd_drm_private *hdlcd; struct drm_gem_cma_object *gem; - u32 src_w, src_h, dest_w, dest_h; + u32 src_x, src_y, dest_w, dest_h; dma_addr_t scanout_start; if (!fb) return; - src_w = plane->state->src_w >> 16; - src_h = plane->state->src_h >> 16; + src_x = plane->state->src_x >> 16; + src_y = plane->state->src_y >> 16; dest_w = plane->state->crtc_w; dest_h = plane->state->crtc_h; gem = drm_fb_cma_get_gem_obj(fb, 0); scanout_start = gem->paddr + fb->offsets[0] + - plane->state->crtc_y * fb->pitches[0] + - plane->state->crtc_x * - fb->format->cpp[0]; + src_y * fb->pitches[0] + + src_x * fb->format->cpp[0]; hdlcd = plane->dev->dev_private; hdlcd_write(hdlcd, HDLCD_REG_FB_LINE_LENGTH, fb->pitches[0]); -- 2.11.0