summaryrefslogtreecommitdiffstats
path: root/drivers/video/fbcon-iplan2p2.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>1999-01-04 16:03:48 +0000
committerRalf Baechle <ralf@linux-mips.org>1999-01-04 16:03:48 +0000
commit78c388aed2b7184182c08428db1de6c872d815f5 (patch)
tree4b2003b1b4ceb241a17faa995da8dd1004bb8e45 /drivers/video/fbcon-iplan2p2.c
parenteb7a5bf93aaa4be1d7c6181100ab7639e74d67f7 (diff)
Merge with Linux 2.1.131 and more MIPS goodies.
(Did I mention that CVS is buggy ...)
Diffstat (limited to 'drivers/video/fbcon-iplan2p2.c')
-rw-r--r--drivers/video/fbcon-iplan2p2.c102
1 files changed, 82 insertions, 20 deletions
diff --git a/drivers/video/fbcon-iplan2p2.c b/drivers/video/fbcon-iplan2p2.c
index 3cd8ab81e..c8d6838be 100644
--- a/drivers/video/fbcon-iplan2p2.c
+++ b/drivers/video/fbcon-iplan2p2.c
@@ -19,8 +19,8 @@
#include <asm/byteorder.h>
-#include "fbcon.h"
-#include "fbcon-iplan2p2.h"
+#include <video/fbcon.h>
+#include <video/fbcon-iplan2p2.h>
/*
@@ -169,18 +169,25 @@ void fbcon_iplan2p2_bmove(struct display *p, int sy, int sx, int dy, int dx,
/* Special (but often used) case: Moving whole lines can be
* done with memmove()
*/
- mymemmove(p->screen_base + dy * p->next_line * p->fontheight,
- p->screen_base + sy * p->next_line * p->fontheight,
- p->next_line * height * p->fontheight);
+ mymemmove(p->screen_base + dy * p->next_line * fontheight(p),
+ p->screen_base + sy * p->next_line * fontheight(p),
+ p->next_line * height * fontheight(p));
} else {
int rows, cols;
u8 *src;
u8 *dst;
int bytes = p->next_line;
- int linesize = bytes * p->fontheight;
- u_int colsize = height * p->fontheight;
+ int linesize;
+ u_int colsize;
u_int upwards = (dy < sy) || (dy == sy && dx < sx);
+ if (fontheightlog(p)) {
+ linesize = bytes << fontheightlog(p);
+ colsize = height << fontheightlog(p);
+ } else {
+ linesize = bytes * fontheight(p);
+ colsize = height * fontheight(p);
+ }
if ((sx & 1) == (dx & 1)) {
/* odd->odd or even->even */
if (upwards) {
@@ -258,19 +265,30 @@ void fbcon_iplan2p2_clear(struct vc_data *conp, struct display *p, int sy,
u8 *start;
int rows;
int bytes = p->next_line;
- int lines = height * p->fontheight;
+ int lines;
u32 size;
u32 cval;
u16 pcval;
cval = expand2l (COLOR_2P (attr_bgcol_ec(p,conp)));
+ if (fontheightlog(p))
+ lines = height << fontheightlog(p);
+ else
+ lines = height * fontheight(p);
+
if (sx == 0 && width * 2 == bytes) {
- offset = sy * bytes * p->fontheight;
+ if (fontheightlog(p))
+ offset = (sy * bytes) << fontheightlog(p);
+ else
+ offset = sy * bytes * fontheight(p);
size = lines * bytes;
memset_even_2p(p->screen_base+offset, size, cval);
} else {
- offset = (sy * bytes * p->fontheight) + (sx>>1)*4 + (sx & 1);
+ if (fontheightlog(p))
+ offset = ((sy * bytes) << fontheightlog(p)) + (sx>>1)*4 + (sx & 1);
+ else
+ offset = sy * bytes * fontheight(p) + (sx>>1)*4 + (sx & 1);
start = p->screen_base + offset;
pcval = expand2w(COLOR_2P(attr_bgcol_ec(p,conp)));
@@ -306,14 +324,21 @@ void fbcon_iplan2p2_putc(struct vc_data *conp, struct display *p, int c,
int bytes = p->next_line;
u16 eorx, fgx, bgx, fdx;
- dest = p->screen_base + yy * p->fontheight * bytes + (xx>>1)*4 + (xx & 1);
- cdat = p->fontdata + (c & p->charmask) * p->fontheight;
+ if (fontheightlog(p)) {
+ dest = (p->screen_base + ((yy * bytes) << fontheightlog(p)) +
+ (xx>>1)*4 + (xx & 1));
+ cdat = p->fontdata + ((c & p->charmask) << fontheightlog(p));
+ } else {
+ dest = (p->screen_base + yy * bytes * fontheight(p) +
+ (xx>>1)*4 + (xx & 1));
+ cdat = p->fontdata + (c & p->charmask) * fontheight(p);
+ }
fgx = expand2w(COLOR_2P(attr_fgcol(p,c)));
bgx = expand2w(COLOR_2P(attr_bgcol(p,c)));
eorx = fgx ^ bgx;
- for (rows = p->fontheight ; rows-- ; dest += bytes) {
+ for (rows = fontheight(p) ; rows-- ; dest += bytes) {
fdx = dup2w(*cdat++);
movepw(dest, (fdx & eorx) ^ bgx);
}
@@ -330,16 +355,24 @@ void fbcon_iplan2p2_putcs(struct vc_data *conp, struct display *p,
u16 eorx, fgx, bgx, fdx;
bytes = p->next_line;
- dest0 = p->screen_base + yy * p->fontheight * bytes + (xx>>1)*4 + (xx & 1);
+ if (fontheightlog(p))
+ dest0 = (p->screen_base + ((yy * bytes) << fontheightlog(p)) +
+ (xx>>1)*4 + (xx & 1));
+ else
+ dest0 = (p->screen_base + yy * bytes * fontheight(p) +
+ (xx>>1)*4 + (xx & 1));
fgx = expand2w(COLOR_2P(attr_fgcol(p,*s)));
bgx = expand2w(COLOR_2P(attr_bgcol(p,*s)));
eorx = fgx ^ bgx;
while (count--) {
c = *s++ & p->charmask;
- cdat = p->fontdata + (c * p->fontheight);
+ if (fontheightlog(p))
+ cdat = p->fontdata + (c << fontheightlog(p));
+ else
+ cdat = p->fontdata + c * fontheight(p);
- for (rows = p->fontheight, dest = dest0; rows-- ; dest += bytes) {
+ for (rows = fontheight(p), dest = dest0; rows-- ; dest += bytes) {
fdx = dup2w(*cdat++);
movepw(dest, (fdx & eorx) ^ bgx);
}
@@ -353,9 +386,13 @@ void fbcon_iplan2p2_revc(struct display *p, int xx, int yy)
int j;
int bytes;
- dest = p->screen_base + yy * p->fontheight * p->next_line + (xx>>1)*4 +
- (xx & 1);
- j = p->fontheight;
+ if (fontheightlog(p))
+ dest = (p->screen_base + ((yy * p->next_line) << fontheightlog(p)) +
+ (xx>>1)*4 + (xx & 1));
+ else
+ dest = (p->screen_base + yy * p->next_line * fontheight(p) +
+ (xx>>1)*4 + (xx & 1));
+ j = fontheight(p);
bytes = p->next_line;
while (j--) {
/* This should really obey the individual character's
@@ -368,6 +405,30 @@ void fbcon_iplan2p2_revc(struct display *p, int xx, int yy)
}
}
+void fbcon_iplan2p2_clear_margins(struct vc_data *conp, struct display *p,
+ int bottom_only)
+{
+ u32 offset;
+ int bytes;
+ int lines;
+ u32 cval;
+
+/* No need to handle right margin, cannot occur with fontwidth == 8 */
+
+ bytes = p->next_line;
+ if (fontheightlog(p)) {
+ lines = p->var.yres - (conp->vc_rows << fontheightlog(p));
+ offset = ((p->yscroll + conp->vc_rows) * bytes) << fontheightlog(p);
+ } else {
+ lines = p->var.yres - conp->vc_rows * fontheight(p);
+ offset = (p->yscroll + conp->vc_rows) * bytes * fontheight(p);
+ }
+ if (lines) {
+ cval = expand2l(COLOR_2P(attr_bgcol_ec(p,conp)));
+ memset_even_2p(p->screen_base+offset, lines * bytes, cval);
+ }
+}
+
/*
* `switch' for the low level operations
@@ -376,7 +437,7 @@ void fbcon_iplan2p2_revc(struct display *p, int xx, int yy)
struct display_switch fbcon_iplan2p2 = {
fbcon_iplan2p2_setup, fbcon_iplan2p2_bmove, fbcon_iplan2p2_clear,
fbcon_iplan2p2_putc, fbcon_iplan2p2_putcs, fbcon_iplan2p2_revc, NULL,
- NULL, NULL, FONTWIDTH(8)
+ NULL, fbcon_iplan2p2_clear_margins, FONTWIDTH(8)
};
@@ -402,3 +463,4 @@ EXPORT_SYMBOL(fbcon_iplan2p2_clear);
EXPORT_SYMBOL(fbcon_iplan2p2_putc);
EXPORT_SYMBOL(fbcon_iplan2p2_putcs);
EXPORT_SYMBOL(fbcon_iplan2p2_revc);
+EXPORT_SYMBOL(fbcon_iplan2p2_clear_margins);