Blame view

Documentation/fb/udlfb.rst 7.35 KB
ab42b8189   Mauro Carvalho Chehab   docs: fb: convert...
1
  ==============
df9be302a   Bernie Thompson   staging: udlfb: A...
2
  What is udlfb?
ab42b8189   Mauro Carvalho Chehab   docs: fb: convert...
3
  ==============
df9be302a   Bernie Thompson   staging: udlfb: A...
4
5
6
7
8
9
10
  
  This is a driver for DisplayLink USB 2.0 era graphics chips.
  
  DisplayLink chips provide simple hline/blit operations with some compression,
  pairing that with a hardware framebuffer (16MB) on the other end of the
  USB wire.  That hardware framebuffer is able to drive the VGA, DVI, or HDMI
  monitor with no CPU involvement until a pixel has to change.
ad6a2d0f8   Eric Engestrom   Documentation: fb...
11
  The CPU or other local resource does all the rendering; optionally compares the
df9be302a   Bernie Thompson   staging: udlfb: A...
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
  result with a local shadow of the remote hardware framebuffer to identify
  the minimal set of pixels that have changed; and compresses and sends those
  pixels line-by-line via USB bulk transfers.
  
  Because of the efficiency of bulk transfers and a protocol on top that
  does not require any acks - the effect is very low latency that
  can support surprisingly high resolutions with good performance for
  non-gaming and non-video applications.
  
  Mode setting, EDID read, etc are other bulk or control transfers. Mode
  setting is very flexible - able to set nearly arbitrary modes from any timing.
  
  Advantages of USB graphics in general:
  
   * Ability to add a nearly arbitrary number of displays to any USB 2.0
     capable system. On Linux, number of displays is limited by fbdev interface
     (FB_MAX is currently 32). Of course, all USB devices on the same
     host controller share the same 480Mbs USB 2.0 interface.
  
  Advantages of supporting DisplayLink chips with kernel framebuffer interface:
  
   * The actual hardware functionality of DisplayLink chips matches nearly
     one-to-one with the fbdev interface, making the driver quite small and
     tight relative to the functionality it provides.
   * X servers and other applications can use the standard fbdev interface
     from user mode to talk to the device, without needing to know anything
     about USB or DisplayLink's protocol at all. A "displaylink" X driver
     and a slightly modified "fbdev" X driver are among those that already do.
  
  Disadvantages:
  
   * Fbdev's mmap interface assumes a real hardware framebuffer is mapped.
     In the case of USB graphics, it is just an allocated (virtual) buffer.
     Writes need to be detected and encoded into USB bulk transfers by the CPU.
     Accurate damage/changed area notifications work around this problem.
     In the future, hopefully fbdev will be enhanced with an small standard
     interface to allow mmap clients to report damage, for the benefit
     of virtual or remote framebuffers.
   * Fbdev does not arbitrate client ownership of the framebuffer well.
   * Fbcon assumes the first framebuffer it finds should be consumed for console.
   * It's not clear what the future of fbdev is, given the rise of KMS/DRM.
  
  How to use it?
  ==============
  
  Udlfb, when loaded as a module, will match against all USB 2.0 generation
  DisplayLink chips (Alex and Ollie family). It will then attempt to read the EDID
  of the monitor, and set the best common mode between the DisplayLink device
  and the monitor's capabilities.
  
  If the DisplayLink device is successful, it will paint a "green screen" which
  means that from a hardware and fbdev software perspective, everything is good.
  
  At that point, a /dev/fb? interface will be present for user-mode applications
  to open and begin writing to the framebuffer of the DisplayLink device using
  standard fbdev calls.  Note that if mmap() is used, by default the user mode
ad6a2d0f8   Eric Engestrom   Documentation: fb...
68
  application must send down damage notifications to trigger repaints of the
df9be302a   Bernie Thompson   staging: udlfb: A...
69
70
  changed regions.  Alternatively, udlfb can be recompiled with experimental
  defio support enabled, to support a page-fault based detection mechanism
ad6a2d0f8   Eric Engestrom   Documentation: fb...
71
  that can work without explicit notification.
df9be302a   Bernie Thompson   staging: udlfb: A...
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
  
  The most common client of udlfb is xf86-video-displaylink or a modified
  xf86-video-fbdev X server. These servers have no real DisplayLink specific
  code. They write to the standard framebuffer interface and rely on udlfb
  to do its thing.  The one extra feature they have is the ability to report
  rectangles from the X DAMAGE protocol extension down to udlfb via udlfb's
  damage interface (which will hopefully be standardized for all virtual
  framebuffers that need damage info). These damage notifications allow
  udlfb to efficiently process the changed pixels.
  
  Module Options
  ==============
  
  Special configuration for udlfb is usually unnecessary. There are a few
  options, however.
  
  From the command line, pass options to modprobe
9f811b72c   Bernie Thompson   udlfb: Enable fb_...
89
  modprobe udlfb fb_defio=0 console=1 shadow=1
df9be302a   Bernie Thompson   staging: udlfb: A...
90

9f811b72c   Bernie Thompson   udlfb: Enable fb_...
91
92
93
  Or modify options on the fly at /sys/module/udlfb/parameters directory via
  sudo nano fb_defio
  change the parameter in place, and save the file.
