1 diff -Nur linux-3.15.1.orig/Documentation/fb/00-INDEX linux-3.15.1/Documentation/fb/00-INDEX
2 --- linux-3.15.1.orig/Documentation/fb/00-INDEX 2014-06-16 22:44:27.000000000 +0200
3 +++ linux-3.15.1/Documentation/fb/00-INDEX 2014-06-28 11:21:19.000000000 +0200
5 - info on the driver for EP93xx LCD controller.
7 - intro to and usage guide for the framebuffer console (fbcon).
9 + - info on the Framebuffer Console Decoration
11 - introduction to frame buffer devices.
13 diff -Nur linux-3.15.1.orig/Documentation/fb/fbcondecor.txt linux-3.15.1/Documentation/fb/fbcondecor.txt
14 --- linux-3.15.1.orig/Documentation/fb/fbcondecor.txt 1970-01-01 01:00:00.000000000 +0100
15 +++ linux-3.15.1/Documentation/fb/fbcondecor.txt 2014-06-28 11:21:19.000000000 +0200
20 +The framebuffer decorations are a kernel feature which allows displaying a
21 +background picture on selected consoles.
23 +What do I need to get it to work?
24 +---------------------------------
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.
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.
36 +[1] The splashutils package can be downloaded from:
37 + http://github.com/alanhaggai/fbsplash
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.
49 +It's possible to set path to the fbcondecor helper by writing it to
50 +/proc/sys/kernel/fbcondecor.
52 +*****************************************************************************
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.
57 +The fbcondecor protocol
58 +-----------------------
60 +The fbcondecor protocol defines a communication interface between the kernel and
61 +the userspace fbcondecor helper.
63 +The kernel side is responsible for:
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
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.
75 +The fbcondecor protocol specifies how communication is done in both ways:
76 +kernel->userspace and userspace->helper.
81 +The kernel communicates with the userspace helper by calling it and specifying
82 +the task to be done in a series of arguments.
84 +The arguments follow the pattern:
85 +<fbcondecor protocol version> <command> <parameters>
87 +All commands defined in fbcondecor protocol v2 have the following parameters:
92 +Fbcondecor protocol v1 specified an additional 'fbcondecor mode' after the
93 +framebuffer number. Fbcondecor protocol v1 is deprecated and should not be used.
95 +Fbcondecor protocol v2 specifies the following commands:
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.
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.
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.
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.
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.
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.
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).
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.
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
152 +The framebuffer console decoration provides the following ioctls (all defined in
156 +description: loads a background picture for a virtual console
157 +argument: struct fbcon_decor_iowrapper*; data: struct fb_image*
159 +If called for consoles other than the current foreground one, the picture data
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.
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.
174 +description: gets the fbcondecor config for a virtual console
175 +argument: struct fbcon_decor_iowrapper*; data: struct vc_decor*
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.
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
187 +Info on used structures:
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.
195 +Definition of struct fbcon_decor_iowrapper can be found in linux/fb.h.
196 +The fields in this struct have the following meaning:
199 +Virtual console number.
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.
208 +Pointer to a data structure appropriate for the performed ioctl. Type of
209 +the data struct is specified in the ioctls description.
211 +*****************************************************************************
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>.
221 +Fbcondecor, fbcondecor protocol design, current implementation & docs by:
222 + Michal Januszewski <michalj+fbcondecor@gmail.com>
224 diff -Nur linux-3.15.1.orig/drivers/Makefile linux-3.15.1/drivers/Makefile
225 --- linux-3.15.1.orig/drivers/Makefile 2014-06-16 22:44:27.000000000 +0200
226 +++ linux-3.15.1/drivers/Makefile 2014-06-28 11:21:19.000000000 +0200
228 obj-$(CONFIG_PCI) += pci/
229 obj-$(CONFIG_PARISC) += parisc/
230 obj-$(CONFIG_RAPIDIO) += rapidio/
231 +# tty/ comes before char/ so that the VT console is the boot-time
239 # reset controllers early, since gpu drivers might rely on them to initialize
240 obj-$(CONFIG_RESET_CONTROLLER) += reset/
242 -# tty/ comes before char/ so that the VT console is the boot-time
247 # gpu/ comes after char for AGP vs DRM startup
250 diff -Nur linux-3.15.1.orig/drivers/video/console/Kconfig linux-3.15.1/drivers/video/console/Kconfig
251 --- linux-3.15.1.orig/drivers/video/console/Kconfig 2014-06-16 22:44:27.000000000 +0200
252 +++ linux-3.15.1/drivers/video/console/Kconfig 2014-06-28 11:21:19.000000000 +0200
254 such that other users of the framebuffer will remain normally
258 + bool "Support for the Framebuffer Console Decorations"
259 + depends on FRAMEBUFFER_CONSOLE=y && !FB_TILEBLITTING
262 + This option enables support for framebuffer console decorations which
263 + makes it possible to display images in the background of the system
264 + consoles. Note that userspace utilities are necessary in order to take
265 + advantage of these features. Refer to Documentation/fb/fbcondecor.txt
266 + for more information.
271 bool "STI text console"
273 diff -Nur linux-3.15.1.orig/drivers/video/console/Makefile linux-3.15.1/drivers/video/console/Makefile
274 --- linux-3.15.1.orig/drivers/video/console/Makefile 2014-06-16 22:44:27.000000000 +0200
275 +++ linux-3.15.1/drivers/video/console/Makefile 2014-06-28 11:21:19.000000000 +0200
280 +obj-$(CONFIG_FB_CON_DECOR) += fbcondecor.o cfbcondecor.o
281 obj-$(CONFIG_FB_STI) += sticore.o
282 diff -Nur linux-3.15.1.orig/drivers/video/console/bitblit.c linux-3.15.1/drivers/video/console/bitblit.c
283 --- linux-3.15.1.orig/drivers/video/console/bitblit.c 2014-06-16 22:44:27.000000000 +0200
284 +++ linux-3.15.1/drivers/video/console/bitblit.c 2014-06-28 11:21:19.000000000 +0200
286 #include <linux/console.h>
287 #include <asm/types.h>
289 +#include "fbcondecor.h"
292 * Accelerated handlers.
294 area.height = height * vc->vc_font.height;
295 area.width = width * vc->vc_font.width;
297 + if (fbcon_decor_active(info, vc)) {
298 + area.sx += vc->vc_decor.tx;
299 + area.sy += vc->vc_decor.ty;
300 + area.dx += vc->vc_decor.tx;
301 + area.dy += vc->vc_decor.ty;
304 info->fbops->fb_copyarea(info, &area);
307 @@ -380,11 +388,15 @@
308 cursor.image.depth = 1;
309 cursor.rop = ROP_XOR;
311 - if (info->fbops->fb_cursor)
312 - err = info->fbops->fb_cursor(info, &cursor);
313 + if (fbcon_decor_active(info, vc)) {
314 + fbcon_decor_cursor(info, &cursor);
316 + if (info->fbops->fb_cursor)
317 + err = info->fbops->fb_cursor(info, &cursor);
320 - soft_cursor(info, &cursor);
322 + soft_cursor(info, &cursor);
325 ops->cursor_reset = 0;
327 diff -Nur linux-3.15.1.orig/drivers/video/console/cfbcondecor.c linux-3.15.1/drivers/video/console/cfbcondecor.c
328 --- linux-3.15.1.orig/drivers/video/console/cfbcondecor.c 1970-01-01 01:00:00.000000000 +0100
329 +++ linux-3.15.1/drivers/video/console/cfbcondecor.c 2014-06-28 11:21:19.000000000 +0200
332 + * linux/drivers/video/cfbcon_decor.c -- Framebuffer decor render functions
334 + * Copyright (C) 2004 Michal Januszewski <michalj+fbcondecor@gmail.com>
336 + * Code based upon "Bootdecor" (C) 2001-2003
337 + * Volker Poplawski <volker@poplawski.de>,
338 + * Stefan Reinauer <stepan@suse.de>,
339 + * Steffen Winterfeldt <snwint@suse.de>,
340 + * Michael Schroeder <mls@suse.de>,
341 + * Ken Wimer <wimer@suse.de>.
343 + * This file is subject to the terms and conditions of the GNU General Public
344 + * License. See the file COPYING in the main directory of this archive for
347 +#include <linux/module.h>
348 +#include <linux/types.h>
349 +#include <linux/fb.h>
350 +#include <linux/selection.h>
351 +#include <linux/slab.h>
352 +#include <linux/vt_kern.h>
353 +#include <asm/irq.h>
356 +#include "fbcondecor.h"
358 +#define parse_pixel(shift,bpp,type) \
360 + if (d & (0x80 >> (shift))) \
361 + dd2[(shift)] = fgx; \
363 + dd2[(shift)] = transparent ? *(type *)decor_src : bgx; \
364 + decor_src += (bpp); \
367 +extern int get_color(struct vc_data *vc, struct fb_info *info,
370 +void fbcon_decor_fix_pseudo_pal(struct fb_info *info, struct vc_data *vc)
373 + int minlen = min(min(info->var.red.length, info->var.green.length),
374 + info->var.blue.length);
377 + for (j = i = 0; i < 16; i++) {
378 + k = color_table[i];
380 + col = ((vc->vc_palette[j++] >> (8-minlen))
381 + << info->var.red.offset);
382 + col |= ((vc->vc_palette[j++] >> (8-minlen))
383 + << info->var.green.offset);
384 + col |= ((vc->vc_palette[j++] >> (8-minlen))
385 + << info->var.blue.offset);
386 + ((u32 *)info->pseudo_palette)[k] = col;
390 +void fbcon_decor_renderc(struct fb_info *info, int ypos, int xpos, int height,
391 + int width, u8* src, u32 fgx, u32 bgx, u8 transparent)
395 + int bytespp = ((info->var.bits_per_pixel + 7) >> 3);
396 + unsigned int d = ypos * info->fix.line_length + xpos * bytespp;
397 + unsigned int ds = (ypos * info->var.xres + xpos) * bytespp;
400 + u8* decor_src = (u8 *)(info->bgdecor.data + ds);
401 + u8* dst = (u8 *)(info->screen_base + d);
403 + if ((ypos + height) > info->var.yres || (xpos + width) > info->var.xres)
406 + for (y = 0; y < height; y++) {
407 + switch (info->var.bits_per_pixel) {
410 + for (x = 0; x < width; x++) {
418 + *(u32 *)decor_src : bgx;
422 + fb_writel(dd, dst);
427 + for (x = 0; x < width; x++) {
435 + (*(u32 *)decor_src & 0xffffff) : bgx;
439 +#ifdef __LITTLE_ENDIAN
440 + fb_writew(dd & 0xffff, dst);
442 + fb_writeb((dd >> 16), dst);
444 + fb_writew(dd >> 8, dst);
446 + fb_writeb(dd & 0xff, dst);
452 + for (x = 0; x < width; x += 2) {
456 + parse_pixel(0, 2, u16);
457 + parse_pixel(1, 2, u16);
458 +#ifdef __LITTLE_ENDIAN
459 + dd = dd2[0] | (dd2[1] << 16);
461 + dd = dd2[1] | (dd2[0] << 16);
464 + fb_writel(dd, dst);
470 + for (x = 0; x < width; x += 4) {
474 + parse_pixel(0, 1, u8);
475 + parse_pixel(1, 1, u8);
476 + parse_pixel(2, 1, u8);
477 + parse_pixel(3, 1, u8);
479 +#ifdef __LITTLE_ENDIAN
480 + dd = dd2[0] | (dd2[1] << 8) | (dd2[2] << 16) | (dd2[3] << 24);
482 + dd = dd2[3] | (dd2[2] << 8) | (dd2[1] << 16) | (dd2[0] << 24);
485 + fb_writel(dd, dst);
490 + dst += info->fix.line_length - width * bytespp;
491 + decor_src += (info->var.xres - width) * bytespp;
496 + ((info->fix.visual == FB_VISUAL_TRUECOLOR || \
497 + info->fix.visual == FB_VISUAL_DIRECTCOLOR) ? \
498 + ((u32*)info->pseudo_palette)[a] : a)
500 +void fbcon_decor_putcs(struct vc_data *vc, struct fb_info *info,
501 + const unsigned short *s, int count, int yy, int xx)
503 + unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff;
504 + struct fbcon_ops *ops = info->fbcon_par;
505 + int fg_color, bg_color, transparent;
508 + u16 c = scr_readw(s);
510 + fg_color = get_color(vc, info, c, 1);
511 + bg_color = get_color(vc, info, c, 0);
513 + /* Don't paint the background image if console is blanked */
514 + transparent = ops->blank_state ? 0 :
515 + (vc->vc_decor.bg_color == bg_color);
517 + xx = xx * vc->vc_font.width + vc->vc_decor.tx;
518 + yy = yy * vc->vc_font.height + vc->vc_decor.ty;
520 + fgx = cc2cx(fg_color);
521 + bgx = cc2cx(bg_color);
524 + c = scr_readw(s++);
525 + src = vc->vc_font.data + (c & charmask) * vc->vc_font.height *
526 + ((vc->vc_font.width + 7) >> 3);
528 + fbcon_decor_renderc(info, yy, xx, vc->vc_font.height,
529 + vc->vc_font.width, src, fgx, bgx, transparent);
530 + xx += vc->vc_font.width;
534 +void fbcon_decor_cursor(struct fb_info *info, struct fb_cursor *cursor)
537 + unsigned int dsize, s_pitch;
538 + struct fbcon_ops *ops = info->fbcon_par;
539 + struct vc_data* vc;
542 + /* we really don't need any cursors while the console is blanked */
543 + if (info->state != FBINFO_STATE_RUNNING || ops->blank_state)
546 + vc = vc_cons[ops->currcon].d;
548 + src = kmalloc(64 + sizeof(struct fb_image), GFP_ATOMIC);
552 + s_pitch = (cursor->image.width + 7) >> 3;
553 + dsize = s_pitch * cursor->image.height;
554 + if (cursor->enable) {
555 + switch (cursor->rop) {
557 + for (i = 0; i < dsize; i++)
558 + src[i] = cursor->image.data[i] ^ cursor->mask[i];
562 + for (i = 0; i < dsize; i++)
563 + src[i] = cursor->image.data[i] & cursor->mask[i];
567 + memcpy(src, cursor->image.data, dsize);
569 + fbcon_decor_renderc(info,
570 + cursor->image.dy + vc->vc_decor.ty,
571 + cursor->image.dx + vc->vc_decor.tx,
572 + cursor->image.height,
573 + cursor->image.width,
575 + cc2cx(cursor->image.fg_color),
576 + cc2cx(cursor->image.bg_color),
577 + cursor->image.bg_color == vc->vc_decor.bg_color);
582 +static void decorset(u8 *dst, int height, int width, int dstbytes,
589 + if (bpp == 16 || bpp == 8)
592 + while (height-- > 0) {
598 + for (i=0; i < width; i++) {
599 + fb_writel(bgx, p); p += 4;
603 + for (i=0; i < width; i++) {
604 +#ifdef __LITTLE_ENDIAN
605 + fb_writew((bgx & 0xffff),(u16*)p); p += 2;
606 + fb_writeb((bgx >> 16),p++);
608 + fb_writew((bgx >> 8),(u16*)p); p += 2;
609 + fb_writeb((bgx & 0xff),p++);
613 + for (i=0; i < width/4; i++) {
614 + fb_writel(bgx,p); p += 4;
615 + fb_writel(bgx,p); p += 4;
618 + fb_writel(bgx,p); p += 4;
621 + fb_writew(bgx,(u16*)p);
624 + for (i=0; i < width/4; i++) {
625 + fb_writel(bgx,p); p += 4;
629 + fb_writew(bgx,p); p += 2;
632 + fb_writeb(bgx,(u8*)p);
640 +void fbcon_decor_copy(u8 *dst, u8 *src, int height, int width, int linebytes,
641 + int srclinebytes, int bpp)
645 + while (height-- > 0) {
646 + u32 *p = (u32 *)dst;
647 + u32 *q = (u32 *)src;
652 + for (i=0; i < width; i++)
653 + fb_writel(*q++, p++);
656 + for (i=0; i < (width*3/4); i++)
657 + fb_writel(*q++, p++);
658 + if ((width*3) % 4) {
660 + fb_writeb(*(u8*)q, (u8*)p);
661 + } else if (width & 1) {
662 + fb_writew(*(u16*)q, (u16*)p);
663 + fb_writeb(*(u8*)((u16*)q+1),(u8*)((u16*)p+2));
668 + for (i=0; i < width/4; i++) {
669 + fb_writel(*q++, p++);
670 + fb_writel(*q++, p++);
673 + fb_writel(*q++, p++);
675 + fb_writew(*(u16*)q, (u16*)p);
678 + for (i=0; i < width/4; i++)
679 + fb_writel(*q++, p++);
682 + fb_writew(*(u16*)q, (u16*)p);
683 + q = (u32*) ((u16*)q + 1);
684 + p = (u32*) ((u16*)p + 1);
687 + fb_writeb(*(u8*)q, (u8*)p);
692 + src += srclinebytes;
696 +static void decorfill(struct fb_info *info, int sy, int sx, int height,
699 + int bytespp = ((info->var.bits_per_pixel + 7) >> 3);
700 + int d = sy * info->fix.line_length + sx * bytespp;
701 + int ds = (sy * info->var.xres + sx) * bytespp;
703 + fbcon_decor_copy((u8 *)(info->screen_base + d), (u8 *)(info->bgdecor.data + ds),
704 + height, width, info->fix.line_length, info->var.xres * bytespp,
705 + info->var.bits_per_pixel);
708 +void fbcon_decor_clear(struct vc_data *vc, struct fb_info *info, int sy, int sx,
709 + int height, int width)
711 + int bgshift = (vc->vc_hi_font_mask) ? 13 : 12;
712 + struct fbcon_ops *ops = info->fbcon_par;
714 + int transparent, bg_color = attr_bgcol_ec(bgshift, vc, info);
716 + transparent = (vc->vc_decor.bg_color == bg_color);
717 + sy = sy * vc->vc_font.height + vc->vc_decor.ty;
718 + sx = sx * vc->vc_font.width + vc->vc_decor.tx;
719 + height *= vc->vc_font.height;
720 + width *= vc->vc_font.width;
722 + /* Don't paint the background image if console is blanked */
723 + if (transparent && !ops->blank_state) {
724 + decorfill(info, sy, sx, height, width);
726 + dst = (u8 *)(info->screen_base + sy * info->fix.line_length +
727 + sx * ((info->var.bits_per_pixel + 7) >> 3));
728 + decorset(dst, height, width, info->fix.line_length, cc2cx(bg_color),
729 + info->var.bits_per_pixel);
733 +void fbcon_decor_clear_margins(struct vc_data *vc, struct fb_info *info,
736 + unsigned int tw = vc->vc_cols*vc->vc_font.width;
737 + unsigned int th = vc->vc_rows*vc->vc_font.height;
739 + if (!bottom_only) {
741 + decorfill(info, 0, 0, vc->vc_decor.ty, info->var.xres);
743 + decorfill(info, vc->vc_decor.ty, 0, th, vc->vc_decor.tx);
745 + decorfill(info, vc->vc_decor.ty, vc->vc_decor.tx + tw, th,
746 + info->var.xres - vc->vc_decor.tx - tw);
748 + decorfill(info, vc->vc_decor.ty + th, 0,
749 + info->var.yres - vc->vc_decor.ty - th, info->var.xres);
752 +void fbcon_decor_bmove_redraw(struct vc_data *vc, struct fb_info *info, int y,
753 + int sx, int dx, int width)
755 + u16 *d = (u16 *) (vc->vc_origin + vc->vc_size_row * y + dx * 2);
756 + u16 *s = d + (dx - sx);
759 + u16 *le = d + width;
766 + if (attr != (c & 0xff00)) {
769 + fbcon_decor_putcs(vc, info, start, d - start, y, x);
774 + if (s >= ls && s < le && c == scr_readw(s)) {
776 + fbcon_decor_putcs(vc, info, start, d - start, y, x);
777 + x += d - start + 1;
788 + fbcon_decor_putcs(vc, info, start, d - start, y, x);
791 +void fbcon_decor_blank(struct vc_data *vc, struct fb_info *info, int blank)
794 + decorset((u8 *)info->screen_base, info->var.yres, info->var.xres,
795 + info->fix.line_length, 0, info->var.bits_per_pixel);
798 + fbcon_decor_clear_margins(vc, info, 0);
802 diff -Nur linux-3.15.1.orig/drivers/video/console/fbcon.c linux-3.15.1/drivers/video/console/fbcon.c
803 --- linux-3.15.1.orig/drivers/video/console/fbcon.c 2014-06-16 22:44:27.000000000 +0200
804 +++ linux-3.15.1/drivers/video/console/fbcon.c 2014-06-28 11:21:19.000000000 +0200
809 +#include "fbcondecor.h"
812 # define DPRINTK(fmt, args...) printk(KERN_DEBUG "%s: " fmt, __func__ , ## args)
815 static struct display fb_display[MAX_NR_CONSOLES];
817 -static signed char con2fb_map[MAX_NR_CONSOLES];
818 +signed char con2fb_map[MAX_NR_CONSOLES];
819 static signed char con2fb_map_boot[MAX_NR_CONSOLES];
821 static int logo_lines;
823 !vt_force_oops_output(vc);
826 -static int get_color(struct vc_data *vc, struct fb_info *info,
827 +int get_color(struct vc_data *vc, struct fb_info *info,
830 int depth = fb_get_color_depth(&info->var, &info->fix);
834 fbcon_has_console_bind = 1;
835 +#ifdef CONFIG_FB_CON_DECOR
836 + fbcon_decor_init();
841 @@ -1007,6 +1011,12 @@
842 rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres);
843 cols /= vc->vc_font.width;
844 rows /= vc->vc_font.height;
846 + if (fbcon_decor_active(info, vc)) {
847 + cols = vc->vc_decor.twidth / vc->vc_font.width;
848 + rows = vc->vc_decor.theight / vc->vc_font.height;
851 vc_resize(vc, cols, rows);
853 DPRINTK("mode: %s\n", info->fix.id);
854 @@ -1036,7 +1046,7 @@
857 if (vc != svc || logo_shown == FBCON_LOGO_DONTSHOW ||
858 - (info->fix.type == FB_TYPE_TEXT))
859 + (info->fix.type == FB_TYPE_TEXT) || fbcon_decor_active(info, vc))
862 if (var_to_display(p, &info->var, info))
863 @@ -1260,6 +1270,11 @@
864 fbcon_clear_margins(vc, 0);
867 + if (fbcon_decor_active(info, vc)) {
868 + fbcon_decor_clear(vc, info, sy, sx, height, width);
872 /* Split blits that cross physical y_wrap boundary */
874 y_break = p->vrows - p->yscroll;
875 @@ -1279,10 +1294,15 @@
876 struct display *p = &fb_display[vc->vc_num];
877 struct fbcon_ops *ops = info->fbcon_par;
879 - if (!fbcon_is_inactive(vc, info))
880 - ops->putcs(vc, info, s, count, real_y(p, ypos), xpos,
881 - get_color(vc, info, scr_readw(s), 1),
882 - get_color(vc, info, scr_readw(s), 0));
883 + if (!fbcon_is_inactive(vc, info)) {
885 + if (fbcon_decor_active(info, vc))
886 + fbcon_decor_putcs(vc, info, s, count, ypos, xpos);
888 + ops->putcs(vc, info, s, count, real_y(p, ypos), xpos,
889 + get_color(vc, info, scr_readw(s), 1),
890 + get_color(vc, info, scr_readw(s), 0));
894 static void fbcon_putc(struct vc_data *vc, int c, int ypos, int xpos)
895 @@ -1298,8 +1318,13 @@
896 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
897 struct fbcon_ops *ops = info->fbcon_par;
899 - if (!fbcon_is_inactive(vc, info))
900 - ops->clear_margins(vc, info, bottom_only);
901 + if (!fbcon_is_inactive(vc, info)) {
902 + if (fbcon_decor_active(info, vc)) {
903 + fbcon_decor_clear_margins(vc, info, bottom_only);
905 + ops->clear_margins(vc, info, bottom_only);
910 static void fbcon_cursor(struct vc_data *vc, int mode)
911 @@ -1819,7 +1844,7 @@
914 fbcon_softback_note(vc, t, count);
915 - if (logo_shown >= 0)
916 + if (logo_shown >= 0 || fbcon_decor_active(info, vc))
918 switch (p->scrollmode) {
920 @@ -1912,6 +1937,8 @@
924 + if (fbcon_decor_active(info, vc))
926 switch (p->scrollmode) {
928 fbcon_redraw_blit(vc, info, p, b - 1, b - t - count,
929 @@ -2060,6 +2087,13 @@
934 + if (fbcon_decor_active(info, vc) && sy == dy && height == 1) {
935 + /* must use slower redraw bmove to keep background pic intact */
936 + fbcon_decor_bmove_redraw(vc, info, sy, sx, dx, width);
940 ops->bmove(vc, info, real_y(p, sy), sx, real_y(p, dy), dx,
943 @@ -2130,8 +2164,8 @@
944 var.yres = virt_h * virt_fh;
945 x_diff = info->var.xres - var.xres;
946 y_diff = info->var.yres - var.yres;
947 - if (x_diff < 0 || x_diff > virt_fw ||
948 - y_diff < 0 || y_diff > virt_fh) {
949 + if ((x_diff < 0 || x_diff > virt_fw ||
950 + y_diff < 0 || y_diff > virt_fh) && !vc->vc_decor.state) {
951 const struct fb_videomode *mode;
953 DPRINTK("attempting resize %ix%i\n", var.xres, var.yres);
954 @@ -2167,6 +2201,21 @@
956 info = registered_fb[con2fb_map[vc->vc_num]];
957 ops = info->fbcon_par;
958 + prev_console = ops->currcon;
959 + if (prev_console != -1)
960 + old_info = registered_fb[con2fb_map[prev_console]];
962 +#ifdef CONFIG_FB_CON_DECOR
963 + if (!fbcon_decor_active_vc(vc) && info->fix.visual == FB_VISUAL_DIRECTCOLOR) {
964 + struct vc_data *vc_curr = vc_cons[prev_console].d;
965 + if (vc_curr && fbcon_decor_active_vc(vc_curr)) {
966 + /* Clear the screen to avoid displaying funky colors during
967 + * palette updates. */
968 + memset((u8*)info->screen_base + info->fix.line_length * info->var.yoffset,
969 + 0, info->var.yres * info->fix.line_length);
976 @@ -2185,9 +2234,6 @@
977 logo_shown = FBCON_LOGO_CANSHOW;
980 - prev_console = ops->currcon;
981 - if (prev_console != -1)
982 - old_info = registered_fb[con2fb_map[prev_console]];
984 * FIXME: If we have multiple fbdev's loaded, we need to
985 * update all info->currcon. Perhaps, we can place this
986 @@ -2231,6 +2277,18 @@
987 fbcon_del_cursor_timer(old_info);
990 + if (fbcon_decor_active_vc(vc)) {
991 + struct vc_data *vc_curr = vc_cons[prev_console].d;
993 + if (!vc_curr->vc_decor.theme ||
994 + strcmp(vc->vc_decor.theme, vc_curr->vc_decor.theme) ||
995 + (fbcon_decor_active_nores(info, vc_curr) &&
996 + !fbcon_decor_active(info, vc_curr))) {
997 + fbcon_decor_disable(vc, 0);
998 + fbcon_decor_call_helper("modechange", vc->vc_num);
1002 if (fbcon_is_inactive(vc, info) ||
1003 ops->blank_state != FB_BLANK_UNBLANK)
1004 fbcon_del_cursor_timer(info);
1005 @@ -2339,15 +2397,20 @@
1009 - if (!fbcon_is_inactive(vc, info)) {
1010 + if (!fbcon_is_inactive(vc, info)) {
1011 if (ops->blank_state != blank) {
1012 ops->blank_state = blank;
1013 fbcon_cursor(vc, blank ? CM_ERASE : CM_DRAW);
1014 ops->cursor_flash = (!blank);
1016 - if (!(info->flags & FBINFO_MISC_USEREVENT))
1017 - if (fb_blank(info, blank))
1018 - fbcon_generic_blank(vc, info, blank);
1019 + if (!(info->flags & FBINFO_MISC_USEREVENT)) {
1020 + if (fb_blank(info, blank)) {
1021 + if (fbcon_decor_active(info, vc))
1022 + fbcon_decor_blank(vc, info, blank);
1024 + fbcon_generic_blank(vc, info, blank);
1030 @@ -2522,13 +2585,22 @@
1034 + /* reset wrap/pan */
1037 cols = FBCON_SWAP(ops->rotate, info->var.xres, info->var.yres);
1038 rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres);
1040 + if (fbcon_decor_active(info, vc)) {
1041 + info->var.xoffset = info->var.yoffset = p->yscroll = 0;
1042 + cols = vc->vc_decor.twidth;
1043 + rows = vc->vc_decor.theight;
1048 vc_resize(vc, cols, rows);
1050 if (CON_IS_VISIBLE(vc) && softback_buf)
1051 fbcon_update_softback(vc);
1052 } else if (CON_IS_VISIBLE(vc)
1053 @@ -2657,7 +2729,11 @@
1057 - if (fbcon_is_inactive(vc, info))
1058 + if (fbcon_is_inactive(vc, info)
1059 +#ifdef CONFIG_FB_CON_DECOR
1060 + || vc->vc_num != fg_console
1065 if (!CON_IS_VISIBLE(vc))
1066 @@ -2683,14 +2759,56 @@
1068 fb_copy_cmap(fb_default_cmap(1 << depth), &palette_cmap);
1070 - return fb_set_cmap(&palette_cmap, info);
1071 + if (fbcon_decor_active(info, vc_cons[fg_console].d) &&
1072 + info->fix.visual == FB_VISUAL_DIRECTCOLOR) {
1074 + u16 *red, *green, *blue;
1075 + int minlen = min(min(info->var.red.length, info->var.green.length),
1076 + info->var.blue.length);
1079 + struct fb_cmap cmap = {
1081 + .len = (1 << minlen),
1088 + red = kmalloc(256 * sizeof(u16) * 3, GFP_KERNEL);
1093 + green = red + 256;
1094 + blue = green + 256;
1096 + cmap.green = green;
1099 + for (i = 0; i < cmap.len; i++) {
1100 + red[i] = green[i] = blue[i] = (0xffff * i)/(cmap.len-1);
1103 + h = fb_set_cmap(&cmap, info);
1104 + fbcon_decor_fix_pseudo_pal(info, vc_cons[fg_console].d);
1109 + } else if (fbcon_decor_active(info, vc_cons[fg_console].d) &&
1110 + info->var.bits_per_pixel == 8 && info->bgdecor.cmap.red != NULL)
1111 + fb_set_cmap(&info->bgdecor.cmap, info);
1113 +out: return fb_set_cmap(&palette_cmap, info);
1116 static u16 *fbcon_screen_pos(struct vc_data *vc, int offset)
1122 if (vc->vc_num != fg_console || !softback_lines)
1123 return (u16 *) (vc->vc_origin + offset);
1124 line = offset / vc->vc_size_row;
1125 @@ -2909,7 +3027,14 @@
1126 rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres);
1127 cols /= vc->vc_font.width;
1128 rows /= vc->vc_font.height;
1129 - vc_resize(vc, cols, rows);
1131 + if (!fbcon_decor_active_nores(info, vc)) {
1132 + vc_resize(vc, cols, rows);
1134 + fbcon_decor_disable(vc, 0);
1135 + fbcon_decor_call_helper("modechange", vc->vc_num);
1138 updatescrollmode(p, info, vc);
1140 scrollback_current = 0;
1141 @@ -2954,7 +3079,9 @@
1142 rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres);
1143 cols /= vc->vc_font.width;
1144 rows /= vc->vc_font.height;
1145 - vc_resize(vc, cols, rows);
1146 + if (!fbcon_decor_active_nores(info, vc)) {
1147 + vc_resize(vc, cols, rows);
1152 @@ -3596,6 +3723,7 @@
1156 + fbcon_decor_exit();
1157 fbcon_has_exited = 1;
1160 diff -Nur linux-3.15.1.orig/drivers/video/console/fbcondecor.c linux-3.15.1/drivers/video/console/fbcondecor.c
1161 --- linux-3.15.1.orig/drivers/video/console/fbcondecor.c 1970-01-01 01:00:00.000000000 +0100
1162 +++ linux-3.15.1/drivers/video/console/fbcondecor.c 2014-06-28 11:21:19.000000000 +0200
1165 + * linux/drivers/video/console/fbcondecor.c -- Framebuffer console decorations
1167 + * Copyright (C) 2004-2009 Michal Januszewski <michalj+fbcondecor@gmail.com>
1169 + * Code based upon "Bootsplash" (C) 2001-2003
1170 + * Volker Poplawski <volker@poplawski.de>,
1171 + * Stefan Reinauer <stepan@suse.de>,
1172 + * Steffen Winterfeldt <snwint@suse.de>,
1173 + * Michael Schroeder <mls@suse.de>,
1174 + * Ken Wimer <wimer@suse.de>.
1176 + * Compat ioctl support by Thorsten Klein <TK@Thorsten-Klein.de>.
1178 + * This file is subject to the terms and conditions of the GNU General Public
1179 + * License. See the file COPYING in the main directory of this archive for
1183 +#include <linux/module.h>
1184 +#include <linux/kernel.h>
1185 +#include <linux/string.h>
1186 +#include <linux/types.h>
1187 +#include <linux/fb.h>
1188 +#include <linux/vt_kern.h>
1189 +#include <linux/vmalloc.h>
1190 +#include <linux/unistd.h>
1191 +#include <linux/syscalls.h>
1192 +#include <linux/init.h>
1193 +#include <linux/proc_fs.h>
1194 +#include <linux/workqueue.h>
1195 +#include <linux/kmod.h>
1196 +#include <linux/miscdevice.h>
1197 +#include <linux/device.h>
1198 +#include <linux/fs.h>
1199 +#include <linux/compat.h>
1200 +#include <linux/console.h>
1202 +#include <asm/uaccess.h>
1203 +#include <asm/irq.h>
1206 +#include "fbcondecor.h"
1208 +extern signed char con2fb_map[];
1209 +static int fbcon_decor_enable(struct vc_data *vc);
1210 +char fbcon_decor_path[KMOD_PATH_LEN] = "/sbin/fbcondecor_helper";
1211 +static int initialized = 0;
1213 +int fbcon_decor_call_helper(char* cmd, unsigned short vc)
1217 + "PATH=/sbin:/bin",
1223 + unsigned char fb = (int) con2fb_map[vc];
1231 + vc_cons[vc].d->vc_decor.theme,
1235 + snprintf(tfb,5,"%d",fb);
1236 + snprintf(tcons,5,"%d",vc);
1238 + return call_usermodehelper(fbcon_decor_path, argv, envp, UMH_WAIT_EXEC);
1241 +/* Disables fbcondecor on a virtual console; called with console sem held. */
1242 +int fbcon_decor_disable(struct vc_data *vc, unsigned char redraw)
1244 + struct fb_info* info;
1246 + if (!vc->vc_decor.state)
1249 + info = registered_fb[(int) con2fb_map[vc->vc_num]];
1254 + vc->vc_decor.state = 0;
1255 + vc_resize(vc, info->var.xres / vc->vc_font.width,
1256 + info->var.yres / vc->vc_font.height);
1258 + if (fg_console == vc->vc_num && redraw) {
1259 + redraw_screen(vc, 0);
1260 + update_region(vc, vc->vc_origin +
1261 + vc->vc_size_row * vc->vc_top,
1262 + vc->vc_size_row * (vc->vc_bottom - vc->vc_top) / 2);
1265 + printk(KERN_INFO "fbcondecor: switched decor state to 'off' on console %d\n",
1271 +/* Enables fbcondecor on a virtual console; called with console sem held. */
1272 +static int fbcon_decor_enable(struct vc_data *vc)
1274 + struct fb_info* info;
1276 + info = registered_fb[(int) con2fb_map[vc->vc_num]];
1278 + if (vc->vc_decor.twidth == 0 || vc->vc_decor.theight == 0 ||
1279 + info == NULL || vc->vc_decor.state || (!info->bgdecor.data &&
1280 + vc->vc_num == fg_console))
1283 + vc->vc_decor.state = 1;
1284 + vc_resize(vc, vc->vc_decor.twidth / vc->vc_font.width,
1285 + vc->vc_decor.theight / vc->vc_font.height);
1287 + if (fg_console == vc->vc_num) {
1288 + redraw_screen(vc, 0);
1289 + update_region(vc, vc->vc_origin +
1290 + vc->vc_size_row * vc->vc_top,
1291 + vc->vc_size_row * (vc->vc_bottom - vc->vc_top) / 2);
1292 + fbcon_decor_clear_margins(vc, info, 0);
1295 + printk(KERN_INFO "fbcondecor: switched decor state to 'on' on console %d\n",
1301 +static inline int fbcon_decor_ioctl_dosetstate(struct vc_data *vc, unsigned int state, unsigned char origin)
1305 +// if (origin == FBCON_DECOR_IO_ORIG_USER)
1308 + ret = fbcon_decor_disable(vc, 1);
1310 + ret = fbcon_decor_enable(vc);
1311 +// if (origin == FBCON_DECOR_IO_ORIG_USER)
1317 +static inline void fbcon_decor_ioctl_dogetstate(struct vc_data *vc, unsigned int *state)
1319 + *state = vc->vc_decor.state;
1322 +static int fbcon_decor_ioctl_dosetcfg(struct vc_data *vc, struct vc_decor *cfg, unsigned char origin)
1324 + struct fb_info *info;
1328 + info = registered_fb[(int) con2fb_map[vc->vc_num]];
1330 + if (info == NULL || !cfg->twidth || !cfg->theight ||
1331 + cfg->tx + cfg->twidth > info->var.xres ||
1332 + cfg->ty + cfg->theight > info->var.yres)
1335 + len = strlen_user(cfg->theme);
1336 + if (!len || len > FBCON_DECOR_THEME_LEN)
1338 + tmp = kmalloc(len, GFP_KERNEL);
1341 + if (copy_from_user(tmp, (void __user *)cfg->theme, len))
1346 + /* If this ioctl is a response to a request from kernel, the console sem
1347 + * is already held; we also don't need to disable decor because either the
1348 + * new config and background picture will be successfully loaded, and the
1349 + * decor will stay on, or in case of a failure it'll be turned off in fbcon. */
1350 +// if (origin == FBCON_DECOR_IO_ORIG_USER) {
1352 + if (vc->vc_decor.state)
1353 + fbcon_decor_disable(vc, 1);
1356 + if (vc->vc_decor.theme)
1357 + kfree(vc->vc_decor.theme);
1359 + vc->vc_decor = *cfg;
1361 +// if (origin == FBCON_DECOR_IO_ORIG_USER)
1364 + printk(KERN_INFO "fbcondecor: console %d using theme '%s'\n",
1365 + vc->vc_num, vc->vc_decor.theme);
1369 +static int fbcon_decor_ioctl_dogetcfg(struct vc_data *vc, struct vc_decor *decor)
1373 + tmp = decor->theme;
1374 + *decor = vc->vc_decor;
1375 + decor->theme = tmp;
1377 + if (vc->vc_decor.theme) {
1378 + if (copy_to_user(tmp, vc->vc_decor.theme, strlen(vc->vc_decor.theme) + 1))
1381 + if (put_user(0, tmp))
1387 +static int fbcon_decor_ioctl_dosetpic(struct vc_data *vc, struct fb_image *img, unsigned char origin)
1389 + struct fb_info *info;
1393 + if (vc->vc_num != fg_console)
1396 + info = registered_fb[(int) con2fb_map[vc->vc_num]];
1401 + if (img->width != info->var.xres || img->height != info->var.yres) {
1402 + printk(KERN_ERR "fbcondecor: picture dimensions mismatch\n");
1403 + printk(KERN_ERR "%dx%d vs %dx%d\n", img->width, img->height, info->var.xres, info->var.yres);
1407 + if (img->depth != info->var.bits_per_pixel) {
1408 + printk(KERN_ERR "fbcondecor: picture depth mismatch\n");
1412 + if (img->depth == 8) {
1413 + if (!img->cmap.len || !img->cmap.red || !img->cmap.green ||
1417 + tmp = vmalloc(img->cmap.len * 3 * 2);
1421 + if (copy_from_user(tmp,
1422 + (void __user*)img->cmap.red, (img->cmap.len << 1)) ||
1423 + copy_from_user(tmp + (img->cmap.len << 1),
1424 + (void __user*)img->cmap.green, (img->cmap.len << 1)) ||
1425 + copy_from_user(tmp + (img->cmap.len << 2),
1426 + (void __user*)img->cmap.blue, (img->cmap.len << 1))) {
1431 + img->cmap.transp = NULL;
1432 + img->cmap.red = (u16*)tmp;
1433 + img->cmap.green = img->cmap.red + img->cmap.len;
1434 + img->cmap.blue = img->cmap.green + img->cmap.len;
1436 + img->cmap.red = NULL;
1439 + len = ((img->depth + 7) >> 3) * img->width * img->height;
1442 + * Allocate an additional byte so that we never go outside of the
1443 + * buffer boundaries in the rendering functions in a 24 bpp mode.
1445 + tmp = vmalloc(len + 1);
1450 + if (copy_from_user(tmp, (void __user*)img->data, len))
1455 + /* If this ioctl is a response to a request from kernel, the console sem
1456 + * is already held. */
1457 +// if (origin == FBCON_DECOR_IO_ORIG_USER)
1460 + if (info->bgdecor.data)
1461 + vfree((u8*)info->bgdecor.data);
1462 + if (info->bgdecor.cmap.red)
1463 + vfree(info->bgdecor.cmap.red);
1465 + info->bgdecor = *img;
1467 + if (fbcon_decor_active_vc(vc) && fg_console == vc->vc_num) {
1468 + redraw_screen(vc, 0);
1469 + update_region(vc, vc->vc_origin +
1470 + vc->vc_size_row * vc->vc_top,
1471 + vc->vc_size_row * (vc->vc_bottom - vc->vc_top) / 2);
1472 + fbcon_decor_clear_margins(vc, info, 0);
1475 +// if (origin == FBCON_DECOR_IO_ORIG_USER)
1480 +out: if (img->cmap.red)
1481 + vfree(img->cmap.red);
1488 +static long fbcon_decor_ioctl(struct file *filp, u_int cmd, u_long arg)
1490 + struct fbcon_decor_iowrapper __user *wrapper = (void __user*) arg;
1491 + struct vc_data *vc = NULL;
1492 + unsigned short vc_num = 0;
1493 + unsigned char origin = 0;
1494 + void __user *data = NULL;
1496 + if (!access_ok(VERIFY_READ, wrapper,
1497 + sizeof(struct fbcon_decor_iowrapper)))
1500 + __get_user(vc_num, &wrapper->vc);
1501 + __get_user(origin, &wrapper->origin);
1502 + __get_user(data, &wrapper->data);
1504 + if (!vc_cons_allocated(vc_num))
1507 + vc = vc_cons[vc_num].d;
1510 + case FBIOCONDECOR_SETPIC:
1512 + struct fb_image img;
1513 + if (copy_from_user(&img, (struct fb_image __user *)data, sizeof(struct fb_image)))
1516 + return fbcon_decor_ioctl_dosetpic(vc, &img, origin);
1518 + case FBIOCONDECOR_SETCFG:
1520 + struct vc_decor cfg;
1521 + if (copy_from_user(&cfg, (struct vc_decor __user *)data, sizeof(struct vc_decor)))
1524 + return fbcon_decor_ioctl_dosetcfg(vc, &cfg, origin);
1526 + case FBIOCONDECOR_GETCFG:
1529 + struct vc_decor cfg;
1531 + if (copy_from_user(&cfg, (struct vc_decor __user *)data, sizeof(struct vc_decor)))
1534 + rval = fbcon_decor_ioctl_dogetcfg(vc, &cfg);
1536 + if (copy_to_user(data, &cfg, sizeof(struct vc_decor)))
1540 + case FBIOCONDECOR_SETSTATE:
1542 + unsigned int state = 0;
1543 + if (get_user(state, (unsigned int __user *)data))
1545 + return fbcon_decor_ioctl_dosetstate(vc, state, origin);
1547 + case FBIOCONDECOR_GETSTATE:
1549 + unsigned int state = 0;
1550 + fbcon_decor_ioctl_dogetstate(vc, &state);
1551 + return put_user(state, (unsigned int __user *)data);
1555 + return -ENOIOCTLCMD;
1559 +#ifdef CONFIG_COMPAT
1561 +static long fbcon_decor_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) {
1563 + struct fbcon_decor_iowrapper32 __user *wrapper = (void __user *)arg;
1564 + struct vc_data *vc = NULL;
1565 + unsigned short vc_num = 0;
1566 + unsigned char origin = 0;
1567 + compat_uptr_t data_compat = 0;
1568 + void __user *data = NULL;
1570 + if (!access_ok(VERIFY_READ, wrapper,
1571 + sizeof(struct fbcon_decor_iowrapper32)))
1574 + __get_user(vc_num, &wrapper->vc);
1575 + __get_user(origin, &wrapper->origin);
1576 + __get_user(data_compat, &wrapper->data);
1577 + data = compat_ptr(data_compat);
1579 + if (!vc_cons_allocated(vc_num))
1582 + vc = vc_cons[vc_num].d;
1585 + case FBIOCONDECOR_SETPIC32:
1587 + struct fb_image32 img_compat;
1588 + struct fb_image img;
1590 + if (copy_from_user(&img_compat, (struct fb_image32 __user *)data, sizeof(struct fb_image32)))
1593 + fb_image_from_compat(img, img_compat);
1595 + return fbcon_decor_ioctl_dosetpic(vc, &img, origin);
1598 + case FBIOCONDECOR_SETCFG32:
1600 + struct vc_decor32 cfg_compat;
1601 + struct vc_decor cfg;
1603 + if (copy_from_user(&cfg_compat, (struct vc_decor32 __user *)data, sizeof(struct vc_decor32)))
1606 + vc_decor_from_compat(cfg, cfg_compat);
1608 + return fbcon_decor_ioctl_dosetcfg(vc, &cfg, origin);
1611 + case FBIOCONDECOR_GETCFG32:
1614 + struct vc_decor32 cfg_compat;
1615 + struct vc_decor cfg;
1617 + if (copy_from_user(&cfg_compat, (struct vc_decor32 __user *)data, sizeof(struct vc_decor32)))
1619 + cfg.theme = compat_ptr(cfg_compat.theme);
1621 + rval = fbcon_decor_ioctl_dogetcfg(vc, &cfg);
1623 + vc_decor_to_compat(cfg_compat, cfg);
1625 + if (copy_to_user((struct vc_decor32 __user *)data, &cfg_compat, sizeof(struct vc_decor32)))
1630 + case FBIOCONDECOR_SETSTATE32:
1632 + compat_uint_t state_compat = 0;
1633 + unsigned int state = 0;
1635 + if (get_user(state_compat, (compat_uint_t __user *)data))
1638 + state = (unsigned int)state_compat;
1640 + return fbcon_decor_ioctl_dosetstate(vc, state, origin);
1643 + case FBIOCONDECOR_GETSTATE32:
1645 + compat_uint_t state_compat = 0;
1646 + unsigned int state = 0;
1648 + fbcon_decor_ioctl_dogetstate(vc, &state);
1649 + state_compat = (compat_uint_t)state;
1651 + return put_user(state_compat, (compat_uint_t __user *)data);
1655 + return -ENOIOCTLCMD;
1659 + #define fbcon_decor_compat_ioctl NULL
1662 +static struct file_operations fbcon_decor_ops = {
1663 + .owner = THIS_MODULE,
1664 + .unlocked_ioctl = fbcon_decor_ioctl,
1665 + .compat_ioctl = fbcon_decor_compat_ioctl
1668 +static struct miscdevice fbcon_decor_dev = {
1669 + .minor = MISC_DYNAMIC_MINOR,
1670 + .name = "fbcondecor",
1671 + .fops = &fbcon_decor_ops
1674 +void fbcon_decor_reset()
1678 + for (i = 0; i < num_registered_fb; i++) {
1679 + registered_fb[i]->bgdecor.data = NULL;
1680 + registered_fb[i]->bgdecor.cmap.red = NULL;
1683 + for (i = 0; i < MAX_NR_CONSOLES && vc_cons[i].d; i++) {
1684 + vc_cons[i].d->vc_decor.state = vc_cons[i].d->vc_decor.twidth =
1685 + vc_cons[i].d->vc_decor.theight = 0;
1686 + vc_cons[i].d->vc_decor.theme = NULL;
1692 +int fbcon_decor_init()
1696 + fbcon_decor_reset();
1701 + i = misc_register(&fbcon_decor_dev);
1703 + printk(KERN_ERR "fbcondecor: failed to register device\n");
1707 + fbcon_decor_call_helper("init", 0);
1712 +int fbcon_decor_exit(void)
1714 + fbcon_decor_reset();
1718 +EXPORT_SYMBOL(fbcon_decor_path);
1719 diff -Nur linux-3.15.1.orig/drivers/video/console/fbcondecor.h linux-3.15.1/drivers/video/console/fbcondecor.h
1720 --- linux-3.15.1.orig/drivers/video/console/fbcondecor.h 1970-01-01 01:00:00.000000000 +0100
1721 +++ linux-3.15.1/drivers/video/console/fbcondecor.h 2014-06-28 11:21:19.000000000 +0200
1724 + * linux/drivers/video/console/fbcondecor.h -- Framebuffer Console Decoration headers
1726 + * Copyright (C) 2004 Michal Januszewski <michalj+fbcondecor@gmail.com>
1730 +#ifndef __FBCON_DECOR_H
1731 +#define __FBCON_DECOR_H
1733 +#ifndef _LINUX_FB_H
1734 +#include <linux/fb.h>
1737 +/* This is needed for vc_cons in fbcmap.c */
1738 +#include <linux/vt_kern.h>
1744 +#ifdef CONFIG_FB_CON_DECOR
1746 +int fbcon_decor_init(void);
1747 +void fbcon_decor_reset(void);
1748 +int fbcon_decor_exit(void);
1749 +int fbcon_decor_call_helper(char* cmd, unsigned short cons);
1750 +int fbcon_decor_disable(struct vc_data *vc, unsigned char redraw);
1752 +/* cfbcondecor.c */
1753 +void fbcon_decor_putcs(struct vc_data *vc, struct fb_info *info, const unsigned short *s, int count, int yy, int xx);
1754 +void fbcon_decor_cursor(struct fb_info *info, struct fb_cursor *cursor);
1755 +void fbcon_decor_clear(struct vc_data *vc, struct fb_info *info, int sy, int sx, int height, int width);
1756 +void fbcon_decor_clear_margins(struct vc_data *vc, struct fb_info *info, int bottom_only);
1757 +void fbcon_decor_blank(struct vc_data *vc, struct fb_info *info, int blank);
1758 +void fbcon_decor_bmove_redraw(struct vc_data *vc, struct fb_info *info, int y, int sx, int dx, int width);
1759 +void fbcon_decor_copy(u8 *dst, u8 *src, int height, int width, int linebytes, int srclinesbytes, int bpp);
1760 +void fbcon_decor_fix_pseudo_pal(struct fb_info *info, struct vc_data *vc);
1763 +void acquire_console_sem(void);
1764 +void release_console_sem(void);
1765 +void do_unblank_screen(int entering_gfx);
1767 +/* struct vc_data *y */
1768 +#define fbcon_decor_active_vc(y) (y->vc_decor.state && y->vc_decor.theme)
1770 +/* struct fb_info *x, struct vc_data *y */
1771 +#define fbcon_decor_active_nores(x,y) (x->bgdecor.data && fbcon_decor_active_vc(y))
1773 +/* struct fb_info *x, struct vc_data *y */
1774 +#define fbcon_decor_active(x,y) (fbcon_decor_active_nores(x,y) && \
1775 + x->bgdecor.width == x->var.xres && \
1776 + x->bgdecor.height == x->var.yres && \
1777 + x->bgdecor.depth == x->var.bits_per_pixel)
1780 +#else /* CONFIG_FB_CON_DECOR */
1782 +static inline void fbcon_decor_putcs(struct vc_data *vc, struct fb_info *info, const unsigned short *s, int count, int yy, int xx) {}
1783 +static inline void fbcon_decor_putc(struct vc_data *vc, struct fb_info *info, int c, int ypos, int xpos) {}
1784 +static inline void fbcon_decor_cursor(struct fb_info *info, struct fb_cursor *cursor) {}
1785 +static inline void fbcon_decor_clear(struct vc_data *vc, struct fb_info *info, int sy, int sx, int height, int width) {}
1786 +static inline void fbcon_decor_clear_margins(struct vc_data *vc, struct fb_info *info, int bottom_only) {}
1787 +static inline void fbcon_decor_blank(struct vc_data *vc, struct fb_info *info, int blank) {}
1788 +static inline void fbcon_decor_bmove_redraw(struct vc_data *vc, struct fb_info *info, int y, int sx, int dx, int width) {}
1789 +static inline void fbcon_decor_fix_pseudo_pal(struct fb_info *info, struct vc_data *vc) {}
1790 +static inline int fbcon_decor_call_helper(char* cmd, unsigned short cons) { return 0; }
1791 +static inline int fbcon_decor_init(void) { return 0; }
1792 +static inline int fbcon_decor_exit(void) { return 0; }
1793 +static inline int fbcon_decor_disable(struct vc_data *vc, unsigned char redraw) { return 0; }
1795 +#define fbcon_decor_active_vc(y) (0)
1796 +#define fbcon_decor_active_nores(x,y) (0)
1797 +#define fbcon_decor_active(x,y) (0)
1799 +#endif /* CONFIG_FB_CON_DECOR */
1801 +#endif /* __FBCON_DECOR_H */
1802 diff -Nur linux-3.15.1.orig/drivers/video/fbdev/core/fbcmap.c linux-3.15.1/drivers/video/fbdev/core/fbcmap.c
1803 --- linux-3.15.1.orig/drivers/video/fbdev/core/fbcmap.c 2014-06-16 22:44:27.000000000 +0200
1804 +++ linux-3.15.1/drivers/video/fbdev/core/fbcmap.c 2014-06-28 11:21:49.000000000 +0200
1806 #include <linux/slab.h>
1807 #include <linux/uaccess.h>
1809 +#include "../../console/fbcondecor.h"
1811 static u16 red2[] __read_mostly = {
1814 @@ -257,6 +259,10 @@
1816 fb_copy_cmap(cmap, &info->cmap);
1818 + if (fbcon_decor_active(info, vc_cons[fg_console].d) &&
1819 + info->fix.visual == FB_VISUAL_DIRECTCOLOR)
1820 + fbcon_decor_fix_pseudo_pal(info, vc_cons[fg_console].d);
1825 diff -Nur linux-3.15.1.orig/include/linux/console_decor.h linux-3.15.1/include/linux/console_decor.h
1826 --- linux-3.15.1.orig/include/linux/console_decor.h 1970-01-01 01:00:00.000000000 +0100
1827 +++ linux-3.15.1/include/linux/console_decor.h 2014-06-28 11:21:19.000000000 +0200
1829 +#ifndef _LINUX_CONSOLE_DECOR_H_
1830 +#define _LINUX_CONSOLE_DECOR_H_ 1
1832 +/* A structure used by the framebuffer console decorations (drivers/video/console/fbcondecor.c) */
1834 + __u8 bg_color; /* The color that is to be treated as transparent */
1835 + __u8 state; /* Current decor state: 0 = off, 1 = on */
1836 + __u16 tx, ty; /* Top left corner coordinates of the text field */
1837 + __u16 twidth, theight; /* Width and height of the text field */
1842 +#ifdef CONFIG_COMPAT
1843 +#include <linux/compat.h>
1845 +struct vc_decor32 {
1846 + __u8 bg_color; /* The color that is to be treated as transparent */
1847 + __u8 state; /* Current decor state: 0 = off, 1 = on */
1848 + __u16 tx, ty; /* Top left corner coordinates of the text field */
1849 + __u16 twidth, theight; /* Width and height of the text field */
1850 + compat_uptr_t theme;
1853 +#define vc_decor_from_compat(to, from) \
1854 + (to).bg_color = (from).bg_color; \
1855 + (to).state = (from).state; \
1856 + (to).tx = (from).tx; \
1857 + (to).ty = (from).ty; \
1858 + (to).twidth = (from).twidth; \
1859 + (to).theight = (from).theight; \
1860 + (to).theme = compat_ptr((from).theme)
1862 +#define vc_decor_to_compat(to, from) \
1863 + (to).bg_color = (from).bg_color; \
1864 + (to).state = (from).state; \
1865 + (to).tx = (from).tx; \
1866 + (to).ty = (from).ty; \
1867 + (to).twidth = (from).twidth; \
1868 + (to).theight = (from).theight; \
1869 + (to).theme = ptr_to_compat((from).theme)
1871 +#endif /* CONFIG_COMPAT */
1872 +#endif /* __KERNEL__ */
1875 diff -Nur linux-3.15.1.orig/include/linux/console_struct.h linux-3.15.1/include/linux/console_struct.h
1876 --- linux-3.15.1.orig/include/linux/console_struct.h 2014-06-16 22:44:27.000000000 +0200
1877 +++ linux-3.15.1/include/linux/console_struct.h 2014-06-28 11:21:19.000000000 +0200
1882 +#include <linux/console_decor.h>
1885 struct tty_port port; /* Upper level data */
1887 unsigned long vc_uni_pagedir;
1888 unsigned long *vc_uni_pagedir_loc; /* [!] Location of uni_pagedir variable for this console */
1889 bool vc_panic_force_write; /* when oops/panic this VC can accept forced output/blanking */
1891 + struct vc_decor vc_decor;
1892 /* additional information is in vt_kern.h */
1895 diff -Nur linux-3.15.1.orig/include/linux/fb.h linux-3.15.1/include/linux/fb.h
1896 --- linux-3.15.1.orig/include/linux/fb.h 2014-06-16 22:44:27.000000000 +0200
1897 +++ linux-3.15.1/include/linux/fb.h 2014-06-28 11:21:19.000000000 +0200
1898 @@ -219,6 +219,34 @@
1903 +#ifdef CONFIG_COMPAT
1904 +struct fb_image32 {
1905 + __u32 dx; /* Where to place image */
1907 + __u32 width; /* Size of image */
1909 + __u32 fg_color; /* Only used when a mono bitmap */
1911 + __u8 depth; /* Depth of the image */
1912 + const compat_uptr_t data; /* Pointer to image data */
1913 + struct fb_cmap32 cmap; /* color map info */
1916 +#define fb_image_from_compat(to, from) \
1917 + (to).dx = (from).dx; \
1918 + (to).dy = (from).dy; \
1919 + (to).width = (from).width; \
1920 + (to).height = (from).height; \
1921 + (to).fg_color = (from).fg_color; \
1922 + (to).bg_color = (from).bg_color; \
1923 + (to).depth = (from).depth; \
1924 + (to).data = compat_ptr((from).data); \
1925 + fb_cmap_from_compat((to).cmap, (from).cmap)
1927 +#endif /* CONFIG_COMPAT */
1928 +#endif /* __KERNEL__ */
1931 * Frame buffer operations
1934 #define FBINFO_STATE_SUSPENDED 1
1935 u32 state; /* Hardware state i.e suspend */
1936 void *fbcon_par; /* fbcon use-only private area */
1938 + struct fb_image bgdecor;
1940 /* From here on everything is device dependent */
1942 /* we need the PCI or similar aperture base/size not
1943 diff -Nur linux-3.15.1.orig/include/uapi/linux/fb.h linux-3.15.1/include/uapi/linux/fb.h
1944 --- linux-3.15.1.orig/include/uapi/linux/fb.h 2014-06-16 22:44:27.000000000 +0200
1945 +++ linux-3.15.1/include/uapi/linux/fb.h 2014-06-28 11:21:19.000000000 +0200
1948 #define FB_MAX 32 /* sufficient for now */
1950 +struct fbcon_decor_iowrapper
1952 + unsigned short vc; /* Virtual console */
1953 + unsigned char origin; /* Point of origin of the request */
1958 +#ifdef CONFIG_COMPAT
1959 +#include <linux/compat.h>
1960 +struct fbcon_decor_iowrapper32
1962 + unsigned short vc; /* Virtual console */
1963 + unsigned char origin; /* Point of origin of the request */
1964 + compat_uptr_t data;
1966 +#endif /* CONFIG_COMPAT */
1967 +#endif /* __KERNEL__ */
1971 #define FBIOGET_VSCREENINFO 0x4600
1973 #define FBIOGET_DISPINFO 0x4618
1974 #define FBIO_WAITFORVSYNC _IOW('F', 0x20, __u32)
1976 +#define FBIOCONDECOR_SETCFG _IOWR('F', 0x19, struct fbcon_decor_iowrapper)
1977 +#define FBIOCONDECOR_GETCFG _IOR('F', 0x1A, struct fbcon_decor_iowrapper)
1978 +#define FBIOCONDECOR_SETSTATE _IOWR('F', 0x1B, struct fbcon_decor_iowrapper)
1979 +#define FBIOCONDECOR_GETSTATE _IOR('F', 0x1C, struct fbcon_decor_iowrapper)
1980 +#define FBIOCONDECOR_SETPIC _IOWR('F', 0x1D, struct fbcon_decor_iowrapper)
1982 +#ifdef CONFIG_COMPAT
1983 +#define FBIOCONDECOR_SETCFG32 _IOWR('F', 0x19, struct fbcon_decor_iowrapper32)
1984 +#define FBIOCONDECOR_GETCFG32 _IOR('F', 0x1A, struct fbcon_decor_iowrapper32)
1985 +#define FBIOCONDECOR_SETSTATE32 _IOWR('F', 0x1B, struct fbcon_decor_iowrapper32)
1986 +#define FBIOCONDECOR_GETSTATE32 _IOR('F', 0x1C, struct fbcon_decor_iowrapper32)
1987 +#define FBIOCONDECOR_SETPIC32 _IOWR('F', 0x1D, struct fbcon_decor_iowrapper32)
1988 +#endif /* CONFIG_COMPAT */
1989 +#endif /* __KERNEL__ */
1991 +#define FBCON_DECOR_THEME_LEN 128 /* Maximum lenght of a theme name */
1992 +#define FBCON_DECOR_IO_ORIG_KERNEL 0 /* Kernel ioctl origin */
1993 +#define FBCON_DECOR_IO_ORIG_USER 1 /* User ioctl origin */
1995 #define FB_TYPE_PACKED_PIXELS 0 /* Packed Pixels */
1996 #define FB_TYPE_PLANES 1 /* Non interleaved planes */
1997 #define FB_TYPE_INTERLEAVED_PLANES 2 /* Interleaved planes */
1998 @@ -277,6 +315,29 @@
1999 __u32 reserved[4]; /* Reserved for future compatibility */
2003 +#ifdef CONFIG_COMPAT
2006 + __u32 len; /* Number of entries */
2007 + compat_uptr_t red; /* Red values */
2008 + compat_uptr_t green;
2009 + compat_uptr_t blue;
2010 + compat_uptr_t transp; /* transparency, can be NULL */
2013 +#define fb_cmap_from_compat(to, from) \
2014 + (to).start = (from).start; \
2015 + (to).len = (from).len; \
2016 + (to).red = compat_ptr((from).red); \
2017 + (to).green = compat_ptr((from).green); \
2018 + (to).blue = compat_ptr((from).blue); \
2019 + (to).transp = compat_ptr((from).transp)
2021 +#endif /* CONFIG_COMPAT */
2022 +#endif /* __KERNEL__ */
2026 __u32 start; /* First entry */
2027 __u32 len; /* Number of entries */
2028 diff -Nur linux-3.15.1.orig/kernel/sysctl.c linux-3.15.1/kernel/sysctl.c
2029 --- linux-3.15.1.orig/kernel/sysctl.c 2014-06-16 22:44:27.000000000 +0200
2030 +++ linux-3.15.1/kernel/sysctl.c 2014-06-28 11:21:19.000000000 +0200
2031 @@ -146,6 +146,10 @@
2032 static unsigned long hung_task_timeout_max = (LONG_MAX/HZ);
2035 +#ifdef CONFIG_FB_CON_DECOR
2036 +extern char fbcon_decor_path[];
2039 #ifdef CONFIG_INOTIFY_USER
2040 #include <linux/inotify.h>
2042 @@ -255,6 +259,15 @@
2046 +#ifdef CONFIG_FB_CON_DECOR
2048 + .procname = "fbcondecor",
2049 + .data = &fbcon_decor_path,
2050 + .maxlen = KMOD_PATH_LEN,
2052 + .proc_handler = &proc_dostring,