Skip to contentSkip to conversation

writing a framebuffer driver and font problem..

DISCUSSION Kaj-Michael Lang 2 participants 4 messages Oct 31, 2003 Framebuffer layer

lore
Share & tools
lore
#0 lore raw

Hello..

I hope someone here can help me. I've started writing support for the b/w framebuffer on
VAXstation for the Linux/VAX project. And I've got so far that it sort-of works, I can output text
on the framebuffer and such. Problem is that all font are flipped/mirrored, like a "b" looks like "d", this picture
might show it a little bit better: http://home.tal.org/~milang/vax/2.html
And as you can se from the picture the logo looks strange.

What might be the problem, and what should I do to fix it ?

I'm totaly new a writing kernel code so it might be something obvious that I'm missing.

Signature · 9 lines
Kaj-Michael Lang , [email protected]



-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?   SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
#1 lore raw
Quoted 9 lines · Kaj-Michael Lang

I hope someone here can help me. I've started writing support for the b/w framebuffer on
VAXstation for the Linux/VAX project. And I've got so far that it sort-of works, I can output text
on the framebuffer and such. Problem is that all font are flipped/mirrored, like a "b" looks like "d", this picture
might show it a little bit better: http://home.tal.org/~milang/vax/2.html
And as you can se from the picture the logo looks strange.

Quoted 4 lines

What might be the problem, and what should I do to fix it ?

I'm totaly new a writing kernel code so it might be something obvious that I'm missing.

Are you using 2.4 or 2.6?

You have to swap the character data in drivers/video/fbcon-mfb.c:fbcon_mfb_putc{,s}() (2.4.x) or drivers/video/cfbimgblt.c.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/

#2 lore raw
Quoted 1 line · Geert Uytterhoeven

Are you using 2.4 or 2.6?

2.4 for now, but I'm going to port it over to 2.6.

Quoted 3 lines

You have to swap the character data in drivers/video/fbcon-mfb.c:fbcon_mfb_putc{,s}() (2.4.x) or drivers/video/cfbimgblt.c.

Ok.. stupid question.. how do I do that ?

Signature · 9 lines
Kaj-Michael Lang <[email protected]>



-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?   SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
#3 lore raw
Quoted 10 lines · Kaj-Michael Lang
Quoted 1 line · Geert Uytterhoeven

Are you using 2.4 or 2.6?

2.4 for now, but I'm going to port it over to 2.6.

Quoted 3 lines

You have to swap the character data in drivers/video/fbcon-mfb.c:fbcon_mfb_putc{,s}() (2.4.x) or drivers/video/cfbimgblt.c.

Ok.. stupid question.. how do I do that ?

This (untested) patch should do the trick...

drivers/video/fbcon-mfb.c renamed from drivers/video/fbcon-mfb.c.orig +11 -2
@@ -19,6 +19,15 @@
 #include <video/fbcon-mfb.h>
 
 
+static inline u8 swap_byte(u8 in)
+{
+    in = ((in & 0xf0) >> 4) | ((in & 0x0f) << 4);
+    in = ((in & 0xcc) >> 2) | ((in & 0x33) << 2);
+    in = ((in & 0xaa) >> 1) | ((in & 0x55) << 1);
+    return in;
+}
+
+
     /*
      *  Monochrome
      */
@@ -97,7 +106,7 @@
     underl = attr_underline(p,c);
 
     for (rows = fontheight(p); rows--; dest += p->next_line) {
-	d = *cdat++;
+	d = swap_byte(*cdat++);
 	if (underl && !rows)
 	    d = 0xff;
 	else if (bold)
@@ -127,7 +136,7 @@
 	dest = dest0++;
 	cdat = p->fontdata+c*fontheight(p);
 	for (rows = fontheight(p); rows--; dest += p->next_line) {
-	    d = *cdat++;
+	    d = swap_byte(*cdat++);
 	    if (underl && !rows)
 		d = 0xff;
 	    else if (bold)

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/