Skip to contentSkip to conversation

gma500: Fix mmap frambuffer

PATCH New Alan Cox 1 participant 1 message Mar 15, 2012

Subsystems (3)
lore
Share & tools
lore

Alan Cox

author
#0 lore raw

PATCH 1/1 gma500: Fix mmap frambuffer

From: Yoichi Yuasa <[email protected]>

It cannot map correctly if page fault begins from a intermediate address.

[The driver prefaults the mapping, so we need to work from the correct
base address not the faulting address otherwise the map appears offset by the fault offset]

---

 drivers/gpu/drm/gma500/framebuffer.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/gpu/drm/gma500/framebuffer.c +1 -1
index 8fde0d9..b51b9b8 100644
@@ -125,7 +125,7 @@ static int psbfb_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
 	unsigned long phys_addr = (unsigned long)dev_priv->stolen_base;
 
 	page_num = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT;
-	address = (unsigned long)vmf->virtual_address;
+	address = (unsigned long)vmf->virtual_address - (vmf->pgoff << PAGE_SHIFT);
 
 	vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);