aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2010-11-16 00:00:24 -0500
committerPaul Mundt <lethal@linux-sh.org>2010-11-16 00:00:24 -0500
commit96f8d864afd646e4a52ea55462b7d83e3b94fd5c (patch)
tree72994dfd59b9774f6fa353fb01898f386486b759 /drivers
parente53beacd23d9cb47590da6a7a7f6d417b941a994 (diff)
fbdev: move udlfb out of staging.
udlfb has undergone a fair bit of cleanup recently and is effectively at the point where it can be liberated from staging purgatory and promoted to a real driver. The outstanding cleanups are all minor, with some of them dependent on drivers/video headers, so these will be done incrementally from udlfb's new home. Requested-by: Bernie Thompson <bernie@plugable.com> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/Kconfig2
-rw-r--r--drivers/staging/Makefile1
-rw-r--r--drivers/staging/udlfb/Kconfig14
-rw-r--r--drivers/staging/udlfb/Makefile1
-rw-r--r--drivers/staging/udlfb/udlfb.h117
-rw-r--r--drivers/staging/udlfb/udlfb.txt144
-rw-r--r--drivers/video/Kconfig14
-rw-r--r--drivers/video/Makefile1
-rw-r--r--drivers/video/udlfb.c (renamed from drivers/staging/udlfb/udlfb.c)3
9 files changed, 16 insertions, 281 deletions
diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig
index 5eafdf435550..df31a7228079 100644
--- a/drivers/staging/Kconfig
+++ b/drivers/staging/Kconfig
@@ -111,8 +111,6 @@ source "drivers/staging/vt6655/Kconfig"
111 111
112source "drivers/staging/vt6656/Kconfig" 112source "drivers/staging/vt6656/Kconfig"
113 113
114source "drivers/staging/udlfb/Kconfig"
115
116source "drivers/staging/hv/Kconfig" 114source "drivers/staging/hv/Kconfig"
117 115
118source "drivers/staging/vme/Kconfig" 116source "drivers/staging/vme/Kconfig"
diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile
index a97a955c094b..7a15c0c82b69 100644
--- a/drivers/staging/Makefile
+++ b/drivers/staging/Makefile
@@ -38,7 +38,6 @@ obj-$(CONFIG_USB_SERIAL_QUATECH_USB2) += quatech_usb2/
38obj-$(CONFIG_OCTEON_ETHERNET) += octeon/ 38obj-$(CONFIG_OCTEON_ETHERNET) += octeon/
39obj-$(CONFIG_VT6655) += vt6655/ 39obj-$(CONFIG_VT6655) += vt6655/
40obj-$(CONFIG_VT6656) += vt6656/ 40obj-$(CONFIG_VT6656) += vt6656/
41obj-$(CONFIG_FB_UDL) += udlfb/
42obj-$(CONFIG_HYPERV) += hv/ 41obj-$(CONFIG_HYPERV) += hv/
43obj-$(CONFIG_VME_BUS) += vme/ 42obj-$(CONFIG_VME_BUS) += vme/
44obj-$(CONFIG_MRST_RAR_HANDLER) += memrar/ 43obj-$(CONFIG_MRST_RAR_HANDLER) += memrar/
diff --git a/drivers/staging/udlfb/Kconfig b/drivers/staging/udlfb/Kconfig
deleted file mode 100644
index 65bd5db4ca56..000000000000
--- a/drivers/staging/udlfb/Kconfig
+++ /dev/null
@@ -1,14 +0,0 @@
1config FB_UDL
2 tristate "Displaylink USB Framebuffer support"
3 depends on FB && USB
4 select FB_MODE_HELPERS
5 select FB_SYS_FILLRECT
6 select FB_SYS_COPYAREA
7 select FB_SYS_IMAGEBLIT
8 select FB_SYS_FOPS
9 select FB_DEFERRED_IO
10 ---help---
11 This is a kernel framebuffer driver for DisplayLink USB devices.
12 Supports fbdev clients like xf86-video-fbdev, kdrive, fbi, and
13 mplayer -vo fbdev. Supports all USB 2.0 era DisplayLink devices.
14 To compile as a module, choose M here: the module name is udlfb.
diff --git a/drivers/staging/udlfb/Makefile b/drivers/staging/udlfb/Makefile
deleted file mode 100644
index 30d9e675b10f..000000000000
--- a/drivers/staging/udlfb/Makefile
+++ /dev/null
@@ -1 +0,0 @@
1obj-$(CONFIG_FB_UDL) += udlfb.o
diff --git a/drivers/staging/udlfb/udlfb.h b/drivers/staging/udlfb/udlfb.h
deleted file mode 100644
index 6f9785e9d62e..000000000000
--- a/drivers/staging/udlfb/udlfb.h
+++ /dev/null
@@ -1,117 +0,0 @@
1#ifndef UDLFB_H
2#define UDLFB_H
3
4/*
5 * TODO: Propose standard fb.h ioctl for reporting damage,
6 * using _IOWR() and one of the existing area structs from fb.h
7 * Consider these ioctls deprecated, but they're still used by the
8 * DisplayLink X server as yet - need both to be modified in tandem
9 * when new ioctl(s) are ready.
10 */
11#define DLFB_IOCTL_RETURN_EDID 0xAD
12#define DLFB_IOCTL_REPORT_DAMAGE 0xAA
13struct dloarea {
14 int x, y;
15 int w, h;
16 int x2, y2;
17};
18
19struct urb_node {
20 struct list_head entry;
21 struct dlfb_data *dev;
22 struct delayed_work release_urb_work;
23 struct urb *urb;
24};
25
26struct urb_list {
27 struct list_head list;
28 spinlock_t lock;
29 struct semaphore limit_sem;
30 int available;
31 int count;
32 size_t size;
33};
34
35struct dlfb_data {
36 struct usb_device *udev;
37 struct device *gdev; /* &udev->dev */
38 struct fb_info *info;
39 struct urb_list urbs;
40 struct kref kref;
41 char *backing_buffer;
42 int fb_count;
43 bool virtualized; /* true when physical usb device not present */
44 struct delayed_work free_framebuffer_work;
45 atomic_t usb_active; /* 0 = update virtual buffer, but no usb traffic */
46 atomic_t lost_pixels; /* 1 = a render op failed. Need screen refresh */
47 char *edid; /* null until we read edid from hw or get from sysfs */
48 size_t edid_size;
49 int sku_pixel_limit;
50 int base16;
51 int base8;
52 u32 pseudo_palette[256];
53 /* blit-only rendering path metrics, exposed through sysfs */
54 atomic_t bytes_rendered; /* raw pixel-bytes driver asked to render */
55 atomic_t bytes_identical; /* saved effort with backbuffer comparison */
56 atomic_t bytes_sent; /* to usb, after compression including overhead */
57 atomic_t cpu_kcycles_used; /* transpired during pixel processing */
58};
59
60#define NR_USB_REQUEST_I2C_SUB_IO 0x02
61#define NR_USB_REQUEST_CHANNEL 0x12
62
63/* -BULK_SIZE as per usb-skeleton. Can we get full page and avoid overhead? */
64#define BULK_SIZE 512
65#define MAX_TRANSFER (PAGE_SIZE*16 - BULK_SIZE)
66#define WRITES_IN_FLIGHT (4)
67
68#define MIN_EDID_SIZE 128
69#define MAX_EDID_SIZE 128
70
71#define MAX_VENDOR_DESCRIPTOR_SIZE 256
72
73#define GET_URB_TIMEOUT HZ
74#define FREE_URB_TIMEOUT (HZ*2)
75
76#define BPP 2
77#define MAX_CMD_PIXELS 255
78
79#define RLX_HEADER_BYTES 7
80#define MIN_RLX_PIX_BYTES 4
81#define MIN_RLX_CMD_BYTES (RLX_HEADER_BYTES + MIN_RLX_PIX_BYTES)
82
83#define RLE_HEADER_BYTES 6
84#define MIN_RLE_PIX_BYTES 3
85#define MIN_RLE_CMD_BYTES (RLE_HEADER_BYTES + MIN_RLE_PIX_BYTES)
86
87#define RAW_HEADER_BYTES 6
88#define MIN_RAW_PIX_BYTES 2
89#define MIN_RAW_CMD_BYTES (RAW_HEADER_BYTES + MIN_RAW_PIX_BYTES)
90
91#define DL_DEFIO_WRITE_DELAY 5 /* fb_deferred_io.delay in jiffies */
92#define DL_DEFIO_WRITE_DISABLE (HZ*60) /* "disable" with long delay */
93
94/* remove these once align.h patch is taken into kernel */
95#define DL_ALIGN_UP(x, a) ALIGN(x, a)
96#define DL_ALIGN_DOWN(x, a) ALIGN(x-(a-1), a)
97
98/* remove once this gets added to sysfs.h */
99#define __ATTR_RW(attr) __ATTR(attr, 0644, attr##_show, attr##_store)
100
101/*
102 * udlfb is both a usb device, and a framebuffer device.
103 * They may exist at the same time, but during various stages
104 * inactivity, teardown, or "virtual" operation, only one or the
105 * other will exist (one will outlive the other). So we can't
106 * call the dev_*() macros, because we don't have a stable dev object.
107 */
108#define dl_err(format, arg...) \
109 pr_err("udlfb: " format, ## arg)
110#define dl_warn(format, arg...) \
111 pr_warning("udlfb: " format, ## arg)
112#define dl_notice(format, arg...) \
113 pr_notice("udlfb: " format, ## arg)
114#define dl_info(format, arg...) \
115 pr_info("udlfb: " format, ## arg)
116
117#endif
diff --git a/drivers/staging/udlfb/udlfb.txt b/drivers/staging/udlfb/udlfb.txt
deleted file mode 100644
index 7fdde2a02a27..000000000000
--- a/drivers/staging/udlfb/udlfb.txt
+++ /dev/null
@@ -1,144 +0,0 @@
1
2What is udlfb?
3===============
4
5This is a driver for DisplayLink USB 2.0 era graphics chips.
6
7DisplayLink chips provide simple hline/blit operations with some compression,
8pairing that with a hardware framebuffer (16MB) on the other end of the
9USB wire. That hardware framebuffer is able to drive the VGA, DVI, or HDMI
10monitor with no CPU involvement until a pixel has to change.
11
12The CPU or other local resource does all the rendering; optinally compares the
13result with a local shadow of the remote hardware framebuffer to identify
14the minimal set of pixels that have changed; and compresses and sends those
15pixels line-by-line via USB bulk transfers.
16
17Because of the efficiency of bulk transfers and a protocol on top that
18does not require any acks - the effect is very low latency that
19can support surprisingly high resolutions with good performance for
20non-gaming and non-video applications.
21
22Mode setting, EDID read, etc are other bulk or control transfers. Mode
23setting is very flexible - able to set nearly arbitrary modes from any timing.
24
25Advantages of USB graphics in general:
26
27 * Ability to add a nearly arbitrary number of displays to any USB 2.0
28 capable system. On Linux, number of displays is limited by fbdev interface
29 (FB_MAX is currently 32). Of course, all USB devices on the same
30 host controller share the same 480Mbs USB 2.0 interface.
31
32Advantages of supporting DisplayLink chips with kernel framebuffer interface:
33
34 * The actual hardware functionality of DisplayLink chips matches nearly
35 one-to-one with the fbdev interface, making the driver quite small and
36 tight relative to the functionality it provides.
37 * X servers and other applications can use the standard fbdev interface
38 from user mode to talk to the device, without needing to know anything
39 about USB or DisplayLink's protocol at all. A "displaylink" X driver
40 and a slightly modified "fbdev" X driver are among those that already do.
41
42Disadvantages:
43
44 * Fbdev's mmap interface assumes a real hardware framebuffer is mapped.
45 In the case of USB graphics, it is just an allocated (virtual) buffer.
46 Writes need to be detected and encoded into USB bulk transfers by the CPU.
47 Accurate damage/changed area notifications work around this problem.
48 In the future, hopefully fbdev will be enhanced with an small standard
49 interface to allow mmap clients to report damage, for the benefit
50 of virtual or remote framebuffers.
51 * Fbdev does not arbitrate client ownership of the framebuffer well.
52 * Fbcon assumes the first framebuffer it finds should be consumed for console.
53 * It's not clear what the future of fbdev is, given the rise of KMS/DRM.
54
55How to use it?
56==============
57
58Udlfb, when loaded as a module, will match against all USB 2.0 generation
59DisplayLink chips (Alex and Ollie family). It will then attempt to read the EDID
60of the monitor, and set the best common mode between the DisplayLink device
61and the monitor's capabilities.
62
63If the DisplayLink device is successful, it will paint a "green screen" which
64means that from a hardware and fbdev software perspective, everything is good.
65
66At that point, a /dev/fb? interface will be present for user-mode applications
67to open and begin writing to the framebuffer of the DisplayLink device using
68standard fbdev calls. Note that if mmap() is used, by default the user mode
69application must send down damage notifcations to trigger repaints of the
70changed regions. Alternatively, udlfb can be recompiled with experimental
71defio support enabled, to support a page-fault based detection mechanism
72that can work without explicit notifcation.
73
74The most common client of udlfb is xf86-video-displaylink or a modified
75xf86-video-fbdev X server. These servers have no real DisplayLink specific
76code. They write to the standard framebuffer interface and rely on udlfb
77to do its thing. The one extra feature they have is the ability to report
78rectangles from the X DAMAGE protocol extension down to udlfb via udlfb's
79damage interface (which will hopefully be standardized for all virtual
80framebuffers that need damage info). These damage notifications allow
81udlfb to efficiently process the changed pixels.
82
83Module Options
84==============
85
86Special configuration for udlfb is usually unnecessary. There are a few
87options, however.
88
89From the command line, pass options to modprobe
90modprobe udlfb defio=1 console=1
91
92Or for permanent option, create file like /etc/modprobe.d/options with text
93options udlfb defio=1 console=1
94
95Accepted options:
96
97fb_defio Make use of the fb_defio (CONFIG_FB_DEFERRED_IO) kernel
98 module to track changed areas of the framebuffer by page faults.
99 Standard fbdev applications that use mmap but that do not
100 report damage, may be able to work with this enabled.
101 Disabled by default because of overhead and other issues.
102
103console Allow fbcon to attach to udlfb provided framebuffers. This
104 is disabled by default because fbcon will aggressively consume
105 the first framebuffer it finds, which isn't usually what the
106 user wants in the case of USB displays.
107
108Sysfs Attributes
109================
110
111Udlfb creates several files in /sys/class/graphics/fb?
112Where ? is the sequential framebuffer id of the particular DisplayLink device
113
114edid If a valid EDID blob is written to this file (typically
115 by a udev rule), then udlfb will use this EDID as a
116 backup in case reading the actual EDID of the monitor
117 attached to the DisplayLink device fails. This is
118 especially useful for fixed panels, etc. that cannot
119 communicate their capabilities via EDID. Reading
120 this file returns the current EDID of the attached
121 monitor (or last backup value written). This is
122 useful to get the EDID of the attached monitor,
123 which can be passed to utilities like parse-edid.
124
125metrics_bytes_rendered 32-bit count of pixel bytes rendered
126
127metrics_bytes_identical 32-bit count of how many of those bytes were found to be
128 unchanged, based on a shadow framebuffer check
129
130metrics_bytes_sent 32-bit count of how many bytes were transferred over
131 USB to communicate the resulting changed pixels to the
132 hardware. Includes compression and protocol overhead
133
134metrics_cpu_kcycles_used 32-bit count of CPU cycles used in processing the
135 above pixels (in thousands of cycles).
136
137metrics_reset Write-only. Any write to this file resets all metrics
138 above to zero. Note that the 32-bit counters above
139 roll over very quickly. To get reliable results, design
140 performance tests to start and finish in a very short
141 period of time (one minute or less is safe).
142
143--
144Bernie Thompson <bernie@plugable.com>
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 27c1fb4b1e0d..37771d0916ef 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -2034,6 +2034,20 @@ config FB_SM501
2034 2034
2035 If unsure, say N. 2035 If unsure, say N.
2036 2036
2037config FB_UDL
2038 tristate "Displaylink USB Framebuffer support"
2039 depends on FB && USB
2040 select FB_MODE_HELPERS
2041 select FB_SYS_FILLRECT
2042 select FB_SYS_COPYAREA
2043 select FB_SYS_IMAGEBLIT
2044 select FB_SYS_FOPS
2045 select FB_DEFERRED_IO
2046 ---help---
2047 This is a kernel framebuffer driver for DisplayLink USB devices.
2048 Supports fbdev clients like xf86-video-fbdev, kdrive, fbi, and
2049 mplayer -vo fbdev. Supports all USB 2.0 era DisplayLink devices.
2050 To compile as a module, choose M here: the module name is udlfb.
2037 2051
2038config FB_PNX4008_DUM 2052config FB_PNX4008_DUM
2039 tristate "Display Update Module support on Philips PNX4008 board" 2053 tristate "Display Update Module support on Philips PNX4008 board"
diff --git a/drivers/video/Makefile b/drivers/video/Makefile
index 485e8ed1318c..03678e3021ab 100644
--- a/drivers/video/Makefile
+++ b/drivers/video/Makefile
@@ -122,6 +122,7 @@ obj-$(CONFIG_FB_PNX4008_DUM_RGB) += pnx4008/
122obj-$(CONFIG_FB_IBM_GXT4500) += gxt4500.o 122obj-$(CONFIG_FB_IBM_GXT4500) += gxt4500.o
123obj-$(CONFIG_FB_PS3) += ps3fb.o 123obj-$(CONFIG_FB_PS3) += ps3fb.o
124obj-$(CONFIG_FB_SM501) += sm501fb.o 124obj-$(CONFIG_FB_SM501) += sm501fb.o
125obj-$(CONFIG_FB_UDL) += udlfb.o
125obj-$(CONFIG_FB_XILINX) += xilinxfb.o 126obj-$(CONFIG_FB_XILINX) += xilinxfb.o
126obj-$(CONFIG_SH_MIPI_DSI) += sh_mipi_dsi.o 127obj-$(CONFIG_SH_MIPI_DSI) += sh_mipi_dsi.o
127obj-$(CONFIG_FB_SH_MOBILE_HDMI) += sh_mobile_hdmi.o 128obj-$(CONFIG_FB_SH_MOBILE_HDMI) += sh_mobile_hdmi.o
diff --git a/drivers/staging/udlfb/udlfb.c b/drivers/video/udlfb.c
index fed25105970a..0cca4873d490 100644
--- a/drivers/staging/udlfb/udlfb.c
+++ b/drivers/video/udlfb.c
@@ -26,8 +26,7 @@
26#include <linux/vmalloc.h> 26#include <linux/vmalloc.h>
27#include <linux/slab.h> 27#include <linux/slab.h>
28#include <linux/delay.h> 28#include <linux/delay.h>
29 29#include <video/udlfb.h>
30#include "udlfb.h"
31 30
32static struct fb_fix_screeninfo dlfb_fix = { 31static struct fb_fix_screeninfo dlfb_fix = {
33 .id = "udlfb", 32 .id = "udlfb",