Contents of /trunk/kernel26-mcore/patches-2.6.36-r3/0150-2.6.36-fbcondecor-0.9.6.patch
Parent Directory | Revision Log
Revision 1231 -
(show annotations)
(download)
Fri Dec 10 22:38:07 2010 UTC (13 years, 9 months ago) by niro
File size: 62732 byte(s)
Fri Dec 10 22:38:07 2010 UTC (13 years, 9 months ago) by niro
File size: 62732 byte(s)
-2.6.36-mcore-r3: -using linux-2.6.36.2 -enabled ipv6 support
1 | diff --git a/Documentation/fb/00-INDEX b/Documentation/fb/00-INDEX |
2 | index a618fd9..6eb4dc4 100644 |
3 | --- a/Documentation/fb/00-INDEX |
4 | +++ b/Documentation/fb/00-INDEX |
5 | @@ -15,6 +15,8 @@ deferred_io.txt |
6 | - an introduction to deferred IO. |
7 | fbcon.txt |
8 | - intro to and usage guide for the framebuffer console (fbcon). |
9 | +fbcondecor.txt |
10 | + - info on the Framebuffer Console Decoration |
11 | framebuffer.txt |
12 | - introduction to frame buffer devices. |
13 | imacfb.txt |
14 | diff --git a/Documentation/fb/fbcondecor.txt b/Documentation/fb/fbcondecor.txt |
15 | new file mode 100644 |
16 | index 0000000..15889f3 |
17 | --- /dev/null |
18 | +++ b/Documentation/fb/fbcondecor.txt |
19 | @@ -0,0 +1,207 @@ |
20 | +What is it? |
21 | +----------- |
22 | + |
23 | +The framebuffer decorations are a kernel feature which allows displaying a |
24 | +background picture on selected consoles. |
25 | + |
26 | +What do I need to get it to work? |
27 | +--------------------------------- |
28 | + |
29 | +To get fbcondecor up-and-running you will have to: |
30 | + 1) get a copy of splashutils [1] or a similar program |
31 | + 2) get some fbcondecor themes |
32 | + 3) build the kernel helper program |
33 | + 4) build your kernel with the FB_CON_DECOR option enabled. |
34 | + |
35 | +To get fbcondecor operational right after fbcon initialization is finished, you |
36 | +will have to include a theme and the kernel helper into your initramfs image. |
37 | +Please refer to splashutils documentation for instructions on how to do that. |
38 | + |
39 | +[1] The splashutils package can be downloaded from: |
40 | + http://dev.gentoo.org/~spock/projects/splashutils/ |
41 | + |
42 | +The userspace helper |
43 | +-------------------- |
44 | + |
45 | +The userspace fbcondecor helper (by default: /sbin/fbcondecor_helper) is called by the |
46 | +kernel whenever an important event occurs and the kernel needs some kind of |
47 | +job to be carried out. Important events include console switches and video |
48 | +mode switches (the kernel requests background images and configuration |
49 | +parameters for the current console). The fbcondecor helper must be accessible at |
50 | +all times. If it's not, fbcondecor will be switched off automatically. |
51 | + |
52 | +It's possible to set path to the fbcondecor helper by writing it to |
53 | +/proc/sys/kernel/fbcondecor. |
54 | + |
55 | +***************************************************************************** |
56 | + |
57 | +The information below is mostly technical stuff. There's probably no need to |
58 | +read it unless you plan to develop a userspace helper. |
59 | + |
60 | +The fbcondecor protocol |
61 | +----------------------- |
62 | + |
63 | +The fbcondecor protocol defines a communication interface between the kernel and |
64 | +the userspace fbcondecor helper. |
65 | + |
66 | +The kernel side is responsible for: |
67 | + |
68 | + * rendering console text, using an image as a background (instead of a |
69 | + standard solid color fbcon uses), |
70 | + * accepting commands from the user via ioctls on the fbcondecor device, |
71 | + * calling the userspace helper to set things up as soon as the fb subsystem |
72 | + is initialized. |
73 | + |
74 | +The userspace helper is responsible for everything else, including parsing |
75 | +configuration files, decompressing the image files whenever the kernel needs |
76 | +it, and communicating with the kernel if necessary. |
77 | + |
78 | +The fbcondecor protocol specifies how communication is done in both ways: |
79 | +kernel->userspace and userspace->helper. |
80 | + |
81 | +Kernel -> Userspace |
82 | +------------------- |
83 | + |
84 | +The kernel communicates with the userspace helper by calling it and specifying |
85 | +the task to be done in a series of arguments. |
86 | + |
87 | +The arguments follow the pattern: |
88 | +<fbcondecor protocol version> <command> <parameters> |
89 | + |
90 | +All commands defined in fbcondecor protocol v2 have the following parameters: |
91 | + virtual console |
92 | + framebuffer number |
93 | + theme |
94 | + |
95 | +Fbcondecor protocol v1 specified an additional 'fbcondecor mode' after the |
96 | +framebuffer number. Fbcondecor protocol v1 is deprecated and should not be used. |
97 | + |
98 | +Fbcondecor protocol v2 specifies the following commands: |
99 | + |
100 | +getpic |
101 | +------ |
102 | + The kernel issues this command to request image data. It's up to the |
103 | + userspace helper to find a background image appropriate for the specified |
104 | + theme and the current resolution. The userspace helper should respond by |
105 | + issuing the FBIOCONDECOR_SETPIC ioctl. |
106 | + |
107 | +init |
108 | +---- |
109 | + The kernel issues this command after the fbcondecor device is created and |
110 | + the fbcondecor interface is initialized. Upon receiving 'init', the userspace |
111 | + helper should parse the kernel command line (/proc/cmdline) or otherwise |
112 | + decide whether fbcondecor is to be activated. |
113 | + |
114 | + To activate fbcondecor on the first console the helper should issue the |
115 | + FBIOCONDECOR_SETCFG, FBIOCONDECOR_SETPIC and FBIOCONDECOR_SETSTATE commands, |
116 | + in the above-mentioned order. |
117 | + |
118 | + When the userspace helper is called in an early phase of the boot process |
119 | + (right after the initialization of fbcon), no filesystems will be mounted. |
120 | + The helper program should mount sysfs and then create the appropriate |
121 | + framebuffer, fbcondecor and tty0 devices (if they don't already exist) to get |
122 | + current display settings and to be able to communicate with the kernel side. |
123 | + It should probably also mount the procfs to be able to parse the kernel |
124 | + command line parameters. |
125 | + |
126 | + Note that the console sem is not held when the kernel calls fbcondecor_helper |
127 | + with the 'init' command. The fbcondecor helper should perform all ioctls with |
128 | + origin set to FBCON_DECOR_IO_ORIG_USER. |
129 | + |
130 | +modechange |
131 | +---------- |
132 | + The kernel issues this command on a mode change. The helper's response should |
133 | + be similar to the response to the 'init' command. Note that this time the |
134 | + console sem is held and all ioctls must be performed with origin set to |
135 | + FBCON_DECOR_IO_ORIG_KERNEL. |
136 | + |
137 | + |
138 | +Userspace -> Kernel |
139 | +------------------- |
140 | + |
141 | +Userspace programs can communicate with fbcondecor via ioctls on the |
142 | +fbcondecor device. These ioctls are to be used by both the userspace helper |
143 | +(called only by the kernel) and userspace configuration tools (run by the users). |
144 | + |
145 | +The fbcondecor helper should set the origin field to FBCON_DECOR_IO_ORIG_KERNEL |
146 | +when doing the appropriate ioctls. All userspace configuration tools should |
147 | +use FBCON_DECOR_IO_ORIG_USER. Failure to set the appropriate value in the origin |
148 | +field when performing ioctls from the kernel helper will most likely result |
149 | +in a console deadlock. |
150 | + |
151 | +FBCON_DECOR_IO_ORIG_KERNEL instructs fbcondecor not to try to acquire the console |
152 | +semaphore. Not surprisingly, FBCON_DECOR_IO_ORIG_USER instructs it to acquire |
153 | +the console sem. |
154 | + |
155 | +The framebuffer console decoration provides the following ioctls (all defined in |
156 | +linux/fb.h): |
157 | + |
158 | +FBIOCONDECOR_SETPIC |
159 | +description: loads a background picture for a virtual console |
160 | +argument: struct fbcon_decor_iowrapper*; data: struct fb_image* |
161 | +notes: |
162 | +If called for consoles other than the current foreground one, the picture data |
163 | +will be ignored. |
164 | + |
165 | +If the current virtual console is running in a 8-bpp mode, the cmap substruct |
166 | +of fb_image has to be filled appropriately: start should be set to 16 (first |
167 | +16 colors are reserved for fbcon), len to a value <= 240 and red, green and |
168 | +blue should point to valid cmap data. The transp field is ingored. The fields |
169 | +dx, dy, bg_color, fg_color in fb_image are ignored as well. |
170 | + |
171 | +FBIOCONDECOR_SETCFG |
172 | +description: sets the fbcondecor config for a virtual console |
173 | +argument: struct fbcon_decor_iowrapper*; data: struct vc_decor* |
174 | +notes: The structure has to be filled with valid data. |
175 | + |
176 | +FBIOCONDECOR_GETCFG |
177 | +description: gets the fbcondecor config for a virtual console |
178 | +argument: struct fbcon_decor_iowrapper*; data: struct vc_decor* |
179 | + |
180 | +FBIOCONDECOR_SETSTATE |
181 | +description: sets the fbcondecor state for a virtual console |
182 | +argument: struct fbcon_decor_iowrapper*; data: unsigned int* |
183 | + values: 0 = disabled, 1 = enabled. |
184 | + |
185 | +FBIOCONDECOR_GETSTATE |
186 | +description: gets the fbcondecor state for a virtual console |
187 | +argument: struct fbcon_decor_iowrapper*; data: unsigned int* |
188 | + values: as in FBIOCONDECOR_SETSTATE |
189 | + |
190 | +Info on used structures: |
191 | + |
192 | +Definition of struct vc_decor can be found in linux/console_decor.h. It's |
193 | +heavily commented. Note that the 'theme' field should point to a string |
194 | +no longer than FBCON_DECOR_THEME_LEN. When FBIOCONDECOR_GETCFG call is |
195 | +performed, the theme field should point to a char buffer of length |
196 | +FBCON_DECOR_THEME_LEN. |
197 | + |
198 | +Definition of struct fbcon_decor_iowrapper can be found in linux/fb.h. |
199 | +The fields in this struct have the following meaning: |
200 | + |
201 | +vc: |
202 | +Virtual console number. |
203 | + |
204 | +origin: |
205 | +Specifies if the ioctl is performed as a response to a kernel request. The |
206 | +fbcondecor helper should set this field to FBCON_DECOR_IO_ORIG_KERNEL, userspace |
207 | +programs should set it to FBCON_DECOR_IO_ORIG_USER. This field is necessary to |
208 | +avoid console semaphore deadlocks. |
209 | + |
210 | +data: |
211 | +Pointer to a data structure appropriate for the performed ioctl. Type of |
212 | +the data struct is specified in the ioctls description. |
213 | + |
214 | +***************************************************************************** |
215 | + |
216 | +Credit |
217 | +------ |
218 | + |
219 | +Original 'bootsplash' project & implementation by: |
220 | + Volker Poplawski <volker@poplawski.de>, Stefan Reinauer <stepan@suse.de>, |
221 | + Steffen Winterfeldt <snwint@suse.de>, Michael Schroeder <mls@suse.de>, |
222 | + Ken Wimer <wimer@suse.de>. |
223 | + |
224 | +Fbcondecor, fbcondecor protocol design, current implementation & docs by: |
225 | + Michal Januszewski <spock@gentoo.org> |
226 | + |
227 | diff --git a/drivers/Makefile b/drivers/Makefile |
228 | index a2aea53..f0eee91 100644 |
229 | --- a/drivers/Makefile |
230 | +++ b/drivers/Makefile |
231 | @@ -9,6 +9,9 @@ obj-y += gpio/ |
232 | obj-$(CONFIG_PCI) += pci/ |
233 | obj-$(CONFIG_PARISC) += parisc/ |
234 | obj-$(CONFIG_RAPIDIO) += rapidio/ |
235 | +# char/ comes before serial/ etc so that the VT console is the boot-time |
236 | +# default. |
237 | +obj-y += char/ |
238 | obj-y += video/ |
239 | obj-y += idle/ |
240 | obj-$(CONFIG_ACPI) += acpi/ |
241 | @@ -24,10 +27,6 @@ obj-$(CONFIG_XEN) += xen/ |
242 | # regulators early, since some subsystems rely on them to initialize |
243 | obj-$(CONFIG_REGULATOR) += regulator/ |
244 | |
245 | -# char/ comes before serial/ etc so that the VT console is the boot-time |
246 | -# default. |
247 | -obj-y += char/ |
248 | - |
249 | # gpu/ comes after char for AGP vs DRM startup |
250 | obj-y += gpu/ |
251 | |
252 | diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig |
253 | index 8b31fdf..f7617b6 100644 |
254 | --- a/drivers/video/Kconfig |
255 | +++ b/drivers/video/Kconfig |
256 | @@ -1195,7 +1195,6 @@ config FB_MATROX |
257 | select FB_CFB_FILLRECT |
258 | select FB_CFB_COPYAREA |
259 | select FB_CFB_IMAGEBLIT |
260 | - select FB_TILEBLITTING |
261 | select FB_MACMODES if PPC_PMAC |
262 | ---help--- |
263 | Say Y here if you have a Matrox Millennium, Matrox Millennium II, |
264 | diff --git a/drivers/video/console/Kconfig b/drivers/video/console/Kconfig |
265 | index 5a35f22..c11cb36 100644 |
266 | --- a/drivers/video/console/Kconfig |
267 | +++ b/drivers/video/console/Kconfig |
268 | @@ -122,6 +122,19 @@ config FRAMEBUFFER_CONSOLE_ROTATION |
269 | such that other users of the framebuffer will remain normally |
270 | oriented. |
271 | |
272 | +config FB_CON_DECOR |
273 | + bool "Support for the Framebuffer Console Decorations" |
274 | + depends on FRAMEBUFFER_CONSOLE=y && !FB_TILEBLITTING |
275 | + default n |
276 | + ---help--- |
277 | + This option enables support for framebuffer console decorations which |
278 | + makes it possible to display images in the background of the system |
279 | + consoles. Note that userspace utilities are necessary in order to take |
280 | + advantage of these features. Refer to Documentation/fb/fbcondecor.txt |
281 | + for more information. |
282 | + |
283 | + If unsure, say N. |
284 | + |
285 | config STI_CONSOLE |
286 | bool "STI text console" |
287 | depends on PARISC |
288 | diff --git a/drivers/video/console/Makefile b/drivers/video/console/Makefile |
289 | index a862e91..86bfcff 100644 |
290 | --- a/drivers/video/console/Makefile |
291 | +++ b/drivers/video/console/Makefile |
292 | @@ -34,6 +34,7 @@ obj-$(CONFIG_FRAMEBUFFER_CONSOLE) += fbcon_rotate.o fbcon_cw.o fbcon_ud.o \ |
293 | fbcon_ccw.o |
294 | endif |
295 | |
296 | +obj-$(CONFIG_FB_CON_DECOR) += fbcondecor.o cfbcondecor.o |
297 | obj-$(CONFIG_FB_STI) += sticore.o font.o |
298 | |
299 | ifeq ($(CONFIG_USB_SISUSBVGA_CON),y) |
300 | diff --git a/drivers/video/console/bitblit.c b/drivers/video/console/bitblit.c |
301 | index 28b1a83..33712c0 100644 |
302 | --- a/drivers/video/console/bitblit.c |
303 | +++ b/drivers/video/console/bitblit.c |
304 | @@ -18,6 +18,7 @@ |
305 | #include <linux/console.h> |
306 | #include <asm/types.h> |
307 | #include "fbcon.h" |
308 | +#include "fbcondecor.h" |
309 | |
310 | /* |
311 | * Accelerated handlers. |
312 | @@ -55,6 +56,13 @@ static void bit_bmove(struct vc_data *vc, struct fb_info *info, int sy, |
313 | area.height = height * vc->vc_font.height; |
314 | area.width = width * vc->vc_font.width; |
315 | |
316 | + if (fbcon_decor_active(info, vc)) { |
317 | + area.sx += vc->vc_decor.tx; |
318 | + area.sy += vc->vc_decor.ty; |
319 | + area.dx += vc->vc_decor.tx; |
320 | + area.dy += vc->vc_decor.ty; |
321 | + } |
322 | + |
323 | info->fbops->fb_copyarea(info, &area); |
324 | } |
325 | |
326 | @@ -380,11 +388,15 @@ static void bit_cursor(struct vc_data *vc, struct fb_info *info, int mode, |
327 | cursor.image.depth = 1; |
328 | cursor.rop = ROP_XOR; |
329 | |
330 | - if (info->fbops->fb_cursor) |
331 | - err = info->fbops->fb_cursor(info, &cursor); |
332 | + if (fbcon_decor_active(info, vc)) { |
333 | + fbcon_decor_cursor(info, &cursor); |
334 | + } else { |
335 | + if (info->fbops->fb_cursor) |
336 | + err = info->fbops->fb_cursor(info, &cursor); |
337 | |
338 | - if (err) |
339 | - soft_cursor(info, &cursor); |
340 | + if (err) |
341 | + soft_cursor(info, &cursor); |
342 | + } |
343 | |
344 | ops->cursor_reset = 0; |
345 | } |
346 | diff --git a/drivers/video/console/cfbcondecor.c b/drivers/video/console/cfbcondecor.c |
347 | new file mode 100644 |
348 | index 0000000..18a5452 |
349 | --- /dev/null |
350 | +++ b/drivers/video/console/cfbcondecor.c |
351 | @@ -0,0 +1,472 @@ |
352 | +/* |
353 | + * linux/drivers/video/cfbcon_decor.c -- Framebuffer decor render functions |
354 | + * |
355 | + * Copyright (C) 2004 Michal Januszewski <spock@gentoo.org> |
356 | + * |
357 | + * Code based upon "Bootdecor" (C) 2001-2003 |
358 | + * Volker Poplawski <volker@poplawski.de>, |
359 | + * Stefan Reinauer <stepan@suse.de>, |
360 | + * Steffen Winterfeldt <snwint@suse.de>, |
361 | + * Michael Schroeder <mls@suse.de>, |
362 | + * Ken Wimer <wimer@suse.de>. |
363 | + * |
364 | + * This file is subject to the terms and conditions of the GNU General Public |
365 | + * License. See the file COPYING in the main directory of this archive for |
366 | + * more details. |
367 | + */ |
368 | +#include <linux/module.h> |
369 | +#include <linux/types.h> |
370 | +#include <linux/fb.h> |
371 | +#include <linux/selection.h> |
372 | +#include <linux/slab.h> |
373 | +#include <linux/vt_kern.h> |
374 | +#include <asm/irq.h> |
375 | +#include <asm/system.h> |
376 | + |
377 | +#include "fbcon.h" |
378 | +#include "fbcondecor.h" |
379 | + |
380 | +#define parse_pixel(shift,bpp,type) \ |
381 | + do { \ |
382 | + if (d & (0x80 >> (shift))) \ |
383 | + dd2[(shift)] = fgx; \ |
384 | + else \ |
385 | + dd2[(shift)] = transparent ? *(type *)decor_src : bgx; \ |
386 | + decor_src += (bpp); \ |
387 | + } while (0) \ |
388 | + |
389 | +extern int get_color(struct vc_data *vc, struct fb_info *info, |
390 | + u16 c, int is_fg); |
391 | + |
392 | +void fbcon_decor_fix_pseudo_pal(struct fb_info *info, struct vc_data *vc) |
393 | +{ |
394 | + int i, j, k; |
395 | + int minlen = min(min(info->var.red.length, info->var.green.length), |
396 | + info->var.blue.length); |
397 | + u32 col; |
398 | + |
399 | + for (j = i = 0; i < 16; i++) { |
400 | + k = color_table[i]; |
401 | + |
402 | + col = ((vc->vc_palette[j++] >> (8-minlen)) |
403 | + << info->var.red.offset); |
404 | + col |= ((vc->vc_palette[j++] >> (8-minlen)) |
405 | + << info->var.green.offset); |
406 | + col |= ((vc->vc_palette[j++] >> (8-minlen)) |
407 | + << info->var.blue.offset); |
408 | + ((u32 *)info->pseudo_palette)[k] = col; |
409 | + } |
410 | +} |
411 | + |
412 | +void fbcon_decor_renderc(struct fb_info *info, int ypos, int xpos, int height, |
413 | + int width, u8* src, u32 fgx, u32 bgx, u8 transparent) |
414 | +{ |
415 | + unsigned int x, y; |
416 | + u32 dd; |
417 | + int bytespp = ((info->var.bits_per_pixel + 7) >> 3); |
418 | + unsigned int d = ypos * info->fix.line_length + xpos * bytespp; |
419 | + unsigned int ds = (ypos * info->var.xres + xpos) * bytespp; |
420 | + u16 dd2[4]; |
421 | + |
422 | + u8* decor_src = (u8 *)(info->bgdecor.data + ds); |
423 | + u8* dst = (u8 *)(info->screen_base + d); |
424 | + |
425 | + if ((ypos + height) > info->var.yres || (xpos + width) > info->var.xres) |
426 | + return; |
427 | + |
428 | + for (y = 0; y < height; y++) { |
429 | + switch (info->var.bits_per_pixel) { |
430 | + |
431 | + case 32: |
432 | + for (x = 0; x < width; x++) { |
433 | + |
434 | + if ((x & 7) == 0) |
435 | + d = *src++; |
436 | + if (d & 0x80) |
437 | + dd = fgx; |
438 | + else |
439 | + dd = transparent ? |
440 | + *(u32 *)decor_src : bgx; |
441 | + |
442 | + d <<= 1; |
443 | + decor_src += 4; |
444 | + fb_writel(dd, dst); |
445 | + dst += 4; |
446 | + } |
447 | + break; |
448 | + case 24: |
449 | + for (x = 0; x < width; x++) { |
450 | + |
451 | + if ((x & 7) == 0) |
452 | + d = *src++; |
453 | + if (d & 0x80) |
454 | + dd = fgx; |
455 | + else |
456 | + dd = transparent ? |
457 | + (*(u32 *)decor_src & 0xffffff) : bgx; |
458 | + |
459 | + d <<= 1; |
460 | + decor_src += 3; |
461 | +#ifdef __LITTLE_ENDIAN |
462 | + fb_writew(dd & 0xffff, dst); |
463 | + dst += 2; |
464 | + fb_writeb((dd >> 16), dst); |
465 | +#else |
466 | + fb_writew(dd >> 8, dst); |
467 | + dst += 2; |
468 | + fb_writeb(dd & 0xff, dst); |
469 | +#endif |
470 | + dst++; |
471 | + } |
472 | + break; |
473 | + case 16: |
474 | + for (x = 0; x < width; x += 2) { |
475 | + if ((x & 7) == 0) |
476 | + d = *src++; |
477 | + |
478 | + parse_pixel(0, 2, u16); |
479 | + parse_pixel(1, 2, u16); |
480 | +#ifdef __LITTLE_ENDIAN |
481 | + dd = dd2[0] | (dd2[1] << 16); |
482 | +#else |
483 | + dd = dd2[1] | (dd2[0] << 16); |
484 | +#endif |
485 | + d <<= 2; |
486 | + fb_writel(dd, dst); |
487 | + dst += 4; |
488 | + } |
489 | + break; |
490 | + |
491 | + case 8: |
492 | + for (x = 0; x < width; x += 4) { |
493 | + if ((x & 7) == 0) |
494 | + d = *src++; |
495 | + |
496 | + parse_pixel(0, 1, u8); |
497 | + parse_pixel(1, 1, u8); |
498 | + parse_pixel(2, 1, u8); |
499 | + parse_pixel(3, 1, u8); |
500 | + |
501 | +#ifdef __LITTLE_ENDIAN |
502 | + dd = dd2[0] | (dd2[1] << 8) | (dd2[2] << 16) | (dd2[3] << 24); |
503 | +#else |
504 | + dd = dd2[3] | (dd2[2] << 8) | (dd2[1] << 16) | (dd2[0] << 24); |
505 | +#endif |
506 | + d <<= 4; |
507 | + fb_writel(dd, dst); |
508 | + dst += 4; |
509 | + } |
510 | + } |
511 | + |
512 | + dst += info->fix.line_length - width * bytespp; |
513 | + decor_src += (info->var.xres - width) * bytespp; |
514 | + } |
515 | +} |
516 | + |
517 | +#define cc2cx(a) \ |
518 | + ((info->fix.visual == FB_VISUAL_TRUECOLOR || \ |
519 | + info->fix.visual == FB_VISUAL_DIRECTCOLOR) ? \ |
520 | + ((u32*)info->pseudo_palette)[a] : a) |
521 | + |
522 | +void fbcon_decor_putcs(struct vc_data *vc, struct fb_info *info, |
523 | + const unsigned short *s, int count, int yy, int xx) |
524 | +{ |
525 | + unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff; |
526 | + struct fbcon_ops *ops = info->fbcon_par; |
527 | + int fg_color, bg_color, transparent; |
528 | + u8 *src; |
529 | + u32 bgx, fgx; |
530 | + u16 c = scr_readw(s); |
531 | + |
532 | + fg_color = get_color(vc, info, c, 1); |
533 | + bg_color = get_color(vc, info, c, 0); |
534 | + |
535 | + /* Don't paint the background image if console is blanked */ |
536 | + transparent = ops->blank_state ? 0 : |
537 | + (vc->vc_decor.bg_color == bg_color); |
538 | + |
539 | + xx = xx * vc->vc_font.width + vc->vc_decor.tx; |
540 | + yy = yy * vc->vc_font.height + vc->vc_decor.ty; |
541 | + |
542 | + fgx = cc2cx(fg_color); |
543 | + bgx = cc2cx(bg_color); |
544 | + |
545 | + while (count--) { |
546 | + c = scr_readw(s++); |
547 | + src = vc->vc_font.data + (c & charmask) * vc->vc_font.height * |
548 | + ((vc->vc_font.width + 7) >> 3); |
549 | + |
550 | + fbcon_decor_renderc(info, yy, xx, vc->vc_font.height, |
551 | + vc->vc_font.width, src, fgx, bgx, transparent); |
552 | + xx += vc->vc_font.width; |
553 | + } |
554 | +} |
555 | + |
556 | +void fbcon_decor_cursor(struct fb_info *info, struct fb_cursor *cursor) |
557 | +{ |
558 | + int i; |
559 | + unsigned int dsize, s_pitch; |
560 | + struct fbcon_ops *ops = info->fbcon_par; |
561 | + struct vc_data* vc; |
562 | + u8 *src; |
563 | + |
564 | + /* we really don't need any cursors while the console is blanked */ |
565 | + if (info->state != FBINFO_STATE_RUNNING || ops->blank_state) |
566 | + return; |
567 | + |
568 | + vc = vc_cons[ops->currcon].d; |
569 | + |
570 | + src = kmalloc(64 + sizeof(struct fb_image), GFP_ATOMIC); |
571 | + if (!src) |
572 | + return; |
573 | + |
574 | + s_pitch = (cursor->image.width + 7) >> 3; |
575 | + dsize = s_pitch * cursor->image.height; |
576 | + if (cursor->enable) { |
577 | + switch (cursor->rop) { |
578 | + case ROP_XOR: |
579 | + for (i = 0; i < dsize; i++) |
580 | + src[i] = cursor->image.data[i] ^ cursor->mask[i]; |
581 | + break; |
582 | + case ROP_COPY: |
583 | + default: |
584 | + for (i = 0; i < dsize; i++) |
585 | + src[i] = cursor->image.data[i] & cursor->mask[i]; |
586 | + break; |
587 | + } |
588 | + } else |
589 | + memcpy(src, cursor->image.data, dsize); |
590 | + |
591 | + fbcon_decor_renderc(info, |
592 | + cursor->image.dy + vc->vc_decor.ty, |
593 | + cursor->image.dx + vc->vc_decor.tx, |
594 | + cursor->image.height, |
595 | + cursor->image.width, |
596 | + (u8*)src, |
597 | + cc2cx(cursor->image.fg_color), |
598 | + cc2cx(cursor->image.bg_color), |
599 | + cursor->image.bg_color == vc->vc_decor.bg_color); |
600 | + |
601 | + kfree(src); |
602 | +} |
603 | + |
604 | +static void decorset(u8 *dst, int height, int width, int dstbytes, |
605 | + u32 bgx, int bpp) |
606 | +{ |
607 | + int i; |
608 | + |
609 | + if (bpp == 8) |
610 | + bgx |= bgx << 8; |
611 | + if (bpp == 16 || bpp == 8) |
612 | + bgx |= bgx << 16; |
613 | + |
614 | + while (height-- > 0) { |
615 | + u8 *p = dst; |
616 | + |
617 | + switch (bpp) { |
618 | + |
619 | + case 32: |
620 | + for (i=0; i < width; i++) { |
621 | + fb_writel(bgx, p); p += 4; |
622 | + } |
623 | + break; |
624 | + case 24: |
625 | + for (i=0; i < width; i++) { |
626 | +#ifdef __LITTLE_ENDIAN |
627 | + fb_writew((bgx & 0xffff),(u16*)p); p += 2; |
628 | + fb_writeb((bgx >> 16),p++); |
629 | +#else |
630 | + fb_writew((bgx >> 8),(u16*)p); p += 2; |
631 | + fb_writeb((bgx & 0xff),p++); |
632 | +#endif |
633 | + } |
634 | + case 16: |
635 | + for (i=0; i < width/4; i++) { |
636 | + fb_writel(bgx,p); p += 4; |
637 | + fb_writel(bgx,p); p += 4; |
638 | + } |
639 | + if (width & 2) { |
640 | + fb_writel(bgx,p); p += 4; |
641 | + } |
642 | + if (width & 1) |
643 | + fb_writew(bgx,(u16*)p); |
644 | + break; |
645 | + case 8: |
646 | + for (i=0; i < width/4; i++) { |
647 | + fb_writel(bgx,p); p += 4; |
648 | + } |
649 | + |
650 | + if (width & 2) { |
651 | + fb_writew(bgx,p); p += 2; |
652 | + } |
653 | + if (width & 1) |
654 | + fb_writeb(bgx,(u8*)p); |
655 | + break; |
656 | + |
657 | + } |
658 | + dst += dstbytes; |
659 | + } |
660 | +} |
661 | + |
662 | +void fbcon_decor_copy(u8 *dst, u8 *src, int height, int width, int linebytes, |
663 | + int srclinebytes, int bpp) |
664 | +{ |
665 | + int i; |
666 | + |
667 | + while (height-- > 0) { |
668 | + u32 *p = (u32 *)dst; |
669 | + u32 *q = (u32 *)src; |
670 | + |
671 | + switch (bpp) { |
672 | + |
673 | + case 32: |
674 | + for (i=0; i < width; i++) |
675 | + fb_writel(*q++, p++); |
676 | + break; |
677 | + case 24: |
678 | + for (i=0; i < (width*3/4); i++) |
679 | + fb_writel(*q++, p++); |
680 | + if ((width*3) % 4) { |
681 | + if (width & 2) { |
682 | + fb_writeb(*(u8*)q, (u8*)p); |
683 | + } else if (width & 1) { |
684 | + fb_writew(*(u16*)q, (u16*)p); |
685 | + fb_writeb(*(u8*)((u16*)q+1),(u8*)((u16*)p+2)); |
686 | + } |
687 | + } |
688 | + break; |
689 | + case 16: |
690 | + for (i=0; i < width/4; i++) { |
691 | + fb_writel(*q++, p++); |
692 | + fb_writel(*q++, p++); |
693 | + } |
694 | + if (width & 2) |
695 | + fb_writel(*q++, p++); |
696 | + if (width & 1) |
697 | + fb_writew(*(u16*)q, (u16*)p); |
698 | + break; |
699 | + case 8: |
700 | + for (i=0; i < width/4; i++) |
701 | + fb_writel(*q++, p++); |
702 | + |
703 | + if (width & 2) { |
704 | + fb_writew(*(u16*)q, (u16*)p); |
705 | + q = (u32*) ((u16*)q + 1); |
706 | + p = (u32*) ((u16*)p + 1); |
707 | + } |
708 | + if (width & 1) |
709 | + fb_writeb(*(u8*)q, (u8*)p); |
710 | + break; |
711 | + } |
712 | + |
713 | + dst += linebytes; |
714 | + src += srclinebytes; |
715 | + } |
716 | +} |
717 | + |
718 | +static void decorfill(struct fb_info *info, int sy, int sx, int height, |
719 | + int width) |
720 | +{ |
721 | + int bytespp = ((info->var.bits_per_pixel + 7) >> 3); |
722 | + int d = sy * info->fix.line_length + sx * bytespp; |
723 | + int ds = (sy * info->var.xres + sx) * bytespp; |
724 | + |
725 | + fbcon_decor_copy((u8 *)(info->screen_base + d), (u8 *)(info->bgdecor.data + ds), |
726 | + height, width, info->fix.line_length, info->var.xres * bytespp, |
727 | + info->var.bits_per_pixel); |
728 | +} |
729 | + |
730 | +void fbcon_decor_clear(struct vc_data *vc, struct fb_info *info, int sy, int sx, |
731 | + int height, int width) |
732 | +{ |
733 | + int bgshift = (vc->vc_hi_font_mask) ? 13 : 12; |
734 | + struct fbcon_ops *ops = info->fbcon_par; |
735 | + u8 *dst; |
736 | + int transparent, bg_color = attr_bgcol_ec(bgshift, vc, info); |
737 | + |
738 | + transparent = (vc->vc_decor.bg_color == bg_color); |
739 | + sy = sy * vc->vc_font.height + vc->vc_decor.ty; |
740 | + sx = sx * vc->vc_font.width + vc->vc_decor.tx; |
741 | + height *= vc->vc_font.height; |
742 | + width *= vc->vc_font.width; |
743 | + |
744 | + /* Don't paint the background image if console is blanked */ |
745 | + if (transparent && !ops->blank_state) { |
746 | + decorfill(info, sy, sx, height, width); |
747 | + } else { |
748 | + dst = (u8 *)(info->screen_base + sy * info->fix.line_length + |
749 | + sx * ((info->var.bits_per_pixel + 7) >> 3)); |
750 | + decorset(dst, height, width, info->fix.line_length, cc2cx(bg_color), |
751 | + info->var.bits_per_pixel); |
752 | + } |
753 | +} |
754 | + |
755 | +void fbcon_decor_clear_margins(struct vc_data *vc, struct fb_info *info, |
756 | + int bottom_only) |
757 | +{ |
758 | + unsigned int tw = vc->vc_cols*vc->vc_font.width; |
759 | + unsigned int th = vc->vc_rows*vc->vc_font.height; |
760 | + |
761 | + if (!bottom_only) { |
762 | + /* top margin */ |
763 | + decorfill(info, 0, 0, vc->vc_decor.ty, info->var.xres); |
764 | + /* left margin */ |
765 | + decorfill(info, vc->vc_decor.ty, 0, th, vc->vc_decor.tx); |
766 | + /* right margin */ |
767 | + decorfill(info, vc->vc_decor.ty, vc->vc_decor.tx + tw, th, |
768 | + info->var.xres - vc->vc_decor.tx - tw); |
769 | + } |
770 | + decorfill(info, vc->vc_decor.ty + th, 0, |
771 | + info->var.yres - vc->vc_decor.ty - th, info->var.xres); |
772 | +} |
773 | + |
774 | +void fbcon_decor_bmove_redraw(struct vc_data *vc, struct fb_info *info, int y, |
775 | + int sx, int dx, int width) |
776 | +{ |
777 | + u16 *d = (u16 *) (vc->vc_origin + vc->vc_size_row * y + dx * 2); |
778 | + u16 *s = d + (dx - sx); |
779 | + u16 *start = d; |
780 | + u16 *ls = d; |
781 | + u16 *le = d + width; |
782 | + u16 c; |
783 | + int x = dx; |
784 | + u16 attr = 1; |
785 | + |
786 | + do { |
787 | + c = scr_readw(d); |
788 | + if (attr != (c & 0xff00)) { |
789 | + attr = c & 0xff00; |
790 | + if (d > start) { |
791 | + fbcon_decor_putcs(vc, info, start, d - start, y, x); |
792 | + x += d - start; |
793 | + start = d; |
794 | + } |
795 | + } |
796 | + if (s >= ls && s < le && c == scr_readw(s)) { |
797 | + if (d > start) { |
798 | + fbcon_decor_putcs(vc, info, start, d - start, y, x); |
799 | + x += d - start + 1; |
800 | + start = d + 1; |
801 | + } else { |
802 | + x++; |
803 | + start++; |
804 | + } |
805 | + } |
806 | + s++; |
807 | + d++; |
808 | + } while (d < le); |
809 | + if (d > start) |
810 | + fbcon_decor_putcs(vc, info, start, d - start, y, x); |
811 | +} |
812 | + |
813 | +void fbcon_decor_blank(struct vc_data *vc, struct fb_info *info, int blank) |
814 | +{ |
815 | + if (blank) { |
816 | + decorset((u8 *)info->screen_base, info->var.yres, info->var.xres, |
817 | + info->fix.line_length, 0, info->var.bits_per_pixel); |
818 | + } else { |
819 | + update_screen(vc); |
820 | + fbcon_decor_clear_margins(vc, info, 0); |
821 | + } |
822 | +} |
823 | + |
824 | diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c |
825 | index 7ccc967..6ebd128 100644 |
826 | --- a/drivers/video/console/fbcon.c |
827 | +++ b/drivers/video/console/fbcon.c |
828 | @@ -80,6 +80,7 @@ |
829 | #include <asm/system.h> |
830 | |
831 | #include "fbcon.h" |
832 | +#include "fbcondecor.h" |
833 | |
834 | #ifdef FBCONDEBUG |
835 | # define DPRINTK(fmt, args...) printk(KERN_DEBUG "%s: " fmt, __func__ , ## args) |
836 | @@ -95,7 +96,7 @@ enum { |
837 | |
838 | static struct display fb_display[MAX_NR_CONSOLES]; |
839 | |
840 | -static signed char con2fb_map[MAX_NR_CONSOLES]; |
841 | +signed char con2fb_map[MAX_NR_CONSOLES]; |
842 | static signed char con2fb_map_boot[MAX_NR_CONSOLES]; |
843 | |
844 | static int logo_lines; |
845 | @@ -287,7 +288,7 @@ static inline int fbcon_is_inactive(struct vc_data *vc, struct fb_info *info) |
846 | !vt_force_oops_output(vc); |
847 | } |
848 | |
849 | -static int get_color(struct vc_data *vc, struct fb_info *info, |
850 | +int get_color(struct vc_data *vc, struct fb_info *info, |
851 | u16 c, int is_fg) |
852 | { |
853 | int depth = fb_get_color_depth(&info->var, &info->fix); |
854 | @@ -392,6 +393,7 @@ static void fb_flashcursor(struct work_struct *work) |
855 | CM_ERASE : CM_DRAW; |
856 | ops->cursor(vc, info, mode, softback_lines, get_color(vc, info, c, 1), |
857 | get_color(vc, info, c, 0)); |
858 | + |
859 | release_console_sem(); |
860 | } |
861 | |
862 | @@ -528,6 +530,9 @@ static int search_for_mapped_con(void) |
863 | static int fbcon_takeover(int show_logo) |
864 | { |
865 | int err, i; |
866 | +#ifdef CONFIG_FB_CON_DECOR |
867 | + struct fb_info *info; |
868 | +#endif |
869 | |
870 | if (!num_registered_fb) |
871 | return -ENODEV; |
872 | @@ -548,6 +553,12 @@ static int fbcon_takeover(int show_logo) |
873 | info_idx = -1; |
874 | } else { |
875 | fbcon_has_console_bind = 1; |
876 | +#ifdef CONFIG_FB_CON_DECOR |
877 | + info = registered_fb[info_idx]; |
878 | + unlock_fb_info(info); |
879 | + fbcon_decor_init(); |
880 | + lock_fb_info(info); |
881 | +#endif |
882 | } |
883 | |
884 | return err; |
885 | @@ -1002,6 +1013,12 @@ static const char *fbcon_startup(void) |
886 | rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres); |
887 | cols /= vc->vc_font.width; |
888 | rows /= vc->vc_font.height; |
889 | + |
890 | + if (fbcon_decor_active(info, vc)) { |
891 | + cols = vc->vc_decor.twidth / vc->vc_font.width; |
892 | + rows = vc->vc_decor.theight / vc->vc_font.height; |
893 | + } |
894 | + |
895 | vc_resize(vc, cols, rows); |
896 | |
897 | DPRINTK("mode: %s\n", info->fix.id); |
898 | @@ -1031,7 +1048,7 @@ static void fbcon_init(struct vc_data *vc, int init) |
899 | cap = info->flags; |
900 | |
901 | if (vc != svc || logo_shown == FBCON_LOGO_DONTSHOW || |
902 | - (info->fix.type == FB_TYPE_TEXT)) |
903 | + (info->fix.type == FB_TYPE_TEXT) || fbcon_decor_active(info, vc)) |
904 | logo = 0; |
905 | |
906 | if (var_to_display(p, &info->var, info)) |
907 | @@ -1241,6 +1258,11 @@ static void fbcon_clear(struct vc_data *vc, int sy, int sx, int height, |
908 | if (sy < vc->vc_top && vc->vc_top == logo_lines) |
909 | vc->vc_top = 0; |
910 | |
911 | + if (fbcon_decor_active(info, vc)) { |
912 | + fbcon_decor_clear(vc, info, sy, sx, height, width); |
913 | + return; |
914 | + } |
915 | + |
916 | /* Split blits that cross physical y_wrap boundary */ |
917 | |
918 | y_break = p->vrows - p->yscroll; |
919 | @@ -1260,10 +1282,15 @@ static void fbcon_putcs(struct vc_data *vc, const unsigned short *s, |
920 | struct display *p = &fb_display[vc->vc_num]; |
921 | struct fbcon_ops *ops = info->fbcon_par; |
922 | |
923 | - if (!fbcon_is_inactive(vc, info)) |
924 | - ops->putcs(vc, info, s, count, real_y(p, ypos), xpos, |
925 | - get_color(vc, info, scr_readw(s), 1), |
926 | - get_color(vc, info, scr_readw(s), 0)); |
927 | + if (!fbcon_is_inactive(vc, info)) { |
928 | + |
929 | + if (fbcon_decor_active(info, vc)) |
930 | + fbcon_decor_putcs(vc, info, s, count, ypos, xpos); |
931 | + else |
932 | + ops->putcs(vc, info, s, count, real_y(p, ypos), xpos, |
933 | + get_color(vc, info, scr_readw(s), 1), |
934 | + get_color(vc, info, scr_readw(s), 0)); |
935 | + } |
936 | } |
937 | |
938 | static void fbcon_putc(struct vc_data *vc, int c, int ypos, int xpos) |
939 | @@ -1279,8 +1306,13 @@ static void fbcon_clear_margins(struct vc_data *vc, int bottom_only) |
940 | struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; |
941 | struct fbcon_ops *ops = info->fbcon_par; |
942 | |
943 | - if (!fbcon_is_inactive(vc, info)) |
944 | - ops->clear_margins(vc, info, bottom_only); |
945 | + if (!fbcon_is_inactive(vc, info)) { |
946 | + if (fbcon_decor_active(info, vc)) { |
947 | + fbcon_decor_clear_margins(vc, info, bottom_only); |
948 | + } else { |
949 | + ops->clear_margins(vc, info, bottom_only); |
950 | + } |
951 | + } |
952 | } |
953 | |
954 | static void fbcon_cursor(struct vc_data *vc, int mode) |
955 | @@ -1800,7 +1832,7 @@ static int fbcon_scroll(struct vc_data *vc, int t, int b, int dir, |
956 | count = vc->vc_rows; |
957 | if (softback_top) |
958 | fbcon_softback_note(vc, t, count); |
959 | - if (logo_shown >= 0) |
960 | + if (logo_shown >= 0 || fbcon_decor_active(info, vc)) |
961 | goto redraw_up; |
962 | switch (p->scrollmode) { |
963 | case SCROLL_MOVE: |
964 | @@ -1893,6 +1925,8 @@ static int fbcon_scroll(struct vc_data *vc, int t, int b, int dir, |
965 | count = vc->vc_rows; |
966 | if (logo_shown >= 0) |
967 | goto redraw_down; |
968 | + if (fbcon_decor_active(info, vc)) |
969 | + goto redraw_down; |
970 | switch (p->scrollmode) { |
971 | case SCROLL_MOVE: |
972 | fbcon_redraw_blit(vc, info, p, b - 1, b - t - count, |
973 | @@ -2041,6 +2075,13 @@ static void fbcon_bmove_rec(struct vc_data *vc, struct display *p, int sy, int s |
974 | } |
975 | return; |
976 | } |
977 | + |
978 | + if (fbcon_decor_active(info, vc) && sy == dy && height == 1) { |
979 | + /* must use slower redraw bmove to keep background pic intact */ |
980 | + fbcon_decor_bmove_redraw(vc, info, sy, sx, dx, width); |
981 | + return; |
982 | + } |
983 | + |
984 | ops->bmove(vc, info, real_y(p, sy), sx, real_y(p, dy), dx, |
985 | height, width); |
986 | } |
987 | @@ -2111,8 +2152,8 @@ static int fbcon_resize(struct vc_data *vc, unsigned int width, |
988 | var.yres = virt_h * virt_fh; |
989 | x_diff = info->var.xres - var.xres; |
990 | y_diff = info->var.yres - var.yres; |
991 | - if (x_diff < 0 || x_diff > virt_fw || |
992 | - y_diff < 0 || y_diff > virt_fh) { |
993 | + if ((x_diff < 0 || x_diff > virt_fw || |
994 | + y_diff < 0 || y_diff > virt_fh) && !vc->vc_decor.state) { |
995 | const struct fb_videomode *mode; |
996 | |
997 | DPRINTK("attempting resize %ix%i\n", var.xres, var.yres); |
998 | @@ -2148,6 +2189,21 @@ static int fbcon_switch(struct vc_data *vc) |
999 | |
1000 | info = registered_fb[con2fb_map[vc->vc_num]]; |
1001 | ops = info->fbcon_par; |
1002 | + prev_console = ops->currcon; |
1003 | + if (prev_console != -1) |
1004 | + old_info = registered_fb[con2fb_map[prev_console]]; |
1005 | + |
1006 | +#ifdef CONFIG_FB_CON_DECOR |
1007 | + if (!fbcon_decor_active_vc(vc) && info->fix.visual == FB_VISUAL_DIRECTCOLOR) { |
1008 | + struct vc_data *vc_curr = vc_cons[prev_console].d; |
1009 | + if (vc_curr && fbcon_decor_active_vc(vc_curr)) { |
1010 | + /* Clear the screen to avoid displaying funky colors during |
1011 | + * palette updates. */ |
1012 | + memset((u8*)info->screen_base + info->fix.line_length * info->var.yoffset, |
1013 | + 0, info->var.yres * info->fix.line_length); |
1014 | + } |
1015 | + } |
1016 | +#endif |
1017 | |
1018 | if (softback_top) { |
1019 | if (softback_lines) |
1020 | @@ -2166,9 +2222,6 @@ static int fbcon_switch(struct vc_data *vc) |
1021 | logo_shown = FBCON_LOGO_CANSHOW; |
1022 | } |
1023 | |
1024 | - prev_console = ops->currcon; |
1025 | - if (prev_console != -1) |
1026 | - old_info = registered_fb[con2fb_map[prev_console]]; |
1027 | /* |
1028 | * FIXME: If we have multiple fbdev's loaded, we need to |
1029 | * update all info->currcon. Perhaps, we can place this |
1030 | @@ -2212,6 +2265,18 @@ static int fbcon_switch(struct vc_data *vc) |
1031 | fbcon_del_cursor_timer(old_info); |
1032 | } |
1033 | |
1034 | + if (fbcon_decor_active_vc(vc)) { |
1035 | + struct vc_data *vc_curr = vc_cons[prev_console].d; |
1036 | + |
1037 | + if (!vc_curr->vc_decor.theme || |
1038 | + strcmp(vc->vc_decor.theme, vc_curr->vc_decor.theme) || |
1039 | + (fbcon_decor_active_nores(info, vc_curr) && |
1040 | + !fbcon_decor_active(info, vc_curr))) { |
1041 | + if (fbcon_decor_call_helper("modechange", vc->vc_num)) |
1042 | + fbcon_decor_disable(vc, 0); |
1043 | + } |
1044 | + } |
1045 | + |
1046 | if (fbcon_is_inactive(vc, info) || |
1047 | ops->blank_state != FB_BLANK_UNBLANK) |
1048 | fbcon_del_cursor_timer(info); |
1049 | @@ -2320,15 +2385,20 @@ static int fbcon_blank(struct vc_data *vc, int blank, int mode_switch) |
1050 | } |
1051 | } |
1052 | |
1053 | - if (!fbcon_is_inactive(vc, info)) { |
1054 | + if (!fbcon_is_inactive(vc, info)) { |
1055 | if (ops->blank_state != blank) { |
1056 | ops->blank_state = blank; |
1057 | fbcon_cursor(vc, blank ? CM_ERASE : CM_DRAW); |
1058 | ops->cursor_flash = (!blank); |
1059 | |
1060 | - if (!(info->flags & FBINFO_MISC_USEREVENT)) |
1061 | - if (fb_blank(info, blank)) |
1062 | - fbcon_generic_blank(vc, info, blank); |
1063 | + if (!(info->flags & FBINFO_MISC_USEREVENT)) { |
1064 | + if (fb_blank(info, blank)) { |
1065 | + if (fbcon_decor_active(info, vc)) |
1066 | + fbcon_decor_blank(vc, info, blank); |
1067 | + else |
1068 | + fbcon_generic_blank(vc, info, blank); |
1069 | + } |
1070 | + } |
1071 | } |
1072 | |
1073 | if (!blank) |
1074 | @@ -2503,13 +2573,22 @@ static int fbcon_do_set_font(struct vc_data *vc, int w, int h, |
1075 | } |
1076 | |
1077 | if (resize) { |
1078 | + /* reset wrap/pan */ |
1079 | int cols, rows; |
1080 | |
1081 | cols = FBCON_SWAP(ops->rotate, info->var.xres, info->var.yres); |
1082 | rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres); |
1083 | + |
1084 | + if (fbcon_decor_active(info, vc)) { |
1085 | + info->var.xoffset = info->var.yoffset = p->yscroll = 0; |
1086 | + cols = vc->vc_decor.twidth; |
1087 | + rows = vc->vc_decor.theight; |
1088 | + } |
1089 | cols /= w; |
1090 | rows /= h; |
1091 | + |
1092 | vc_resize(vc, cols, rows); |
1093 | + |
1094 | if (CON_IS_VISIBLE(vc) && softback_buf) |
1095 | fbcon_update_softback(vc); |
1096 | } else if (CON_IS_VISIBLE(vc) |
1097 | @@ -2638,7 +2717,11 @@ static int fbcon_set_palette(struct vc_data *vc, unsigned char *table) |
1098 | int i, j, k, depth; |
1099 | u8 val; |
1100 | |
1101 | - if (fbcon_is_inactive(vc, info)) |
1102 | + if (fbcon_is_inactive(vc, info) |
1103 | +#ifdef CONFIG_FB_CON_DECOR |
1104 | + || vc->vc_num != fg_console |
1105 | +#endif |
1106 | + ) |
1107 | return -EINVAL; |
1108 | |
1109 | if (!CON_IS_VISIBLE(vc)) |
1110 | @@ -2664,7 +2747,49 @@ static int fbcon_set_palette(struct vc_data *vc, unsigned char *table) |
1111 | } else |
1112 | fb_copy_cmap(fb_default_cmap(1 << depth), &palette_cmap); |
1113 | |
1114 | - return fb_set_cmap(&palette_cmap, info); |
1115 | + if (fbcon_decor_active(info, vc_cons[fg_console].d) && |
1116 | + info->fix.visual == FB_VISUAL_DIRECTCOLOR) { |
1117 | + |
1118 | + u16 *red, *green, *blue; |
1119 | + int minlen = min(min(info->var.red.length, info->var.green.length), |
1120 | + info->var.blue.length); |
1121 | + int h; |
1122 | + |
1123 | + struct fb_cmap cmap = { |
1124 | + .start = 0, |
1125 | + .len = (1 << minlen), |
1126 | + .red = NULL, |
1127 | + .green = NULL, |
1128 | + .blue = NULL, |
1129 | + .transp = NULL |
1130 | + }; |
1131 | + |
1132 | + red = kmalloc(256 * sizeof(u16) * 3, GFP_KERNEL); |
1133 | + |
1134 | + if (!red) |
1135 | + goto out; |
1136 | + |
1137 | + green = red + 256; |
1138 | + blue = green + 256; |
1139 | + cmap.red = red; |
1140 | + cmap.green = green; |
1141 | + cmap.blue = blue; |
1142 | + |
1143 | + for (i = 0; i < cmap.len; i++) { |
1144 | + red[i] = green[i] = blue[i] = (0xffff * i)/(cmap.len-1); |
1145 | + } |
1146 | + |
1147 | + h = fb_set_cmap(&cmap, info); |
1148 | + fbcon_decor_fix_pseudo_pal(info, vc_cons[fg_console].d); |
1149 | + kfree(red); |
1150 | + |
1151 | + return h; |
1152 | + |
1153 | + } else if (fbcon_decor_active(info, vc_cons[fg_console].d) && |
1154 | + info->var.bits_per_pixel == 8 && info->bgdecor.cmap.red != NULL) |
1155 | + fb_set_cmap(&info->bgdecor.cmap, info); |
1156 | + |
1157 | +out: return fb_set_cmap(&palette_cmap, info); |
1158 | } |
1159 | |
1160 | static u16 *fbcon_screen_pos(struct vc_data *vc, int offset) |
1161 | @@ -2872,7 +2997,7 @@ static void fbcon_modechanged(struct fb_info *info) |
1162 | struct fbcon_ops *ops = info->fbcon_par; |
1163 | struct vc_data *vc; |
1164 | struct display *p; |
1165 | - int rows, cols; |
1166 | + int rows, cols, res; |
1167 | |
1168 | if (!ops || ops->currcon < 0) |
1169 | return; |
1170 | @@ -2890,7 +3015,18 @@ static void fbcon_modechanged(struct fb_info *info) |
1171 | rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres); |
1172 | cols /= vc->vc_font.width; |
1173 | rows /= vc->vc_font.height; |
1174 | - vc_resize(vc, cols, rows); |
1175 | + |
1176 | + if (!fbcon_decor_active_nores(info, vc)) { |
1177 | + vc_resize(vc, cols, rows); |
1178 | + } else { |
1179 | + /* HACK: Do this properly at some point.. */ |
1180 | + unlock_fb_info(info); |
1181 | + res = fbcon_decor_call_helper("modechange", vc->vc_num); |
1182 | + lock_fb_info(info); |
1183 | + if (res) |
1184 | + fbcon_decor_disable(vc, 0); |
1185 | + } |
1186 | + |
1187 | updatescrollmode(p, info, vc); |
1188 | scrollback_max = 0; |
1189 | scrollback_current = 0; |
1190 | @@ -3545,6 +3681,7 @@ static void fbcon_exit(void) |
1191 | } |
1192 | } |
1193 | |
1194 | + fbcon_decor_exit(); |
1195 | fbcon_has_exited = 1; |
1196 | } |
1197 | |
1198 | diff --git a/drivers/video/console/fbcondecor.c b/drivers/video/console/fbcondecor.c |
1199 | new file mode 100644 |
1200 | index 0000000..dddb23b |
1201 | --- /dev/null |
1202 | +++ b/drivers/video/console/fbcondecor.c |
1203 | @@ -0,0 +1,560 @@ |
1204 | +/* |
1205 | + * linux/drivers/video/console/fbcondecor.c -- Framebuffer console decorations |
1206 | + * |
1207 | + * Copyright (C) 2004-2009 Michal Januszewski <spock@gentoo.org> |
1208 | + * |
1209 | + * Code based upon "Bootsplash" (C) 2001-2003 |
1210 | + * Volker Poplawski <volker@poplawski.de>, |
1211 | + * Stefan Reinauer <stepan@suse.de>, |
1212 | + * Steffen Winterfeldt <snwint@suse.de>, |
1213 | + * Michael Schroeder <mls@suse.de>, |
1214 | + * Ken Wimer <wimer@suse.de>. |
1215 | + * |
1216 | + * Compat ioctl support by Thorsten Klein <TK@Thorsten-Klein.de>. |
1217 | + * |
1218 | + * This file is subject to the terms and conditions of the GNU General Public |
1219 | + * License. See the file COPYING in the main directory of this archive for |
1220 | + * more details. |
1221 | + * |
1222 | + */ |
1223 | +#include <linux/module.h> |
1224 | +#include <linux/kernel.h> |
1225 | +#include <linux/string.h> |
1226 | +#include <linux/types.h> |
1227 | +#include <linux/fb.h> |
1228 | +#include <linux/vt_kern.h> |
1229 | +#include <linux/vmalloc.h> |
1230 | +#include <linux/unistd.h> |
1231 | +#include <linux/syscalls.h> |
1232 | +#include <linux/init.h> |
1233 | +#include <linux/proc_fs.h> |
1234 | +#include <linux/workqueue.h> |
1235 | +#include <linux/kmod.h> |
1236 | +#include <linux/miscdevice.h> |
1237 | +#include <linux/device.h> |
1238 | +#include <linux/fs.h> |
1239 | +#include <linux/compat.h> |
1240 | + |
1241 | +#include <asm/uaccess.h> |
1242 | +#include <asm/irq.h> |
1243 | +#include <asm/system.h> |
1244 | + |
1245 | +#include "fbcon.h" |
1246 | +#include "fbcondecor.h" |
1247 | + |
1248 | +extern signed char con2fb_map[]; |
1249 | +static int fbcon_decor_enable(struct vc_data *vc); |
1250 | +char fbcon_decor_path[KMOD_PATH_LEN] = "/sbin/fbcondecor_helper"; |
1251 | +static int initialized = 0; |
1252 | + |
1253 | +int fbcon_decor_call_helper(char* cmd, unsigned short vc) |
1254 | +{ |
1255 | + char *envp[] = { |
1256 | + "HOME=/", |
1257 | + "PATH=/sbin:/bin", |
1258 | + NULL |
1259 | + }; |
1260 | + |
1261 | + char tfb[5]; |
1262 | + char tcons[5]; |
1263 | + unsigned char fb = (int) con2fb_map[vc]; |
1264 | + |
1265 | + char *argv[] = { |
1266 | + fbcon_decor_path, |
1267 | + "2", |
1268 | + cmd, |
1269 | + tcons, |
1270 | + tfb, |
1271 | + vc_cons[vc].d->vc_decor.theme, |
1272 | + NULL |
1273 | + }; |
1274 | + |
1275 | + snprintf(tfb,5,"%d",fb); |
1276 | + snprintf(tcons,5,"%d",vc); |
1277 | + |
1278 | + return call_usermodehelper(fbcon_decor_path, argv, envp, 1); |
1279 | +} |
1280 | + |
1281 | +/* Disables fbcondecor on a virtual console; called with console sem held. */ |
1282 | +int fbcon_decor_disable(struct vc_data *vc, unsigned char redraw) |
1283 | +{ |
1284 | + struct fb_info* info; |
1285 | + |
1286 | + if (!vc->vc_decor.state) |
1287 | + return -EINVAL; |
1288 | + |
1289 | + info = registered_fb[(int) con2fb_map[vc->vc_num]]; |
1290 | + |
1291 | + if (info == NULL) |
1292 | + return -EINVAL; |
1293 | + |
1294 | + vc->vc_decor.state = 0; |
1295 | + vc_resize(vc, info->var.xres / vc->vc_font.width, |
1296 | + info->var.yres / vc->vc_font.height); |
1297 | + |
1298 | + if (fg_console == vc->vc_num && redraw) { |
1299 | + redraw_screen(vc, 0); |
1300 | + update_region(vc, vc->vc_origin + |
1301 | + vc->vc_size_row * vc->vc_top, |
1302 | + vc->vc_size_row * (vc->vc_bottom - vc->vc_top) / 2); |
1303 | + } |
1304 | + |
1305 | + printk(KERN_INFO "fbcondecor: switched decor state to 'off' on console %d\n", |
1306 | + vc->vc_num); |
1307 | + |
1308 | + return 0; |
1309 | +} |
1310 | + |
1311 | +/* Enables fbcondecor on a virtual console; called with console sem held. */ |
1312 | +static int fbcon_decor_enable(struct vc_data *vc) |
1313 | +{ |
1314 | + struct fb_info* info; |
1315 | + |
1316 | + info = registered_fb[(int) con2fb_map[vc->vc_num]]; |
1317 | + |
1318 | + if (vc->vc_decor.twidth == 0 || vc->vc_decor.theight == 0 || |
1319 | + info == NULL || vc->vc_decor.state || (!info->bgdecor.data && |
1320 | + vc->vc_num == fg_console)) |
1321 | + return -EINVAL; |
1322 | + |
1323 | + vc->vc_decor.state = 1; |
1324 | + vc_resize(vc, vc->vc_decor.twidth / vc->vc_font.width, |
1325 | + vc->vc_decor.theight / vc->vc_font.height); |
1326 | + |
1327 | + if (fg_console == vc->vc_num) { |
1328 | + redraw_screen(vc, 0); |
1329 | + update_region(vc, vc->vc_origin + |
1330 | + vc->vc_size_row * vc->vc_top, |
1331 | + vc->vc_size_row * (vc->vc_bottom - vc->vc_top) / 2); |
1332 | + fbcon_decor_clear_margins(vc, info, 0); |
1333 | + } |
1334 | + |
1335 | + printk(KERN_INFO "fbcondecor: switched decor state to 'on' on console %d\n", |
1336 | + vc->vc_num); |
1337 | + |
1338 | + return 0; |
1339 | +} |
1340 | + |
1341 | +static inline int fbcon_decor_ioctl_dosetstate(struct vc_data *vc, unsigned int state, unsigned char origin) |
1342 | +{ |
1343 | + int ret; |
1344 | + |
1345 | + if (origin == FBCON_DECOR_IO_ORIG_USER) |
1346 | + acquire_console_sem(); |
1347 | + if (!state) |
1348 | + ret = fbcon_decor_disable(vc, 1); |
1349 | + else |
1350 | + ret = fbcon_decor_enable(vc); |
1351 | + if (origin == FBCON_DECOR_IO_ORIG_USER) |
1352 | + release_console_sem(); |
1353 | + |
1354 | + return ret; |
1355 | +} |
1356 | + |
1357 | +static inline void fbcon_decor_ioctl_dogetstate(struct vc_data *vc, unsigned int *state) |
1358 | +{ |
1359 | + *state = vc->vc_decor.state; |
1360 | +} |
1361 | + |
1362 | +static int fbcon_decor_ioctl_dosetcfg(struct vc_data *vc, struct vc_decor *cfg, unsigned char origin) |
1363 | +{ |
1364 | + struct fb_info *info; |
1365 | + int len; |
1366 | + char *tmp; |
1367 | + |
1368 | + info = registered_fb[(int) con2fb_map[vc->vc_num]]; |
1369 | + |
1370 | + if (info == NULL || !cfg->twidth || !cfg->theight || |
1371 | + cfg->tx + cfg->twidth > info->var.xres || |
1372 | + cfg->ty + cfg->theight > info->var.yres) |
1373 | + return -EINVAL; |
1374 | + |
1375 | + len = strlen_user(cfg->theme); |
1376 | + if (!len || len > FBCON_DECOR_THEME_LEN) |
1377 | + return -EINVAL; |
1378 | + tmp = kmalloc(len, GFP_KERNEL); |
1379 | + if (!tmp) |
1380 | + return -ENOMEM; |
1381 | + if (copy_from_user(tmp, (void __user *)cfg->theme, len)) |
1382 | + return -EFAULT; |
1383 | + cfg->theme = tmp; |
1384 | + cfg->state = 0; |
1385 | + |
1386 | + /* If this ioctl is a response to a request from kernel, the console sem |
1387 | + * is already held; we also don't need to disable decor because either the |
1388 | + * new config and background picture will be successfully loaded, and the |
1389 | + * decor will stay on, or in case of a failure it'll be turned off in fbcon. */ |
1390 | + if (origin == FBCON_DECOR_IO_ORIG_USER) { |
1391 | + acquire_console_sem(); |
1392 | + if (vc->vc_decor.state) |
1393 | + fbcon_decor_disable(vc, 1); |
1394 | + } |
1395 | + |
1396 | + if (vc->vc_decor.theme) |
1397 | + kfree(vc->vc_decor.theme); |
1398 | + |
1399 | + vc->vc_decor = *cfg; |
1400 | + |
1401 | + if (origin == FBCON_DECOR_IO_ORIG_USER) |
1402 | + release_console_sem(); |
1403 | + |
1404 | + printk(KERN_INFO "fbcondecor: console %d using theme '%s'\n", |
1405 | + vc->vc_num, vc->vc_decor.theme); |
1406 | + return 0; |
1407 | +} |
1408 | + |
1409 | +static int fbcon_decor_ioctl_dogetcfg(struct vc_data *vc, struct vc_decor *decor) |
1410 | +{ |
1411 | + char __user *tmp; |
1412 | + |
1413 | + tmp = decor->theme; |
1414 | + *decor = vc->vc_decor; |
1415 | + decor->theme = tmp; |
1416 | + |
1417 | + if (vc->vc_decor.theme) { |
1418 | + if (copy_to_user(tmp, vc->vc_decor.theme, strlen(vc->vc_decor.theme) + 1)) |
1419 | + return -EFAULT; |
1420 | + } else |
1421 | + if (put_user(0, tmp)) |
1422 | + return -EFAULT; |
1423 | + |
1424 | + return 0; |
1425 | +} |
1426 | + |
1427 | +static int fbcon_decor_ioctl_dosetpic(struct vc_data *vc, struct fb_image *img, unsigned char origin) |
1428 | +{ |
1429 | + struct fb_info *info; |
1430 | + int len; |
1431 | + u8 *tmp; |
1432 | + |
1433 | + if (vc->vc_num != fg_console) |
1434 | + return -EINVAL; |
1435 | + |
1436 | + info = registered_fb[(int) con2fb_map[vc->vc_num]]; |
1437 | + |
1438 | + if (info == NULL) |
1439 | + return -EINVAL; |
1440 | + |
1441 | + if (img->width != info->var.xres || img->height != info->var.yres) { |
1442 | + printk(KERN_ERR "fbcondecor: picture dimensions mismatch\n"); |
1443 | + printk(KERN_ERR "%dx%d vs %dx%d\n", img->width, img->height, info->var.xres, info->var.yres); |
1444 | + return -EINVAL; |
1445 | + } |
1446 | + |
1447 | + if (img->depth != info->var.bits_per_pixel) { |
1448 | + printk(KERN_ERR "fbcondecor: picture depth mismatch\n"); |
1449 | + return -EINVAL; |
1450 | + } |
1451 | + |
1452 | + if (img->depth == 8) { |
1453 | + if (!img->cmap.len || !img->cmap.red || !img->cmap.green || |
1454 | + !img->cmap.blue) |
1455 | + return -EINVAL; |
1456 | + |
1457 | + tmp = vmalloc(img->cmap.len * 3 * 2); |
1458 | + if (!tmp) |
1459 | + return -ENOMEM; |
1460 | + |
1461 | + if (copy_from_user(tmp, |
1462 | + (void __user*)img->cmap.red, (img->cmap.len << 1)) || |
1463 | + copy_from_user(tmp + (img->cmap.len << 1), |
1464 | + (void __user*)img->cmap.green, (img->cmap.len << 1)) || |
1465 | + copy_from_user(tmp + (img->cmap.len << 2), |
1466 | + (void __user*)img->cmap.blue, (img->cmap.len << 1))) { |
1467 | + vfree(tmp); |
1468 | + return -EFAULT; |
1469 | + } |
1470 | + |
1471 | + img->cmap.transp = NULL; |
1472 | + img->cmap.red = (u16*)tmp; |
1473 | + img->cmap.green = img->cmap.red + img->cmap.len; |
1474 | + img->cmap.blue = img->cmap.green + img->cmap.len; |
1475 | + } else { |
1476 | + img->cmap.red = NULL; |
1477 | + } |
1478 | + |
1479 | + len = ((img->depth + 7) >> 3) * img->width * img->height; |
1480 | + |
1481 | + /* |
1482 | + * Allocate an additional byte so that we never go outside of the |
1483 | + * buffer boundaries in the rendering functions in a 24 bpp mode. |
1484 | + */ |
1485 | + tmp = vmalloc(len + 1); |
1486 | + |
1487 | + if (!tmp) |
1488 | + goto out; |
1489 | + |
1490 | + if (copy_from_user(tmp, (void __user*)img->data, len)) |
1491 | + goto out; |
1492 | + |
1493 | + img->data = tmp; |
1494 | + |
1495 | + /* If this ioctl is a response to a request from kernel, the console sem |
1496 | + * is already held. */ |
1497 | + if (origin == FBCON_DECOR_IO_ORIG_USER) |
1498 | + acquire_console_sem(); |
1499 | + |
1500 | + if (info->bgdecor.data) |
1501 | + vfree((u8*)info->bgdecor.data); |
1502 | + if (info->bgdecor.cmap.red) |
1503 | + vfree(info->bgdecor.cmap.red); |
1504 | + |
1505 | + info->bgdecor = *img; |
1506 | + |
1507 | + if (fbcon_decor_active_vc(vc) && fg_console == vc->vc_num) { |
1508 | + redraw_screen(vc, 0); |
1509 | + update_region(vc, vc->vc_origin + |
1510 | + vc->vc_size_row * vc->vc_top, |
1511 | + vc->vc_size_row * (vc->vc_bottom - vc->vc_top) / 2); |
1512 | + fbcon_decor_clear_margins(vc, info, 0); |
1513 | + } |
1514 | + |
1515 | + if (origin == FBCON_DECOR_IO_ORIG_USER) |
1516 | + release_console_sem(); |
1517 | + |
1518 | + return 0; |
1519 | + |
1520 | +out: if (img->cmap.red) |
1521 | + vfree(img->cmap.red); |
1522 | + |
1523 | + if (tmp) |
1524 | + vfree(tmp); |
1525 | + return -ENOMEM; |
1526 | +} |
1527 | + |
1528 | +static long fbcon_decor_ioctl(struct file *filp, u_int cmd, u_long arg) |
1529 | +{ |
1530 | + struct fbcon_decor_iowrapper __user *wrapper = (void __user*) arg; |
1531 | + struct vc_data *vc = NULL; |
1532 | + unsigned short vc_num = 0; |
1533 | + unsigned char origin = 0; |
1534 | + void __user *data = NULL; |
1535 | + |
1536 | + if (!access_ok(VERIFY_READ, wrapper, |
1537 | + sizeof(struct fbcon_decor_iowrapper))) |
1538 | + return -EFAULT; |
1539 | + |
1540 | + __get_user(vc_num, &wrapper->vc); |
1541 | + __get_user(origin, &wrapper->origin); |
1542 | + __get_user(data, &wrapper->data); |
1543 | + |
1544 | + if (!vc_cons_allocated(vc_num)) |
1545 | + return -EINVAL; |
1546 | + |
1547 | + vc = vc_cons[vc_num].d; |
1548 | + |
1549 | + switch (cmd) { |
1550 | + case FBIOCONDECOR_SETPIC: |
1551 | + { |
1552 | + struct fb_image img; |
1553 | + if (copy_from_user(&img, (struct fb_image __user *)data, sizeof(struct fb_image))) |
1554 | + return -EFAULT; |
1555 | + |
1556 | + return fbcon_decor_ioctl_dosetpic(vc, &img, origin); |
1557 | + } |
1558 | + case FBIOCONDECOR_SETCFG: |
1559 | + { |
1560 | + struct vc_decor cfg; |
1561 | + if (copy_from_user(&cfg, (struct vc_decor __user *)data, sizeof(struct vc_decor))) |
1562 | + return -EFAULT; |
1563 | + |
1564 | + return fbcon_decor_ioctl_dosetcfg(vc, &cfg, origin); |
1565 | + } |
1566 | + case FBIOCONDECOR_GETCFG: |
1567 | + { |
1568 | + int rval; |
1569 | + struct vc_decor cfg; |
1570 | + |
1571 | + if (copy_from_user(&cfg, (struct vc_decor __user *)data, sizeof(struct vc_decor))) |
1572 | + return -EFAULT; |
1573 | + |
1574 | + rval = fbcon_decor_ioctl_dogetcfg(vc, &cfg); |
1575 | + |
1576 | + if (copy_to_user(data, &cfg, sizeof(struct vc_decor))) |
1577 | + return -EFAULT; |
1578 | + return rval; |
1579 | + } |
1580 | + case FBIOCONDECOR_SETSTATE: |
1581 | + { |
1582 | + unsigned int state = 0; |
1583 | + if (get_user(state, (unsigned int __user *)data)) |
1584 | + return -EFAULT; |
1585 | + return fbcon_decor_ioctl_dosetstate(vc, state, origin); |
1586 | + } |
1587 | + case FBIOCONDECOR_GETSTATE: |
1588 | + { |
1589 | + unsigned int state = 0; |
1590 | + fbcon_decor_ioctl_dogetstate(vc, &state); |
1591 | + return put_user(state, (unsigned int __user *)data); |
1592 | + } |
1593 | + |
1594 | + default: |
1595 | + return -ENOIOCTLCMD; |
1596 | + } |
1597 | +} |
1598 | + |
1599 | +#ifdef CONFIG_COMPAT |
1600 | + |
1601 | +static long fbcon_decor_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) { |
1602 | + |
1603 | + struct fbcon_decor_iowrapper32 __user *wrapper = (void __user *)arg; |
1604 | + struct vc_data *vc = NULL; |
1605 | + unsigned short vc_num = 0; |
1606 | + unsigned char origin = 0; |
1607 | + compat_uptr_t data_compat = 0; |
1608 | + void __user *data = NULL; |
1609 | + |
1610 | + if (!access_ok(VERIFY_READ, wrapper, |
1611 | + sizeof(struct fbcon_decor_iowrapper32))) |
1612 | + return -EFAULT; |
1613 | + |
1614 | + __get_user(vc_num, &wrapper->vc); |
1615 | + __get_user(origin, &wrapper->origin); |
1616 | + __get_user(data_compat, &wrapper->data); |
1617 | + data = compat_ptr(data_compat); |
1618 | + |
1619 | + if (!vc_cons_allocated(vc_num)) |
1620 | + return -EINVAL; |
1621 | + |
1622 | + vc = vc_cons[vc_num].d; |
1623 | + |
1624 | + switch (cmd) { |
1625 | + case FBIOCONDECOR_SETPIC32: |
1626 | + { |
1627 | + struct fb_image32 img_compat; |
1628 | + struct fb_image img; |
1629 | + |
1630 | + if (copy_from_user(&img_compat, (struct fb_image32 __user *)data, sizeof(struct fb_image32))) |
1631 | + return -EFAULT; |
1632 | + |
1633 | + fb_image_from_compat(img, img_compat); |
1634 | + |
1635 | + return fbcon_decor_ioctl_dosetpic(vc, &img, origin); |
1636 | + } |
1637 | + |
1638 | + case FBIOCONDECOR_SETCFG32: |
1639 | + { |
1640 | + struct vc_decor32 cfg_compat; |
1641 | + struct vc_decor cfg; |
1642 | + |
1643 | + if (copy_from_user(&cfg_compat, (struct vc_decor32 __user *)data, sizeof(struct vc_decor32))) |
1644 | + return -EFAULT; |
1645 | + |
1646 | + vc_decor_from_compat(cfg, cfg_compat); |
1647 | + |
1648 | + return fbcon_decor_ioctl_dosetcfg(vc, &cfg, origin); |
1649 | + } |
1650 | + |
1651 | + case FBIOCONDECOR_GETCFG32: |
1652 | + { |
1653 | + int rval; |
1654 | + struct vc_decor32 cfg_compat; |
1655 | + struct vc_decor cfg; |
1656 | + |
1657 | + if (copy_from_user(&cfg_compat, (struct vc_decor32 __user *)data, sizeof(struct vc_decor32))) |
1658 | + return -EFAULT; |
1659 | + cfg.theme = compat_ptr(cfg_compat.theme); |
1660 | + |
1661 | + rval = fbcon_decor_ioctl_dogetcfg(vc, &cfg); |
1662 | + |
1663 | + vc_decor_to_compat(cfg_compat, cfg); |
1664 | + |
1665 | + if (copy_to_user((struct vc_decor32 __user *)data, &cfg_compat, sizeof(struct vc_decor32))) |
1666 | + return -EFAULT; |
1667 | + return rval; |
1668 | + } |
1669 | + |
1670 | + case FBIOCONDECOR_SETSTATE32: |
1671 | + { |
1672 | + compat_uint_t state_compat = 0; |
1673 | + unsigned int state = 0; |
1674 | + |
1675 | + if (get_user(state_compat, (compat_uint_t __user *)data)) |
1676 | + return -EFAULT; |
1677 | + |
1678 | + state = (unsigned int)state_compat; |
1679 | + |
1680 | + return fbcon_decor_ioctl_dosetstate(vc, state, origin); |
1681 | + } |
1682 | + |
1683 | + case FBIOCONDECOR_GETSTATE32: |
1684 | + { |
1685 | + compat_uint_t state_compat = 0; |
1686 | + unsigned int state = 0; |
1687 | + |
1688 | + fbcon_decor_ioctl_dogetstate(vc, &state); |
1689 | + state_compat = (compat_uint_t)state; |
1690 | + |
1691 | + return put_user(state_compat, (compat_uint_t __user *)data); |
1692 | + } |
1693 | + |
1694 | + default: |
1695 | + return -ENOIOCTLCMD; |
1696 | + } |
1697 | +} |
1698 | +#else |
1699 | + #define fbcon_decor_compat_ioctl NULL |
1700 | +#endif |
1701 | + |
1702 | +static struct file_operations fbcon_decor_ops = { |
1703 | + .owner = THIS_MODULE, |
1704 | + .unlocked_ioctl = fbcon_decor_ioctl, |
1705 | + .compat_ioctl = fbcon_decor_compat_ioctl |
1706 | +}; |
1707 | + |
1708 | +static struct miscdevice fbcon_decor_dev = { |
1709 | + .minor = MISC_DYNAMIC_MINOR, |
1710 | + .name = "fbcondecor", |
1711 | + .fops = &fbcon_decor_ops |
1712 | +}; |
1713 | + |
1714 | +void fbcon_decor_reset(void) |
1715 | +{ |
1716 | + struct fb_info *info; |
1717 | + struct vc_data *vc; |
1718 | + int i; |
1719 | + |
1720 | + vc = vc_cons[0].d; |
1721 | + info = registered_fb[0]; |
1722 | + |
1723 | + for (i = 0; i < num_registered_fb; i++) { |
1724 | + registered_fb[i]->bgdecor.data = NULL; |
1725 | + registered_fb[i]->bgdecor.cmap.red = NULL; |
1726 | + } |
1727 | + |
1728 | + for (i = 0; i < MAX_NR_CONSOLES && vc_cons[i].d; i++) { |
1729 | + vc_cons[i].d->vc_decor.state = vc_cons[i].d->vc_decor.twidth = |
1730 | + vc_cons[i].d->vc_decor.theight = 0; |
1731 | + vc_cons[i].d->vc_decor.theme = NULL; |
1732 | + } |
1733 | + |
1734 | + return; |
1735 | +} |
1736 | + |
1737 | +int fbcon_decor_init(void) |
1738 | +{ |
1739 | + int i; |
1740 | + |
1741 | + fbcon_decor_reset(); |
1742 | + |
1743 | + if (initialized) |
1744 | + return 0; |
1745 | + |
1746 | + i = misc_register(&fbcon_decor_dev); |
1747 | + if (i) { |
1748 | + printk(KERN_ERR "fbcondecor: failed to register device\n"); |
1749 | + return i; |
1750 | + } |
1751 | + |
1752 | + fbcon_decor_call_helper("init", 0); |
1753 | + initialized = 1; |
1754 | + return 0; |
1755 | +} |
1756 | + |
1757 | +int fbcon_decor_exit(void) |
1758 | +{ |
1759 | + fbcon_decor_reset(); |
1760 | + return 0; |
1761 | +} |
1762 | + |
1763 | +EXPORT_SYMBOL(fbcon_decor_path); |
1764 | diff --git a/drivers/video/console/fbcondecor.h b/drivers/video/console/fbcondecor.h |
1765 | new file mode 100644 |
1766 | index 0000000..1d852dd |
1767 | --- /dev/null |
1768 | +++ b/drivers/video/console/fbcondecor.h |
1769 | @@ -0,0 +1,78 @@ |
1770 | +/* |
1771 | + * linux/drivers/video/console/fbcondecor.h -- Framebuffer Console Decoration headers |
1772 | + * |
1773 | + * Copyright (C) 2004 Michal Januszewski <spock@gentoo.org> |
1774 | + * |
1775 | + */ |
1776 | + |
1777 | +#ifndef __FBCON_DECOR_H |
1778 | +#define __FBCON_DECOR_H |
1779 | + |
1780 | +#ifndef _LINUX_FB_H |
1781 | +#include <linux/fb.h> |
1782 | +#endif |
1783 | + |
1784 | +/* This is needed for vc_cons in fbcmap.c */ |
1785 | +#include <linux/vt_kern.h> |
1786 | + |
1787 | +struct fb_cursor; |
1788 | +struct fb_info; |
1789 | +struct vc_data; |
1790 | + |
1791 | +#ifdef CONFIG_FB_CON_DECOR |
1792 | +/* fbcondecor.c */ |
1793 | +int fbcon_decor_init(void); |
1794 | +int fbcon_decor_exit(void); |
1795 | +int fbcon_decor_call_helper(char* cmd, unsigned short cons); |
1796 | +int fbcon_decor_disable(struct vc_data *vc, unsigned char redraw); |
1797 | + |
1798 | +/* cfbcondecor.c */ |
1799 | +void fbcon_decor_putcs(struct vc_data *vc, struct fb_info *info, const unsigned short *s, int count, int yy, int xx); |
1800 | +void fbcon_decor_cursor(struct fb_info *info, struct fb_cursor *cursor); |
1801 | +void fbcon_decor_clear(struct vc_data *vc, struct fb_info *info, int sy, int sx, int height, int width); |
1802 | +void fbcon_decor_clear_margins(struct vc_data *vc, struct fb_info *info, int bottom_only); |
1803 | +void fbcon_decor_blank(struct vc_data *vc, struct fb_info *info, int blank); |
1804 | +void fbcon_decor_bmove_redraw(struct vc_data *vc, struct fb_info *info, int y, int sx, int dx, int width); |
1805 | +void fbcon_decor_copy(u8 *dst, u8 *src, int height, int width, int linebytes, int srclinesbytes, int bpp); |
1806 | +void fbcon_decor_fix_pseudo_pal(struct fb_info *info, struct vc_data *vc); |
1807 | + |
1808 | +/* vt.c */ |
1809 | +void acquire_console_sem(void); |
1810 | +void release_console_sem(void); |
1811 | +void do_unblank_screen(int entering_gfx); |
1812 | + |
1813 | +/* struct vc_data *y */ |
1814 | +#define fbcon_decor_active_vc(y) (y->vc_decor.state && y->vc_decor.theme) |
1815 | + |
1816 | +/* struct fb_info *x, struct vc_data *y */ |
1817 | +#define fbcon_decor_active_nores(x,y) (x->bgdecor.data && fbcon_decor_active_vc(y)) |
1818 | + |
1819 | +/* struct fb_info *x, struct vc_data *y */ |
1820 | +#define fbcon_decor_active(x,y) (fbcon_decor_active_nores(x,y) && \ |
1821 | + x->bgdecor.width == x->var.xres && \ |
1822 | + x->bgdecor.height == x->var.yres && \ |
1823 | + x->bgdecor.depth == x->var.bits_per_pixel) |
1824 | + |
1825 | + |
1826 | +#else /* CONFIG_FB_CON_DECOR */ |
1827 | + |
1828 | +static inline void fbcon_decor_putcs(struct vc_data *vc, struct fb_info *info, const unsigned short *s, int count, int yy, int xx) {} |
1829 | +static inline void fbcon_decor_putc(struct vc_data *vc, struct fb_info *info, int c, int ypos, int xpos) {} |
1830 | +static inline void fbcon_decor_cursor(struct fb_info *info, struct fb_cursor *cursor) {} |
1831 | +static inline void fbcon_decor_clear(struct vc_data *vc, struct fb_info *info, int sy, int sx, int height, int width) {} |
1832 | +static inline void fbcon_decor_clear_margins(struct vc_data *vc, struct fb_info *info, int bottom_only) {} |
1833 | +static inline void fbcon_decor_blank(struct vc_data *vc, struct fb_info *info, int blank) {} |
1834 | +static inline void fbcon_decor_bmove_redraw(struct vc_data *vc, struct fb_info *info, int y, int sx, int dx, int width) {} |
1835 | +static inline void fbcon_decor_fix_pseudo_pal(struct fb_info *info, struct vc_data *vc) {} |
1836 | +static inline int fbcon_decor_call_helper(char* cmd, unsigned short cons) { return 0; } |
1837 | +static inline int fbcon_decor_init(void) { return 0; } |
1838 | +static inline int fbcon_decor_exit(void) { return 0; } |
1839 | +static inline int fbcon_decor_disable(struct vc_data *vc, unsigned char redraw) { return 0; } |
1840 | + |
1841 | +#define fbcon_decor_active_vc(y) (0) |
1842 | +#define fbcon_decor_active_nores(x,y) (0) |
1843 | +#define fbcon_decor_active(x,y) (0) |
1844 | + |
1845 | +#endif /* CONFIG_FB_CON_DECOR */ |
1846 | + |
1847 | +#endif /* __FBCON_DECOR_H */ |
1848 | diff --git a/drivers/video/fbcmap.c b/drivers/video/fbcmap.c |
1849 | index f53b9f1..467f921 100644 |
1850 | --- a/drivers/video/fbcmap.c |
1851 | +++ b/drivers/video/fbcmap.c |
1852 | @@ -17,6 +17,8 @@ |
1853 | #include <linux/slab.h> |
1854 | #include <linux/uaccess.h> |
1855 | |
1856 | +#include "console/fbcondecor.h" |
1857 | + |
1858 | static u16 red2[] __read_mostly = { |
1859 | 0x0000, 0xaaaa |
1860 | }; |
1861 | @@ -234,14 +236,17 @@ int fb_set_cmap(struct fb_cmap *cmap, struct fb_info *info) |
1862 | if (transp) |
1863 | htransp = *transp++; |
1864 | if (info->fbops->fb_setcolreg(start++, |
1865 | - hred, hgreen, hblue, |
1866 | + hred, hgreen, hblue, |
1867 | htransp, info)) |
1868 | break; |
1869 | } |
1870 | } |
1871 | - if (rc == 0) |
1872 | + if (rc == 0) { |
1873 | fb_copy_cmap(cmap, &info->cmap); |
1874 | - |
1875 | + if (fbcon_decor_active(info, vc_cons[fg_console].d) && |
1876 | + info->fix.visual == FB_VISUAL_DIRECTCOLOR) |
1877 | + fbcon_decor_fix_pseudo_pal(info, vc_cons[fg_console].d); |
1878 | + } |
1879 | return rc; |
1880 | } |
1881 | |
1882 | diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c |
1883 | index b066475..7a1b105 100644 |
1884 | --- a/drivers/video/fbmem.c |
1885 | +++ b/drivers/video/fbmem.c |
1886 | @@ -1184,15 +1184,6 @@ struct fb_fix_screeninfo32 { |
1887 | u16 reserved[3]; |
1888 | }; |
1889 | |
1890 | -struct fb_cmap32 { |
1891 | - u32 start; |
1892 | - u32 len; |
1893 | - compat_caddr_t red; |
1894 | - compat_caddr_t green; |
1895 | - compat_caddr_t blue; |
1896 | - compat_caddr_t transp; |
1897 | -}; |
1898 | - |
1899 | static int fb_getput_cmap(struct fb_info *info, unsigned int cmd, |
1900 | unsigned long arg) |
1901 | { |
1902 | diff --git a/include/linux/console_decor.h b/include/linux/console_decor.h |
1903 | new file mode 100644 |
1904 | index 0000000..04b8d80 |
1905 | --- /dev/null |
1906 | +++ b/include/linux/console_decor.h |
1907 | @@ -0,0 +1,46 @@ |
1908 | +#ifndef _LINUX_CONSOLE_DECOR_H_ |
1909 | +#define _LINUX_CONSOLE_DECOR_H_ 1 |
1910 | + |
1911 | +/* A structure used by the framebuffer console decorations (drivers/video/console/fbcondecor.c) */ |
1912 | +struct vc_decor { |
1913 | + __u8 bg_color; /* The color that is to be treated as transparent */ |
1914 | + __u8 state; /* Current decor state: 0 = off, 1 = on */ |
1915 | + __u16 tx, ty; /* Top left corner coordinates of the text field */ |
1916 | + __u16 twidth, theight; /* Width and height of the text field */ |
1917 | + char* theme; |
1918 | +}; |
1919 | + |
1920 | +#ifdef __KERNEL__ |
1921 | +#ifdef CONFIG_COMPAT |
1922 | +#include <linux/compat.h> |
1923 | + |
1924 | +struct vc_decor32 { |
1925 | + __u8 bg_color; /* The color that is to be treated as transparent */ |
1926 | + __u8 state; /* Current decor state: 0 = off, 1 = on */ |
1927 | + __u16 tx, ty; /* Top left corner coordinates of the text field */ |
1928 | + __u16 twidth, theight; /* Width and height of the text field */ |
1929 | + compat_uptr_t theme; |
1930 | +}; |
1931 | + |
1932 | +#define vc_decor_from_compat(to, from) \ |
1933 | + (to).bg_color = (from).bg_color; \ |
1934 | + (to).state = (from).state; \ |
1935 | + (to).tx = (from).tx; \ |
1936 | + (to).ty = (from).ty; \ |
1937 | + (to).twidth = (from).twidth; \ |
1938 | + (to).theight = (from).theight; \ |
1939 | + (to).theme = compat_ptr((from).theme) |
1940 | + |
1941 | +#define vc_decor_to_compat(to, from) \ |
1942 | + (to).bg_color = (from).bg_color; \ |
1943 | + (to).state = (from).state; \ |
1944 | + (to).tx = (from).tx; \ |
1945 | + (to).ty = (from).ty; \ |
1946 | + (to).twidth = (from).twidth; \ |
1947 | + (to).theight = (from).theight; \ |
1948 | + (to).theme = ptr_to_compat((from).theme) |
1949 | + |
1950 | +#endif /* CONFIG_COMPAT */ |
1951 | +#endif /* __KERNEL__ */ |
1952 | + |
1953 | +#endif |
1954 | diff --git a/include/linux/console_struct.h b/include/linux/console_struct.h |
1955 | index 7f0c329..98f5d60 100644 |
1956 | --- a/include/linux/console_struct.h |
1957 | +++ b/include/linux/console_struct.h |
1958 | @@ -19,6 +19,7 @@ |
1959 | struct vt_struct; |
1960 | |
1961 | #define NPAR 16 |
1962 | +#include <linux/console_decor.h> |
1963 | |
1964 | struct vc_data { |
1965 | struct tty_port port; /* Upper level data */ |
1966 | @@ -107,6 +108,8 @@ struct vc_data { |
1967 | unsigned long vc_uni_pagedir; |
1968 | unsigned long *vc_uni_pagedir_loc; /* [!] Location of uni_pagedir variable for this console */ |
1969 | bool vc_panic_force_write; /* when oops/panic this VC can accept forced output/blanking */ |
1970 | + |
1971 | + struct vc_decor vc_decor; |
1972 | /* additional information is in vt_kern.h */ |
1973 | }; |
1974 | |
1975 | diff --git a/include/linux/fb.h b/include/linux/fb.h |
1976 | index f0268de..cb9d67a 100644 |
1977 | --- a/include/linux/fb.h |
1978 | +++ b/include/linux/fb.h |
1979 | @@ -11,6 +11,25 @@ |
1980 | |
1981 | #define FB_MAX 32 /* sufficient for now */ |
1982 | |
1983 | +struct fbcon_decor_iowrapper |
1984 | +{ |
1985 | + unsigned short vc; /* Virtual console */ |
1986 | + unsigned char origin; /* Point of origin of the request */ |
1987 | + void *data; |
1988 | +}; |
1989 | + |
1990 | +#ifdef __KERNEL__ |
1991 | +#ifdef CONFIG_COMPAT |
1992 | +#include <linux/compat.h> |
1993 | +struct fbcon_decor_iowrapper32 |
1994 | +{ |
1995 | + unsigned short vc; /* Virtual console */ |
1996 | + unsigned char origin; /* Point of origin of the request */ |
1997 | + compat_uptr_t data; |
1998 | +}; |
1999 | +#endif /* CONFIG_COMPAT */ |
2000 | +#endif /* __KERNEL__ */ |
2001 | + |
2002 | /* ioctls |
2003 | 0x46 is 'F' */ |
2004 | #define FBIOGET_VSCREENINFO 0x4600 |
2005 | @@ -39,6 +58,24 @@ |
2006 | #define FBIOPUT_MODEINFO 0x4617 |
2007 | #define FBIOGET_DISPINFO 0x4618 |
2008 | #define FBIO_WAITFORVSYNC _IOW('F', 0x20, __u32) |
2009 | +#define FBIOCONDECOR_SETCFG _IOWR('F', 0x19, struct fbcon_decor_iowrapper) |
2010 | +#define FBIOCONDECOR_GETCFG _IOR('F', 0x1A, struct fbcon_decor_iowrapper) |
2011 | +#define FBIOCONDECOR_SETSTATE _IOWR('F', 0x1B, struct fbcon_decor_iowrapper) |
2012 | +#define FBIOCONDECOR_GETSTATE _IOR('F', 0x1C, struct fbcon_decor_iowrapper) |
2013 | +#define FBIOCONDECOR_SETPIC _IOWR('F', 0x1D, struct fbcon_decor_iowrapper) |
2014 | +#ifdef __KERNEL__ |
2015 | +#ifdef CONFIG_COMPAT |
2016 | +#define FBIOCONDECOR_SETCFG32 _IOWR('F', 0x19, struct fbcon_decor_iowrapper32) |
2017 | +#define FBIOCONDECOR_GETCFG32 _IOR('F', 0x1A, struct fbcon_decor_iowrapper32) |
2018 | +#define FBIOCONDECOR_SETSTATE32 _IOWR('F', 0x1B, struct fbcon_decor_iowrapper32) |
2019 | +#define FBIOCONDECOR_GETSTATE32 _IOR('F', 0x1C, struct fbcon_decor_iowrapper32) |
2020 | +#define FBIOCONDECOR_SETPIC32 _IOWR('F', 0x1D, struct fbcon_decor_iowrapper32) |
2021 | +#endif /* CONFIG_COMPAT */ |
2022 | +#endif /* __KERNEL__ */ |
2023 | + |
2024 | +#define FBCON_DECOR_THEME_LEN 128 /* Maximum lenght of a theme name */ |
2025 | +#define FBCON_DECOR_IO_ORIG_KERNEL 0 /* Kernel ioctl origin */ |
2026 | +#define FBCON_DECOR_IO_ORIG_USER 1 /* User ioctl origin */ |
2027 | |
2028 | #define FB_TYPE_PACKED_PIXELS 0 /* Packed Pixels */ |
2029 | #define FB_TYPE_PLANES 1 /* Non interleaved planes */ |
2030 | @@ -283,6 +320,28 @@ struct fb_cmap { |
2031 | __u16 *transp; /* transparency, can be NULL */ |
2032 | }; |
2033 | |
2034 | +#ifdef __KERNEL__ |
2035 | +#ifdef CONFIG_COMPAT |
2036 | +struct fb_cmap32 { |
2037 | + __u32 start; |
2038 | + __u32 len; /* Number of entries */ |
2039 | + compat_uptr_t red; /* Red values */ |
2040 | + compat_uptr_t green; |
2041 | + compat_uptr_t blue; |
2042 | + compat_uptr_t transp; /* transparency, can be NULL */ |
2043 | +}; |
2044 | + |
2045 | +#define fb_cmap_from_compat(to, from) \ |
2046 | + (to).start = (from).start; \ |
2047 | + (to).len = (from).len; \ |
2048 | + (to).red = compat_ptr((from).red); \ |
2049 | + (to).green = compat_ptr((from).green); \ |
2050 | + (to).blue = compat_ptr((from).blue); \ |
2051 | + (to).transp = compat_ptr((from).transp) |
2052 | + |
2053 | +#endif /* CONFIG_COMPAT */ |
2054 | +#endif /* __KERNEL__ */ |
2055 | + |
2056 | struct fb_con2fbmap { |
2057 | __u32 console; |
2058 | __u32 framebuffer; |
2059 | @@ -364,6 +423,34 @@ struct fb_image { |
2060 | struct fb_cmap cmap; /* color map info */ |
2061 | }; |
2062 | |
2063 | +#ifdef __KERNEL__ |
2064 | +#ifdef CONFIG_COMPAT |
2065 | +struct fb_image32 { |
2066 | + __u32 dx; /* Where to place image */ |
2067 | + __u32 dy; |
2068 | + __u32 width; /* Size of image */ |
2069 | + __u32 height; |
2070 | + __u32 fg_color; /* Only used when a mono bitmap */ |
2071 | + __u32 bg_color; |
2072 | + __u8 depth; /* Depth of the image */ |
2073 | + const compat_uptr_t data; /* Pointer to image data */ |
2074 | + struct fb_cmap32 cmap; /* color map info */ |
2075 | +}; |
2076 | + |
2077 | +#define fb_image_from_compat(to, from) \ |
2078 | + (to).dx = (from).dx; \ |
2079 | + (to).dy = (from).dy; \ |
2080 | + (to).width = (from).width; \ |
2081 | + (to).height = (from).height; \ |
2082 | + (to).fg_color = (from).fg_color; \ |
2083 | + (to).bg_color = (from).bg_color; \ |
2084 | + (to).depth = (from).depth; \ |
2085 | + (to).data = compat_ptr((from).data); \ |
2086 | + fb_cmap_from_compat((to).cmap, (from).cmap) |
2087 | + |
2088 | +#endif /* CONFIG_COMPAT */ |
2089 | +#endif /* __KERNEL__ */ |
2090 | + |
2091 | /* |
2092 | * hardware cursor control |
2093 | */ |
2094 | @@ -873,6 +960,9 @@ struct fb_info { |
2095 | #define FBINFO_STATE_SUSPENDED 1 |
2096 | u32 state; /* Hardware state i.e suspend */ |
2097 | void *fbcon_par; /* fbcon use-only private area */ |
2098 | + |
2099 | + struct fb_image bgdecor; |
2100 | + |
2101 | /* From here on everything is device dependent */ |
2102 | void *par; |
2103 | /* we need the PCI or similiar aperture base/size not |
2104 | diff --git a/kernel/sysctl.c b/kernel/sysctl.c |
2105 | index 3a45c22..cab1282 100644 |
2106 | --- a/kernel/sysctl.c |
2107 | +++ b/kernel/sysctl.c |
2108 | @@ -132,6 +132,10 @@ static int min_percpu_pagelist_fract = 8; |
2109 | |
2110 | static int ngroups_max = NGROUPS_MAX; |
2111 | |
2112 | +#ifdef CONFIG_FB_CON_DECOR |
2113 | +extern char fbcon_decor_path[]; |
2114 | +#endif |
2115 | + |
2116 | #ifdef CONFIG_INOTIFY_USER |
2117 | #include <linux/inotify.h> |
2118 | #endif |
2119 | @@ -247,6 +251,16 @@ static struct ctl_table root_table[] = { |
2120 | .mode = 0555, |
2121 | .child = dev_table, |
2122 | }, |
2123 | +#ifdef CONFIG_FB_CON_DECOR |
2124 | + { |
2125 | + .procname = "fbcondecor", |
2126 | + .data = &fbcon_decor_path, |
2127 | + .maxlen = KMOD_PATH_LEN, |
2128 | + .mode = 0644, |
2129 | + .proc_handler = &proc_dostring, |
2130 | + }, |
2131 | +#endif |
2132 | + |
2133 | /* |
2134 | * NOTE: do not add new entries to this table unless you have read |
2135 | * Documentation/sysctl/ctl_unnumbered.txt |