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: 9583421 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 6FF82604A0 for ; Mon, 20 Feb 2017 17:53:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 73DF028699 for ; Mon, 20 Feb 2017 17:53:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 67025286A9; Mon, 20 Feb 2017 17:53:36 +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.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id CECC028699 for ; Mon, 20 Feb 2017 17:53:35 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 491D56E3AA; Mon, 20 Feb 2017 17:53:34 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from foss.arm.com (foss.arm.com [217.140.101.70]) by gabe.freedesktop.org (Postfix) with ESMTP id CC4106E3AA for ; Mon, 20 Feb 2017 17:53:33 +0000 (UTC) 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) Cc: dri-devel@lists.freedesktop.org, Mali DP Maintainers , 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-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