- c = scr_readw((u16 *) vc->vc_pos);
- attribute = get_attribute(info, c);
- src = vc->vc_font.data + ((c & charmask) * (w * vc->vc_font.height));
- if (attribute) {
- u8 *dst;
-
- dst = kmalloc(w * vc->vc_font.height, GFP_ATOMIC);
- if (!dst)
- return;
- if (info->cursor.data)
- kfree(info->cursor.data);
- info->cursor.data = dst;
- update_attr(dst, src, attribute, vc);
- src = dst;
- }
-
- cursor.image.data = src;
- cursor.set = FB_CUR_SETCUR;
- cursor.image.depth = 1;
-
- switch (mode) {
- case CM_ERASE:
- if (info->cursor.rop == ROP_XOR) {
- info->cursor.enable = 0;
- info->cursor.rop = ROP_COPY;
- info->fbops->fb_cursor(info, &cursor);
- }
- break;
- case CM_MOVE:
- case CM_DRAW:
- info->cursor.enable = 1;
- fg = get_color(vc, info, c, 1);
- bg = get_color(vc, info, c, 0);
-
- if (info->cursor.image.fg_color != fg ||
- info->cursor.image.bg_color != bg) {
- cursor.image.fg_color = fg;
- cursor.image.bg_color = bg;
- cursor.set |= FB_CUR_SETCMAP;
- }
-
- if ((info->cursor.image.dx != (vc->vc_font.width * vc->vc_x)) ||
- (info->cursor.image.dy != (vc->vc_font.height * y))) {
- cursor.image.dx = vc->vc_font.width * vc->vc_x;
- cursor.image.dy = vc->vc_font.height * y;
- cursor.set |= FB_CUR_SETPOS;
- }
-
- if (info->cursor.image.height != vc->vc_font.height ||
- info->cursor.image.width != vc->vc_font.width) {
- cursor.image.height = vc->vc_font.height;
- cursor.image.width = vc->vc_font.width;
- cursor.set |= FB_CUR_SETSIZE;
- }
-
- if (info->cursor.hot.x || info->cursor.hot.y) {
- cursor.hot.x = cursor.hot.y = 0;
- cursor.set |= FB_CUR_SETHOT;
- }
-
- if ((cursor.set & FB_CUR_SETSIZE) ||
- ((vc->vc_cursor_type & 0x0f) != p->cursor_shape)
- || info->cursor.mask == NULL) {
- char *mask = kmalloc(w*vc->vc_font.height, GFP_ATOMIC);
- int cur_height, size, i = 0;
- u8 msk = 0xff;
-
- if (!mask)
- return;
-
- if (info->cursor.mask)
- kfree(info->cursor.mask);
- info->cursor.mask = mask;
- p->cursor_shape = vc->vc_cursor_type & 0x0f;
- cursor.set |= FB_CUR_SETSHAPE;
-
- switch (vc->vc_cursor_type & 0x0f) {
- case CUR_NONE:
- cur_height = 0;
- break;
- case CUR_UNDERLINE:
- cur_height = (vc->vc_font.height < 10) ? 1 : 2;
- break;
- case CUR_LOWER_THIRD:
- cur_height = vc->vc_font.height/3;
- break;
- case CUR_LOWER_HALF:
- cur_height = vc->vc_font.height >> 1;
- break;
- case CUR_TWO_THIRDS:
- cur_height = (vc->vc_font.height << 1)/3;
- break;
- case CUR_BLOCK:
- default:
- cur_height = vc->vc_font.height;
- break;
- }
- size = (vc->vc_font.height - cur_height) * w;
- while (size--)
- mask[i++] = ~msk;
- size = cur_height * w;
- while (size--)
- mask[i++] = msk;
- }
- info->cursor.rop = ROP_XOR;
- info->fbops->fb_cursor(info, &cursor);
- vbl_cursor_cnt = CURSOR_DRAW_DELAY;
- break;
- }