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