~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/Documentation/fb/deferred_io.rst

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 ===========
  2 Deferred IO
  3 ===========
  4 
  5 Deferred IO is a way to delay and repurpose IO. It uses host memory as a
  6 buffer and the MMU pagefault as a pretrigger for when to perform the device
  7 IO. The following example may be a useful explanation of how one such setup
  8 works:
  9 
 10 - userspace app like Xfbdev mmaps framebuffer
 11 - deferred IO and driver sets up fault and page_mkwrite handlers
 12 - userspace app tries to write to mmapped vaddress
 13 - we get pagefault and reach fault handler
 14 - fault handler finds and returns physical page
 15 - we get page_mkwrite where we add this page to a list
 16 - schedule a workqueue task to be run after a delay
 17 - app continues writing to that page with no additional cost. this is
 18   the key benefit.
 19 - the workqueue task comes in and mkcleans the pages on the list, then
 20   completes the work associated with updating the framebuffer. this is
 21   the real work talking to the device.
 22 - app tries to write to the address (that has now been mkcleaned)
 23 - get pagefault and the above sequence occurs again
 24 
 25 As can be seen from above, one benefit is roughly to allow bursty framebuffer
 26 writes to occur at minimum cost. Then after some time when hopefully things
 27 have gone quiet, we go and really update the framebuffer which would be
 28 a relatively more expensive operation.
 29 
 30 For some types of nonvolatile high latency displays, the desired image is
 31 the final image rather than the intermediate stages which is why it's okay
 32 to not update for each write that is occurring.
 33 
 34 It may be the case that this is useful in other scenarios as well. Paul Mundt
 35 has mentioned a case where it is beneficial to use the page count to decide
 36 whether to coalesce and issue SG DMA or to do memory bursts.
 37 
 38 Another one may be if one has a device framebuffer that is in an usual format,
 39 say diagonally shifting RGB, this may then be a mechanism for you to allow
 40 apps to pretend to have a normal framebuffer but reswizzle for the device
 41 framebuffer at vsync time based on the touched pagelist.
 42 
 43 How to use it: (for applications)
 44 ---------------------------------
 45 No changes needed. mmap the framebuffer like normal and just use it.
 46 
 47 How to use it: (for fbdev drivers)
 48 ----------------------------------
 49 The following example may be helpful.
 50 
 51 1. Setup your structure. Eg::
 52 
 53         static struct fb_deferred_io hecubafb_defio = {
 54                 .delay          = HZ,
 55                 .deferred_io    = hecubafb_dpy_deferred_io,
 56         };
 57 
 58 The delay is the minimum delay between when the page_mkwrite trigger occurs
 59 and when the deferred_io callback is called. The deferred_io callback is
 60 explained below.
 61 
 62 2. Setup your deferred IO callback. Eg::
 63 
 64         static void hecubafb_dpy_deferred_io(struct fb_info *info,
 65                                              struct list_head *pagelist)
 66 
 67 The deferred_io callback is where you would perform all your IO to the display
 68 device. You receive the pagelist which is the list of pages that were written
 69 to during the delay. You must not modify this list. This callback is called
 70 from a workqueue.
 71 
 72 3. Call init::
 73 
 74         info->fbdefio = &hecubafb_defio;
 75         fb_deferred_io_init(info);
 76 
 77 4. Call cleanup::
 78 
 79         fb_deferred_io_cleanup(info);

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php