aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/console
diff options
context:
space:
mode:
authorAntonino A. Daplas <adaplas@gmail.com>2005-11-07 04:00:35 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-07 10:53:50 -0500
commitc465e05a03209651078b95686158648fd7ed84c5 (patch)
treee1119586a567a9a6a5ad9bda43d3438772ecf5a4 /drivers/video/console
parente764a20196f4e1b497a42fdc6e9d254e7ec290f2 (diff)
[PATCH] fbcon/fbdev: Move softcursor out of fbdev to fbcon
According to Jon Smirl, filling in the field fb_cursor with soft_cursor for drivers that do not support hardware cursors is redundant. The soft_cursor function is usable by all drivers because it is just a wrapper around fb_imageblit. And because soft_cursor is an fbcon-specific hook, the file is moved to the console directory. Thus, drivers that do not support hardware cursors can leave the fb_cursor field blank. For drivers that do, they can fill up this field with their own version. The end result is a smaller code size. And if the framebuffer console is not loaded, module/kernel size is also reduced because the soft_cursor module will also not be loaded. Signed-off-by: Antonino Daplas <adaplas@pol.net> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/video/console')
-rw-r--r--drivers/video/console/Makefile2
-rw-r--r--drivers/video/console/bitblit.c7
-rw-r--r--drivers/video/console/fbcon.h2
-rw-r--r--drivers/video/console/softcursor.c72
4 files changed, 80 insertions, 3 deletions
diff --git a/drivers/video/console/Makefile b/drivers/video/console/Makefile
index 42c7b8dcd220..71b4b626e328 100644
--- a/drivers/video/console/Makefile
+++ b/drivers/video/console/Makefile
@@ -26,7 +26,7 @@ obj-$(CONFIG_PROM_CONSOLE) += promcon.o promcon_tbl.o
26obj-$(CONFIG_STI_CONSOLE) += sticon.o sticore.o font.o 26obj-$(CONFIG_STI_CONSOLE) += sticon.o sticore.o font.o
27obj-$(CONFIG_VGA_CONSOLE) += vgacon.o 27obj-$(CONFIG_VGA_CONSOLE) += vgacon.o
28obj-$(CONFIG_MDA_CONSOLE) += mdacon.o 28obj-$(CONFIG_MDA_CONSOLE) += mdacon.o
29obj-$(CONFIG_FRAMEBUFFER_CONSOLE) += fbcon.o bitblit.o font.o 29obj-$(CONFIG_FRAMEBUFFER_CONSOLE) += fbcon.o bitblit.o font.o softcursor.o
30ifeq ($(CONFIG_FB_TILEBLITTING),y) 30ifeq ($(CONFIG_FB_TILEBLITTING),y)
31obj-$(CONFIG_FRAMEBUFFER_CONSOLE) += tileblit.o 31obj-$(CONFIG_FRAMEBUFFER_CONSOLE) += tileblit.o
32endif 32endif
diff --git a/drivers/video/console/bitblit.c b/drivers/video/console/bitblit.c
index 9f70e512b88b..67857b3cfc8b 100644
--- a/drivers/video/console/bitblit.c
+++ b/drivers/video/console/bitblit.c
@@ -272,6 +272,7 @@ static void bit_cursor(struct vc_data *vc, struct fb_info *info,
272 int w = (vc->vc_font.width + 7) >> 3, c; 272 int w = (vc->vc_font.width + 7) >> 3, c;
273 int y = real_y(p, vc->vc_y); 273 int y = real_y(p, vc->vc_y);
274 int attribute, use_sw = (vc->vc_cursor_type & 0x10); 274 int attribute, use_sw = (vc->vc_cursor_type & 0x10);
275 int err = 1;
275 char *src; 276 char *src;
276 277
277 cursor.set = 0; 278 cursor.set = 0;
@@ -408,7 +409,11 @@ static void bit_cursor(struct vc_data *vc, struct fb_info *info,
408 cursor.image.depth = 1; 409 cursor.image.depth = 1;
409 cursor.rop = ROP_XOR; 410 cursor.rop = ROP_XOR;
410 411
411 info->fbops->fb_cursor(info, &cursor); 412 if (info->fbops->fb_cursor)
413 err = info->fbops->fb_cursor(info, &cursor);
414
415 if (err)
416 soft_cursor(info, &cursor);
412 417
413 ops->cursor_reset = 0; 418 ops->cursor_reset = 0;
414} 419}
diff --git a/drivers/video/console/fbcon.h b/drivers/video/console/fbcon.h
index 0738cd62def2..b68e0e2c2d16 100644
--- a/drivers/video/console/fbcon.h
+++ b/drivers/video/console/fbcon.h
@@ -167,5 +167,5 @@ extern void fbcon_set_tileops(struct vc_data *vc, struct fb_info *info,
167 struct display *p, struct fbcon_ops *ops); 167 struct display *p, struct fbcon_ops *ops);
168#endif 168#endif
169extern void fbcon_set_bitops(struct fbcon_ops *ops); 169extern void fbcon_set_bitops(struct fbcon_ops *ops);
170 170extern int soft_cursor(struct fb_info *info, struct fb_cursor *cursor);
171#endif /* _VIDEO_FBCON_H */ 171#endif /* _VIDEO_FBCON_H */
diff --git a/drivers/video/console/softcursor.c b/drivers/video/console/softcursor.c
new file mode 100644
index 000000000000..8529bf08db28
--- /dev/null
+++ b/drivers/video/console/softcursor.c
@@ -0,0 +1,72 @@
1/*
2 * linux/drivers/video/softcursor.c -- Generic software cursor for frame buffer devices
3 *
4 * Created 14 Nov 2002 by James Simmons
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file COPYING in the main directory of this archive
8 * for more details.
9 */
10
11#include <linux/module.h>
12#include <linux/string.h>
13#include <linux/tty.h>
14#include <linux/fb.h>
15#include <linux/slab.h>
16
17#include <asm/uaccess.h>
18#include <asm/io.h>
19
20int soft_cursor(struct fb_info *info, struct fb_cursor *cursor)
21{
22 unsigned int scan_align = info->pixmap.scan_align - 1;
23 unsigned int buf_align = info->pixmap.buf_align - 1;
24 unsigned int i, size, dsize, s_pitch, d_pitch;
25 struct fb_image *image;
26 u8 *dst, *src;
27
28 if (info->state != FBINFO_STATE_RUNNING)
29 return 0;
30
31 s_pitch = (cursor->image.width + 7) >> 3;
32 dsize = s_pitch * cursor->image.height;
33
34 src = kmalloc(dsize + sizeof(struct fb_image), GFP_ATOMIC);
35 if (!src)
36 return -ENOMEM;
37
38 image = (struct fb_image *) (src + dsize);
39 *image = cursor->image;
40 d_pitch = (s_pitch + scan_align) & ~scan_align;
41
42 size = d_pitch * image->height + buf_align;
43 size &= ~buf_align;
44 dst = fb_get_buffer_offset(info, &info->pixmap, size);
45
46 if (cursor->enable) {
47 switch (cursor->rop) {
48 case ROP_XOR:
49 for (i = 0; i < dsize; i++)
50 src[i] = image->data[i] ^ cursor->mask[i];
51 break;
52 case ROP_COPY:
53 default:
54 for (i = 0; i < dsize; i++)
55 src[i] = image->data[i] & cursor->mask[i];
56 break;
57 }
58 } else
59 memcpy(src, image->data, dsize);
60
61 fb_pad_aligned_buffer(dst, d_pitch, src, s_pitch, image->height);
62 image->data = dst;
63 info->fbops->fb_imageblit(info, image);
64 kfree(src);
65 return 0;
66}
67
68EXPORT_SYMBOL(soft_cursor);
69
70MODULE_AUTHOR("James Simmons <jsimmons@users.sf.net>");
71MODULE_DESCRIPTION("Generic software cursor");
72MODULE_LICENSE("GPL");