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