From patchwork Tue May 14 12:50:54 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrik Jakobsson X-Patchwork-Id: 2565721 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork2.kernel.org (Postfix) with ESMTP id 1EEF7DF24C for ; Tue, 14 May 2013 12:51:07 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EEC9AE617B for ; Tue, 14 May 2013 05:51:06 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lb0-f179.google.com (mail-lb0-f179.google.com [209.85.217.179]) by gabe.freedesktop.org (Postfix) with ESMTP id 35401E5C6A for ; Tue, 14 May 2013 05:50:55 -0700 (PDT) Received: by mail-lb0-f179.google.com with SMTP id d10so571805lbj.10 for ; Tue, 14 May 2013 05:50:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=xaZIugONypIL+k0Q78B41YA/LmEdeRFnWlRDJ/MVsXU=; b=bL8nwjSGGGgei72f6OXf8ZlxYeuBXuwfEBW2Jy5TLdx4/v39wpOg3h5bmD8DqlwjTC RGZVXbMHDQwYDtCg8QKeYNJvMfRFBGz6OrM4EOge6r27pSWVk23uknA526GnbNSKwdPo XgZ297sF8acgU7Jp1K3JET30PDMGOSQE4v2nd5xnJ1z5lrK5pwsxJWszPAJ7ylPyyX/w VMcSGhcYVDmSa0Z3m09Spc4kjNVXvNC1+RuILTlHuDea5Bp/G8SA4WE57ZMyXiAZkgEF 0lWInB24A4az9Yom10GssAq0GdwOEIf0vgZB0eUCmHZB555GJBS89P1HuobBxnp5BKGp GDAw== MIME-Version: 1.0 X-Received: by 10.112.171.7 with SMTP id aq7mr15539166lbc.130.1368535854225; Tue, 14 May 2013 05:50:54 -0700 (PDT) Received: by 10.112.7.232 with HTTP; Tue, 14 May 2013 05:50:54 -0700 (PDT) In-Reply-To: References: Date: Tue, 14 May 2013 14:50:54 +0200 Message-ID: Subject: Re: gma500: display displaced vertically by a few lines From: Patrik Jakobsson To: Holger Schurig Cc: dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org On Tue, May 14, 2013 at 2:13 PM, Holger Schurig wrote: > Okay, I found the patch that produces my regression: > > ---------------------------------------------------------------------------- > From bc794829141f28e14fe7d0e07e35870bd9aee78c Mon Sep 17 00:00:00 2001 > From: Patrik Jakobsson > Date: Mon, 21 May 2012 15:27:30 +0100 > Subject: [PATCH 143/209] gma500: handle poulsbo cursor restriction > > Poulsbo needs a physical address in the cursor base register. We allocate a > stolen memory buffer and copy the cursor image provided by userspace into it. > When/If we get our own userspace driver we can map this stolen memory directly. > The patch also adds a mark in chip ops so we can identify devices that has this > requirement. > ---------------------------------------------------------------------------- > > When I modify the patch that psb_chip_ops.cursor_needs_phys doesn't > get initialized to 1, then the display doesn't get displaced. Hmm, I would have guessed on the gtt rolling code, but this makes sense. If we need phys cursor, we allocate a cursor bo in stolen memory and this happens before the framebuffer is allocated, thus moving the framebuffer 4 pages. Since the gtt rolling code tries to put a pitch of 1 page so it can perform it's trick we loose 4 lines at the top. The actual problem is in psbfb_vm_fault() where we assume the framebuffer to be at the start of stolen memory. The following patch should fix your problem, though I recommend you use the modesetting driver because you get a hardware accelerated cursor. Thanks Patrik From 1d68e97f39cb70862f7b02bb430e64dfa07fd08d Mon Sep 17 00:00:00 2001 From: Patrik Jakobsson Date: Tue, 14 May 2013 14:37:10 +0200 Subject: [PATCH] drm/gma500: Add fb gtt offset to fb base Old code assumed framebuffer starts at base of stolen memory. Since the addition of hardware cursors, this might not be true anymore so add the gtt offset to the calculation. Reported-by: Holger Schurig Signed-off-by: Patrik Jakobsson Tested-by: Holger Schurig --- drivers/gpu/drm/gma500/framebuffer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) address = (unsigned long)vmf->virtual_address - (vmf->pgoff << PAGE_SHIFT); diff --git a/drivers/gpu/drm/gma500/framebuffer.c b/drivers/gpu/drm/gma500/framebuffer.c index 1534e22..8b1b6d9 100644 --- a/drivers/gpu/drm/gma500/framebuffer.c +++ b/drivers/gpu/drm/gma500/framebuffer.c @@ -121,8 +121,8 @@ static int psbfb_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf) unsigned long address; int ret; unsigned long pfn; - /* FIXME: assumes fb at stolen base which may not be true */ - unsigned long phys_addr = (unsigned long)dev_priv->stolen_base; + unsigned long phys_addr = (unsigned long)dev_priv->stolen_base + + psbfb->gtt->offset; page_num = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT;