Commit d3189545ee69527e949769b89a4cbb331de97b4a
Committed by
Florian Tobias Schandinat
1 parent
def7660868
Exists in
master
and in
6 other branches
udlfb: Add module option to do without shadow framebuffer
By default, udlfb allocates a 2nd buffer to shadow what's across the bus on the USB device. It can operate without this shadow, but then it cannot tell which pixels have changed, and must send all. Saves host memory, but worsens the USB 2.0 bus bottleneck. This option allows users in very low memory situations (e.g. bifferboard) to optionally turn off this shadow framebuffer. Signed-off-by: Stuart Hopkins <stuart@linux-depot.com> Signed-off-by: Bernie Thompson <bernie@plugable.com> Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Showing 2 changed files with 13 additions and 2 deletions Side-by-side Diff
Documentation/fb/udlfb.txt
... | ... | @@ -105,6 +105,11 @@ |
105 | 105 | the first framebuffer it finds, which isn't usually what the |
106 | 106 | user wants in the case of USB displays. |
107 | 107 | |
108 | +shadow Allocate a 2nd framebuffer to shadow what's currently across | |
109 | + the USB bus in device memory. If any pixels are unchanged, | |
110 | + do not transmit. Spends host memory to save USB transfers. | |
111 | + Enabled by default. Only disable on very low memory systems. | |
112 | + | |
108 | 113 | Sysfs Attributes |
109 | 114 | ================ |
110 | 115 |
drivers/video/udlfb.c
... | ... | @@ -62,6 +62,7 @@ |
62 | 62 | /* module options */ |
63 | 63 | static int console; /* Optionally allow fbcon to consume first framebuffer */ |
64 | 64 | static int fb_defio; /* Optionally enable experimental fb_defio mmap support */ |
65 | +static int shadow = 1; /* Optionally disable shadow framebuffer */ | |
65 | 66 | |
66 | 67 | /* dlfb keeps a list of urbs for efficient bulk transfers */ |
67 | 68 | static void dlfb_urb_completion(struct urb *urb); |
... | ... | @@ -1148,7 +1149,7 @@ |
1148 | 1149 | int new_len; |
1149 | 1150 | unsigned char *old_fb = info->screen_base; |
1150 | 1151 | unsigned char *new_fb; |
1151 | - unsigned char *new_back; | |
1152 | + unsigned char *new_back = 0; | |
1152 | 1153 | |
1153 | 1154 | pr_warn("Reallocating framebuffer. Addresses will change!\n"); |
1154 | 1155 | |
... | ... | @@ -1180,7 +1181,8 @@ |
1180 | 1181 | * But with imperfect damage info we may send pixels over USB |
1181 | 1182 | * that were, in fact, unchanged - wasting limited USB bandwidth |
1182 | 1183 | */ |
1183 | - new_back = vzalloc(new_len); | |
1184 | + if (shadow) | |
1185 | + new_back = vzalloc(new_len); | |
1184 | 1186 | if (!new_back) |
1185 | 1187 | pr_info("No shadow/backing buffer allocated\n"); |
1186 | 1188 | else { |
... | ... | @@ -1593,6 +1595,7 @@ |
1593 | 1595 | usbdev->descriptor.bcdDevice, dev); |
1594 | 1596 | pr_info("console enable=%d\n", console); |
1595 | 1597 | pr_info("fb_defio enable=%d\n", fb_defio); |
1598 | + pr_info("shadow enable=%d\n", shadow); | |
1596 | 1599 | |
1597 | 1600 | dev->sku_pixel_limit = 2048 * 1152; /* default to maximum */ |
1598 | 1601 | |
... | ... | @@ -1949,6 +1952,9 @@ |
1949 | 1952 | |
1950 | 1953 | module_param(fb_defio, bool, S_IWUSR | S_IRUSR | S_IWGRP | S_IRGRP); |
1951 | 1954 | MODULE_PARM_DESC(fb_defio, "Enable fb_defio mmap support. *Experimental*"); |
1955 | + | |
1956 | +module_param(shadow, bool, S_IWUSR | S_IRUSR | S_IWGRP | S_IRGRP); | |
1957 | +MODULE_PARM_DESC(shadow, "Shadow vid mem. Disable to save mem but lose perf"); | |
1952 | 1958 | |
1953 | 1959 | MODULE_AUTHOR("Roberto De Ioris <roberto@unbit.it>, " |
1954 | 1960 | "Jaya Kumar <jayakumar.lkml@gmail.com>, " |