framebuffer.c (0a3173a5f09bc58a3638ecfd0a80bdbae55e123c) | framebuffer.c (0edf68137541a58984cc3a35a193558057f035cb) |
---|---|
1/************************************************************************** 2 * Copyright (c) 2007-2011, Intel Corporation. 3 * All Rights Reserved. 4 * 5 * This program is free software; you can redistribute it and/or modify it 6 * under the terms and conditions of the GNU General Public License, 7 * version 2, as published by the Free Software Foundation. 8 * --- 94 unchanged lines hidden (view full) --- 103 /* GTT roll shifts in 4K pages, we need to shift the right 104 number of pages */ 105 int pages = info->fix.line_length >> 12; 106 psb_gtt_roll(dev, gtt, var->yoffset * pages); 107 } 108 return 0; 109} 110 | 1/************************************************************************** 2 * Copyright (c) 2007-2011, Intel Corporation. 3 * All Rights Reserved. 4 * 5 * This program is free software; you can redistribute it and/or modify it 6 * under the terms and conditions of the GNU General Public License, 7 * version 2, as published by the Free Software Foundation. 8 * --- 94 unchanged lines hidden (view full) --- 103 /* GTT roll shifts in 4K pages, we need to shift the right 104 number of pages */ 105 int pages = info->fix.line_length >> 12; 106 psb_gtt_roll(dev, gtt, var->yoffset * pages); 107 } 108 return 0; 109} 110 |
111static int psbfb_vm_fault(struct vm_fault *vmf) | 111static vm_fault_t psbfb_vm_fault(struct vm_fault *vmf) |
112{ 113 struct vm_area_struct *vma = vmf->vma; 114 struct psb_framebuffer *psbfb = vma->vm_private_data; 115 struct drm_device *dev = psbfb->base.dev; 116 struct drm_psb_private *dev_priv = dev->dev_private; 117 struct gtt_range *gtt = to_gtt_range(psbfb->base.obj[0]); 118 int page_num; 119 int i; 120 unsigned long address; | 112{ 113 struct vm_area_struct *vma = vmf->vma; 114 struct psb_framebuffer *psbfb = vma->vm_private_data; 115 struct drm_device *dev = psbfb->base.dev; 116 struct drm_psb_private *dev_priv = dev->dev_private; 117 struct gtt_range *gtt = to_gtt_range(psbfb->base.obj[0]); 118 int page_num; 119 int i; 120 unsigned long address; |
121 int ret; | 121 vm_fault_t ret = VM_FAULT_SIGBUS; |
122 unsigned long pfn; 123 unsigned long phys_addr = (unsigned long)dev_priv->stolen_base + 124 gtt->offset; 125 126 page_num = vma_pages(vma); 127 address = vmf->address - (vmf->pgoff << PAGE_SHIFT); 128 129 vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); 130 131 for (i = 0; i < page_num; i++) { 132 pfn = (phys_addr >> PAGE_SHIFT); 133 | 122 unsigned long pfn; 123 unsigned long phys_addr = (unsigned long)dev_priv->stolen_base + 124 gtt->offset; 125 126 page_num = vma_pages(vma); 127 address = vmf->address - (vmf->pgoff << PAGE_SHIFT); 128 129 vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); 130 131 for (i = 0; i < page_num; i++) { 132 pfn = (phys_addr >> PAGE_SHIFT); 133 |
134 ret = vm_insert_mixed(vma, address, | 134 ret = vmf_insert_mixed(vma, address, |
135 __pfn_to_pfn_t(pfn, PFN_DEV)); | 135 __pfn_to_pfn_t(pfn, PFN_DEV)); |
136 if (unlikely((ret == -EBUSY) || (ret != 0 && i > 0))) | 136 if (unlikely(ret & VM_FAULT_ERROR)) |
137 break; | 137 break; |
138 else if (unlikely(ret != 0)) { 139 ret = (ret == -ENOMEM) ? VM_FAULT_OOM : VM_FAULT_SIGBUS; 140 return ret; 141 } | |
142 address += PAGE_SIZE; 143 phys_addr += PAGE_SIZE; 144 } | 138 address += PAGE_SIZE; 139 phys_addr += PAGE_SIZE; 140 } |
145 return VM_FAULT_NOPAGE; | 141 return ret; |
146} 147 148static void psbfb_vm_open(struct vm_area_struct *vma) 149{ 150} 151 152static void psbfb_vm_close(struct vm_area_struct *vma) 153{ --- 529 unchanged lines hidden --- | 142} 143 144static void psbfb_vm_open(struct vm_area_struct *vma) 145{ 146} 147 148static void psbfb_vm_close(struct vm_area_struct *vma) 149{ --- 529 unchanged lines hidden --- |