Exemple #1
0
static int
promcon_start(struct vc_data *conp, char *b)
{
	unsigned short *s = (unsigned short *)
			(conp->vc_origin + py * conp->vc_size_row + (px << 1));
	u16 cs;

	cs = scr_readw(s);
	if (px == pw) {
		unsigned short *t = s - 1;
		u16 ct = scr_readw(t);

		if (inverted(cs) && inverted(ct))
			return sprintf(b, "\b\033[7m%c\b\033[@%c\033[m", cs,
				       ct);
		else if (inverted(cs))
			return sprintf(b, "\b\033[7m%c\033[m\b\033[@%c", cs,
				       ct);
		else if (inverted(ct))
			return sprintf(b, "\b%c\b\033[@\033[7m%c\033[m", cs,
				       ct);
		else
			return sprintf(b, "\b%c\b\033[@%c", cs, ct);
	}

	if (inverted(cs))
		return sprintf(b, "\033[7m%c\033[m\b", cs);
	else
		return sprintf(b, "%c\b", cs);
}
void fbcon_mfb_putcs(struct vc_data *conp, struct display *p, 
		     const unsigned short *s, int count, int yy, int xx)
{
    u8 *dest, *dest0, *cdat;
    u_int rows, bold, revs, underl;
    u8 d;
    u16 c;

    dest0 = p->screen_base+yy*fontheight(p)*p->next_line+xx;
    bold = attr_bold(p,scr_readw(s));
    revs = attr_reverse(p,scr_readw(s));
    underl = attr_underline(p,scr_readw(s));

    while (count--) {
	c = scr_readw(s++) & p->charmask;
	dest = dest0++;
	cdat = p->fontdata+c*fontheight(p);
	for (rows = fontheight(p); rows--; dest += p->next_line) {
	    d = *cdat++;
	    if (underl && !rows)
		d = 0xff;
	    else if (bold)
		d |= d>>1;
	    if (revs)
		d = ~d;
	    *dest = d;
	}
    }
}
Exemple #3
0
static int
promcon_end(struct vc_data *conp, char *b)
{
	unsigned short *s = (unsigned short *)
			(conp->vc_origin + py * conp->vc_size_row + (px << 1));
	char *p = b;
	u16 cs;

	b += sprintf(b, "\033[%d;%dH", py + 1, px + 1);

	cs = scr_readw(s);
	if (px == pw) {
		unsigned short *t = s - 1;
		u16 ct = scr_readw(t);

		if (inverted(cs) && inverted(ct))
			b += sprintf(b, "\b%c\b\033[@\033[7m%c\033[m", cs, ct);
		else if (inverted(cs))
			b += sprintf(b, "\b%c\b\033[@%c", cs, ct);
		else if (inverted(ct))
			b += sprintf(b, "\b\033[7m%c\b\033[@%c\033[m", cs, ct);
		else
			b += sprintf(b, "\b\033[7m%c\033[m\b\033[@%c", cs, ct);
		return b - p;
	}

	if (inverted(cs))
		b += sprintf(b, "%c\b", cs);
	else
		b += sprintf(b, "\033[7m%c\033[m\b", cs);
	return b - p;
}
Exemple #4
0
static void sticon_putcs(struct vc_data *conp, const unsigned short *s,
			 int count, int ypos, int xpos)
{
    int redraw_cursor = 0;

    if (vga_is_gfx || console_blanked)
	    return;

    if (conp->vc_mode != KD_TEXT)
    	    return;

#if 0
    if ((p->cursor_y == ypos) && (xpos <= p->cursor_x) &&
	(p->cursor_x < (xpos + count))) {
	    cursor_undrawn();
	    redraw_cursor = 1;
    }
#endif

    while (count--) {
	sti_putc(sticon_sti, scr_readw(s++), ypos, xpos++);
    }

    if (redraw_cursor)
	    vbl_cursor_cnt = CURSOR_DRAW_DELAY;
}
Exemple #5
0
static inline void bit_putcs_aligned(struct vc_data *vc, struct fb_info *info,
				     const u16 *s, u32 attr, u32 cnt,
				     u32 d_pitch, u32 s_pitch, u32 cellsize,
				     struct fb_image *image, u8 *buf, u8 *dst)
{
	u16 charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff;
	u32 idx = vc->vc_font.width >> 3;
	u8 *src;

	while (cnt--) {
		src = vc->vc_font.data + (scr_readw(s++)&
					  charmask)*cellsize;

		if (attr) {
			update_attr(buf, src, attr, vc);
			src = buf;
		}

		if (likely(idx == 1))
			__fb_pad_aligned_buffer(dst, d_pitch, src, idx,
						image->height);
		else
			fb_pad_aligned_buffer(dst, d_pitch, src, idx,
					      image->height);

		dst += s_pitch;
	}