df9be302a   Bernie Thompson   staging: udlfb: A...
94

9f811b72c   Bernie Thompson   udlfb: Enable fb_...
95
96
97
98
99
100
  Unplug/replug USB device to apply with new settings
  
  Or for permanent option, create file like /etc/modprobe.d/udlfb.conf with text
  options udlfb fb_defio=0 console=1 shadow=1
  
  Accepted boolean options:
df9be302a   Bernie Thompson   staging: udlfb: A...
101

ab42b8189   Mauro Carvalho Chehab   docs: fb: convert...
102
  =============== ================================================================
df9be302a   Bernie Thompson   staging: udlfb: A...
103
104
  fb_defio	Make use of the fb_defio (CONFIG_FB_DEFERRED_IO) kernel
  		module to track changed areas of the framebuffer by page faults.
9f811b72c   Bernie Thompson   udlfb: Enable fb_...
105
106
107
108
109
  		Standard fbdev applications that use mmap but that do not
  		report damage, should be able to work with this enabled.
  		Disable when running with X server that supports reporting
  		changed regions via ioctl, as this method is simpler,
  		more stable, and higher performance.
4aa7faffe   Bernie Thompson   udlfb: Enable fbc...
110
  		default: fb_defio=1
df9be302a   Bernie Thompson   staging: udlfb: A...
111

ab42b8189   Mauro Carvalho Chehab   docs: fb: convert...
112
  console		Allow fbcon to attach to udlfb provided framebuffers.
4aa7faffe   Bernie Thompson   udlfb: Enable fbc...
113
114
115
  		Can be disabled if fbcon and other clients
  		(e.g. X with --shared-vt) are in conflict.
  		default: console=1
df9be302a   Bernie Thompson   staging: udlfb: A...
116

d3189545e   Stuart Hopkins   udlfb: Add module...
117
118
119
120
  shadow		Allocate a 2nd framebuffer to shadow what's currently across
  		the USB bus in device memory. If any pixels are unchanged,
  		do not transmit. Spends host memory to save USB transfers.
  		Enabled by default. Only disable on very low memory systems.
4aa7faffe   Bernie Thompson   udlfb: Enable fbc...
121
  		default: shadow=1
ab42b8189   Mauro Carvalho Chehab   docs: fb: convert...
122
  =============== ================================================================
d3189545e   Stuart Hopkins   udlfb: Add module...
123

df9be302a   Bernie Thompson   staging: udlfb: A...
124
125
126
127
128
  Sysfs Attributes
  ================
  
  Udlfb creates several files in /sys/class/graphics/fb?
  Where ? is the sequential framebuffer id of the particular DisplayLink device
ab42b8189   Mauro Carvalho Chehab   docs: fb: convert...
129
130
131
132
133
134
135
136
137
138
139
  ======================== ========================================================
  edid			 If a valid EDID blob is written to this file (typically
  			 by a udev rule), then udlfb will use this EDID as a
  			 backup in case reading the actual EDID of the monitor
  			 attached to the DisplayLink device fails. This is
  			 especially useful for fixed panels, etc. that cannot
  			 communicate their capabilities via EDID. Reading
  			 this file returns the current EDID of the attached
  			 monitor (or last backup value written). This is
  			 useful to get the EDID of the attached monitor,
  			 which can be passed to utilities like parse-edid.
df9be302a   Bernie Thompson   staging: udlfb: A...
140

ab42b8189   Mauro Carvalho Chehab   docs: fb: convert...
141
  metrics_bytes_rendered	 32-bit count of pixel bytes rendered
df9be302a   Bernie Thompson   staging: udlfb: A...
142

ab42b8189   Mauro Carvalho Chehab   docs: fb: convert...
143
144
  metrics_bytes_identical  32-bit count of how many of those bytes were found to be
  			 unchanged, based on a shadow framebuffer check
df9be302a   Bernie Thompson   staging: udlfb: A...
145

ab42b8189   Mauro Carvalho Chehab   docs: fb: convert...
146
147
148
  metrics_bytes_sent	 32-bit count of how many bytes were transferred over
  			 USB to communicate the resulting changed pixels to the
  			 hardware. Includes compression and protocol overhead
df9be302a   Bernie Thompson   staging: udlfb: A...
149
150
  
  metrics_cpu_kcycles_used 32-bit count of CPU cycles used in processing the
ab42b8189   Mauro Carvalho Chehab   docs: fb: convert...
151
  			 above pixels (in thousands of cycles).
df9be302a   Bernie Thompson   staging: udlfb: A...
152

ab42b8189   Mauro Carvalho Chehab   docs: fb: convert...
153
154
155
156
157
158
  metrics_reset		 Write-only. Any write to this file resets all metrics
  			 above to zero.  Note that the 32-bit counters above
  			 roll over very quickly. To get reliable results, design
  			 performance tests to start and finish in a very short
  			 period of time (one minute or less is safe).
  ======================== ========================================================
df9be302a   Bernie Thompson   staging: udlfb: A...
159

df9be302a   Bernie Thompson   staging: udlfb: A...
160
  Bernie Thompson <bernie@plugable.com>