/[linux-patches]/genpatches-2.6/tags/2.6.28-1/4200_fbcondecor-0.9.4.patch
Gentoo

Contents of /genpatches-2.6/tags/2.6.28-1/4200_fbcondecor-0.9.4.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1451 - (show annotations) (download)
Thu Dec 25 01:56:17 2008 UTC (5 years, 7 months ago) by dsd
File size: 54739 byte(s)
2.6.28-1 release
1 diff -Naurp -x .git /tmp/linux/Documentation/fb/00-INDEX ./Documentation/fb/00-INDEX
2 --- /tmp/linux/Documentation/fb/00-INDEX 2008-03-25 07:24:16.000000000 +0100
3 +++ ./Documentation/fb/00-INDEX 2008-03-25 23:04:10.000000000 +0100
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 -x .git /tmp/linux/Documentation/fb/fbcondecor.txt ./Documentation/fb/fbcondecor.txt
14 --- /tmp/linux/Documentation/fb/fbcondecor.txt 1970-01-01 01:00:00.000000000 +0100
15 +++ ./Documentation/fb/fbcondecor.txt 2008-03-25 23:04:10.000000000 +0100
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 --- a/drivers/Makefile 2008-10-12 13:30:08.000000000 -0400
225 +++ b/drivers/Makefile 2008-10-12 13:30:51.000000000 -0400
226 @@ -9,6 +9,9 @@ obj-y += gpio/
227 obj-$(CONFIG_PCI) += pci/
228 obj-$(CONFIG_PARISC) += parisc/
229 obj-$(CONFIG_RAPIDIO) += rapidio/
230 +# char/ comes before serial/ etc so that the VT console is the boot-time
231 +# default.
232 +obj-y += char/
233 obj-y += video/
234 obj-$(CONFIG_ACPI) += acpi/
235 # PnP must come after ACPI since it will eventually need to check if acpi
236 @@ -18,9 +21,6 @@ obj-$(CONFIG_ARM_AMBA) += amba/
237
238 obj-$(CONFIG_XEN) += xen/
239
240 -# char/ comes before serial/ etc so that the VT console is the boot-time
241 -# default.
242 -obj-y += char/
243
244 # gpu/ comes after char for AGP vs DRM startup
245 obj-y += gpu/
246 diff -Naurp -x .git /tmp/linux/drivers/video/console/bitblit.c ./drivers/video/console/bitblit.c
247 --- /tmp/linux/drivers/video/console/bitblit.c 2008-03-25 07:24:16.000000000 +0100
248 +++ ./drivers/video/console/bitblit.c 2008-03-25 23:04:10.000000000 +0100
249 @@ -17,6 +17,7 @@
250 #include <linux/console.h>
251 #include <asm/types.h>
252 #include "fbcon.h"
253 +#include "fbcondecor.h"
254
255 /*
256 * Accelerated handlers.
257 @@ -54,6 +55,13 @@ static void bit_bmove(struct vc_data *vc
258 area.height = height * vc->vc_font.height;
259 area.width = width * vc->vc_font.width;
260
261 + if (fbcon_decor_active(info, vc)) {
262 + area.sx += vc->vc_decor.tx;
263 + area.sy += vc->vc_decor.ty;
264 + area.dx += vc->vc_decor.tx;
265 + area.dy += vc->vc_decor.ty;
266 + }
267 +
268 info->fbops->fb_copyarea(info, &area);
269 }
270
271 @@ -379,11 +387,15 @@ static void bit_cursor(struct vc_data *v
272 cursor.image.depth = 1;
273 cursor.rop = ROP_XOR;
274
275 - if (info->fbops->fb_cursor)
276 - err = info->fbops->fb_cursor(info, &cursor);
277 + if (fbcon_decor_active(info, vc)) {
278 + fbcon_decor_cursor(info, &cursor);
279 + } else {
280 + if (info->fbops->fb_cursor)
281 + err = info->fbops->fb_cursor(info, &cursor);
282
283 - if (err)
284 - soft_cursor(info, &cursor);
285 + if (err)
286 + soft_cursor(info, &cursor);
287 + }
288
289 ops->cursor_reset = 0;
290 }
291 diff -Naurp -x .git /tmp/linux/drivers/video/console/cfbcondecor.c ./drivers/video/console/cfbcondecor.c
292 --- /tmp/linux/drivers/video/console/cfbcondecor.c 1970-01-01 01:00:00.000000000 +0100
293 +++ ./drivers/video/console/cfbcondecor.c 2008-03-25 23:11:30.000000000 +0100
294 @@ -0,0 +1,471 @@
295 +/*
296 + * linux/drivers/video/cfbcon_decor.c -- Framebuffer decor render functions
297 + *
298 + * Copyright (C) 2004 Michal Januszewski <spock@gentoo.org>
299 + *
300 + * Code based upon "Bootdecor" (C) 2001-2003
301 + * Volker Poplawski <volker@poplawski.de>,
302 + * Stefan Reinauer <stepan@suse.de>,
303 + * Steffen Winterfeldt <snwint@suse.de>,
304 + * Michael Schroeder <mls@suse.de>,
305 + * Ken Wimer <wimer@suse.de>.
306 + *
307 + * This file is subject to the terms and conditions of the GNU General Public
308 + * License. See the file COPYING in the main directory of this archive for
309 + * more details.
310 + */
311 +#include <linux/module.h>
312 +#include <linux/types.h>
313 +#include <linux/fb.h>
314 +#include <linux/selection.h>
315 +#include <linux/vt_kern.h>
316 +#include <asm/irq.h>
317 +#include <asm/system.h>
318 +
319 +#include "fbcon.h"
320 +#include "fbcondecor.h"
321 +
322 +#define parse_pixel(shift,bpp,type) \
323 + do { \
324 + if (d & (0x80 >> (shift))) \
325 + dd2[(shift)] = fgx; \
326 + else \
327 + dd2[(shift)] = transparent ? *(type *)decor_src : bgx; \
328 + decor_src += (bpp); \
329 + } while (0) \
330 +
331 +extern int get_color(struct vc_data *vc, struct fb_info *info,
332 + u16 c, int is_fg);
333 +
334 +void fbcon_decor_fix_pseudo_pal(struct fb_info *info, struct vc_data *vc)
335 +{
336 + int i, j, k;
337 + int minlen = min(min(info->var.red.length, info->var.green.length),
338 + info->var.blue.length);
339 + u32 col;
340 +
341 + for (j = i = 0; i < 16; i++) {
342 + k = color_table[i];
343 +
344 + col = ((vc->vc_palette[j++] >> (8-minlen))
345 + << info->var.red.offset);
346 + col |= ((vc->vc_palette[j++] >> (8-minlen))
347 + << info->var.green.offset);
348 + col |= ((vc->vc_palette[j++] >> (8-minlen))
349 + << info->var.blue.offset);
350 + ((u32 *)info->pseudo_palette)[k] = col;
351 + }
352 +}
353 +
354 +void fbcon_decor_renderc(struct fb_info *info, int ypos, int xpos, int height,
355 + int width, u8* src, u32 fgx, u32 bgx, u8 transparent)
356 +{
357 + unsigned int x, y;
358 + u32 dd;
359 + int bytespp = ((info->var.bits_per_pixel + 7) >> 3);
360 + unsigned int d = ypos * info->fix.line_length + xpos * bytespp;
361 + unsigned int ds = (ypos * info->var.xres + xpos) * bytespp;
362 + u16 dd2[4];
363 +
364 + u8* decor_src = (u8 *)(info->bgdecor.data + ds);
365 + u8* dst = (u8 *)(info->screen_base + d);
366 +
367 + if ((ypos + height) > info->var.yres || (xpos + width) > info->var.xres)
368 + return;
369 +
370 + for (y = 0; y < height; y++) {
371 + switch (info->var.bits_per_pixel) {
372 +
373 + case 32:
374 + for (x = 0; x < width; x++) {
375 +
376 + if ((x & 7) == 0)
377 + d = *src++;
378 + if (d & 0x80)
379 + dd = fgx;
380 + else
381 + dd = transparent ?
382 + *(u32 *)decor_src : bgx;
383 +
384 + d <<= 1;
385 + decor_src += 4;
386 + fb_writel(dd, dst);
387 + dst += 4;
388 + }
389 + break;
390 + case 24:
391 + for (x = 0; x < width; x++) {
392 +
393 + if ((x & 7) == 0)
394 + d = *src++;
395 + if (d & 0x80)
396 + dd = fgx;
397 + else
398 + dd = transparent ?
399 + (*(u32 *)decor_src & 0xffffff) : bgx;
400 +
401 + d <<= 1;
402 + decor_src += 3;
403 +#ifdef __LITTLE_ENDIAN
404 + fb_writew(dd & 0xffff, dst);
405 + dst += 2;
406 + fb_writeb((dd >> 16), dst);
407 +#else
408 + fb_writew(dd >> 8, dst);
409 + dst += 2;
410 + fb_writeb(dd & 0xff, dst);
411 +#endif
412 + dst++;
413 + }
414 + break;
415 + case 16:
416 + for (x = 0; x < width; x += 2) {
417 + if ((x & 7) == 0)
418 + d = *src++;
419 +
420 + parse_pixel(0, 2, u16);
421 + parse_pixel(1, 2, u16);
422 +#ifdef __LITTLE_ENDIAN
423 + dd = dd2[0] | (dd2[1] << 16);
424 +#else
425 + dd = dd2[1] | (dd2[0] << 16);
426 +#endif
427 + d <<= 2;
428 + fb_writel(dd, dst);
429 + dst += 4;
430 + }
431 + break;
432 +
433 + case 8:
434 + for (x = 0; x < width; x += 4) {
435 + if ((x & 7) == 0)
436 + d = *src++;
437 +
438 + parse_pixel(0, 1, u8);
439 + parse_pixel(1, 1, u8);
440 + parse_pixel(2, 1, u8);
441 + parse_pixel(3, 1, u8);
442 +
443 +#ifdef __LITTLE_ENDIAN
444 + dd = dd2[0] | (dd2[1] << 8) | (dd2[2] << 16) | (dd2[3] << 24);
445 +#else
446 + dd = dd2[3] | (dd2[2] << 8) | (dd2[1] << 16) | (dd2[0] << 24);
447 +#endif
448 + d <<= 4;
449 + fb_writel(dd, dst);
450 + dst += 4;
451 + }
452 + }
453 +
454 + dst += info->fix.line_length - width * bytespp;
455 + decor_src += (info->var.xres - width) * bytespp;
456 + }
457 +}
458 +
459 +#define cc2cx(a) \
460 + ((info->fix.visual == FB_VISUAL_TRUECOLOR || \
461 + info->fix.visual == FB_VISUAL_DIRECTCOLOR) ? \
462 + ((u32*)info->pseudo_palette)[a] : a)
463 +
464 +void fbcon_decor_putcs(struct vc_data *vc, struct fb_info *info,
465 + const unsigned short *s, int count, int yy, int xx)
466 +{
467 + unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff;
468 + struct fbcon_ops *ops = info->fbcon_par;
469 + int fg_color, bg_color, transparent;
470 + u8 *src;
471 + u32 bgx, fgx;
472 + u16 c = scr_readw(s);
473 +
474 + fg_color = get_color(vc, info, c, 1);
475 + bg_color = get_color(vc, info, c, 0);
476 +
477 + /* Don't paint the background image if console is blanked */
478 + transparent = ops->blank_state ? 0 :
479 + (vc->vc_decor.bg_color == bg_color);
480 +
481 + xx = xx * vc->vc_font.width + vc->vc_decor.tx;
482 + yy = yy * vc->vc_font.height + vc->vc_decor.ty;
483 +
484 + fgx = cc2cx(fg_color);
485 + bgx = cc2cx(bg_color);
486 +
487 + while (count--) {
488 + c = scr_readw(s++);
489 + src = vc->vc_font.data + (c & charmask) * vc->vc_font.height *
490 + ((vc->vc_font.width + 7) >> 3);
491 +
492 + fbcon_decor_renderc(info, yy, xx, vc->vc_font.height,
493 + vc->vc_font.width, src, fgx, bgx, transparent);
494 + xx += vc->vc_font.width;
495 + }
496 +}
497 +
498 +void fbcon_decor_cursor(struct fb_info *info, struct fb_cursor *cursor)
499 +{
500 + int i;
501 + unsigned int dsize, s_pitch;
502 + struct fbcon_ops *ops = info->fbcon_par;
503 + struct vc_data* vc;
504 + u8 *src;
505 +
506 + /* we really don't need any cursors while the console is blanked */
507 + if (info->state != FBINFO_STATE_RUNNING || ops->blank_state)
508 + return;
509 +
510 + vc = vc_cons[ops->currcon].d;
511 +
512 + src = kmalloc(64 + sizeof(struct fb_image), GFP_ATOMIC);
513 + if (!src)
514 + return;
515 +
516 + s_pitch = (cursor->image.width + 7) >> 3;
517 + dsize = s_pitch * cursor->image.height;
518 + if (cursor->enable) {
519 + switch (cursor->rop) {
520 + case ROP_XOR:
521 + for (i = 0; i < dsize; i++)
522 + src[i] = cursor->image.data[i] ^ cursor->mask[i];
523 + break;
524 + case ROP_COPY:
525 + default:
526 + for (i = 0; i < dsize; i++)
527 + src[i] = cursor->image.data[i] & cursor->mask[i];
528 + break;
529 + }
530 + } else
531 + memcpy(src, cursor->image.data, dsize);
532 +
533 + fbcon_decor_renderc(info,
534 + cursor->image.dy + vc->vc_decor.ty,
535 + cursor->image.dx + vc->vc_decor.tx,
536 + cursor->image.height,
537 + cursor->image.width,
538 + (u8*)src,
539 + cc2cx(cursor->image.fg_color),
540 + cc2cx(cursor->image.bg_color),
541 + cursor->image.bg_color == vc->vc_decor.bg_color);
542 +
543 + kfree(src);
544 +}
545 +
546 +static void decorset(u8 *dst, int height, int width, int dstbytes,
547 + u32 bgx, int bpp)
548 +{
549 + int i;
550 +
551 + if (bpp == 8)
552 + bgx |= bgx << 8;
553 + if (bpp == 16 || bpp == 8)
554 + bgx |= bgx << 16;
555 +
556 + while (height-- > 0) {
557 + u8 *p = dst;
558 +
559 + switch (bpp) {
560 +
561 + case 32:
562 + for (i=0; i < width; i++) {
563 + fb_writel(bgx, p); p += 4;
564 + }
565 + break;
566 + case 24:
567 + for (i=0; i < width; i++) {
568 +#ifdef __LITTLE_ENDIAN
569 + fb_writew((bgx & 0xffff),(u16*)p); p += 2;
570 + fb_writeb((bgx >> 16),p++);
571 +#else
572 + fb_writew((bgx >> 8),(u16*)p); p += 2;
573 + fb_writeb((bgx & 0xff),p++);
574 +#endif
575 + }
576 + case 16:
577 + for (i=0; i < width/4; i++) {
578 + fb_writel(bgx,p); p += 4;
579 + fb_writel(bgx,p); p += 4;
580 + }
581 + if (width & 2) {
582 + fb_writel(bgx,p); p += 4;
583 + }
584 + if (width & 1)
585 + fb_writew(bgx,(u16*)p);
586 + break;
587 + case 8:
588 + for (i=0; i < width/4; i++) {
589 + fb_writel(bgx,p); p += 4;
590 + }
591 +
592 + if (width & 2) {
593 + fb_writew(bgx,p); p += 2;
594 + }
595 + if (width & 1)
596 + fb_writeb(bgx,(u8*)p);
597 + break;
598 +
599 + }
600 + dst += dstbytes;
601 + }
602 +}
603 +
604 +void fbcon_decor_copy(u8 *dst, u8 *src, int height, int width, int linebytes,
605 + int srclinebytes, int bpp)
606 +{
607 + int i;
608 +
609 + while (height-- > 0) {
610 + u32 *p = (u32 *)dst;
611 + u32 *q = (u32 *)src;
612 +
613 + switch (bpp) {
614 +
615 + case 32:
616 + for (i=0; i < width; i++)
617 + fb_writel(*q++, p++);
618 + break;
619 + case 24:
620 + for (i=0; i < (width*3/4); i++)
621 + fb_writel(*q++, p++);
622 + if ((width*3) % 4) {
623 + if (width & 2) {
624 + fb_writeb(*(u8*)q, (u8*)p);
625 + } else if (width & 1) {
626 + fb_writew(*(u16*)q, (u16*)p);
627 + fb_writeb(*(u8*)((u16*)q+1),(u8*)((u16*)p+2));
628 + }
629 + }
630 + break;
631 + case 16:
632 + for (i=0; i < width/4; i++) {
633 + fb_writel(*q++, p++);
634 + fb_writel(*q++, p++);
635 + }
636 + if (width & 2)
637 + fb_writel(*q++, p++);
638 + if (width & 1)
639 + fb_writew(*(u16*)q, (u16*)p);
640 + break;
641 + case 8:
642 + for (i=0; i < width/4; i++)
643 + fb_writel(*q++, p++);
644 +
645 + if (width & 2) {
646 + fb_writew(*(u16*)q, (u16*)p);
647 + q = (u32*) ((u16*)q + 1);
648 + p = (u32*) ((u16*)p + 1);
649 + }
650 + if (width & 1)
651 + fb_writeb(*(u8*)q, (u8*)p);
652 + break;
653 + }
654 +
655 + dst += linebytes;
656 + src += srclinebytes;
657 + }
658 +}
659 +
660 +static void decorfill(struct fb_info *info, int sy, int sx, int height,
661 + int width)
662 +{
663 + int bytespp = ((info->var.bits_per_pixel + 7) >> 3);
664 + int d = sy * info->fix.line_length + sx * bytespp;
665 + int ds = (sy * info->var.xres + sx) * bytespp;
666 +
667 + fbcon_decor_copy((u8 *)(info->screen_base + d), (u8 *)(info->bgdecor.data + ds),
668 + height, width, info->fix.line_length, info->var.xres * bytespp,
669 + info->var.bits_per_pixel);
670 +}
671 +
672 +void fbcon_decor_clear(struct vc_data *vc, struct fb_info *info, int sy, int sx,
673 + int height, int width)
674 +{
675 + int bgshift = (vc->vc_hi_font_mask) ? 13 : 12;
676 + struct fbcon_ops *ops = info->fbcon_par;
677 + u8 *dst;
678 + int transparent, bg_color = attr_bgcol_ec(bgshift, vc, info);
679 +
680 + transparent = (vc->vc_decor.bg_color == bg_color);
681 + sy = sy * vc->vc_font.height + vc->vc_decor.ty;
682 + sx = sx * vc->vc_font.width + vc->vc_decor.tx;
683 + height *= vc->vc_font.height;
684 + width *= vc->vc_font.width;
685 +
686 + /* Don't paint the background image if console is blanked */
687 + if (transparent && !ops->blank_state) {
688 + decorfill(info, sy, sx, height, width);
689 + } else {
690 + dst = (u8 *)(info->screen_base + sy * info->fix.line_length +
691 + sx * ((info->var.bits_per_pixel + 7) >> 3));
692 + decorset(dst, height, width, info->fix.line_length, cc2cx(bg_color),
693 + info->var.bits_per_pixel);
694 + }
695 +}
696 +
697 +void fbcon_decor_clear_margins(struct vc_data *vc, struct fb_info *info,
698 + int bottom_only)
699 +{
700 + unsigned int tw = vc->vc_cols*vc->vc_font.width;
701 + unsigned int th = vc->vc_rows*vc->vc_font.height;
702 +
703 + if (!bottom_only) {
704 + /* top margin */
705 + decorfill(info, 0, 0, vc->vc_decor.ty, info->var.xres);
706 + /* left margin */
707 + decorfill(info, vc->vc_decor.ty, 0, th, vc->vc_decor.tx);
708 + /* right margin */
709 + decorfill(info, vc->vc_decor.ty, vc->vc_decor.tx + tw, th,
710 + info->var.xres - vc->vc_decor.tx - tw);
711 + }
712 + decorfill(info, vc->vc_decor.ty + th, 0,
713 + info->var.yres - vc->vc_decor.ty - th, info->var.xres);
714 +}
715 +
716 +void fbcon_decor_bmove_redraw(struct vc_data *vc, struct fb_info *info, int y,
717 + int sx, int dx, int width)
718 +{
719 + u16 *d = (u16 *) (vc->vc_origin + vc->vc_size_row * y + dx * 2);
720 + u16 *s = d + (dx - sx);
721 + u16 *start = d;
722 + u16 *ls = d;
723 + u16 *le = d + width;
724 + u16 c;
725 + int x = dx;
726 + u16 attr = 1;
727 +
728 + do {
729 + c = scr_readw(d);
730 + if (attr != (c & 0xff00)) {
731 + attr = c & 0xff00;
732 + if (d > start) {
733 + fbcon_decor_putcs(vc, info, start, d - start, y, x);
734 + x += d - start;
735 + start = d;
736 + }
737 + }
738 + if (s >= ls && s < le && c == scr_readw(s)) {
739 + if (d > start) {
740 + fbcon_decor_putcs(vc, info, start, d - start, y, x);
741 + x += d - start + 1;
742 + start = d + 1;
743 + } else {
744 + x++;
745 + start++;
746 + }
747 + }
748 + s++;
749 + d++;
750 + } while (d < le);
751 + if (d > start)
752 + fbcon_decor_putcs(vc, info, start, d - start, y, x);
753 +}
754 +
755 +void fbcon_decor_blank(struct vc_data *vc, struct fb_info *info, int blank)
756 +{
757 + if (blank) {
758 + decorset((u8 *)info->screen_base, info->var.yres, info->var.xres,
759 + info->fix.line_length, 0, info->var.bits_per_pixel);
760 + } else {
761 + update_screen(vc);
762 + fbcon_decor_clear_margins(vc, info, 0);
763 + }
764 +}
765 +
766 diff -Naurp -x .git /tmp/linux/drivers/video/console/fbcon.c ./drivers/video/console/fbcon.c
767 --- /tmp/linux/drivers/video/console/fbcon.c 2008-03-25 07:24:16.000000000 +0100
768 +++ ./drivers/video/console/fbcon.c 2008-03-25 23:04:10.000000000 +0100
769 @@ -90,6 +90,7 @@
770 #endif
771
772 #include "fbcon.h"
773 +#include "fbcondecor.h"
774
775 #ifdef FBCONDEBUG
776 # define DPRINTK(fmt, args...) printk(KERN_DEBUG "%s: " fmt, __FUNCTION__ , ## args)
777 @@ -105,7 +106,7 @@ enum {
778
779 static struct display fb_display[MAX_NR_CONSOLES];
780
781 -static signed char con2fb_map[MAX_NR_CONSOLES];
782 +signed char con2fb_map[MAX_NR_CONSOLES];
783 static signed char con2fb_map_boot[MAX_NR_CONSOLES];
784 #ifndef MODULE
785 static int logo_height;
786 @@ -315,7 +316,7 @@ static inline int fbcon_is_inactive(stru
787 vc->vc_mode != KD_TEXT || ops->graphics);
788 }
789
790 -static inline int get_color(struct vc_data *vc, struct fb_info *info,
791 +inline int get_color(struct vc_data *vc, struct fb_info *info,
792 u16 c, int is_fg)
793 {
794 int depth = fb_get_color_depth(&info->var, &info->fix);
795 @@ -420,6 +421,7 @@ static void fb_flashcursor(struct work_s
796 CM_ERASE : CM_DRAW;
797 ops->cursor(vc, info, mode, softback_lines, get_color(vc, info, c, 1),
798 get_color(vc, info, c, 0));
799 +
800 release_console_sem();
801 }
802
803 @@ -590,6 +592,8 @@ static int fbcon_takeover(int show_logo)
804 info_idx = -1;
805 }
806
807 + fbcon_decor_init();
808 +
809 return err;
810 }
811
812 @@ -1031,6 +1035,12 @@ static const char *fbcon_startup(void)
813 rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres);
814 cols /= vc->vc_font.width;
815 rows /= vc->vc_font.height;
816 +
817 + if (fbcon_decor_active(info, vc)) {
818 + cols = vc->vc_decor.twidth / vc->vc_font.width;
819 + rows = vc->vc_decor.theight / vc->vc_font.height;
820 + }
821 +
822 vc_resize(vc, cols, rows);
823
824 DPRINTK("mode: %s\n", info->fix.id);
825 @@ -1114,7 +1124,7 @@ static void fbcon_init(struct vc_data *v
826 cap = info->flags;
827
828 if (vc != svc || logo_shown == FBCON_LOGO_DONTSHOW ||
829 - (info->fix.type == FB_TYPE_TEXT))
830 + (info->fix.type == FB_TYPE_TEXT) || fbcon_decor_active(info, vc))
831 logo = 0;
832
833 if (var_to_display(p, &info->var, info))
834 @@ -1313,6 +1323,11 @@ static void fbcon_clear(struct vc_data *
835 if (!height || !width)
836 return;
837
838 + if (fbcon_decor_active(info, vc)) {
839 + fbcon_decor_clear(vc, info, sy, sx, height, width);
840 + return;
841 + }
842 +
843 /* Split blits that cross physical y_wrap boundary */
844
845 y_break = p->vrows - p->yscroll;
846 @@ -1332,10 +1347,15 @@ static void fbcon_putcs(struct vc_data *
847 struct display *p = &fb_display[vc->vc_num];
848 struct fbcon_ops *ops = info->fbcon_par;
849
850 - if (!fbcon_is_inactive(vc, info))
851 - ops->putcs(vc, info, s, count, real_y(p, ypos), xpos,
852 - get_color(vc, info, scr_readw(s), 1),
853 - get_color(vc, info, scr_readw(s), 0));
854 + if (!fbcon_is_inactive(vc, info)) {
855 +
856 + if (fbcon_decor_active(info, vc))
857 + fbcon_decor_putcs(vc, info, s, count, ypos, xpos);
858 + else
859 + ops->putcs(vc, info, s, count, real_y(p, ypos), xpos,
860 + get_color(vc, info, scr_readw(s), 1),
861 + get_color(vc, info, scr_readw(s), 0));
862 + }
863 }
864
865 static void fbcon_putc(struct vc_data *vc, int c, int ypos, int xpos)
866 @@ -1351,8 +1371,13 @@ static void fbcon_clear_margins(struct v
867 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
868 struct fbcon_ops *ops = info->fbcon_par;
869
870 - if (!fbcon_is_inactive(vc, info))
871 - ops->clear_margins(vc, info, bottom_only);
872 + if (!fbcon_is_inactive(vc, info)) {
873 + if (fbcon_decor_active(info, vc)) {
874 + fbcon_decor_clear_margins(vc, info, bottom_only);
875 + } else {
876 + ops->clear_margins(vc, info, bottom_only);
877 + }
878 + }
879 }
880
881 static void fbcon_cursor(struct vc_data *vc, int mode)
882 @@ -1872,7 +1897,7 @@ static int fbcon_scroll(struct vc_data *
883 count = vc->vc_rows;
884 if (softback_top)
885 fbcon_softback_note(vc, t, count);
886 - if (logo_shown >= 0)
887 + if (logo_shown >= 0 || fbcon_decor_active(info, vc))
888 goto redraw_up;
889 switch (p->scrollmode) {
890 case SCROLL_MOVE:
891 @@ -1965,6 +1990,8 @@ static int fbcon_scroll(struct vc_data *
892 count = vc->vc_rows;
893 if (logo_shown >= 0)
894 goto redraw_down;
895 + if (fbcon_decor_active(info, vc))
896 + goto redraw_down;
897 switch (p->scrollmode) {
898 case SCROLL_MOVE:
899 fbcon_redraw_blit(vc, info, p, b - 1, b - t - count,
900 @@ -2113,6 +2140,13 @@ static void fbcon_bmove_rec(struct vc_da
901 }
902 return;
903 }
904 +
905 + if (fbcon_decor_active(info, vc) && sy == dy && height == 1) {
906 + /* must use slower redraw bmove to keep background pic intact */
907 + fbcon_decor_bmove_redraw(vc, info, sy, sx, dx, width);
908 + return;
909 + }
910 +
911 ops->bmove(vc, info, real_y(p, sy), sx, real_y(p, dy), dx,
912 height, width);
913 }
914 @@ -2183,8 +2217,8 @@ static int fbcon_resize(struct vc_data *
915 var.yres = virt_h * virt_fh;
916 x_diff = info->var.xres - var.xres;
917 y_diff = info->var.yres - var.yres;
918 - if (x_diff < 0 || x_diff > virt_fw ||
919 - y_diff < 0 || y_diff > virt_fh) {
920 + if ((x_diff < 0 || x_diff > virt_fw ||
921 + y_diff < 0 || y_diff > virt_fh) && !vc->vc_decor.state) {
922 const struct fb_videomode *mode;
923
924 DPRINTK("attempting resize %ix%i\n", var.xres, var.yres);
925 @@ -2220,6 +2254,19 @@ static int fbcon_switch(struct vc_data *
926
927 info = registered_fb[con2fb_map[vc->vc_num]];
928 ops = info->fbcon_par;
929 + prev_console = ops->currcon;
930 + if (prev_console != -1)
931 + old_info = registered_fb[con2fb_map[prev_console]];
932 +
933 + if (!fbcon_decor_active_vc(vc) && info->fix.visual == FB_VISUAL_DIRECTCOLOR) {
934 + struct vc_data *vc_curr = vc_cons[prev_console].d;
935 + if (vc_curr && fbcon_decor_active_vc(vc_curr)) {
936 + /* Clear the screen to avoid displaying funky colors during
937 + * palette updates. */
938 + memset((u8*)info->screen_base + info->fix.line_length * info->var.yoffset,
939 + 0, info->var.yres * info->fix.line_length);
940 + }
941 + }
942
943 if (softback_top) {
944 if (softback_lines)
945 @@ -2238,9 +2285,6 @@ static int fbcon_switch(struct vc_data *
946 logo_shown = FBCON_LOGO_CANSHOW;
947 }
948
949 - prev_console = ops->currcon;
950 - if (prev_console != -1)
951 - old_info = registered_fb[con2fb_map[prev_console]];
952 /*
953 * FIXME: If we have multiple fbdev's loaded, we need to
954 * update all info->currcon. Perhaps, we can place this
955 @@ -2280,6 +2324,18 @@ static int fbcon_switch(struct vc_data *
956 fbcon_del_cursor_timer(old_info);
957 }
958
959 + if (fbcon_decor_active_vc(vc)) {
960 + struct vc_data *vc_curr = vc_cons[prev_console].d;
961 +
962 + if (!vc_curr->vc_decor.theme ||
963 + strcmp(vc->vc_decor.theme, vc_curr->vc_decor.theme) ||
964 + (fbcon_decor_active_nores(info, vc_curr) &&
965 + !fbcon_decor_active(info, vc_curr))) {
966 + if (fbcon_decor_call_helper("modechange", vc->vc_num))
967 + fbcon_decor_disable(vc, 0);
968 + }
969 + }
970 +
971 if (fbcon_is_inactive(vc, info) ||
972 ops->blank_state != FB_BLANK_UNBLANK)
973 fbcon_del_cursor_timer(info);
974 @@ -2546,13 +2606,22 @@ static int fbcon_do_set_font(struct vc_d
975 }
976
977 if (resize) {
978 + /* reset wrap/pan */
979 int cols, rows;
980
981 cols = FBCON_SWAP(ops->rotate, info->var.xres, info->var.yres);
982 rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres);
983 +
984 + info->var.xoffset = info->var.yoffset = p->yscroll = 0;
985 + if (fbcon_decor_active(info, vc)) {
986 + cols = vc->vc_decor.twidth;
987 + rows = vc->vc_decor.theight;
988 + }
989 cols /= w;
990 rows /= h;
991 +
992 vc_resize(vc, cols, rows);
993 +
994 if (CON_IS_VISIBLE(vc) && softback_buf)
995 fbcon_update_softback(vc);
996 } else if (CON_IS_VISIBLE(vc)
997 @@ -2681,7 +2750,7 @@ static int fbcon_set_palette(struct vc_d
998 int i, j, k, depth;
999 u8 val;
1000
1001 - if (fbcon_is_inactive(vc, info))
1002 + if (fbcon_is_inactive(vc, info) || vc->vc_num != fg_console)
1003 return -EINVAL;
1004
1005 if (!CON_IS_VISIBLE(vc))
1006 @@ -2707,7 +2776,49 @@ static int fbcon_set_palette(struct vc_d
1007 } else
1008 fb_copy_cmap(fb_default_cmap(1 << depth), &palette_cmap);
1009
1010 - return fb_set_cmap(&palette_cmap, info);
1011 + if (fbcon_decor_active(info, vc_cons[fg_console].d) &&
1012 + info->fix.visual == FB_VISUAL_DIRECTCOLOR) {
1013 +
1014 + u16 *red, *green, *blue;
1015 + int minlen = min(min(info->var.red.length, info->var.green.length),
1016 + info->var.blue.length);
1017 + int h;
1018 +
1019 + struct fb_cmap cmap = {
1020 + .start = 0,
1021 + .len = (1 << minlen),
1022 + .red = NULL,
1023 + .green = NULL,
1024 + .blue = NULL,
1025 + .transp = NULL
1026 + };
1027 +
1028 + red = kmalloc(256 * sizeof(u16) * 3, GFP_KERNEL);
1029 +
1030 + if (!red)
1031 + goto out;
1032 +
1033 + green = red + 256;
1034 + blue = green + 256;
1035 + cmap.red = red;
1036 + cmap.green = green;
1037 + cmap.blue = blue;
1038 +
1039 + for (i = 0; i < cmap.len; i++) {
1040 + red[i] = green[i] = blue[i] = (0xffff * i)/(cmap.len-1);
1041 + }
1042 +
1043 + h = fb_set_cmap(&cmap, info);
1044 + fbcon_decor_fix_pseudo_pal(info, vc_cons[fg_console].d);
1045 + kfree(red);
1046 +
1047 + return h;
1048 +
1049 + } else if (fbcon_decor_active(info, vc_cons[fg_console].d) &&
1050 + info->var.bits_per_pixel == 8 && info->bgdecor.cmap.red != NULL)
1051 + fb_set_cmap(&info->bgdecor.cmap, info);
1052 +
1053 +out: return fb_set_cmap(&palette_cmap, info);
1054 }
1055
1056 static u16 *fbcon_screen_pos(struct vc_data *vc, int offset)
1057 @@ -2933,7 +3044,14 @@ static void fbcon_modechanged(struct fb_
1058 rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres);
1059 cols /= vc->vc_font.width;
1060 rows /= vc->vc_font.height;
1061 - vc_resize(vc, cols, rows);
1062 +
1063 + if (!fbcon_decor_active_nores(info, vc)) {
1064 + vc_resize(vc, cols, rows);
1065 + } else {
1066 + if (fbcon_decor_call_helper("modechange", vc->vc_num))
1067 + fbcon_decor_disable(vc, 0);
1068 + }
1069 +
1070 updatescrollmode(p, info, vc);
1071 scrollback_max = 0;
1072 scrollback_current = 0;
1073 @@ -3561,6 +3679,7 @@ static void fbcon_exit(void)
1074 }
1075 }
1076
1077 + fbcon_decor_exit();
1078 fbcon_has_exited = 1;
1079 }
1080
1081 diff -Naurp -x .git /tmp/linux/drivers/video/console/fbcondecor.c ./drivers/video/console/fbcondecor.c
1082 --- /tmp/linux/drivers/video/console/fbcondecor.c 1970-01-01 01:00:00.000000000 +0100
1083 +++ ./drivers/video/console/fbcondecor.c 2008-03-25 23:04:10.000000000 +0100
1084 @@ -0,0 +1,420 @@
1085 +/*
1086 + * linux/drivers/video/console/fbcondecor.c -- Framebuffer console decorations
1087 + *
1088 + * Copyright (C) 2004 Michal Januszewski <spock@gentoo.org>
1089 + *
1090 + * Code based upon "Bootsplash" (C) 2001-2003
1091 + * Volker Poplawski <volker@poplawski.de>,
1092 + * Stefan Reinauer <stepan@suse.de>,
1093 + * Steffen Winterfeldt <snwint@suse.de>,
1094 + * Michael Schroeder <mls@suse.de>,
1095 + * Ken Wimer <wimer@suse.de>.
1096 + *
1097 + * This file is subject to the terms and conditions of the GNU General Public
1098 + * License. See the file COPYING in the main directory of this archive for
1099 + * more details.
1100 + *
1101 + */
1102 +#include <linux/module.h>
1103 +#include <linux/kernel.h>
1104 +#include <linux/string.h>
1105 +#include <linux/types.h>
1106 +#include <linux/fb.h>
1107 +#include <linux/vt_kern.h>
1108 +#include <linux/vmalloc.h>
1109 +#include <linux/unistd.h>
1110 +#include <linux/syscalls.h>
1111 +#include <linux/init.h>
1112 +#include <linux/proc_fs.h>
1113 +#include <linux/workqueue.h>
1114 +#include <linux/kmod.h>
1115 +#include <linux/miscdevice.h>
1116 +#include <linux/device.h>
1117 +#include <linux/fs.h>
1118 +
1119 +#include <asm/uaccess.h>
1120 +#include <asm/irq.h>
1121 +#include <asm/system.h>
1122 +
1123 +#include "fbcon.h"
1124 +#include "fbcondecor.h"
1125 +
1126 +extern signed char con2fb_map[];
1127 +static int fbcon_decor_enable(struct vc_data *vc);
1128 +char fbcon_decor_path[KMOD_PATH_LEN] = "/sbin/fbcondecor_helper";
1129 +static int initialized = 0;
1130 +
1131 +int fbcon_decor_call_helper(char* cmd, unsigned short vc)
1132 +{
1133 + char *envp[] = {
1134 + "HOME=/",
1135 + "PATH=/sbin:/bin",
1136 + NULL
1137 + };
1138 +
1139 + char tfb[5];
1140 + char tcons[5];
1141 + unsigned char fb = (int) con2fb_map[vc];
1142 +
1143 + char *argv[] = {
1144 + fbcon_decor_path,
1145 + "2",
1146 + cmd,
1147 + tcons,
1148 + tfb,
1149 + vc_cons[vc].d->vc_decor.theme,
1150 + NULL
1151 + };
1152 +
1153 + snprintf(tfb,5,"%d",fb);
1154 + snprintf(tcons,5,"%d",vc);
1155 +
1156 + return call_usermodehelper(fbcon_decor_path, argv, envp, 1);
1157 +}
1158 +
1159 +/* Disables fbcondecor on a virtual console; called with console sem held. */
1160 +int fbcon_decor_disable(struct vc_data *vc, unsigned char redraw)
1161 +{
1162 + struct fb_info* info;
1163 +
1164 + if (!vc->vc_decor.state)
1165 + return -EINVAL;
1166 +
1167 + info = registered_fb[(int) con2fb_map[vc->vc_num]];
1168 +
1169 + if (info == NULL)
1170 + return -EINVAL;
1171 +
1172 + vc->vc_decor.state = 0;
1173 + vc_resize(vc, info->var.xres / vc->vc_font.width,
1174 + info->var.yres / vc->vc_font.height);
1175 +
1176 + if (fg_console == vc->vc_num && redraw) {
1177 + redraw_screen(vc, 0);
1178 + update_region(vc, vc->vc_origin +
1179 + vc->vc_size_row * vc->vc_top,
1180 + vc->vc_size_row * (vc->vc_bottom - vc->vc_top) / 2);
1181 + }
1182 +
1183 + printk(KERN_INFO "fbcondecor: switched decor state to 'off' on console %d\n",
1184 + vc->vc_num);
1185 +
1186 + return 0;
1187 +}
1188 +
1189 +/* Enables fbcondecor on a virtual console; called with console sem held. */
1190 +static int fbcon_decor_enable(struct vc_data *vc)
1191 +{
1192 + struct fb_info* info;
1193 +
1194 + info = registered_fb[(int) con2fb_map[vc->vc_num]];
1195 +
1196 + if (vc->vc_decor.twidth == 0 || vc->vc_decor.theight == 0 ||
1197 + info == NULL || vc->vc_decor.state || (!info->bgdecor.data &&
1198 + vc->vc_num == fg_console))
1199 + return -EINVAL;
1200 +
1201 + vc->vc_decor.state = 1;
1202 + vc_resize(vc, vc->vc_decor.twidth / vc->vc_font.width,
1203 + vc->vc_decor.theight / vc->vc_font.height);
1204 +
1205 + if (fg_console == vc->vc_num) {
1206 + redraw_screen(vc, 0);
1207 + update_region(vc, vc->vc_origin +
1208 + vc->vc_size_row * vc->vc_top,
1209 + vc->vc_size_row * (vc->vc_bottom - vc->vc_top) / 2);
1210 + fbcon_decor_clear_margins(vc, info, 0);
1211 + }
1212 +
1213 + printk(KERN_INFO "fbcondecor: switched decor state to 'on' on console %d\n",
1214 + vc->vc_num);
1215 +
1216 + return 0;
1217 +}
1218 +
1219 +static inline int fbcon_decor_ioctl_dosetstate(struct vc_data *vc, unsigned int __user* state, unsigned char origin)
1220 +{
1221 + int tmp, ret;
1222 +
1223 + if (get_user(tmp, state))
1224 + return -EFAULT;
1225 +
1226 + if (origin == FBCON_DECOR_IO_ORIG_USER)
1227 + acquire_console_sem();
1228 + if (!tmp)
1229 + ret = fbcon_decor_disable(vc, 1);
1230 + else
1231 + ret = fbcon_decor_enable(vc);
1232 + if (origin == FBCON_DECOR_IO_ORIG_USER)
1233 + release_console_sem();
1234 +
1235 + return ret;
1236 +}
1237 +
1238 +static inline int fbcon_decor_ioctl_dogetstate(struct vc_data *vc, unsigned int __user *state)
1239 +{
1240 + return put_user(vc->vc_decor.state, (unsigned int __user*) state);
1241 +}
1242 +
1243 +static int fbcon_decor_ioctl_dosetcfg(struct vc_data *vc, struct vc_decor __user *arg, unsigned char origin)
1244 +{
1245 + struct vc_decor cfg;
1246 + struct fb_info *info;
1247 + int len;
1248 + char *tmp;
1249 +
1250 + info = registered_fb[(int) con2fb_map[vc->vc_num]];
1251 +
1252 + if (copy_from_user(&cfg, arg, sizeof(struct vc_decor)))
1253 + return -EFAULT;
1254 + if (info == NULL || !cfg.twidth || !cfg.theight ||
1255 + cfg.tx + cfg.twidth > info->var.xres ||
1256 + cfg.ty + cfg.theight > info->var.yres)
1257 + return -EINVAL;
1258 +
1259 + len = strlen_user(cfg.theme);
1260 + if (!len || len > FBCON_DECOR_THEME_LEN)
1261 + return -EINVAL;
1262 + tmp = kmalloc(len, GFP_KERNEL);
1263 + if (!tmp)
1264 + return -ENOMEM;
1265 + if (copy_from_user(tmp, (void __user *)cfg.theme, len))
1266 + return -EFAULT;
1267 + cfg.theme = tmp;
1268 + cfg.state = 0;
1269 +
1270 + /* If this ioctl is a response to a request from kernel, the console sem
1271 + * is already held; we also don't need to disable decor because either the
1272 + * new config and background picture will be successfully loaded, and the
1273 + * decor will stay on, or in case of a failure it'll be turned off in fbcon. */
1274 + if (origin == FBCON_DECOR_IO_ORIG_USER) {
1275 + acquire_console_sem();
1276 + if (vc->vc_decor.state)
1277 + fbcon_decor_disable(vc, 1);
1278 + }
1279 +
1280 + if (vc->vc_decor.theme)
1281 + kfree(vc->vc_decor.theme);
1282 +
1283 + vc->vc_decor = cfg;
1284 +
1285 + if (origin == FBCON_DECOR_IO_ORIG_USER)
1286 + release_console_sem();
1287 +
1288 + printk(KERN_INFO "fbcondecor: console %d using theme '%s'\n",
1289 + vc->vc_num, vc->vc_decor.theme);
1290 + return 0;
1291 +}
1292 +
1293 +static int fbcon_decor_ioctl_dogetcfg(struct vc_data *vc, struct vc_decor __user *arg)
1294 +{
1295 + struct vc_decor decor;
1296 + char __user *tmp;
1297 +
1298 + if (get_user(tmp, &arg->theme))
1299 + return -EFAULT;
1300 +
1301 + decor = vc->vc_decor;
1302 + decor.theme = tmp;
1303 +
1304 + if (vc->vc_decor.theme) {
1305 + if (copy_to_user(tmp, vc->vc_decor.theme, strlen(vc->vc_decor.theme) + 1))
1306 + return -EFAULT;
1307 + } else
1308 + if (put_user(0, tmp))
1309 + return -EFAULT;
1310 +
1311 + if (copy_to_user(arg, &decor, sizeof(struct vc_decor)))
1312 + return -EFAULT;
1313 +
1314 + return 0;
1315 +}
1316 +
1317 +static int fbcon_decor_ioctl_dosetpic(struct vc_data *vc, struct fb_image __user *arg, unsigned char origin)
1318 +{
1319 + struct fb_image img;
1320 + struct fb_info *info;
1321 + int len;
1322 + u8 *tmp;
1323 +
1324 + if (vc->vc_num != fg_console)
1325 + return -EINVAL;
1326 +
1327 + info = registered_fb[(int) con2fb_map[vc->vc_num]];
1328 +
1329 + if (info == NULL)
1330 + return -EINVAL;
1331 +
1332 + if (copy_from_user(&img, arg, sizeof(struct fb_image)))
1333 + return -EFAULT;
1334 +
1335 + if (img.width != info->var.xres || img.height != info->var.yres) {
1336 + printk(KERN_ERR "fbcondecor: picture dimensions mismatch\n");
1337 + return -EINVAL;
1338 + }
1339 +
1340 + if (img.depth != info->var.bits_per_pixel) {
1341 + printk(KERN_ERR "fbcondecor: picture depth mismatch\n");
1342 + return -EINVAL;
1343 + }
1344 +
1345 + if (img.depth == 8) {
1346 + if (!img.cmap.len || !img.cmap.red || !img.cmap.green ||
1347 + !img.cmap.blue)
1348 + return -EINVAL;
1349 +
1350 + tmp = vmalloc(img.cmap.len * 3 * 2);
1351 + if (!tmp)
1352 + return -ENOMEM;
1353 +
1354 + if (copy_from_user(tmp, (void __user*)img.cmap.red, img.cmap.len * 2) ||
1355 + copy_from_user(tmp + (img.cmap.len << 1),
1356 + (void __user*)img.cmap.green, (img.cmap.len << 1)) ||
1357 + copy_from_user(tmp + (img.cmap.len << 2),
1358 + (void __user*)img.cmap.blue, (img.cmap.len << 1))) {
1359 + vfree(tmp);
1360 + return -EFAULT;
1361 + }
1362 +
1363 + img.cmap.transp = NULL;
1364 + img.cmap.red = (u16*)tmp;
1365 + img.cmap.green = img.cmap.red + img.cmap.len;
1366 + img.cmap.blue = img.cmap.green + img.cmap.len;
1367 + } else {
1368 + img.cmap.red = NULL;
1369 + }
1370 +
1371 + len = ((img.depth + 7) >> 3) * img.width * img.height;
1372 + tmp = vmalloc(len);
1373 +
1374 + if (!tmp)
1375 + goto out;
1376 +
1377 + if (copy_from_user(tmp, (void __user*)img.data, len))
1378 + goto out;
1379 +
1380 + img.data = tmp;
1381 +
1382 + /* If this ioctl is a response to a request from kernel, the console sem
1383 + * is already held. */
1384 + if (origin == FBCON_DECOR_IO_ORIG_USER)
1385 + acquire_console_sem();
1386 +
1387 + if (info->bgdecor.data)
1388 + vfree((u8*)info->bgdecor.data);
1389 + if (info->bgdecor.cmap.red)
1390 + vfree(info->bgdecor.cmap.red);
1391 +
1392 + info->bgdecor = img;
1393 +
1394 + if (origin == FBCON_DECOR_IO_ORIG_USER)
1395 + release_console_sem();
1396 +
1397 + return 0;
1398 +
1399 +out: if (img.cmap.red)
1400 + vfree(img.cmap.red);
1401 + if (tmp)
1402 + vfree(tmp);
1403 + return -ENOMEM;
1404 +}
1405 +
1406 +static int fbcon_decor_ioctl(struct inode * inode, struct file *filp, u_int cmd,
1407 + u_long arg)
1408 +{
1409 + struct fbcon_decor_iowrapper __user *wrapper = (void __user*) arg;
1410 + struct vc_data *vc = NULL;
1411 + unsigned short vc_num = 0;
1412 + unsigned char origin = 0;
1413 + void __user *data = NULL;
1414 +
1415 + if (!access_ok(VERIFY_READ, wrapper,
1416 + sizeof(struct fbcon_decor_iowrapper)))
1417 + return -EFAULT;
1418 +
1419 + __get_user(vc_num, &wrapper->vc);
1420 + __get_user(origin, &wrapper->origin);
1421 + __get_user(data, &wrapper->data);
1422 +
1423 + if (!vc_cons_allocated(vc_num))
1424 + return -EINVAL;
1425 +
1426 + vc = vc_cons[vc_num].d;
1427 +
1428 + switch (cmd) {
1429 + case FBIOCONDECOR_SETPIC:
1430 + return fbcon_decor_ioctl_dosetpic(vc, (struct fb_image __user*)data, origin);
1431 + case FBIOCONDECOR_SETCFG:
1432 + return fbcon_decor_ioctl_dosetcfg(vc, (struct vc_decor*)data, origin);
1433 + case FBIOCONDECOR_GETCFG:
1434 + return fbcon_decor_ioctl_dogetcfg(vc, (struct vc_decor*)data);
1435 + case FBIOCONDECOR_SETSTATE:
1436 + return fbcon_decor_ioctl_dosetstate(vc, (unsigned int *)data, origin);
1437 + case FBIOCONDECOR_GETSTATE:
1438 + return fbcon_decor_ioctl_dogetstate(vc, (unsigned int *)data);
1439 + default:
1440 + return -ENOIOCTLCMD;
1441 + }
1442 +}
1443 +
1444 +static struct file_operations fbcon_decor_ops = {
1445 + .owner = THIS_MODULE,
1446 + .ioctl = fbcon_decor_ioctl
1447 +};
1448 +
1449 +static struct miscdevice fbcon_decor_dev = {
1450 + .minor = MISC_DYNAMIC_MINOR,
1451 + .name = "fbcondecor",
1452 + .fops = &fbcon_decor_ops
1453 +};
1454 +
1455 +void fbcon_decor_reset(void)
1456 +{
1457 + struct fb_info *info;
1458 + struct vc_data *vc;
1459 + int i;
1460 +
1461 + vc = vc_cons[0].d;
1462 + info = registered_fb[0];
1463 +
1464 + for (i = 0; i < num_registered_fb; i++) {
1465 + registered_fb[i]->bgdecor.data = NULL;
1466 + registered_fb[i]->bgdecor.cmap.red = NULL;
1467 + }
1468 +
1469 + for (i = 0; i < MAX_NR_CONSOLES && vc_cons[i].d; i++) {
1470 + vc_cons[i].d->vc_decor.state = vc_cons[i].d->vc_decor.twidth =
1471 + vc_cons[i].d->vc_decor.theight = 0;
1472 + vc_cons[i].d->vc_decor.theme = NULL;
1473 + }
1474 +
1475 + return;
1476 +}
1477 +
1478 +int fbcon_decor_init(void)
1479 +{
1480 + int i;
1481 +
1482 + fbcon_decor_reset();
1483 +
1484 + if (initialized)
1485 + return 0;
1486 +
1487 + i = misc_register(&fbcon_decor_dev);
1488 + if (i) {
1489 + printk(KERN_ERR "fbcondecor: failed to register device\n");
1490 + return i;
1491 + }
1492 +
1493 + fbcon_decor_call_helper("init", 0);
1494 + initialized = 1;
1495 + return 0;
1496 +}
1497 +
1498 +int fbcon_decor_exit(void)
1499 +{
1500 + fbcon_decor_reset();
1501 + return 0;
1502 +}
1503 +
1504 +EXPORT_SYMBOL(fbcon_decor_path);
1505 diff -Naurp -x .git /tmp/linux/drivers/video/console/fbcondecor.h ./drivers/video/console/fbcondecor.h
1506 --- /tmp/linux/drivers/video/console/fbcondecor.h 1970-01-01 01:00:00.000000000 +0100
1507 +++ ./drivers/video/console/fbcondecor.h 2008-03-25 23:04:10.000000000 +0100
1508 @@ -0,0 +1,78 @@
1509 +/*
1510 + * linux/drivers/video/console/fbcondecor.h -- Framebuffer Console Decoration headers
1511 + *
1512 + * Copyright (C) 2004 Michal Januszewski <spock@gentoo.org>
1513 + *
1514 + */
1515 +
1516 +#ifndef __FBCON_DECOR_H
1517 +#define __FBCON_DECOR_H
1518 +
1519 +#ifndef _LINUX_FB_H
1520 +#include <linux/fb.h>
1521 +#endif
1522 +
1523 +/* This is needed for vc_cons in fbcmap.c */
1524 +#include <linux/vt_kern.h>
1525 +
1526 +struct fb_cursor;
1527 +struct fb_info;
1528 +struct vc_data;
1529 +
1530 +#ifdef CONFIG_FB_CON_DECOR
1531 +/* fbcondecor.c */
1532 +int fbcon_decor_init(void);
1533 +int fbcon_decor_exit(void);
1534 +int fbcon_decor_call_helper(char* cmd, unsigned short cons);
1535 +int fbcon_decor_disable(struct vc_data *vc, unsigned char redraw);
1536 +
1537 +/* cfbcondecor.c */
1538 +void fbcon_decor_putcs(struct vc_data *vc, struct fb_info *info, const unsigned short *s, int count, int yy, int xx);
1539 +void fbcon_decor_cursor(struct fb_info *info, struct fb_cursor *cursor);
1540 +void fbcon_decor_clear(struct vc_data *vc, struct fb_info *info, int sy, int sx, int height, int width);
1541 +void fbcon_decor_clear_margins(struct vc_data *vc, struct fb_info *info, int bottom_only);
1542 +void fbcon_decor_blank(struct vc_data *vc, struct fb_info *info, int blank);
1543 +void fbcon_decor_bmove_redraw(struct vc_data *vc, struct fb_info *info, int y, int sx, int dx, int width);
1544 +void fbcon_decor_copy(u8 *dst, u8 *src, int height, int width, int linebytes, int srclinesbytes, int bpp);
1545 +void fbcon_decor_fix_pseudo_pal(struct fb_info *info, struct vc_data *vc);
1546 +
1547 +/* vt.c */
1548 +void acquire_console_sem(void);
1549 +void release_console_sem(void);
1550 +void do_unblank_screen(int entering_gfx);
1551 +
1552 +/* struct vc_data *y */
1553 +#define fbcon_decor_active_vc(y) (y->vc_decor.state && y->vc_decor.theme)
1554 +
1555 +/* struct fb_info *x, struct vc_data *y */
1556 +#define fbcon_decor_active_nores(x,y) (x->bgdecor.data && fbcon_decor_active_vc(y))
1557 +
1558 +/* struct fb_info *x, struct vc_data *y */
1559 +#define fbcon_decor_active(x,y) (fbcon_decor_active_nores(x,y) && \
1560 + x->bgdecor.width == x->var.xres && \
1561 + x->bgdecor.height == x->var.yres && \
1562 + x->bgdecor.depth == x->var.bits_per_pixel)
1563 +
1564 +
1565 +#else /* CONFIG_FB_CON_DECOR */
1566 +
1567 +static inline void fbcon_decor_putcs(struct vc_data *vc, struct fb_info *info, const unsigned short *s, int count, int yy, int xx) {}
1568 +static inline void fbcon_decor_putc(struct vc_data *vc, struct fb_info *info, int c, int ypos, int xpos) {}
1569 +static inline void fbcon_decor_cursor(struct fb_info *info, struct fb_cursor *cursor) {}
1570 +static inline void fbcon_decor_clear(struct vc_data *vc, struct fb_info *info, int sy, int sx, int height, int width) {}
1571 +static inline void fbcon_decor_clear_margins(struct vc_data *vc, struct fb_info *info, int bottom_only) {}
1572 +static inline void fbcon_decor_blank(struct vc_data *vc, struct fb_info *info, int blank) {}
1573 +static inline void fbcon_decor_bmove_redraw(struct vc_data *vc, struct fb_info *info, int y, int sx, int dx, int width) {}
1574 +static inline void fbcon_decor_fix_pseudo_pal(struct fb_info *info, struct vc_data *vc) {}
1575 +static inline int fbcon_decor_call_helper(char* cmd, unsigned short cons) { return 0; }
1576 +static inline int fbcon_decor_init(void) { return 0; }
1577 +static inline int fbcon_decor_exit(void) { return 0; }
1578 +static inline int fbcon_decor_disable(struct vc_data *vc, unsigned char redraw) { return 0; }
1579 +
1580 +#define fbcon_decor_active_vc(y) (0)
1581 +#define fbcon_decor_active_nores(x,y) (0)
1582 +#define fbcon_decor_active(x,y) (0)
1583 +
1584 +#endif /* CONFIG_FB_CON_DECOR */
1585 +
1586 +#endif /* __FBCON_DECOR_H */
1587 diff -Naurp -x .git /tmp/linux/drivers/video/console/Kconfig ./drivers/video/console/Kconfig
1588 --- /tmp/linux/drivers/video/console/Kconfig 2008-03-25 07:24:16.000000000 +0100
1589 +++ ./drivers/video/console/Kconfig 2008-03-25 23:04:10.000000000 +0100
1590 @@ -144,6 +144,19 @@ config FRAMEBUFFER_CONSOLE_ROTATION
1591 such that other users of the framebuffer will remain normally
1592 oriented.
1593
1594 +config FB_CON_DECOR
1595 + bool "Support for the Framebuffer Console Decorations"
1596 + depends on FRAMEBUFFER_CONSOLE=y && !FB_TILEBLITTING
1597 + default n
1598 + ---help---
1599 + This option enables support for framebuffer console decorations which
1600 + makes it possible to display images in the background of the system
1601 + consoles. Note that userspace utilities are necessary in order to take
1602 + advantage of these features. Refer to Documentation/fb/fbcondecor.txt
1603 + for more information.
1604 +
1605 + If unsure, say N.
1606 +
1607 config STI_CONSOLE
1608 bool "STI text console"
1609 depends on PARISC
1610 diff -Naurp -x .git /tmp/linux/drivers/video/console/Makefile ./drivers/video/console/Makefile
1611 --- /tmp/linux/drivers/video/console/Makefile 2008-03-25 07:24:16.000000000 +0100
1612 +++ ./drivers/video/console/Makefile 2008-03-25 23:04:10.000000000 +0100
1613 @@ -35,6 +35,7 @@ obj-$(CONFIG_FRAMEBUFFER_CONSOLE) +=
1614 fbcon_ccw.o
1615 endif
1616
1617 +obj-$(CONFIG_FB_CON_DECOR) += fbcondecor.o cfbcondecor.o
1618 obj-$(CONFIG_FB_STI) += sticore.o font.o
1619
1620 ifeq ($(CONFIG_USB_SISUSBVGA_CON),y)
1621 diff -Naurp -x .git /tmp/linux/drivers/video/fbcmap.c ./drivers/video/fbcmap.c
1622 --- /tmp/linux/drivers/video/fbcmap.c 2008-03-25 07:24:16.000000000 +0100
1623 +++ ./drivers/video/fbcmap.c 2008-03-25 23:04:10.000000000 +0100
1624 @@ -17,6 +17,8 @@
1625 #include <linux/slab.h>
1626 #include <linux/uaccess.h>
1627
1628 +#include "console/fbcondecor.h"
1629 +
1630 static u16 red2[] __read_mostly = {
1631 0x0000, 0xaaaa
1632 };
1633 @@ -234,14 +236,17 @@ int fb_set_cmap(struct fb_cmap *cmap, st
1634 if (transp)
1635 htransp = *transp++;
1636 if (info->fbops->fb_setcolreg(start++,
1637 - hred, hgreen, hblue,
1638 + hred, hgreen, hblue,
1639 htransp, info))
1640 break;
1641 }
1642 }
1643 - if (rc == 0)
1644 + if (rc == 0) {
1645 fb_copy_cmap(cmap, &info->cmap);
1646 -
1647 + if (fbcon_decor_active(info, vc_cons[fg_console].d) &&
1648 + info->fix.visual == FB_VISUAL_DIRECTCOLOR)
1649 + fbcon_decor_fix_pseudo_pal(info, vc_cons[fg_console].d);
1650 + }
1651 return rc;
1652 }
1653
1654 @@ -249,7 +254,7 @@ int fb_set_user_cmap(struct fb_cmap_user
1655 {
1656 int rc, size = cmap->len * sizeof(u16);
1657 struct fb_cmap umap;
1658 -
1659 +
1660 if (cmap->start < 0 || (!info->fbops->fb_setcolreg &&
1661 !info->fbops->fb_setcmap))
1662 return -EINVAL;
1663 diff -Naurp -x .git /tmp/linux/drivers/video/Kconfig ./drivers/video/Kconfig
1664 --- /tmp/linux/drivers/video/Kconfig 2008-03-25 07:24:16.000000000 +0100
1665 +++ ./drivers/video/Kconfig 2008-03-25 23:04:10.000000000 +0100
1666 @@ -1134,7 +1134,6 @@ config FB_MATROX
1667 select FB_CFB_FILLRECT
1668 select FB_CFB_COPYAREA
1669 select FB_CFB_IMAGEBLIT
1670 - select FB_TILEBLITTING
1671 select FB_MACMODES if PPC_PMAC
1672 ---help---
1673 Say Y here if you have a Matrox Millennium, Matrox Millennium II,
1674 diff -Naurp -x .git /tmp/linux/include/linux/console_decor.h ./include/linux/console_decor.h
1675 --- /tmp/linux/include/linux/console_decor.h 1970-01-01 01:00:00.000000000 +0100
1676 +++ ./include/linux/console_decor.h 2008-03-25 23:04:10.000000000 +0100
1677 @@ -0,0 +1,13 @@
1678 +#ifndef _LINUX_CONSOLE_DECOR_H_
1679 +#define _LINUX_CONSOLE_DECOR_H_ 1
1680 +
1681 +/* A structure used by the framebuffer console decorations (drivers/video/console/fbcondecor.c) */
1682 +struct vc_decor {
1683 + __u8 bg_color; /* The color that is to be treated as transparent */
1684 + __u8 state; /* Current decor state: 0 = off, 1 = on */
1685 + __u16 tx, ty; /* Top left corner coordinates of the text field */
1686 + __u16 twidth, theight; /* Width and height of the text field */
1687 + char* theme;
1688 +};
1689 +
1690 +#endif
1691 diff -Naurp -x .git /tmp/linux/include/linux/console_struct.h ./include/linux/console_struct.h
1692 --- /tmp/linux/include/linux/console_struct.h 2008-03-25 07:24:16.000000000 +0100
1693 +++ ./include/linux/console_struct.h 2008-03-25 23:04:10.000000000 +0100
1694 @@ -19,6 +19,7 @@
1695 struct vt_struct;
1696
1697 #define NPAR 16
1698 +#include <linux/console_decor.h>
1699
1700 struct vc_data {
1701 unsigned short vc_num; /* Console number */
1702 @@ -106,6 +107,8 @@ struct vc_data {
1703 struct vc_data **vc_display_fg; /* [!] Ptr to var holding fg console for this display */
1704 unsigned long vc_uni_pagedir;
1705 unsigned long *vc_uni_pagedir_loc; /* [!] Location of uni_pagedir variable for this console */
1706 +
1707 + struct vc_decor vc_decor;
1708 /* additional information is in vt_kern.h */
1709 };
1710
1711 diff -Naurp -x .git /tmp/linux/include/linux/fb.h ./include/linux/fb.h
1712 --- /tmp/linux/include/linux/fb.h 2008-03-25 07:24:16.000000000 +0100
1713 +++ ./include/linux/fb.h 2008-03-25 23:04:10.000000000 +0100
1714 @@ -11,6 +11,13 @@ struct dentry;
1715 #define FB_MAJOR 29
1716 #define FB_MAX 32 /* sufficient for now */
1717
1718 +struct fbcon_decor_iowrapper
1719 +{
1720 + unsigned short vc; /* Virtual console */
1721 + unsigned char origin; /* Point of origin of the request */
1722 + void *data;
1723 +};
1724 +
1725 /* ioctls
1726 0x46 is 'F' */
1727 #define FBIOGET_VSCREENINFO 0x4600
1728 @@ -38,7 +45,15 @@ struct dentry;
1729 #define FBIOGET_HWCINFO 0x4616
1730 #define FBIOPUT_MODEINFO 0x4617
1731 #define FBIOGET_DISPINFO 0x4618
1732 -
1733 +#define FBIOCONDECOR_SETCFG _IOWR('F', 0x19, struct fbcon_decor_iowrapper)
1734 +#define FBIOCONDECOR_GETCFG _IOR('F', 0x1A, struct fbcon_decor_iowrapper)
1735 +#define FBIOCONDECOR_SETSTATE _IOWR('F', 0x1B, struct fbcon_decor_iowrapper)
1736 +#define FBIOCONDECOR_GETSTATE _IOR('F', 0x1C, struct fbcon_decor_iowrapper)
1737 +#define FBIOCONDECOR_SETPIC _IOWR('F', 0x1D, struct fbcon_decor_iowrapper)
1738 +
1739 +#define FBCON_DECOR_THEME_LEN 128 /* Maximum lenght of a theme name */
1740 +#define FBCON_DECOR_IO_ORIG_KERNEL 0 /* Kernel ioctl origin */
1741 +#define FBCON_DECOR_IO_ORIG_USER 1 /* User ioctl origin */
1742
1743 #define FB_TYPE_PACKED_PIXELS 0 /* Packed Pixels */
1744 #define FB_TYPE_PLANES 1 /* Non interleaved planes */
1745 @@ -833,6 +848,9 @@ struct fb_info {
1746 #define FBINFO_STATE_SUSPENDED 1
1747 u32 state; /* Hardware state i.e suspend */
1748 void *fbcon_par; /* fbcon use-only private area */
1749 +
1750 + struct fb_image bgdecor;
1751 +
1752 /* From here on everything is device dependent */
1753 void *par;
1754 };
1755 diff -Naurp -x .git /tmp/linux/kernel/sysctl.c ./kernel/sysctl.c
1756 --- /tmp/linux/kernel/sysctl.c 2008-03-25 07:24:16.000000000 +0100
1757 +++ ./kernel/sysctl.c 2008-03-25 23:04:10.000000000 +0100
1758 @@ -107,6 +107,9 @@ static int ngroups_max = NGROUPS_MAX;
1759 #ifdef CONFIG_KMOD
1760 extern char modprobe_path[];
1761 #endif
1762 +#ifdef CONFIG_FB_CON_DECOR
1763 +extern char fbcon_decor_path[];
1764 +#endif
1765 #ifdef CONFIG_CHR_DEV_SG
1766 extern int sg_big_buff;
1767 #endif
1768 @@ -820,6 +823,18 @@ static struct ctl_table kern_table[] = {
1769 .proc_handler = &proc_dostring,
1770 .strategy = &sysctl_string,
1771 },
1772 +#ifdef CONFIG_FB_CON_DECOR
1773 + {
1774 + .ctl_name = CTL_UNNUMBERED,
1775 + .procname = "fbcondecor",
1776 + .data = &fbcon_decor_path,
1777 + .maxlen = KMOD_PATH_LEN,
1778 + .mode = 0644,
1779 + .proc_handler = &proc_dostring,
1780 + .strategy = &sysctl_string,
1781 + },
1782 +#endif
1783 +
1784 /*
1785 * NOTE: do not add new entries to this table unless you have read
1786 * Documentation/sysctl/ctl_unnumbered.txt

  ViewVC Help
Powered by ViewVC 1.1.20