	info->fbops->fb_imageblit(info, image);
}
Exemple #6
0
static inline void bit_putcs_unaligned(struct vc_data *vc,
				       struct fb_info *info, const u16 *s,
				       u32 attr, u32 cnt, u32 d_pitch,
				       u32 s_pitch, u32 cellsize,
				       struct fb_image *image, u8 *buf,
				       u8 *dst)
{
	u16 charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff;
	u32 shift_low = 0, mod = vc->vc_font.width % 8;
	u32 shift_high = 8;
	u32 idx = vc->vc_font.width >> 3;
	u8 *src;

	while (cnt--) {
		src = vc->vc_font.data + (scr_readw(s++)&
					  charmask)*cellsize;

		if (attr) {
			update_attr(buf, src, attr, vc);
			src = buf;
		}

		fb_pad_unaligned_buffer(dst, d_pitch, src, idx,
					image->height, shift_high,
					shift_low, mod);
		shift_low += mod;
		dst += (shift_low >= 8) ? s_pitch : s_pitch - 1;
		shift_low &= 7;
		shift_high = 8 - shift_low;
	}

	info->fbops->fb_imageblit(info, image);

}
Exemple #7
0
static unsigned short *
promcon_repaint_line(unsigned short *s, unsigned char *buf, unsigned char **bp)
{
	int cnt = pw + 1;
	int attr = -1;
	unsigned char *b = *bp;

	while (cnt--) {
		u16 c = scr_readw(s);
		if (attr != inverted(c)) {
			attr = inverted(c);
			if (attr) {
				strcpy (b, "\033[7m");
				b += 4;
			} else {
				strcpy (b, "\033[m");
				b += 3;
			}
		}
		*b++ = c;
		s++;
		if (b - buf >= 224) {
			promcon_puts(buf, b - buf);
			b = buf;
		}
	}
	*bp = b;
	return s;
}
static void mdacon_invert_region(struct vc_data *c, u16 *p, int count)
{
	for (; count > 0; count--) {
		scr_writew(scr_readw(p) ^ 0x0800, p);
		p++;
	}
}
Exemple #9
0
static void fbcon_sti_putcs(struct vc_data *conp,
			    struct display *p, 
			    const unsigned short *s,
			    int count, int yy, int xx)
{
	u8 *dest, *dest0, *cdat;
	u_int rows, bold, revs, underl;
	u8 d;
	u16 c;

	if(((unsigned)xx > 200) || ((unsigned) yy > 200)) {
		printk("refusing to putcs %p %p %p %d %d %d (%p)\n",
			conp, p, s, count, yy, xx, __builtin_return_address(0));
		return;
	}	


	dest0 = p->screen_base+yy*fontheight(p)*p->next_line+xx;
	if(((u32)dest0&0xf0000000)!=0xf0000000) {
		printk("refusing to putcs %p %p %p %d %d %d (%p) %p = %p + %d * %d * %ld + %d\n",
			conp, p, s, count, yy, xx, __builtin_return_address(0),
			dest0, p->screen_base, yy, fontheight(p), p->next_line,
			xx);
		return;
	}	

	c = scr_readw(s);
	bold = attr_bold(p, c);
	revs = attr_reverse(p, c);
	underl = attr_underline(p, c);

	while (count--) {
		c = scr_readw(s++) & p->charmask;
		dest = dest0++;
		cdat = p->fontdata+c*fontheight(p);
		for (rows = fontheight(p); rows--; dest += p->next_line) {
			d = *cdat++;
			if (0 && underl && !rows)
				d = 0xff;
			else if (0 && bold)
				d |= d>>1;
			if (revs)
				d = ~d;
			writeb_hp (d, dest);
		}
	}
}
static void mdacon_putcs(struct vc_data *c, const unsigned short *s,
		         int count, int y, int x)
{
	u16 *dest = MDA_ADDR(x, y);

	for (; count > 0; count--) {
		scr_writew(mda_convert_attr(scr_readw(s++)), dest++);
	}
}
Exemple #11
0
static void fbcon_riva32_putcs(struct vc_data *conp, struct display *p,
			     const unsigned short *s, int count, int yy,
			     int xx)
{
	u16 c;
	u32 fgx,bgx;

	xx *= fontwidth(p);
	yy *= fontheight(p);

	c = scr_readw(s);
	fgx = ((u32 *)p->dispsw_data)[attr_fgcol(p, c)];
	bgx = ((u32 *)p->dispsw_data)[attr_bgcol(p, c)];
	while (count--) {
		c = scr_readw(s++);
		fbcon_riva_writechr(conp, p, c, fgx, bgx, yy, xx);
		xx += fontwidth(p);
	}
}
Exemple #12
0
static void fbcon_riva16_putcs(struct vc_data *conp, struct display *p,
			     const unsigned short *s, int count, int yy,
			     int xx)
{
	u16 c;
	u32 fgx,bgx;

	xx *= fontwidth(p);
	yy *= fontheight(p);

	c = scr_readw(s);
	fgx = ((u16 *)p->dispsw_data)[attr_fgcol(p, c)];
	bgx = ((u16 *)p->dispsw_data)[attr_bgcol(p, c)];
	if (p->var.green.length == 6)
		convert_bgcolor_16(&bgx);
	while (count--) {
		c = scr_readw(s++);
		fbcon_riva_writechr(conp, p, c, fgx, bgx, yy, xx);
		xx += fontwidth(p);
	}
}
Exemple #13
0
/* 28.50 in my test */
void fbcon_ega_planes_putcs(struct vc_data *conp, struct display *p, const unsigned short *s,
		   int count, int yy, int xx)
{
	int fg = attr_fgcol(p,scr_readw(s));
	int bg = attr_bgcol(p,scr_readw(s));

	char *where;
	int n;

	setmode(2);
	setop(0);
	selectmask();

	setmask(0xff);
	where = p->screen_base + xx + yy * p->line_length * fontheight(p);
	writeb(bg, where);
	rmb();
	readb(where); /* fill latches */
	wmb();
	selectmask();
	for (n = 0; n < count; n++) {
		int c = scr_readw(s++) & p->charmask;
		u8 *cdat = p->fontdata + c * fontheight(p);
		u8 *end = cdat + fontheight(p);

		while (cdat < end) {
			outb(*cdat++, GRAPHICS_DATA_REG);	
			wmb();
			writeb(fg, where);
			where += p->line_length;
		}
		where += 1 - p->line_length * fontheight(p);
	}
	
	wmb();
}
Exemple #14
0
static void tile_putcs(struct vc_data *vc, struct fb_info *info,
		       const unsigned short *s, int count, int yy, int xx,
		       int fg, int bg)
{
	struct fb_tileblit blit;
	unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff;
	int size = sizeof(u32) * count, i;

	blit.sx = xx;
	blit.sy = yy;
	blit.width = count;
	blit.height = 1;
	blit.fg = fg;
	blit.bg = bg;
	blit.length = count;
	blit.indices = (u32 *) fb_get_buffer_offset(info, &info->pixmap, size);
	for (i = 0; i < count; i++)
		blit.indices[i] = (u32)(scr_readw(s++) & charmask);

	info->tileops->fb_tileblit(info, &blit);
}
Exemple #15
0
static void i810_accel_revc(struct display *p, int xx, int yy)
{
    struct blit_data rect;
    int depth, c, fg;

    if (i810_accel->lockup || not_safe())
        return;

    c = scr_readw((u16 *) p->conp->vc_pos);
    fg = (int) attr_fgcol(p,c);

    depth = (p->var.bits_per_pixel + 7) >> 3;

    switch (depth) {
    case 1:
        rect.fg = fg;
        rect.blit_bpp = BPP8;
        break;
    case 2:
        rect.fg = (int) ((u16 *)p->dispsw_data)[fg];
        rect.blit_bpp = BPP16;
        break;
    case 3:
        rect.fg = ((int *)p->dispsw_data)[fg];
        rect.blit_bpp = BPP24;
        break;
    }


    rect.dpitch = p->next_line;
    rect.dwidth = fontwidth(p)*depth;
    rect.dheight = fontheight(p);
    rect.d_addr = (i810_accel->fb_offset << 12) +
                  (yy * rect.dheight * p->next_line) +
                  (xx * rect.dwidth);
    rect.rop = XOR_ROP;
    color_blit(&rect);
}
Exemple #16
0
static void bit_putcs(struct vc_data *vc, struct fb_info *info,
		      const unsigned short *s, int count, int yy, int xx,
		      int fg, int bg)
{
	struct fb_image image;
	u32 width = DIV_ROUND_UP(vc->vc_font.width, 8);
	u32 cellsize = width * vc->vc_font.height;
	u32 maxcnt = info->pixmap.size/cellsize;
	u32 scan_align = info->pixmap.scan_align - 1;
	u32 buf_align = info->pixmap.buf_align - 1;
	u32 mod = vc->vc_font.width % 8, cnt, pitch, size;
	u32 attribute = get_attribute(info, scr_readw(s));
	u8 *dst, *buf = NULL;

	image.fg_color = fg;
	image.bg_color = bg;
	image.dx = xx * vc->vc_font.width;
	image.dy = yy * vc->vc_font.height;
	image.height = vc->vc_font.height;
	image.depth = 1;

	if (attribute) {
		buf = kmalloc(cellsize, GFP_KERNEL);
		if (!buf)
			return;
	}

	while (count) {
		if (count > maxcnt)
			cnt = maxcnt;
		else
			cnt = count;

		image.width = vc->vc_font.width * cnt;
		pitch = DIV_ROUND_UP(image.width, 8) + scan_align;
		pitch &= ~scan_align;
		size = pitch * image.height + buf_align;
		size &= ~buf_align;
		dst = fb_get_buffer_offset(info, &info->pixmap, size);
		image.data = dst;

		if (!mod)
			bit_putcs_aligned(vc, info, s, attribute, cnt, pitch,
					  width, cellsize, &image, buf, dst);
		else
			bit_putcs_unaligned(vc, info, s, attribute, cnt,
					    pitch, width, cellsize, &image,
					    buf, dst);

		image.dx += cnt * vc->vc_font.width;
		count -= cnt;
		s += cnt;
	}

	/* buf is always NULL except when in monochrome mode, so in this case
	   it's a gain to check buf against NULL even though kfree() handles
	   NULL pointers just fine */
	if (unlikely(buf))
		kfree(buf);

}
Exemple #17
0
static int mda_detect(void)
{
	int count=0;
	u16 *p, p_save;
	u16 *q, q_save;

	

	p = (u16 *) mda_vram_base;
	q = (u16 *) (mda_vram_base + 0x01000);

	p_save = scr_readw(p); q_save = scr_readw(q);

	scr_writew(0xAA55, p); if (scr_readw(p) == 0xAA55) count++;
	scr_writew(0x55AA, p); if (scr_readw(p) == 0x55AA) count++;
	scr_writew(p_save, p);

	if (count != 2) {
		return 0;
	}

	

	scr_writew(0xA55A, q); scr_writew(0x0000, p);
	if (scr_readw(q) == 0xA55A) count++;
	
	scr_writew(0x5AA5, q); scr_writew(0x0000, p);
	if (scr_readw(q) == 0x5AA5) count++;

	scr_writew(p_save, p); scr_writew(q_save, q);
	
	if (count == 4) {
		mda_vram_len = 0x02000;
	}
	
	

#ifdef TEST_MDA_B
	

	
	if (! test_mda_b(0x66, 0x0f)) {
		return 0;
	}

	
	if (! test_mda_b(0x99, 0x0f)) {
		return 0;
	}
#endif

	
	
	p_save = q_save = inb_p(mda_status_port) & MDA_STATUS_VSYNC;

	for (count=0; count < 50000 && p_save == q_save; count++) {
		q_save = inb(mda_status_port) & MDA_STATUS_VSYNC;
		udelay(2);
	}

	if (p_save != q_save) {
		switch (inb_p(mda_status_port) & 0x70) {
			case 0x10:
				mda_type = TYPE_HERCPLUS;
				mda_type_name = "HerculesPlus";
				break;
			case 0x50:
				mda_type = TYPE_HERCCOLOR;
				mda_type_name = "HerculesColor";
				break;
			default:
				mda_type = TYPE_HERC;
				mda_type_name = "Hercules";
				break;
		}
	}

	return 1;
}
static int mda_detect(void)
{
	int count=0;
	u16 *p, p_save;
	u16 *q, q_save;

	/* do a memory check */

	p = (u16 *) mda_vram_base;
	q = (u16 *) (mda_vram_base + 0x01000);

	p_save = scr_readw(p); q_save = scr_readw(q);

	scr_writew(0xAA55, p); if (scr_readw(p) == 0xAA55) count++;
	scr_writew(0x55AA, p); if (scr_readw(p) == 0x55AA) count++;
	scr_writew(p_save, p);

	if (count != 2) {
		return 0;
	}

	/* check if we have 4K or 8K */

	scr_writew(0xA55A, q); scr_writew(0x0000, p);
	if (scr_readw(q) == 0xA55A) count++;
	
	scr_writew(0x5AA5, q); scr_writew(0x0000, p);
	if (scr_readw(q) == 0x5AA5) count++;

	scr_writew(p_save, p); scr_writew(q_save, q);
	
	if (count == 4) {
		mda_vram_len = 0x02000;
	}
	
	/* Ok, there is definitely a card registering at the correct
	 * memory location, so now we do an I/O port test.
	 */

#ifdef TEST_MDA_B
	/* Edward: These two mess `tests' mess up my cursor on bootup */

	/* cursor low register */
	if (! test_mda_b(0x66, 0x0f)) {
		return 0;
	}

	/* cursor low register */
	if (! test_mda_b(0x99, 0x0f)) {
		return 0;
	}
#endif

	/* See if the card is a Hercules, by checking whether the vsync
	 * bit of the status register is changing.  This test lasts for
	 * approximately 1/10th of a second.
	 */
	
	p_save = q_save = inb_p(mda_status_port) & MDA_STATUS_VSYNC;

	for (count=0; count < 50000 && p_save == q_save; count++) {
		q_save = inb(mda_status_port) & MDA_STATUS_VSYNC;
		udelay(2);
	}

	if (p_save != q_save) {
		switch (inb_p(mda_status_port) & 0x70) {
			case 0x10:
				mda_type = TYPE_HERCPLUS;
				mda_type_name = "HerculesPlus";
				break;
			case 0x50:
				mda_type = TYPE_HERCCOLOR;
				mda_type_name = "HerculesColor";
				break;
			default:
				mda_type = TYPE_HERC;
				mda_type_name = "Hercules";
				break;
		}
	}

	return 1;
}
Exemple #19
0
static void ffb_putcs(struct vc_data *conp, struct display *p, const unsigned short *s,
		      int count, int yy, int xx)
{
	struct fb_info_sbusfb *fb = (struct fb_info_sbusfb *)p->fb_info;
	register struct ffb_fbc *fbc = fb->s.ffb.fbc;
	unsigned long flags;
	int i, xy;
	u8 *fd1, *fd2, *fd3, *fd4;
	u16 c;
	u64 fgbg;

	spin_lock_irqsave(&fb->lock, flags);
	c = scr_readw(s);
	fgbg = (((u64)(((u32 *)p->dispsw_data)[attr_fgcol(p, c)])) << 32) |
	       ((u32 *)p->dispsw_data)[attr_bgcol(p, c)];
	if (fgbg != *(u64 *)&fb->s.ffb.fg_cache) {
		FFBFifo(fb, 2);
		upa_writeq(fgbg, &fbc->fg);
		*(u64 *)&fb->s.ffb.fg_cache = fgbg;
	}
	xy = fb->s.ffb.xy_margin;
	if (fontwidthlog(p))
		xy += (xx << fontwidthlog(p));
	else
		xy += xx * fontwidth(p);
	if (fontheightlog(p))
		xy += (yy << (16 + fontheightlog(p)));
	else
		xy += ((yy * fontheight(p)) << 16);
	if (fontwidth(p) <= 8) {
		while (count >= 4) {
			count -= 4;
			FFBFifo(fb, 2 + fontheight(p));
			upa_writel(4 * fontwidth(p), &fbc->fontw);
			upa_writel(xy, &fbc->fontxy);
			if (fontheightlog(p)) {
				fd1 = p->fontdata + ((scr_readw(s++) & p->charmask) << fontheightlog(p));
				fd2 = p->fontdata + ((scr_readw(s++) & p->charmask) << fontheightlog(p));
				fd3 = p->fontdata + ((scr_readw(s++) & p->charmask) << fontheightlog(p));
				fd4 = p->fontdata + ((scr_readw(s++) & p->charmask) << fontheightlog(p));
			} else {
				fd1 = p->fontdata + ((scr_readw(s++) & p->charmask) * fontheight(p));
				fd2 = p->fontdata + ((scr_readw(s++) & p->charmask) * fontheight(p));
				fd3 = p->fontdata + ((scr_readw(s++) & p->charmask) * fontheight(p));
				fd4 = p->fontdata + ((scr_readw(s++) & p->charmask) * fontheight(p));
			}
			if (fontwidth(p) == 8) {
				for (i = 0; i < fontheight(p); i++) {
					u32 val;

					val = ((u32)*fd4++) | ((((u32)*fd3++) | ((((u32)*fd2++) | (((u32)*fd1++) 
						<< 8)) << 8)) << 8);
					upa_writel(val, &fbc->font);
				}
				xy += 32;
			} else {
				for (i = 0; i < fontheight(p); i++) {
					u32 val = (((u32)*fd4++) | ((((u32)*fd3++) | ((((u32)*fd2++) | (((u32)*fd1++) 
						<< fontwidth(p))) << fontwidth(p))) << fontwidth(p))) << (24 - 3 * fontwidth(p));
					upa_writel(val, &fbc->font);
				}
				xy += 4 * fontwidth(p);
			}
		}
	} else {
		while (count >= 2) {
			count -= 2;
			FFBFifo(fb, 2 + fontheight(p));
			upa_writel(2 * fontwidth(p), &fbc->fontw);
			upa_writel(xy, &fbc->fontxy);
			if (fontheightlog(p)) {
				fd1 = p->fontdata + ((scr_readw(s++) & p->charmask) << (fontheightlog(p) + 1));
				fd2 = p->fontdata + ((scr_readw(s++) & p->charmask) << (fontheightlog(p) + 1));
			} else {
				fd1 = p->fontdata + (((scr_readw(s++) & p->charmask) * fontheight(p)) << 1);
				fd2 = p->fontdata + (((scr_readw(s++) & p->charmask) * fontheight(p)) << 1);
			}
			for (i = 0; i < fontheight(p); i++) {
				u32 val = ((((u32)*(u16 *)fd1) << fontwidth(p)) | ((u32)*(u16 *)fd2)) << (16 - fontwidth(p));

				upa_writel(val, &fbc->font);
				fd1 += 2; fd2 += 2;
			}
			xy += 2 * fontwidth(p);
		}
	}
	while (count) {
		count--;
		FFBFifo(fb, 2 + fontheight(p));
		upa_writel(fontwidth(p), &fbc->fontw);
		upa_writel(xy, &fbc->fontxy);
		if (fontheightlog(p))
			i = ((scr_readw(s++) & p->charmask) << fontheightlog(p));
		else
			i = ((scr_readw(s++) & p->charmask) * fontheight(p));
		if (fontwidth(p) <= 8) {
			fd1 = p->fontdata + i;
			for (i = 0; i < fontheight(p); i++) {
				u32 val = *fd1++ << 24;

				upa_writel(val, &fbc->font);
			}
		} else {
			fd1 = p->fontdata + (i << 1);
			for (i = 0; i < fontheight(p); i++) {
				u32 val = *(u16 *)fd1 << 16;

				upa_writel(val, &fbc->font);
				fd1 += 2;
			}
		}
		xy += fontwidth(p);
	}
	spin_unlock_irqrestore(&fb->lock, flags);
}
Exemple #20
0
static void i810_accel_putcs(struct vc_data *conp, struct display *p,
                             const unsigned short *s, int count, int yy, int xx)
{
    struct blit_data text;
    int depth, c, d_addr, s_pitch, d_pitch, f_width, cell;
    char *s_addr;
    void (*move_data)(void *dst, void *src, int dpitch, int spitch, int size);

    if (i810_accel->lockup || not_safe())
        return;

    c = scr_readw(s);
    depth = (p->var.bits_per_pixel + 7) >> 3;

    switch (depth) {
    case 1:
        text.fg = (int) attr_fgcol(p,c);
        text.bg = (int) attr_bgcol(p,c);
        text.blit_bpp = BPP8;
        break;
    case 2:
        text.bg = (int) ((u16 *)p->dispsw_data)[attr_bgcol(p, c)];
        text.fg = (int) ((u16 *)p->dispsw_data)[attr_fgcol(p, c)];
        text.blit_bpp = BPP16;
        break;
    case 3:
        text.fg = ((int *) p->dispsw_data)[attr_fgcol(p, c)];
        text.bg = ((int *) p->dispsw_data)[attr_bgcol(p, c)];
        text.blit_bpp = BPP24;
    }

    f_width = (fontwidth(p) + 7) & ~7;

    switch (f_width) {
    case 8:
        move_data = i810fb_moveb;
        break;
    case 16:
        move_data = i810fb_movew;
        break;
    case 32:
        move_data = i810fb_movel;
        break;
    default:
        move_data = i810fb_move;
        break;
    }

    s_pitch = f_width >> 3;
    d_pitch = ((s_pitch * count) + 1) & ~1;

    text.dwidth = f_width * depth * count;
    text.dheight = fontheight(p);
    text.dpitch = p->next_line;
    text.dsize = ((d_pitch * text.dheight) + 7) & ~7;
    text.dsize >>= 2;
    text.rop = PAT_COPY_ROP;
    text.d_addr = (i810_accel->fb_offset << 12) + (yy * text.dheight * p->next_line) +
                  (xx * f_width * depth);
    text.s_addr[0] = d_addr = i810_accel->text_buffer;

    cell = s_pitch * text.dheight;
    if (s_pitch == 1 && count > 3) {
        int i, d_addr0;
        char *s1, *s2, *s3, *s4;

        while (count > 3) {
            s1 = p->fontdata + (scr_readw(s++) & p->charmask) * cell;
            s2 = p->fontdata + (scr_readw(s++) & p->charmask) * cell;
            s3 = p->fontdata + (scr_readw(s++) & p->charmask) * cell;
            s4 = p->fontdata + (scr_readw(s++) & p->charmask) * cell;
            d_addr0 = d_addr;

            for (i = text.dheight; i--; ) {
                *(unsigned long *) d_addr0 =
                    (unsigned long) ((*s1++ & 0xff)       |
                                     (*s2++ & 0xff) << 8  |
                                     (*s3++ & 0xff) << 16 |
                                     (*s4++ & 0xff) << 24   );
                d_addr0 += d_pitch;
            }
            d_addr += 4;
            count -= 4;
        }
    }

    while (count--) {
        c = scr_readw(s++) & p->charmask;
        s_addr = p->fontdata + (c * cell);
        move_data((void *) d_addr, s_addr, d_pitch, s_pitch, text.dheight);
        d_addr += s_pitch;
    }

    mono_src_copy_imm_blit(&text);
}
Exemple #21
0
static void
promcon_putcs(struct vc_data *conp, const unsigned short *s,
	      int count, int y, int x)
{
	unsigned char buf[256], *b = buf;
	unsigned short attr = scr_readw(s);
	unsigned char save;
	int i, last = 0;

	if (console_blanked)
		return;
	
	if (count <= 0)
		return;

	b += promcon_start(conp, b);

	if (x + count >= pw + 1) {
		if (count == 1) {
			x -= 1;
			save = scr_readw((unsigned short *)(conp->vc_origin
						   + y * conp->vc_size_row
						   + (x << 1)));

			if (px != x || py != y) {
				b += sprintf(b, "\033[%d;%dH", y + 1, x + 1);
				px = x;
				py = y;
			}

			if (inverted(attr))
				b += sprintf(b, "\033[7m%c\033[m", scr_readw(s++));
			else
				b += sprintf(b, "%c", scr_readw(s++));

			strcpy(b, "\b\033[@");
			b += 4;

			if (inverted(save))
				b += sprintf(b, "\033[7m%c\033[m", save);
			else
				b += sprintf(b, "%c", save);

			px++;

			b += promcon_end(conp, b);
			promcon_puts(buf, b - buf);
			return;
		} else {
			last = 1;
			count = pw - x - 1;
		}
	}

	if (inverted(attr)) {
		strcpy(b, "\033[7m");
		b += 4;
	}

	if (px != x || py != y) {
		b += sprintf(b, "\033[%d;%dH", y + 1, x + 1);
		px = x;
		py = y;
	}

	for (i = 0; i < count; i++) {
		if (b - buf >= 224) {
			promcon_puts(buf, b - buf);
			b = buf;
		}
		*b++ = scr_readw(s++);
	}

	px += count;

	if (last) {
		save = scr_readw(s++);
		b += sprintf(b, "%c\b\033[@%c", scr_readw(s++), save);
		px++;
	}

	if (inverted(attr)) {
		strcpy(b, "\033[m");
		b += 3;
	}

	b += promcon_end(conp, b);
	promcon_puts(buf, b - buf);
}
static void leo_putcs(struct vc_data *conp, struct display *p, const unsigned short *s,
		      int count, int yy, int xx)
{
	struct fb_info_sbusfb *fb = (struct fb_info_sbusfb *)p->fb_info;
	register struct leo_lc_ss0_usr *us = fb->s.leo.lc_ss0_usr;
	register struct leo_ld *ss = (struct leo_ld *) fb->s.leo.ld_ss0;
	unsigned long flags;
	int i, x, y;
	u8 *fd1, *fd2, *fd3, *fd4;
	u16 c;
	u32 *u;

	spin_lock_irqsave(&fb->lock, flags);
	do {
		i = sbus_readl(&us->csr);
	} while (i & 0x20000000);
	c = scr_readw(s);
	sbus_writel(attr_fgcol(p, c) << 24, &ss->fg);
	sbus_writel(attr_bgcol(p, c) << 24, &ss->bg);
	sbus_writel(0xFFFFFFFF<<(32-fontwidth(p)), &us->fontmsk);
	if (fontwidthlog(p))
		x = (xx << fontwidthlog(p));
	else
		x = xx * fontwidth(p);
	if (fontheightlog(p))
		y = yy << (fontheightlog(p) + 11);
	else
		y = (yy * fontheight(p)) << 11;
	u = ((u32 *)p->screen_base) + y + x;
	if (fontwidth(p) <= 8) {
		sbus_writel(0xFFFFFFFF<<(32-4*fontwidth(p)), &us->fontmsk);
		x = 4*fontwidth(p) - fontheight(p)*2048;
		while (count >= 4) {
			count -= 4;
			if (fontheightlog(p)) {
				fd1 = p->fontdata + ((scr_readw(s++) & p->charmask) << fontheightlog(p));
				fd2 = p->fontdata + ((scr_readw(s++) & p->charmask) << fontheightlog(p));
				fd3 = p->fontdata + ((scr_readw(s++) & p->charmask) << fontheightlog(p));
				fd4 = p->fontdata + ((scr_readw(s++) & p->charmask) << fontheightlog(p));
			} else {
				fd1 = p->fontdata + ((scr_readw(s++) & p->charmask) * fontheight(p));
				fd2 = p->fontdata + ((scr_readw(s++) & p->charmask) * fontheight(p));
				fd3 = p->fontdata + ((scr_readw(s++) & p->charmask) * fontheight(p));
				fd4 = p->fontdata + ((scr_readw(s++) & p->charmask) * fontheight(p));
			}
			if (fontwidth(p) == 8) {
				for (i = 0; i < fontheight(p); i++, u += 2048) {
					u32 val;

					val = ((u32)*fd4++) | ((((u32)*fd3++) | ((((u32)*fd2++) | (((u32)*fd1++) 
						<< 8)) << 8)) << 8);
					sbus_writel(val, u);
				}
				u += x;
			} else {
				for (i = 0; i < fontheight(p); i++, u += 2048) {
					u32 val;

					val = (((u32)*fd4++) | ((((u32)*fd3++) | ((((u32)*fd2++) | (((u32)*fd1++) 
						<< fontwidth(p))) << fontwidth(p))) << fontwidth(p))) << (24 - 3 * fontwidth(p));
					sbus_writel(val, u);
				}
				u += x;
			}
		}
	} else {
		sbus_writel(0xFFFFFFFF<<(32-2*fontwidth(p)), &us->fontmsk);
		x = 2*fontwidth(p) - fontheight(p)*2048;
		while (count >= 2) {
			count -= 2;
			if (fontheightlog(p)) {
				fd1 = p->fontdata + ((scr_readw(s++) & p->charmask) << (fontheightlog(p) + 1));
				fd2 = p->fontdata + ((scr_readw(s++) & p->charmask) << (fontheightlog(p) + 1));
			} else {
				fd1 = p->fontdata + (((scr_readw(s++) & p->charmask) * fontheight(p)) << 1);
				fd2 = p->fontdata + (((scr_readw(s++) & p->charmask) * fontheight(p)) << 1);
			}
			for (i = 0; i < fontheight(p); i++, u += 2048) {
				u32 val;

				val = ((((u32)*(u16 *)fd1) << fontwidth(p)) | ((u32)*(u16 *)fd2)) << (16 - fontwidth(p));
				sbus_writel(val, u);
				fd1 += 2; fd2 += 2;
			}
			u += x;
		}
	}
	sbus_writel(0xFFFFFFFF<<(32-fontwidth(p)), &us->fontmsk);
	x = fontwidth(p) - fontheight(p)*2048;
	while (count) {
		count--;
		if (fontheightlog(p))
			i = ((scr_readw(s++) & p->charmask) << fontheightlog(p));
		else
			i = ((scr_readw(s++) & p->charmask) * fontheight(p));
		if (fontwidth(p) <= 8) {
			fd1 = p->fontdata + i;
			for (i = 0; i < fontheight(p); i++, u += 2048) {
				u32 val = *fd1++ << 24;

				sbus_writel(val, u);
			}
		} else {
			fd1 = p->fontdata + (i << 1);
			for (i = 0; i < fontheight(p); i++, u += 2048) {
				u32 val = *(u16 *)fd1 << 16;

				sbus_writel(val, u);
				fd1 += 2;
			}
		}
		u += x;
	}
	spin_unlock_irqrestore(&fb->lock, flags);
}
Exemple #23
0
static void bit_cursor(struct vc_data *vc, struct fb_info *info, int mode,
		       int softback_lines, int fg, int bg)
{
	struct fb_cursor cursor;
	struct fbcon_ops *ops = info->fbcon_par;
	unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff;
	int w = DIV_ROUND_UP(vc->vc_font.width, 8), c;
	int y = real_y(ops->p, vc->vc_y);
	int attribute, use_sw = (vc->vc_cursor_type & 0x10);
	int err = 1;
	char *src;

	cursor.set = 0;

	if (softback_lines) {
		if (y + softback_lines >= vc->vc_rows) {
			mode = CM_ERASE;
			ops->cursor_flash = 0;
			return;
		} else
			y += softback_lines;
	}

 	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 (ops->cursor_state.image.data != src ||
	    ops->cursor_reset) {
	    ops->cursor_state.image.data = src;
	    cursor.set |= FB_CUR_SETIMAGE;
	}

	if (attribute) {
		u8 *dst;

		dst = kmalloc(w * vc->vc_font.height, GFP_ATOMIC);
		if (!dst)
			return;
		kfree(ops->cursor_data);
		ops->cursor_data = dst;
		update_attr(dst, src, attribute, vc);
		src = dst;
	}

	if (ops->cursor_state.image.fg_color != fg ||
	    ops->cursor_state.image.bg_color != bg ||
	    ops->cursor_reset) {
		ops->cursor_state.image.fg_color = fg;
		ops->cursor_state.image.bg_color = bg;
		cursor.set |= FB_CUR_SETCMAP;
	}

	if ((ops->cursor_state.image.dx != (vc->vc_font.width * vc->vc_x)) ||
	    (ops->cursor_state.image.dy != (vc->vc_font.height * y)) ||
	    ops->cursor_reset) {
		ops->cursor_state.image.dx = vc->vc_font.width * vc->vc_x;
		ops->cursor_state.image.dy = vc->vc_font.height * y;
		cursor.set |= FB_CUR_SETPOS;
	}

	if (ops->cursor_state.image.height != vc->vc_font.height ||
	    ops->cursor_state.image.width != vc->vc_font.width ||
	    ops->cursor_reset) {
		ops->cursor_state.image.height = vc->vc_font.height;
		ops->cursor_state.image.width = vc->vc_font.width;
		cursor.set |= FB_CUR_SETSIZE;
	}

	if (ops->cursor_state.hot.x || ops->cursor_state.hot.y ||
	    ops->cursor_reset) {
		ops->cursor_state.hot.x = cursor.hot.y = 0;
		cursor.set |= FB_CUR_SETHOT;
	}

	if (cursor.set & FB_CUR_SETSIZE ||
	    vc->vc_cursor_type != ops->p->cursor_shape ||
	    ops->cursor_state.mask == NULL ||
	    ops->cursor_reset) {
		char *mask = kmalloc(w*vc->vc_font.height, GFP_ATOMIC);
		int cur_height, size, i = 0;
		u8 msk = 0xff;

		if (!mask)
			return;

		kfree(ops->cursor_state.mask);
		ops->cursor_state.mask = mask;

		ops->p->cursor_shape = vc->vc_cursor_type;
		cursor.set |= FB_CUR_SETSHAPE;

		switch (ops->p->cursor_shape & CUR_HWMASK) {
		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;
	}