Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 83556
b: refs/heads/master
c: 529e55b
h: refs/heads/master
v: v3
  • Loading branch information
Nick Piggin authored and Linus Torvalds committed Feb 6, 2008
1 parent 7a80a2d commit 1c069e7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8c85fd89be565e7b7ff48d66b3544b320c129475
refs/heads/master: 529e55b6a57bda6df9e45eb268589efc70f63303
6 changes: 3 additions & 3 deletions trunk/Documentation/fb/deferred_io.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ IO. The following example may be a useful explanation of how one such setup
works:

- userspace app like Xfbdev mmaps framebuffer
- deferred IO and driver sets up nopage and page_mkwrite handlers
- deferred IO and driver sets up fault and page_mkwrite handlers
- userspace app tries to write to mmaped vaddress
- we get pagefault and reach nopage handler
- nopage handler finds and returns physical page
- we get pagefault and reach fault handler
- fault handler finds and returns physical page
- we get page_mkwrite where we add this page to a list
- schedule a workqueue task to be run after a delay
- app continues writing to that page with no additional cost. this is
Expand Down
17 changes: 8 additions & 9 deletions trunk/drivers/video/fb_defio.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,27 +25,26 @@
#include <linux/pagemap.h>

/* this is to find and return the vmalloc-ed fb pages */
static struct page* fb_deferred_io_nopage(struct vm_area_struct *vma,
unsigned long vaddr, int *type)
static int fb_deferred_io_fault(struct vm_area_struct *vma,
struct vm_fault *vmf)
{
unsigned long offset;
struct page *page;
struct fb_info *info = vma->vm_private_data;
/* info->screen_base is in System RAM */
void *screen_base = (void __force *) info->screen_base;

offset = (vaddr - vma->vm_start) + (vma->vm_pgoff << PAGE_SHIFT);
offset = vmf->pgoff << PAGE_SHIFT;
if (offset >= info->fix.smem_len)
return NOPAGE_SIGBUS;
return VM_FAULT_SIGBUS;

page = vmalloc_to_page(screen_base + offset);
if (!page)
return NOPAGE_OOM;
return VM_FAULT_SIGBUS;

get_page(page);
if (type)
*type = VM_FAULT_MINOR;
return page;
vmf->page = page;
return 0;
}

int fb_deferred_io_fsync(struct file *file, struct dentry *dentry, int datasync)
Expand Down Expand Up @@ -84,7 +83,7 @@ static int fb_deferred_io_mkwrite(struct vm_area_struct *vma,
}

static struct vm_operations_struct fb_deferred_io_vm_ops = {
.nopage = fb_deferred_io_nopage,
.fault = fb_deferred_io_fault,
.page_mkwrite = fb_deferred_io_mkwrite,
};

Expand Down

0 comments on commit 1c069e7

Please sign in to comment.