Commit d53898ad authored by James Simmons's avatar James Simmons

Added a cursor api.

parent 66ccf1ad
......@@ -11,6 +11,7 @@ export-objs := fbmem.o fbcmap.o fbgen.o fbmon.o modedb.o cyber2000fb.o
obj-$(CONFIG_AGP) += agp/
obj-$(CONFIG_DRM) += drm/
obj-$(CONFIG_VT) += console/
# Add fbmon.o back into obj-$(CONFIG_FB) in 2.5.x
obj-$(CONFIG_FB) += fbmem.o fbcmap.o modedb.o fbgen.o
......
......@@ -66,6 +66,7 @@ static struct fb_ops anakinfb_ops = {
.fb_fillrect = cfb_fillrect,
.fb_copyarea = cfb_copyarea,
.fb_imageblit = cfb_imageblit,
.fb_cursor = cfb_cursor,
};
int __init
......
......@@ -158,7 +158,7 @@ extern void atyfb_imageblit(struct fb_info *info, struct fb_image *image);
static int atyfb_mmap(struct fb_info *info, struct file *file,
struct vm_area_struct *vma);
#endif
static int atyfb_rasterimg(struct fb_info *info, int start);
static int atyfb_sync(struct fb_info *info);
/*
* Internal routines
......@@ -1126,7 +1126,7 @@ static int atyfb_ioctl(struct inode *inode, struct file *file, u_int cmd,
return 0;
}
static int atyfb_rasterimg(struct fb_info *info, int start)
static int atyfb_sync(struct fb_info *info)
{
struct atyfb_par *par = (struct atyfb_par *) info->par;
......
......@@ -234,7 +234,6 @@ static struct fb_fix_screeninfo aty128fb_fix __initdata = {
.accel = FB_ACCEL_ATI_RAGE128,
};
static const char *aty128fb_name = "ATY Rage128";
static char fontname[40] __initdata = { 0 };
static int noaccel __initdata = 0;
......@@ -360,7 +359,7 @@ static int aty128fb_pan_display(struct fb_var_screeninfo *var, int con,
static int aty128fb_blank(int blank, struct fb_info *fb);
static int aty128fb_ioctl(struct inode *inode, struct file *file, u_int cmd,
u_long arg, int con, struct fb_info *info);
static int aty128fb_rasterimg(struct fb_info *info, int start);
static int aty128fb_sync(struct fb_info *info);
/*
* Interface to the low level console driver
......@@ -397,22 +396,21 @@ static struct fb_ops aty128fb_ops = {
.fb_set_var = gen_set_var,
.fb_check_var = aty128fb_check_var,
.fb_set_par = aty128fb_set_par,
.fb_get_cmap = gen_get_cmap,
.fb_set_cmap = gen_set_cmap,
.fb_setcolreg = aty128fb_setcolreg,
.fb_pan_display = aty128fb_pan_display,
.fb_blank = aty128fb_blank,
.fb_ioctl = aty128fb_ioctl,
.fb_sync = aty128fb_sync,
#if 0
.fb_fillrect = aty128fb_fillrect,
.fb_copyarea = aty128fb_copyarea,
.fb_imageblit = aty128fb_imageblit,
.fb_rasterimg = aty128fb_rasterimg,
#else
.fb_fillrect = cfb_fillrect,
.fb_copyarea = cfb_copyarea,
.fb_imageblit = cfb_imageblit,
#endif
.fb_cursor = cfb_cursor,
};
#ifdef CONFIG_PMAC_BACKLIGHT
......@@ -1398,17 +1396,15 @@ aty128_st_pal(u_int regno, u_int red, u_int green, u_int blue,
}
static int
aty128fb_rasterimg(struct fb_info *info, int start)
aty128fb_sync(struct fb_info *info)
{
struct aty128fb_par *par = info->par;
if (par->blitter_may_be_busy)
wait_for_idle(par);
return 0;
}
int __init
aty128fb_setup(char *options)
{
......@@ -1507,13 +1503,8 @@ aty128_init(struct fb_info *info, const char *name)
printk("%dk %s\n", par->vram_size / 1024, par->mem->name);
/* fill in info */
strcpy(info->modename, aty128fb_name);
info->node = NODEV;
info->fbops = &aty128fb_ops;
strcpy(info->fontname, fontname);
info->changevar = NULL;
info->switch_con = gen_switch;
info->updatevar = gen_update_var;
info->flags = FBINFO_FLAG_DEFAULT;
#ifdef CONFIG_PMAC_PBOOK
......@@ -1591,10 +1582,8 @@ aty128_init(struct fb_info *info, const char *name)
info->var = var;
fb_alloc_cmap(&info->cmap, 256, 0);
gen_set_disp(-1, info);
var.activate = FB_ACTIVATE_NOW;
gen_set_var(&var, -1, info);
aty128_init_engine(par);
......@@ -1616,7 +1605,7 @@ aty128_init(struct fb_info *info, const char *name)
#endif
printk(KERN_INFO "fb%d: %s frame buffer device on %s\n",
GET_FB_IDX(info->node), aty128fb_name, name);
GET_FB_IDX(info->node), info->fix.id, name);
return 1; /* success! */
}
......@@ -1693,7 +1682,6 @@ aty128_pci_register(struct pci_dev *pdev,
info->par = par;
info->disp = &lump->disp;
info->fix = aty128fb_fix;
info->currcon = -1;
info->pseudo_palette = lump->pseudo_palette;
par->pdev = pdev;
......
......@@ -214,14 +214,12 @@ static struct fb_ops clps7111fb_ops = {
.owner = THIS_MODULE,
.fb_check_var = clps7111fb_check_var,
.fb_set_par = clps7111fb_set_par,
.fb_set_var = gen_set_var,
.fb_set_cmap = gen_set_cmap,
.fb_get_cmap = gen_get_cmap,
.fb_setcolreg = clps7111fb_setcolreg,
.fb_blank = clps7111fb_blank,
.fb_fillrect = cfb_fillrect,
.fb_copyarea = cfb_copyarea,
.fb_imageblit = cfb_imageblit,
.fb_cursor = cfb_cursor,
};
static int
......@@ -373,7 +371,6 @@ int __init clps711xfb_init(void)
memset(cfb, 0, sizeof(*cfb));
strcpy(cfb->fix.id, "clps711x");
cfb->currcon = -1;
cfb->fbops = &clps7111fb_ops;
cfb->flags = FBINFO_FLAG_DEFAULT;
......
......@@ -34,18 +34,18 @@ void fbcon_accel_bmove(struct display *p, int sy, int sx, int dy, int dx,
area.dx = dx * fontwidth(p);
area.dy = dy * fontheight(p);
area.height = height * fontheight(p);
area.width = width * fontwidth(p);
area.width = width * fontwidth(p);
info->fbops->fb_copyarea(info, &area);
}
void fbcon_accel_clear(struct vc_data *vc, struct display *p, int sy, int sx,
int height, int width)
void fbcon_accel_clear(struct vc_data *vc, struct display *p, int sy,
int sx, int height, int width)
{
struct fb_info *info = p->fb_info;
struct fb_fillrect region;
region.color = attr_bgcol_ec(p,vc);
region.color = attr_bgcol_ec(p, vc);
region.dx = sx * fontwidth(p);
region.dy = sy * fontheight(p);
region.width = width * fontwidth(p);
......@@ -60,7 +60,7 @@ void fbcon_accel_putc(struct vc_data *vc, struct display *p, int c, int yy,
{
struct fb_info *info = p->fb_info;
unsigned short charmask = p->charmask;
unsigned int width = ((fontwidth(p)+7)>>3);
unsigned int width = ((fontwidth(p) + 7) >> 3);
struct fb_image image;
image.fg_color = attr_fgcol(p, c);
......@@ -70,7 +70,7 @@ void fbcon_accel_putc(struct vc_data *vc, struct display *p, int c, int yy,
image.width = fontwidth(p);
image.height = fontheight(p);
image.depth = 1;
image.data = p->fontdata + (c & charmask)*fontheight(p)*width;
image.data = p->fontdata + (c & charmask) * fontheight(p) * width;
info->fbops->fb_imageblit(info, &image);
}
......@@ -80,7 +80,7 @@ void fbcon_accel_putcs(struct vc_data *vc, struct display *p,
{
struct fb_info *info = p->fb_info;
unsigned short charmask = p->charmask;
unsigned int width = ((fontwidth(p)+7)>>3);
unsigned int width = ((fontwidth(p) + 7) >> 3);
struct fb_image image;
u16 c = scr_readw(s);
......@@ -94,7 +94,7 @@ void fbcon_accel_putcs(struct vc_data *vc, struct display *p,
while (count--) {
image.data = p->fontdata +
(scr_readw(s++) & charmask) * fontheight(p) * width;
(scr_readw(s++) & charmask) * fontheight(p) * width;
info->fbops->fb_imageblit(info, &image);
image.dx += fontwidth(p);
}
......@@ -108,10 +108,10 @@ void fbcon_accel_revc(struct display *p, int xx, int yy)
region.color = attr_fgcol_ec(p, p->conp);
region.dx = xx * fontwidth(p);
region.dy = yy * fontheight(p);
region.width = fontwidth(p);
region.height = fontheight(p);
region.width = fontwidth(p);
region.height = fontheight(p);
region.rop = ROP_XOR;
info->fbops->fb_fillrect(info, &region);
}
......@@ -127,39 +127,180 @@ void fbcon_accel_clear_margins(struct vc_data *vc, struct display *p,
unsigned int bs = info->var.yres - bh;
struct fb_fillrect region;
region.color = attr_bgcol_ec(p,vc);
region.color = attr_bgcol_ec(p, vc);
region.rop = ROP_COPY;
if (rw && !bottom_only) {
region.dx = info->var.xoffset + rs;
region.dy = 0;
region.width = rw;
region.width = rw;
region.height = info->var.yres_virtual;
info->fbops->fb_fillrect(info, &region);
info->fbops->fb_fillrect(info, &region);
}
if (bh) {
region.dx = info->var.xoffset;
region.dy = info->var.yoffset + bs;
region.width = rs;
region.height = bh;
region.dy = info->var.yoffset + bs;
region.width = rs;
region.height = bh;
info->fbops->fb_fillrect(info, &region);
}
}
/*
* `switch' for the low level operations
*/
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 int fgcolor, bgcolor, shape, width, height;
struct fb_info *info = p->fb_info;
struct fbcursor cursor;
int c;
char *font;
cursor.set = FB_CUR_SETPOS;
if (width != fontwidth(p) || height != fontheight(p)) {
width = fontwidth(p);
height = fontheight(p);
cursor.set |= FB_CUR_SETSIZE;
}
if ((p->conp->vc_cursor_type & 0x0f) != shape) {
shape = p->conp->vc_cursor_type & 0x0f;
cursor.set |= FB_CUR_SETSHAPE;
}
c = scr_readw((u16 *) p->cursor_pos);
if (fgcolor != (int) attr_fgcol(p, c) ||
bgcolor != (int) attr_bgcol(p, c)) {
fgcolor = (int) attr_fgcol(p, c);
bgcolor = (int) attr_bgcol(p, c);
cursor.set |= FB_CUR_SETCMAP;
}
c &= p->charmask;
font = p->fontdata + (c * ((width + 7) / 8) * height);
if (font != dest) {
dest = font;
cursor.set |= FB_CUR_SETDEST;
}
if (flags & FB_CUR_SETCUR)
cursor.enable = 1;
else
cursor.enable = 0;
if (cursor.set & FB_CUR_SETCMAP) {
palette_index[0] = bgcolor;
palette_index[1] = fgcolor;
}
if (cursor.set & FB_CUR_SETSIZE) {
memset(image, 0xff, 64);
cursor.set |= FB_CUR_SETSHAPE;
}
if (cursor.set & FB_CUR_SETSHAPE) {
int w, cur_height, size, i = 0;
w = (width + 7) / 8;
switch (shape) {
case CUR_NONE:
cur_height = 0;
break;
case CUR_UNDERLINE:
cur_height = (height < 10) ? 1 : 2;
break;
case CUR_LOWER_THIRD:
cur_height = height / 3;
break;
case CUR_LOWER_HALF:
cur_height = height / 2;
break;
case CUR_TWO_THIRDS:
cur_height = (height * 2) / 3;
break;
case CUR_BLOCK:
default:
cur_height = height;
break;
}
size = (height - cur_height) * w;
while (size--)
mask[i++] = 0;
size = cur_height * w;
while (size--)
mask[i++] = 0xff;
}
cursor.size.x = width;
cursor.size.y = height;
cursor.pos.x = xx * width;
cursor.pos.y = yy * height;
cursor.image = image;
cursor.mask = mask;
cursor.dest = dest;
cursor.rop = ROP_XOR;
cursor.index = &index;
cursor.depth = 1;
if (info->fbops->fb_cursor)
info->fbops->fb_cursor(info, &cursor);
else {
int i, size = ((cursor.size.x + 7) / 8) * cursor.size.y;
struct fb_image image;
static char data[64];
image.bg_color = cursor.index->entry[0];
image.fg_color = cursor.index->entry[1];
if (cursor.enable) {
switch (cursor.rop) {
case ROP_XOR:
for (i = 0; i < size; i++)
data[i] = (cursor.image[i] &
cursor.mask[i]) ^
cursor.dest[i];
break;
case ROP_COPY:
default:
for (i = 0; i < size; i++)
data[i] = cursor.image[i] &
cursor.mask[i];
break;
}
} else
memcpy(data, &cursor.dest, size);
image.dx = cursor.pos.x;
image.dy = cursor.pos.y;
image.width = cursor.size.x;
image.height = cursor.size.y;
image.depth = cursor.depth;
image.data = data;
if (info->fbops->fb_imageblit)
info->fbops->fb_imageblit(info, &image);
}
}
/*
* `switch' for the low level operations
*/
struct display_switch fbcon_accel = {
.setup = fbcon_accel_setup,
.bmove = fbcon_accel_bmove,
.clear = fbcon_accel_clear,
.putc = fbcon_accel_putc,
.putcs = fbcon_accel_putcs,
.revc = fbcon_accel_revc,
.clear_margins =fbcon_accel_clear_margins,
.fontwidthmask =FONTWIDTHRANGE(1, 16)
.setup = fbcon_accel_setup,
.bmove = fbcon_accel_bmove,
.clear = fbcon_accel_clear,
.putc = fbcon_accel_putc,
.putcs = fbcon_accel_putcs,
.revc = fbcon_accel_revc,
.clear_margins = fbcon_accel_clear_margins,
.cursor = fbcon_accel_cursor,
.fontwidthmask = FONTWIDTHRANGE(1, 16)
};
#ifdef MODULE
......@@ -167,17 +308,17 @@ MODULE_LICENSE("GPL");
int init_module(void)
{
return 0;
return 0;
}
void cleanup_module(void)
{}
#endif /* MODULE */
{
}
#endif /* MODULE */
/*
* Visible symbols for modules
*/
/*
* Visible symbols for modules
*/
EXPORT_SYMBOL(fbcon_accel);
EXPORT_SYMBOL(fbcon_accel_setup);
......
......@@ -929,73 +929,69 @@ static void fbcon_putcs(struct vc_data *conp, const unsigned short *s, int count
vbl_cursor_cnt = CURSOR_DRAW_DELAY;
}
static void fbcon_cursor(struct vc_data *conp, int mode)
{
int unit = conp->vc_num;
struct display *p = &fb_display[unit];
int y = conp->vc_y;
if (mode & CM_SOFTBACK) {
mode &= ~CM_SOFTBACK;
if (softback_lines) {
if (y + softback_lines >= conp->vc_rows)
mode = CM_ERASE;
else
y += softback_lines;
}
} else if (softback_lines)
fbcon_set_origin(conp);
/* do we have a hardware cursor ? */
if (p->dispsw->cursor) {
int unit = conp->vc_num;
struct display *p = &fb_display[unit];
int y = conp->vc_y;
if (mode & CM_SOFTBACK) {
mode &= ~CM_SOFTBACK;
if (softback_lines) {
if (y + softback_lines >= conp->vc_rows)
mode = CM_ERASE;
else
y += softback_lines;
}
} else if (softback_lines)
fbcon_set_origin(conp);
/* Avoid flickering if there's no real change. */
if (p->cursor_x == conp->vc_x && p->cursor_y == y &&
(mode == CM_ERASE) == !cursor_on)
return;
cursor_on = 0;
if (cursor_drawn)
p->dispsw->cursor(p, 0, p->cursor_x, real_y(p, p->cursor_y));
p->cursor_x = conp->vc_x;
p->cursor_y = y;
p->dispsw->cursor(p, mode, p->cursor_x, real_y(p, p->cursor_y));
return;
}
/* Avoid flickering if there's no real change. */
if (p->cursor_x == conp->vc_x && p->cursor_y == y &&
(mode == CM_ERASE) == !cursor_on)
return;
p->cursor_pos = conp->vc_pos;
cursor_on = 0;
if (cursor_drawn)
p->dispsw->revc(p, p->cursor_x, real_y(p, p->cursor_y));
p->cursor_x = conp->vc_x;
p->cursor_y = y;
switch (mode) {
switch (mode) {
case CM_ERASE:
cursor_drawn = 0;
break;
cursor_drawn = 0;
break;
case CM_MOVE:
case CM_DRAW:
if (cursor_drawn)
p->dispsw->revc(p, p->cursor_x, real_y(p, p->cursor_y));
vbl_cursor_cnt = CURSOR_DRAW_DELAY;
cursor_on = 1;
break;
if (cursor_drawn)
p->dispsw->cursor(p, FB_CUR_SETCUR, p->cursor_x, real_y(p, p->cursor_y));
vbl_cursor_cnt = CURSOR_DRAW_DELAY;
cursor_on = 1;
break;
}
}
static void fbcon_vbl_handler(int irq, void *dummy, struct pt_regs *fp)
{
struct display *p;
if (!cursor_on)
return;
if (vbl_cursor_cnt && --vbl_cursor_cnt == 0) {
p = &fb_display[fg_console];
if (p->dispsw->revc)
p->dispsw->revc(p, p->cursor_x, real_y(p, p->cursor_y));
cursor_drawn ^= 1;
vbl_cursor_cnt = cursor_blink_rate;
}
struct display *p;
if (!cursor_on)
return;
if (vbl_cursor_cnt && --vbl_cursor_cnt == 0) {
int flag;
p = &fb_display[fg_console];
flag = 0;
if (!cursor_drawn)
flag = FB_CUR_SETCUR;
p->dispsw->cursor(p, flag, p->cursor_x, real_y(p, p->cursor_y));
cursor_drawn ^= 1;
vbl_cursor_cnt = cursor_blink_rate;
}
}
static int scrollback_phys_max = 0;
......
......@@ -121,6 +121,7 @@ static struct fb_ops dn_fb_ops = {
.fb_fillrect = cfb_fillrect,
.fb_copyarea = dnfb_copyarea,
.fb_imageblit = cfb_imageblit,
.fb_cursor = cfb_cursor,
};
struct fb_var_screeninfo dnfb_var __initdata = {
......
......@@ -29,90 +29,121 @@ int fb_set_var(struct fb_var_screeninfo *var, struct fb_info *info)
*var = info->var;
return 0;
}
if ((err = info->fbops->fb_check_var(var, info)))
return err;
if ((var->activate & FB_ACTIVATE_MASK) == FB_ACTIVATE_NOW) {
info->var = *var;
if (info->fbops->fb_set_par)
info->fbops->fb_set_par(info);
if (info->fbops->fb_pan_display)
info->fbops->fb_pan_display(&info->var, info);
info->fbops->fb_pan_display(&info->var,
info);
fb_set_cmap(&info->cmap, 1, info);
}
}
return 0;
}
int fb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info)
int cfb_cursor(struct fb_info *info, struct fbcursor *cursor)
{
int xoffset = var->xoffset;
int yoffset = var->yoffset;
int err;
if (xoffset < 0 || yoffset < 0 ||
xoffset + info->var.xres > info->var.xres_virtual ||
yoffset + info->var.yres > info->var.yres_virtual)
return -EINVAL;
if (info->fbops->fb_pan_display) {
if ((err = info->fbops->fb_pan_display(var, info)))
return err;
else
return -EINVAL;
}
info->var.xoffset = var->xoffset;
info->var.yoffset = var->yoffset;
if (var->vmode & FB_VMODE_YWRAP)
info->var.vmode |= FB_VMODE_YWRAP;
else
info->var.vmode &= ~FB_VMODE_YWRAP;
return 0;
}
int i, size = ((cursor->size.x + 7) / 8) * cursor->size.y;
struct fb_image image;
static char data[64];
image.bg_color = cursor->index->entry[0];
image.fg_color = cursor->index->entry[1];
/* ---- Helper functions --------------------------------------------------- */
if (cursor->depth == 1) {
if (cursor->enable) {
switch (cursor->rop) {
case ROP_XOR:
for (i = 0; i < size; i++)
data[i] = (cursor->image[i] &
cursor->mask[i]) ^
cursor->dest[i];
break;
case ROP_COPY:
default:
for (i = 0; i < size; i++)
data[i] =
cursor->image[i] & cursor->mask[i];
break;
}
} else
memcpy(data, cursor->dest, size);
/**
* fb_blank - blank the screen
* @blank: boolean, 0 unblank, 1 blank
* @info: frame buffer info structure
*
* Blank the screen on device @info.
*
*/
image.dx = cursor->pos.x;
image.dy = cursor->pos.y;
image.width = cursor->size.x;
image.height = cursor->size.y;
image.depth = cursor->depth;
image.data = data;
if (info->fbops->fb_imageblit)
info->fbops->fb_imageblit(info, &image);
}
}
int fb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info)
{
int xoffset = var->xoffset;
int yoffset = var->yoffset;
int err;
if (xoffset < 0 || yoffset < 0 ||
xoffset + info->var.xres > info->var.xres_virtual ||
yoffset + info->var.yres > info->var.yres_virtual)
return -EINVAL;
if (info->fbops->fb_pan_display) {
if ((err = info->fbops->fb_pan_display(var, info)))
return err;
else
return -EINVAL;
}
info->var.xoffset = var->xoffset;
info->var.yoffset = var->yoffset;
if (var->vmode & FB_VMODE_YWRAP)
info->var.vmode |= FB_VMODE_YWRAP;
else
info->var.vmode &= ~FB_VMODE_YWRAP;
return 0;
}
int fb_blank(int blank, struct fb_info *info)
{
struct fb_cmap cmap;
u16 black[16];
if (info->fbops->fb_blank && !info->fbops->fb_blank(blank, info))
struct fb_cmap cmap;
u16 black[16];
if (info->fbops->fb_blank && !info->fbops->fb_blank(blank, info))
return 0;
if (blank) {
memset(black, 0, 16 * sizeof(u16));
cmap.red = black;
cmap.green = black;
cmap.blue = black;
cmap.transp = NULL;
cmap.start = 0;
cmap.len = 16;
fb_set_cmap(&cmap, 1, info);
} else {
if (info->cmap.len)
fb_set_cmap(&info->cmap, 1, info);
else {
int size =
info->var.bits_per_pixel == 16 ? 64 : 256;
fb_set_cmap(fb_default_cmap(size), 1, info);
}
}
return 0;
if (blank) {
memset(black, 0, 16*sizeof(u16));
cmap.red = black;
cmap.green = black;
cmap.blue = black;
cmap.transp = NULL;
cmap.start = 0;
cmap.len = 16;
fb_set_cmap(&cmap, 1, info);
} else {
if (info->cmap.len)
fb_set_cmap(&info->cmap, 1, info);
else {
int size = info->var.bits_per_pixel == 16 ? 64 : 256;
fb_set_cmap(fb_default_cmap(size), 1, info);
}
}
return 0;
}
/* generic frame buffer operations */
EXPORT_SYMBOL(fb_set_var);
EXPORT_SYMBOL(cfb_cursor);
EXPORT_SYMBOL(fb_pan_display);
EXPORT_SYMBOL(fb_blank);
......
......@@ -178,6 +178,7 @@ static struct fb_ops fm2fb_ops = {
.fb_fillrect = cfb_fillrect,
.fb_copyarea = cfb_copyarea,
.fb_imageblit = cfb_imageblit,
.fb_cursor = cfb_cursor,
};
/*
......
......@@ -111,6 +111,7 @@ static int g364fb_pan_display(struct fb_var_screeninfo *var,
static int g364fb_setcolreg(u_int regno, u_int red, u_int green,
u_int blue, u_int transp,
struct fb_info *info);
static int g364fb_cursor(struct fb_info *info, struct fb_cursor *cursor);
static int g364fb_blank(int blank, struct fb_info *info);
static struct fb_ops g364fb_ops = {
......@@ -121,11 +122,13 @@ static struct fb_ops g364fb_ops = {
.fb_fillrect = cfb_fillrect,
.fb_copyarea = cfb_copyarea,
.fb_imageblit = cfb_imageblit,
.fb_cursor = g364fb_cursor,
};
void fbcon_g364fb_cursor(struct display *p, int mode, int x, int y)
int g364fb_cursor(struct fb_info *info, struct fb_cursor *cursor)
{
switch (mode) {
switch (cursor->enable) {
case CM_ERASE:
*(unsigned int *) CTLA_REG |= CURS_TOGGLE;
break;
......@@ -135,9 +138,10 @@ void fbcon_g364fb_cursor(struct display *p, int mode, int x, int y)
*(unsigned int *) CTLA_REG &= ~CURS_TOGGLE;
*(unsigned int *) CURS_POS_REG =
((x * fontwidth(p)) << 12) | ((y * fontheight(p)) -
p->var.yoffset);
info->var.yoffset);
break;
}
return 0;
}
/*
......
......@@ -128,6 +128,7 @@ static struct fb_ops hitfb_ops = {
.fb_fillrect = cfb_fillrect,
.fb_copyarea = cfb_copyarea,
.fb_imageblit = cfb_imageblit,
.fb_cursor = cfb_cursor,
};
int __init hitfb_init(void)
......
......@@ -105,6 +105,7 @@ static struct fb_ops hpfb_ops = {
.fb_fillrect = cfb_fillrect,
.fb_copyarea = hpfb_copyarea,
.fb_imageblit = cfb_imageblit,
.fb_cursor = cfb_cursor,
};
#define TOPCAT_FBOMSB 0x5d
......
......@@ -589,6 +589,7 @@ static struct fb_ops macfb_ops = {
.fb_fillrect = cfb_fillrect,
.fb_copyarea = cfb_copyarea,
.fb_imageblit = cfb_imageblit,
.fb_cursor = cfb_cursor,
};
void __init macfb_setup(char *options, int *ints)
......
......@@ -114,6 +114,7 @@ static struct fb_ops maxinefb_ops = {
.fb_fillrect = cfb_fillrect,
.fb_copyarea = cfb_copyarea,
.fb_imageblit = cfb_imageblit,
.fb_cursor = cfb_cursor,
};
int __init maxinefb_init(void)
......
......@@ -1393,6 +1393,7 @@ static struct fb_ops neofb_ops = {
.fb_fillrect = cfb_fillrect,
.fb_copyarea = cfb_copyarea,
.fb_imageblit = cfb_imageblit,
.fb_cursor = cfb_cursor,
};
/* --------------------------------------------------------------------- */
......
......@@ -86,6 +86,7 @@ static struct fb_ops offb_ops = {
.fb_fillrect = cfb_fillrect,
.fb_copyarea = cfb_copyarea,
.fb_imageblit = cfb_imageblit,
.fb_cursor = cfb_cursor,
};
/*
......
......@@ -112,6 +112,7 @@ static struct fb_ops pmagbafb_ops = {
.fb_fillrect = cfb_fillrect,
.fb_copyarea = cfb_copyarea,
.fb_imageblit = cfb_imageblit,
.fb_cursor = cfb_cursor,
}
int __init pmagbafb_init_one(int slot)
......
......@@ -115,6 +115,7 @@ static struct fb_ops pmagbbfb_ops = {
.fb_fillrect = cfb_fillrect,
.fb_copyarea = cfb_copyarea,
.fb_imageblit = cfb_imageblit,
.fb_cursor = cfb_cursor,
};
int __init pmagbbfb_init_one(int slot)
......
......@@ -70,6 +70,7 @@ static struct fb_ops q40fb_ops = {
.fb_fillrect = cfb_fillrect,
.fb_copyarea = cfb_copyarea,
.fb_imageblit = cfb_imageblit,
.fb_cursor = cfb_cursor,
};
static int q40fb_setcolreg(unsigned regno, unsigned red, unsigned green,
......
......@@ -105,6 +105,7 @@ static struct fb_ops sgivwfb_ops = {
.fb_fillrect = cfb_fillrect,
.fb_copyarea = cfb_copyarea,
.fb_imageblit = cfb_imageblit,
.fb_cursor = cfb_cursor,
.fb_mmap = sgivwfb_mmap,
};
......
......@@ -283,6 +283,12 @@ static int xxxfb_setcolreg(unsigned regno, unsigned red, unsigned green,
return 0;
}
/**
* xxxfb_cursor -
*
* Returns negative errno on error, or zero on success.
*/
/**
* xxxfb_pan_display - NOT a required function. Pans the display.
* @var: frame buffer variable screen structure
......
......@@ -176,6 +176,7 @@ static struct fb_ops tdfxfb_ops = {
.fb_fillrect = tdfxfb_fillrect,
.fb_copyarea = tdfxfb_copyarea,
.fb_imageblit = tdfxfb_imageblit,
.fb_cursor = cfb_cursor,
};
/*
......
......@@ -98,6 +98,7 @@ static struct fb_ops tx3912fb_ops = {
.fb_fillrect = cfb_fillrect,
.fb_copyarea = cfb_copyarea,
.fb_imageblit = cfb_imageblit,
.fb_cursor = cfb_cursor,
};
static int tx3912fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
......
......@@ -175,6 +175,7 @@ static struct fb_ops vesafb_ops = {
.fb_fillrect = cfb_fillrect,
.fb_copyarea = cfb_copyarea,
.fb_imageblit = cfb_imageblit,
.fb_cursor = cfb_cursor,
};
int __init vesafb_setup(char *options)
......
......@@ -93,14 +93,15 @@ static int vfb_mmap(struct fb_info *info, struct file *file,
struct vm_area_struct *vma);
static struct fb_ops vfb_ops = {
.fb_check_var vfb_check_var,
.fb_set_par vfb_set_par,
.fb_setcolreg vfb_setcolreg,
.fb_pan_display vfb_pan_display,
.fb_fillrect cfb_fillrect,
.fb_copyarea cfb_copyarea,
.fb_imageblit cfb_imageblit,
.fb_mmap vfb_mmap,
.fb_check_var = vfb_check_var,
.fb_set_par = vfb_set_par,
.fb_setcolreg = vfb_setcolreg,
.fb_pan_display = vfb_pan_display,
.fb_fillrect = cfb_fillrect,
.fb_copyarea = cfb_copyarea,
.fb_imageblit = cfb_imageblit,
.fb_cursor = cfb_cursor,
.fb_mmap = vfb_mmap,
};
/*
......
......@@ -1054,6 +1054,7 @@ static struct fb_ops vga16fb_ops = {
.fb_pan_display = vga16fb_pan_display,
.fb_blank = vga16fb_blank,
.fb_imageblit = vga16fb_imageblit,
.fb_cursor = cfb_cursor,
};
int vga16fb_setup(char *options)
......
......@@ -222,6 +222,11 @@ struct fb_cmap {
__u16 *transp; /* transparency, can be NULL */
};
struct fb_index {
__u32 len; /* number of entries */
__u32 *entry; /* "pseudopalette" color index entries */
};
struct fb_con2fbmap {
__u32 console;
__u32 framebuffer;
......@@ -268,7 +273,9 @@ struct fb_vblank {
#define FB_CUR_SETHOT 0x04
#define FB_CUR_SETCMAP 0x08
#define FB_CUR_SETSHAPE 0x10
#define FB_CUR_SETALL 0x1F
#define FB_CUR_SETDEST 0x20
#define FB_CUR_SETSIZE 0x40
#define FB_CUR_SETALL 0xFF
struct fbcurpos {
__u16 x, y;
......@@ -277,12 +284,16 @@ struct fbcurpos {
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 fb_cmap cmap; /* color map info */
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 */
......@@ -314,7 +325,7 @@ struct fb_image {
__u32 height;
__u32 fg_color; /* Only used when a mono bitmap */
__u32 bg_color;
__u8 depth; /* Dpeth of the image */
__u8 depth; /* Depth of the image */
char *data; /* Pointer to image data */
};
......@@ -351,8 +362,6 @@ struct fb_ops {
int (*fb_check_var)(struct fb_var_screeninfo *var, struct fb_info *info);
/* set the video mode according to par */
int (*fb_set_par)(struct fb_info *info);
/* cursor control */
int (*fb_cursor)(struct fb_info *info, struct fbcursor *cursor);
/* set color register */
int (*fb_setcolreg)(unsigned regno, unsigned red, unsigned green,
unsigned blue, unsigned transp, struct fb_info *info);
......@@ -366,6 +375,8 @@ struct fb_ops {
void (*fb_copyarea)(struct fb_info *info, struct fb_copyarea *region);
/* Draws a image to the display */
void (*fb_imageblit)(struct fb_info *info, struct fb_image *image);
/* Draws cursor */
int (*fb_cursor)(struct fb_info *info, struct fbcursor *cursor);
/* perform polling on fb device */
int (*fb_poll)(struct fb_info *info, poll_table *wait);
/* wait for blit idle, optional */
......@@ -451,6 +462,7 @@ struct fb_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_blank(int blank, struct fb_info *info);
extern int cfb_cursor(struct fb_info *info, struct fbcursor *cursor);
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_imageblit(struct fb_info *info, struct fb_image *image);
......
......@@ -36,7 +36,7 @@ struct display_switch {
void (*putcs)(struct vc_data *conp, struct display *p, const unsigned short *s,
int count, int yy, int xx);
void (*revc)(struct display *p, int xx, int yy);
void (*cursor)(struct display *p, int mode, int xx, int yy);
void (*cursor)(struct display *p, int flags, int xx, int yy);
int (*set_font)(struct display *p, int width, int height);
void (*clear_margins)(struct vc_data *conp, struct display *p,
int bottom_only);
......@@ -69,6 +69,7 @@ struct display {
int vrows; /* number of virtual rows */
unsigned short cursor_x; /* current cursor position */
unsigned short cursor_y;
unsigned long cursor_pos;
int fgcol; /* text colors */
int bgcol;
u_long next_line; /* offset to one line below */
......
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