Commit 21324daa authored by James Simmons's avatar James Simmons

Cleaned up the cursor api. Now it uses fb_imaeg which makes sense since a...

Cleaned up the cursor api. Now it uses fb_imaeg which makes sense since a cursor is a image.More code cleanup for fbcon.c. Removal of excess elements passed into functions. 
parent 52540260
...@@ -17,9 +17,9 @@ ...@@ -17,9 +17,9 @@
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/io.h> #include <asm/io.h>
int cfb_cursor(struct fb_info *info, struct fbcursor *cursor) int cfb_cursor(struct fb_info *info, struct fb_cursor *cursor)
{ {
int i, size = ((cursor->size.x + 7) / 8) * cursor->size.y; int i, size = ((cursor->image.width + 7) / 8) * cursor->image.height;
struct fb_image image; struct fb_image image;
static char data[64]; static char data[64];
...@@ -27,7 +27,7 @@ int cfb_cursor(struct fb_info *info, struct fbcursor *cursor) ...@@ -27,7 +27,7 @@ int cfb_cursor(struct fb_info *info, struct fbcursor *cursor)
switch (cursor->rop) { switch (cursor->rop) {
case ROP_XOR: case ROP_XOR:
for (i = 0; i < size; i++) for (i = 0; i < size; i++)
data[i] = (cursor->image[i] & data[i] = (cursor->image.data[i] &
cursor->mask[i]) ^ cursor->mask[i]) ^
cursor->dest[i]; cursor->dest[i];
break; break;
...@@ -35,22 +35,19 @@ int cfb_cursor(struct fb_info *info, struct fbcursor *cursor) ...@@ -35,22 +35,19 @@ int cfb_cursor(struct fb_info *info, struct fbcursor *cursor)
default: default:
for (i = 0; i < size; i++) for (i = 0; i < size; i++)
data[i] = data[i] =
cursor->image[i] & cursor->mask[i]; cursor->image.data[i] & cursor->mask[i];
break; break;
} }
} else } else
memcpy(data, cursor->dest, size); memcpy(data, cursor->dest, size);
if (cursor->depth == 1) { image.bg_color = cursor->image.bg_color;
image.bg_color = cursor->index->entry[0]; image.fg_color = cursor->image.fg_color;
image.fg_color = cursor->index->entry[1]; image.dx = cursor->image.dx;
} image.dy = cursor->image.dy;
image.width = cursor->image.width;
image.dx = cursor->pos.x; image.height = cursor->image.height;
image.dy = cursor->pos.y; image.depth = cursor->image.depth;
image.width = cursor->size.x;
image.height = cursor->size.y;
image.depth = cursor->depth;
image.data = data; image.data = data;
if (info->fbops->fb_imageblit) if (info->fbops->fb_imageblit)
......
...@@ -149,12 +149,11 @@ void fbcon_accel_clear_margins(struct vc_data *vc, struct display *p, ...@@ -149,12 +149,11 @@ void fbcon_accel_clear_margins(struct vc_data *vc, struct display *p,
void fbcon_accel_cursor(struct display *p, int flags, int xx, int yy) void fbcon_accel_cursor(struct display *p, int flags, int xx, int yy)
{ {
static u32 palette_index[2];
static struct fb_index index = { 2, palette_index };
static char mask[64], image[64], *dest; static char mask[64], image[64], *dest;
struct vc_data *vc = p->conp;
static int fgcolor, bgcolor, shape, width, height; static int fgcolor, bgcolor, shape, width, height;
struct fb_info *info = p->fb_info; struct fb_info *info = p->fb_info;
struct fbcursor cursor; struct fb_cursor cursor;
int c; int c;
char *font; char *font;
...@@ -165,18 +164,20 @@ void fbcon_accel_cursor(struct display *p, int flags, int xx, int yy) ...@@ -165,18 +164,20 @@ void fbcon_accel_cursor(struct display *p, int flags, int xx, int yy)
cursor.set |= FB_CUR_SETSIZE; cursor.set |= FB_CUR_SETSIZE;
} }
if ((p->conp->vc_cursor_type & 0x0f) != shape) { if ((vc->vc_cursor_type & 0x0f) != shape) {
shape = p->conp->vc_cursor_type & 0x0f; shape = vc->vc_cursor_type & 0x0f;
cursor.set |= FB_CUR_SETSHAPE; cursor.set |= FB_CUR_SETSHAPE;
} }
c = scr_readw((u16 *) p->cursor_pos); c = scr_readw((u16 *) vc->vc_pos);
if (fgcolor != (int) attr_fgcol(p, c) || if (fgcolor != (int) attr_fgcol(p, c) ||
bgcolor != (int) attr_bgcol(p, c)) { bgcolor != (int) attr_bgcol(p, c)) {
fgcolor = (int) attr_fgcol(p, c); fgcolor = (int) attr_fgcol(p, c);
bgcolor = (int) attr_bgcol(p, c); bgcolor = (int) attr_bgcol(p, c);
cursor.set |= FB_CUR_SETCMAP; cursor.set |= FB_CUR_SETCMAP;
cursor.image.bg_color = bgcolor;
cursor.image.fg_color = fgcolor;
} }
c &= p->charmask; c &= p->charmask;
...@@ -191,11 +192,6 @@ void fbcon_accel_cursor(struct display *p, int flags, int xx, int yy) ...@@ -191,11 +192,6 @@ void fbcon_accel_cursor(struct display *p, int flags, int xx, int yy)
else else
cursor.enable = 0; cursor.enable = 0;
if (cursor.set & FB_CUR_SETCMAP) {
palette_index[0] = bgcolor;
palette_index[1] = fgcolor;
}
if (cursor.set & FB_CUR_SETSIZE) { if (cursor.set & FB_CUR_SETSIZE) {
memset(image, 0xff, 64); memset(image, 0xff, 64);
cursor.set |= FB_CUR_SETSHAPE; cursor.set |= FB_CUR_SETSHAPE;
...@@ -236,16 +232,15 @@ void fbcon_accel_cursor(struct display *p, int flags, int xx, int yy) ...@@ -236,16 +232,15 @@ void fbcon_accel_cursor(struct display *p, int flags, int xx, int yy)
mask[i++] = 0xff; mask[i++] = 0xff;
} }
cursor.size.x = width; cursor.image.width = width;
cursor.size.y = height; cursor.image.height = height;
cursor.pos.x = xx * width; cursor.image.dx = xx * width;
cursor.pos.y = yy * height; cursor.image.dy = yy * height;
cursor.image = image; cursor.image.depth = 1;
cursor.image.data = image;
cursor.mask = mask; cursor.mask = mask;
cursor.dest = dest; cursor.dest = dest;
cursor.rop = ROP_XOR; cursor.rop = ROP_XOR;
cursor.index = &index;
cursor.depth = 1;
if (info->fbops->fb_cursor) if (info->fbops->fb_cursor)
info->fbops->fb_cursor(info, &cursor); info->fbops->fb_cursor(info, &cursor);
......
This diff is collapsed.
...@@ -57,12 +57,6 @@ struct display { ...@@ -57,12 +57,6 @@ struct display {
struct display_switch *dispsw; /* low level operations */ struct display_switch *dispsw; /* low level operations */
void *dispsw_data; /* optional dispsw helper data */ void *dispsw_data; /* optional dispsw helper data */
#if 0
struct fb_fix_cursorinfo fcrsr;
struct fb_var_cursorinfo *vcrsr;
struct fb_cursorstate crsrstate;
#endif
/* Filled in by the low-level console driver */ /* Filled in by the low-level console driver */
struct vc_data *conp; /* pointer to console data */ struct vc_data *conp; /* pointer to console data */
struct fb_info *fb_info; /* frame buffer for this console */ struct fb_info *fb_info; /* frame buffer for this console */
...@@ -181,6 +175,6 @@ extern void set_con2fb_map(int unit, int newidx); ...@@ -181,6 +175,6 @@ extern void set_con2fb_map(int unit, int newidx);
#define SCROLL_YNOPARTIAL __SCROLL_YNOPARTIAL #define SCROLL_YNOPARTIAL __SCROLL_YNOPARTIAL
extern void fbcon_redraw_clear(struct vc_data *, struct display *, int, int, int, int); extern void fbcon_redraw_clear(struct vc_data *, struct display *, int, int, int, int);
extern void fbcon_redraw_bmove(struct display *, int, int, int, int, int, int); extern void fbcon_redraw_bmove(struct vc_data *, struct display *, int, int, int, int, int, int);
#endif /* _VIDEO_FBCON_H */ #endif /* _VIDEO_FBCON_H */
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#define FBIOGETCMAP 0x4604 #define FBIOGETCMAP 0x4604
#define FBIOPUTCMAP 0x4605 #define FBIOPUTCMAP 0x4605
#define FBIOPAN_DISPLAY 0x4606 #define FBIOPAN_DISPLAY 0x4606
#define FBIO_CURSOR _IOWR('F', 0x08, struct fbcursor) #define FBIO_CURSOR _IOWR('F', 0x08, struct fb_cursor)
/* 0x4607-0x460B are defined below */ /* 0x4607-0x460B are defined below */
/* #define FBIOGET_MONITORSPEC 0x460C */ /* #define FBIOGET_MONITORSPEC 0x460C */
/* #define FBIOPUT_MONITORSPEC 0x460D */ /* #define FBIOPUT_MONITORSPEC 0x460D */
...@@ -223,11 +223,6 @@ struct fb_cmap { ...@@ -223,11 +223,6 @@ struct fb_cmap {
__u16 *transp; /* transparency, can be NULL */ __u16 *transp; /* transparency, can be NULL */
}; };
struct fb_index {
__u32 len; /* number of entries */
__u32 *entry; /* "pseudopalette" color index entries */
};
struct fb_con2fbmap { struct fb_con2fbmap {
__u32 console; __u32 console;
__u32 framebuffer; __u32 framebuffer;
...@@ -265,38 +260,6 @@ struct fb_vblank { ...@@ -265,38 +260,6 @@ struct fb_vblank {
__u32 reserved[4]; /* reserved for future compatibility */ __u32 reserved[4]; /* reserved for future compatibility */
}; };
/*
* hardware cursor control
*/
#define FB_CUR_SETCUR 0x01
#define FB_CUR_SETPOS 0x02
#define FB_CUR_SETHOT 0x04
#define FB_CUR_SETCMAP 0x08
#define FB_CUR_SETSHAPE 0x10
#define FB_CUR_SETDEST 0x20
#define FB_CUR_SETSIZE 0x40
#define FB_CUR_SETALL 0xFF
struct fbcurpos {
__u16 x, y;
};
struct fbcursor {
__u16 set; /* what to set */
__u16 enable; /* cursor on/off */
__u8 rop; /* bitop operation */
__u8 depth; /* color depth of image */
struct fbcurpos pos; /* cursor position */
struct fbcurpos hot; /* cursor hot spot */
struct fbcurpos size; /* cursor bit map size */
struct fb_cmap cmap; /* color map info */
struct fb_index *index;
char *image; /* cursor image bits */
char *mask; /* cursor mask bits */
char *dest; /* destination */
};
/* Internal HW accel */ /* Internal HW accel */
#define ROP_COPY 0 #define ROP_COPY 0
#define ROP_XOR 1 #define ROP_XOR 1
...@@ -328,6 +291,34 @@ struct fb_image { ...@@ -328,6 +291,34 @@ struct fb_image {
__u32 bg_color; __u32 bg_color;
__u8 depth; /* Depth of the image */ __u8 depth; /* Depth of the image */
char *data; /* Pointer to image data */ char *data; /* Pointer to image data */
struct fb_cmap cmap; /* color map info */
};
/*
* hardware cursor control
*/
#define FB_CUR_SETCUR 0x01
#define FB_CUR_SETPOS 0x02
#define FB_CUR_SETHOT 0x04
#define FB_CUR_SETCMAP 0x08
#define FB_CUR_SETSHAPE 0x10
#define FB_CUR_SETDEST 0x20
#define FB_CUR_SETSIZE 0x40
#define FB_CUR_SETALL 0xFF
struct fbcurpos {
__u16 x, y;
};
struct fb_cursor {
__u16 set; /* what to set */
__u16 enable; /* cursor on/off */
__u16 rop; /* bitop operation */
char *mask; /* cursor mask bits */
char *dest; /* destination */
struct fbcurpos hot; /* cursor hot spot */
struct fb_image image; /* Cursor image */
}; };
#ifdef __KERNEL__ #ifdef __KERNEL__
...@@ -371,7 +362,7 @@ struct fb_ops { ...@@ -371,7 +362,7 @@ struct fb_ops {
/* Draws a image to the display */ /* Draws a image to the display */
void (*fb_imageblit)(struct fb_info *info, struct fb_image *image); void (*fb_imageblit)(struct fb_info *info, struct fb_image *image);
/* Draws cursor */ /* Draws cursor */
int (*fb_cursor)(struct fb_info *info, struct fbcursor *cursor); int (*fb_cursor)(struct fb_info *info, struct fb_cursor *cursor);
/* Rotates the display */ /* Rotates the display */
void (*fb_rotate)(struct fb_info *info, int angle); void (*fb_rotate)(struct fb_info *info, int angle);
/* perform polling on fb device */ /* perform polling on fb device */
...@@ -393,7 +384,7 @@ struct fb_info { ...@@ -393,7 +384,7 @@ struct fb_info {
struct fb_var_screeninfo var; /* Current var */ struct fb_var_screeninfo var; /* Current var */
struct fb_fix_screeninfo fix; /* Current fix */ struct fb_fix_screeninfo fix; /* Current fix */
struct fb_monspecs monspecs; /* Current Monitor specs */ struct fb_monspecs monspecs; /* Current Monitor specs */
struct fbcursor cursor; /* Current cursor */ struct fb_cursor cursor; /* Current cursor */
struct fb_cmap cmap; /* Current cmap */ struct fb_cmap cmap; /* Current cmap */
struct fb_ops *fbops; struct fb_ops *fbops;
char *screen_base; /* Virtual address */ char *screen_base; /* Virtual address */
...@@ -457,7 +448,7 @@ struct fb_info { ...@@ -457,7 +448,7 @@ struct fb_info {
extern int fb_set_var(struct fb_var_screeninfo *var, struct fb_info *info); extern int fb_set_var(struct fb_var_screeninfo *var, struct fb_info *info);
extern int fb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info); extern int fb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info);
extern int fb_blank(int blank, struct fb_info *info); extern int fb_blank(int blank, struct fb_info *info);
extern int cfb_cursor(struct fb_info *info, struct fbcursor *cursor); extern int cfb_cursor(struct fb_info *info, struct fb_cursor *cursor);
extern void cfb_fillrect(struct fb_info *info, struct fb_fillrect *rect); extern void cfb_fillrect(struct fb_info *info, struct fb_fillrect *rect);
extern void cfb_copyarea(struct fb_info *info, struct fb_copyarea *area); extern void cfb_copyarea(struct fb_info *info, struct fb_copyarea *area);
extern void cfb_imageblit(struct fb_info *info, struct fb_image *image); extern void cfb_imageblit(struct fb_info *info, struct fb_image *image);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment