diff options
author | Magnus Damm <damm@igel.co.jp> | 2008-12-19 01:34:32 -0500 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2008-12-22 04:44:48 -0500 |
commit | 37b4837959cb9aa60686ca0d85f73d819251abad (patch) | |
tree | d3e12e54e21c6e2a7c62cc1a2f5a074fd09dac33 /drivers/video/fb_defio.c | |
parent | 6e1038a95bebb8a1ad6066c95aa9c3af6963c9ff (diff) |
video: deferred io with physically contiguous memory
Extend the deferred io code from only supporting vmalloc()ed frame
buffer memory to support both vmalloc()ed and physically contiguous
frame buffer memory.
The sh_mobile_lcdcfb hardware does not support scatter gather so
we need physically contiguous memory to back our frame buffer.
Signed-off-by: Magnus Damm <damm@igel.co.jp>
Acked-by: Jaya Kumar <jayakumar.lkml@gmail.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'drivers/video/fb_defio.c')
-rw-r--r-- | drivers/video/fb_defio.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/drivers/video/fb_defio.c b/drivers/video/fb_defio.c index 06060ccd3c23..082026546aee 100644 --- a/drivers/video/fb_defio.c +++ b/drivers/video/fb_defio.c | |||
@@ -24,6 +24,19 @@ | |||
24 | #include <linux/rmap.h> | 24 | #include <linux/rmap.h> |
25 | #include <linux/pagemap.h> | 25 | #include <linux/pagemap.h> |
26 | 26 | ||
27 | struct page *fb_deferred_io_page(struct fb_info *info, unsigned long offs) | ||
28 | { | ||
29 | void *screen_base = (void __force *) info->screen_base; | ||
30 | struct page *page; | ||
31 | |||
32 | if (is_vmalloc_addr(screen_base + offs)) | ||
33 | page = vmalloc_to_page(screen_base + offs); | ||
34 | else | ||
35 | page = pfn_to_page((info->fix.smem_start + offs) >> PAGE_SHIFT); | ||
36 | |||
37 | return page; | ||
38 | } | ||
39 | |||
27 | /* this is to find and return the vmalloc-ed fb pages */ | 40 | /* this is to find and return the vmalloc-ed fb pages */ |
28 | static int fb_deferred_io_fault(struct vm_area_struct *vma, | 41 | static int fb_deferred_io_fault(struct vm_area_struct *vma, |
29 | struct vm_fault *vmf) | 42 | struct vm_fault *vmf) |
@@ -31,14 +44,12 @@ static int fb_deferred_io_fault(struct vm_area_struct *vma, | |||
31 | unsigned long offset; | 44 | unsigned long offset; |
32 | struct page *page; | 45 | struct page *page; |
33 | struct fb_info *info = vma->vm_private_data; | 46 | struct fb_info *info = vma->vm_private_data; |
34 | /* info->screen_base is virtual memory */ | ||
35 | void *screen_base = (void __force *) info->screen_base; | ||
36 | 47 | ||
37 | offset = vmf->pgoff << PAGE_SHIFT; | 48 | offset = vmf->pgoff << PAGE_SHIFT; |
38 | if (offset >= info->fix.smem_len) | 49 | if (offset >= info->fix.smem_len) |
39 | return VM_FAULT_SIGBUS; | 50 | return VM_FAULT_SIGBUS; |
40 | 51 | ||
41 | page = vmalloc_to_page(screen_base + offset); | 52 | page = fb_deferred_io_page(info, offset); |
42 | if (!page) | 53 | if (!page) |
43 | return VM_FAULT_SIGBUS; | 54 | return VM_FAULT_SIGBUS; |
44 | 55 | ||
@@ -188,7 +199,6 @@ EXPORT_SYMBOL_GPL(fb_deferred_io_open); | |||
188 | 199 | ||
189 | void fb_deferred_io_cleanup(struct fb_info *info) | 200 | void fb_deferred_io_cleanup(struct fb_info *info) |
190 | { | 201 | { |
191 | void *screen_base = (void __force *) info->screen_base; | ||
192 | struct fb_deferred_io *fbdefio = info->fbdefio; | 202 | struct fb_deferred_io *fbdefio = info->fbdefio; |
193 | struct page *page; | 203 | struct page *page; |
194 | int i; | 204 | int i; |
@@ -199,7 +209,7 @@ void fb_deferred_io_cleanup(struct fb_info *info) | |||
199 | 209 | ||
200 | /* clear out the mapping that we setup */ | 210 | /* clear out the mapping that we setup */ |
201 | for (i = 0 ; i < info->fix.smem_len; i += PAGE_SIZE) { | 211 | for (i = 0 ; i < info->fix.smem_len; i += PAGE_SIZE) { |
202 | page = vmalloc_to_page(screen_base + i); | 212 | page = fb_deferred_io_page(info, i); |
203 | page->mapping = NULL; | 213 | page->mapping = NULL; |
204 | } | 214 | } |
205 | 215 | ||