From patchwork Fri Mar 31 09:51:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 9655825 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 9A07F602BD for ; Fri, 31 Mar 2017 09:52:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 895CC28555 for ; Fri, 31 Mar 2017 09:52:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7E1772865D; Fri, 31 Mar 2017 09:52:33 +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=ham 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 10BC228555 for ; Fri, 31 Mar 2017 09:52:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Date:Message-Id:MIME-Version:Subject:To :From:References:In-Reply-To:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=AU2MXLPKL1dx2lzYmcKjWmC3WbRRih8YdJJms6KjJxM=; b=NP3od52Z1eNDE6 606EIS1D1pcqxAfl65AXpZb3wbhQdXLbn4mWXmunQIcqqH4tZpqWsDv9EaI17kwQ/ZLijkz17ySSc wrqnsz3+/2Tk1AzCHvle4b93DjKdtCS84o90Kh8T9T/SwK6o8PhixaMsf13pLMPjoIA0kKMahzKw2 sOshwmrqmQU+/hGfZsLGiN98zz/x2pAAsKqXoXuyoKF+q82k2NbSSGwy/Eei0uyJnZs5/nTk0FZrk CtQuFKIfAVannAuujr9uGGvznIhOXjXitXdFISW7bU1EefTDWC9YMuK8yBDyiZhT/6nsm9z9w7bGL He8N2kUNgPu9rbmYs0sA==; 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 1cttEN-0003wh-SO; Fri, 31 Mar 2017 09:52:31 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:3201:214:fdff:fe10:1be6]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cttE9-0003Qm-S2 for linux-arm-kernel@lists.infradead.org; Fri, 31 Mar 2017 09:52:20 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2014; h=Date:Sender:Message-Id:Content-Type:Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References:In-Reply-To; bh=IgzB1looGgq0Uk3hHcLsSb4zsoRZcFGbKPsfHPQtX24=; b=M5i4E5m6zPFuTGKiVfAx+R49ET0hd6xbtg8egeayU3ShmXSppwGL1yKVvozaHXKs+a1bwAzaEg8W+54OBLAo+wga6TxQILVOcy8C3vDJQ7Rzcm6sTGusYe0MXSAMPPrxQG2RiZ51j2ZRIpPWW9Q16zqsZaf1Bl8p5BoceDGwC0o=; Received: from e0022681537dd.dyn.armlinux.org.uk ([2002:4e20:1eda:1:222:68ff:fe15:37dd]:43732 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1cttDg-0003mw-4c; Fri, 31 Mar 2017 10:51:48 +0100 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1cttDe-000679-UD; Fri, 31 Mar 2017 10:51:46 +0100 In-Reply-To: <20170331094937.GO7909@n2100.armlinux.org.uk> References: <20170331094937.GO7909@n2100.armlinux.org.uk> From: Russell King To: Liviu Dudau Subject: [PATCH 2/3] drm/arm: hdlcd: fix plane base address calculation MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Fri, 31 Mar 2017 10:51:46 +0100 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170331_025218_446954_992AFB3F X-CRM114-Status: GOOD ( 12.38 ) 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 , Liviu Dudau , dri-devel@lists.freedesktop.org, Mali DP Maintainers , =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= , Brian Starkey , LAKML 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 The plane base address needs to be calculated using the source coordinates to position the source correctly - it's possible to have a larger source buffer than the CRTC size, and have several CRTCs reading from different parts of the buffer. In such a case, the pitch may be larger, and we will use the source position to select an area of the buffer to scan out. In order for this to work correctly, we need to also fix the atomic check to do a fuller validation of the new state. Signed-off-by: Russell King --- drivers/gpu/drm/arm/hdlcd_crtc.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/arm/hdlcd_crtc.c b/drivers/gpu/drm/arm/hdlcd_crtc.c index ba68fa2b5701..cf70184fd028 100644 --- a/drivers/gpu/drm/arm/hdlcd_crtc.c +++ b/drivers/gpu/drm/arm/hdlcd_crtc.c @@ -240,21 +240,19 @@ static void hdlcd_plane_atomic_update(struct drm_plane *plane, { 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_h; dma_addr_t scanout_start; if (!plane->state->fb) return; - src_w = plane->state->src_w >> 16; - src_h = plane->state->src_h >> 16; - dest_w = plane->state->crtc_w; - dest_h = plane->state->crtc_h; gem = drm_fb_cma_get_gem_obj(plane->state->fb, 0); + src_x = plane->state->src_x >> 16; + src_y = plane->state->src_y >> 16; + dest_h = plane->state->crtc_h; scanout_start = gem->paddr + plane->state->fb->offsets[0] + - plane->state->crtc_y * plane->state->fb->pitches[0] + - plane->state->crtc_x * - drm_format_plane_cpp(plane->state->fb->pixel_format, 0); + src_y * plane->state->fb->pitches[0] + + src_x * drm_format_plane_cpp(plane->state->fb->pixel_format, 0); hdlcd = plane->dev->dev_private; hdlcd_write(hdlcd, HDLCD_REG_FB_LINE_LENGTH, plane->state->fb->pitches[0]);