2006-03-27 00:47:43

by Herbert Poetzl

[permalink] [raw]
Subject: funny framebuffer fonts on PowerBook with radeonfb


Hey Ben!

2.6.16 and 2.6.15-something show a funny behaviour
when using the radeonfb driver (for text mode), they
kind of twist and break the fonts in various places
some characters or parts seem to be mirrored like
'[' becoming ']' but not on character boundary but
more on N pixels, colors seem to be correct for the
characters, and sometimes the font is perfectly fine
for larger runs, e.g. I can read the logon prompt
fine, but everything I type is garbled ...

just for an example, when I type 'echo "Test"' then
all characters are mirrored and cut off on the right
side but the locations are as shown above, on enter
the T is only a few pixels wide, but the est part is
written perfectly fine ... this is a new behaviour
and going back to 2.6.13.3 doesn't show this ...

if there is some testing I can do for you, or when
you need more info, please let me know. here a few
details for the machine:

TIA,
Herbert

processor : 0
cpu : 7450, altivec supported
clock : 667.000000MHz
revision : 0.1 (pvr 8000 0201)
bogomips : 66.56
timebase : 33290001
machine : PowerBook3,3
motherboard : PowerBook3,3 MacRISC2 MacRISC Power Macintosh
detected as : 72 (PowerBook Titanium II)
pmac flags : 0000001b
L2 cache : 256K unified
pmac-generation: NewWorld

00:10.0 VGA compatible controller: ATI Technologies Inc Radeon Mobility M6 LY (prog-if 00 [VGA])
Subsystem: ATI Technologies Inc Radeon Mobility M6 LY
Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping+ SERR- FastB2B-
Status: Cap+ 66Mhz+ UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR-
Latency: 255 (2000ns min), cache line size 08
Interrupt: pin A routed to IRQ 48
Region 0: Memory at b8000000 (32-bit, prefetchable) [size=128M]
Region 1: I/O ports at f0000400 [size=256]
Region 2: Memory at b0000000 (32-bit, non-prefetchable) [size=64K]
Expansion ROM at f1000000 [disabled] [size=128K]
Capabilities: [58] AGP version 2.0
Status: RQ=48 Iso- ArqSz=0 Cal=0 SBA+ ITACoh- GART64- HTrans- 64bit- FW- AGP3- Rate=x1,x2,x4
Command: RQ=1 ArqSz=0 Cal=0 SBA+ AGP- GART64- 64bit- FW- Rate=<none>
Capabilities: [50] Power Management version 2
Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)
Status: D0 PME-Enable- DSel=0 DScale=0 PME-

PCI: Enabling device 0000:00:10.0 (0086 -> 0087)
radeonfb (0000:00:10.0): Invalid ROM signature 8080 should be 0xaa55
radeonfb: Retrieved PLL infos from Open Firmware
radeonfb: Reference=27.00 MHz (RefDiv=12) Memory=166.00 Mhz, System=166.00 MHz
radeonfb: PLL min 12000 max 35000
radeonfb: Monitor 1 type LCD found
radeonfb: EDID probed
radeonfb: Monitor 2 type no found
radeonfb: Using Firmware dividers 0x0001003a from PPLL 0
radeonfb: Dynamic Clock Power Management enabled
Console: switching to colour frame buffer device 164x54
Registered "ati" backlight controller,level: 15/15
radeonfb (0000:00:10.0): ATI Radeon LY



2006-03-27 01:18:55

by Benjamin Herrenschmidt

[permalink] [raw]
Subject: Re: funny framebuffer fonts on PowerBook with radeonfb

On Mon, 2006-03-27 at 02:47 +0200, Herbert Poetzl wrote:
> Hey Ben!
>
> 2.6.16 and 2.6.15-something show a funny behaviour
> when using the radeonfb driver (for text mode), they
> kind of twist and break the fonts in various places
> some characters or parts seem to be mirrored like
> '[' becoming ']' but not on character boundary but
> more on N pixels, colors seem to be correct for the
> characters, and sometimes the font is perfectly fine
> for larger runs, e.g. I can read the logon prompt
> fine, but everything I type is garbled ...
>
> just for an example, when I type 'echo "Test"' then
> all characters are mirrored and cut off on the right
> side but the locations are as shown above, on enter
> the T is only a few pixels wide, but the est part is
> written perfectly fine ... this is a new behaviour
> and going back to 2.6.13.3 doesn't show this ...
>
> if there is some testing I can do for you, or when
> you need more info, please let me know. here a few
> details for the machine:

I have a similar machine and haven't seen such a problem with it so
far ... does this happen after you load X or already at boot before X
ever kicks in ? Does it happen if you don't load any font (that is for
example boot with init=/bin/sh to prevent any init script to try to load
a font)

Ben.


2006-03-27 01:20:43

by Antonino A. Daplas

[permalink] [raw]
Subject: Re: funny framebuffer fonts on PowerBook with radeonfb

Herbert Poetzl wrote:
> Hey Ben!
>
> 2.6.16 and 2.6.15-something show a funny behaviour
> when using the radeonfb driver (for text mode), they
> kind of twist and break the fonts in various places
> some characters or parts seem to be mirrored like
> '[' becoming ']' but not on character boundary but
> more on N pixels, colors seem to be correct for the
> characters, and sometimes the font is perfectly fine
> for larger runs, e.g. I can read the logon prompt
> fine, but everything I type is garbled ...
>
> just for an example, when I type 'echo "Test"' then
> all characters are mirrored and cut off on the right
> side but the locations are as shown above, on enter
> the T is only a few pixels wide, but the est part is
> written perfectly fine ... this is a new behaviour
> and going back to 2.6.13.3 doesn't show this ...
>
> if there is some testing I can do for you, or when
> you need more info, please let me know. here a few
> details for the machine:
>

What font are you using? I presume the dimensions are
not divisible by 8. Can you try this patch?

Tony

diff --git a/drivers/video/cfbimgblt.c b/drivers/video/cfbimgblt.c
index 910e233..8ba6152 100644
--- a/drivers/video/cfbimgblt.c
+++ b/drivers/video/cfbimgblt.c
@@ -169,7 +169,7 @@ static inline void slow_imageblit(const

while (j--) {
l--;
- color = (*s & 1 << (FB_BIT_NR(l))) ? fgcolor : bgcolor;
+ color = (*s & (1 << l)) ? fgcolor : bgcolor;
val |= FB_SHIFT_HIGH(color, shift);

/* Did the bitshift spill bits to the next long? */
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 17fc771..4fe1d2d 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -841,12 +841,10 @@ struct fb_info {
#define FB_LEFT_POS(bpp) (32 - bpp)
#define FB_SHIFT_HIGH(val, bits) ((val) >> (bits))
#define FB_SHIFT_LOW(val, bits) ((val) << (bits))
-#define FB_BIT_NR(b) (7 - (b))
#else
#define FB_LEFT_POS(bpp) (0)
#define FB_SHIFT_HIGH(val, bits) ((val) << (bits))
#define FB_SHIFT_LOW(val, bits) ((val) >> (bits))
-#define FB_BIT_NR(b) (b)
#endif

/*

2006-03-27 01:24:35

by Daniel Hazelton

[permalink] [raw]
Subject: Re: funny framebuffer fonts on PowerBook with radeonfb

On Sunday 26 March 2006 19:47, Herbert Poetzl wrote:
> Hey Ben!
>
> 2.6.16 and 2.6.15-something show a funny behaviour
> when using the radeonfb driver (for text mode), they
> kind of twist and break the fonts in various places
> some characters or parts seem to be mirrored like
> '[' becoming ']' but not on character boundary but
> more on N pixels, colors seem to be correct for the
> characters, and sometimes the font is perfectly fine
> for larger runs, e.g. I can read the logon prompt
> fine, but everything I type is garbled ...
>
> just for an example, when I type 'echo "Test"' then
> all characters are mirrored and cut off on the right
> side but the locations are as shown above, on enter
> the T is only a few pixels wide, but the est part is
> written perfectly fine ... this is a new behaviour
> and going back to 2.6.13.3 doesn't show this ...
>
> if there is some testing I can do for you, or when
> you need more info, please let me know. here a few
> details for the machine:

I saw this on an PC with a Radeon 7000/VE that was slowly going bad. I'd
recommend you run a full diagnostic on the video system memory (if possible)
and look for errors there. If it isn't the memory (which was the problem on
my Radeon) then the GPU itself might be going bad.

ShadowWolf

2006-03-27 03:37:45

by Herbert Poetzl

[permalink] [raw]
Subject: Re: funny framebuffer fonts on PowerBook with radeonfb

On Mon, Mar 27, 2006 at 12:17:21PM +1100, Benjamin Herrenschmidt wrote:
> On Mon, 2006-03-27 at 02:47 +0200, Herbert Poetzl wrote:
> > Hey Ben!
> >
> > 2.6.16 and 2.6.15-something show a funny behaviour
> > when using the radeonfb driver (for text mode), they
> > kind of twist and break the fonts in various places
> > some characters or parts seem to be mirrored like
> > '[' becoming ']' but not on character boundary but
> > more on N pixels, colors seem to be correct for the
> > characters, and sometimes the font is perfectly fine
> > for larger runs, e.g. I can read the logon prompt
> > fine, but everything I type is garbled ...
> >
> > just for an example, when I type 'echo "Test"' then
> > all characters are mirrored and cut off on the right
> > side but the locations are as shown above, on enter
> > the T is only a few pixels wide, but the est part is
> > written perfectly fine ... this is a new behaviour
> > and going back to 2.6.13.3 doesn't show this ...
> >
> > if there is some testing I can do for you, or when
> > you need more info, please let me know. here a few
> > details for the machine:
>
> I have a similar machine and haven't seen such a problem with
> it so far ... does this happen after you load X or already at
> boot before X ever kicks in?

long before X is started (which doesn't happen by
default on my setup), btw X works fine

> Does it happen if you don't load any font (that is for example
> boot with init=/bin/sh to prevent any init script to try to load
> a font)

yes, just tried that, the boot looks like this:

first, I end up in the bootloader yaboot, which
asks me (in a very small font) which kernel to
boot, then, for example, I enter

linux2616 init=/bin/bash

after that, the screen goes white for half a second
and becomes black with a large terminal font on it
(the one I get without framebuffer, I think), the
text there is printed undistorted ... shortly after
that, I get a flash, and the mode switches to a much
smaller font (the final framebuffer font) and the
kernel messages written there are already distorted.
half a second later (or less) the penguin appears at
the top area (undistorted), when the bootup is done
I get the following prompt (which again is okay)

bash-2.05b#

typing anything there is distorted again ...

pressing enter several times leaves 'copies' of
the caracters on the screen, forming vertical bars
the prompt (bash) is now always fine, the copy one
line above (as all the others) is distorted ...

note, the bootup is not much different with older
kernels, except for the strange distortions ...

attached my kernel configuration, just in case
it is related ...

TIA,
Herbert

> Ben.
>


Attachments:
(No filename) (2.63 kB)
2616.config.bz2 (8.53 kB)
Download all attachments

2006-03-27 05:28:12

by Benjamin Herrenschmidt

[permalink] [raw]
Subject: Re: funny framebuffer fonts on PowerBook with radeonfb

On Mon, 2006-03-27 at 05:37 +0200, Herbert Poetzl wrote:

> after that, the screen goes white for half a second
> and becomes black with a large terminal font on it
> (the one I get without framebuffer, I think), the
> text there is printed undistorted ... shortly after
> that, I get a flash, and the mode switches to a much
> smaller font (the final framebuffer font) and the
> kernel messages written there are already distorted.
> half a second later (or less) the penguin appears at
> the top area (undistorted), when the bootup is done
> I get the following prompt (which again is okay)
>
> bash-2.05b#
>
> typing anything there is distorted again ...

Hrm... this is a a pristine 2.6.16 without any patch applied ? Also,
what video chip revision do you have exactly ? (lspci will tell you)

> pressing enter several times leaves 'copies' of
> the caracters on the screen, forming vertical bars
> the prompt (bash) is now always fine, the copy one
> line above (as all the others) is distorted ...
>
> note, the bootup is not much different with older
> kernels, except for the strange distortions ...
>
> attached my kernel configuration, just in case
> it is related ...

# CONFIG_VGA_CONSOLE is not set
CONFIG_DUMMY_CONSOLE=y
CONFIG_FRAMEBUFFER_CONSOLE=y
# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
CONFIG_FONTS=y
# CONFIG_FONT_8x8 is not set
# CONFIG_FONT_8x16 is not set
CONFIG_FONT_6x11=y
CONFIG_FONT_7x14=y
# CONFIG_FONT_PEARL_8x8 is not set
# CONFIG_FONT_ACORN_8x8 is not set
# CONFIG_FONT_MINI_4x6 is not set
# CONFIG_FONT_SUN8x16 is not set
# CONFIG_FONT_SUN12x22 is not set
# CONFIG_FONT_10x18 is not set

Interesting... I suspect there is an endian bug in the new font code
that hits odd sized fonts (or non-multiple-of-8 fonts). Can you try
enabling 8x8 and 8x16 instead of 6x11 and 7x14 fonts and tell me if
those work ?

Tony: If my suspition is confirmed, I think that's your call :)

Cheers,
Ben.


2006-03-27 07:11:25

by Antonino A. Daplas

[permalink] [raw]
Subject: Re: [Linux-fbdev-devel] Re: funny framebuffer fonts on PowerBook with radeonfb

Benjamin Herrenschmidt wrote:
> On Mon, 2006-03-27 at 05:37 +0200, Herbert Poetzl wrote:
> Interesting... I suspect there is an endian bug in the new font code
> that hits odd sized fonts (or non-multiple-of-8 fonts). Can you try
> enabling 8x8 and 8x16 instead of 6x11 and 7x14 fonts and tell me if
> those work ?
>
> Tony: If my suspition is confirmed, I think that's your call :)

It probably is, a remnant of the console rotation code. If that is
truly the case, the patch I just sent in another thread should fix it.

Tony

2006-03-27 07:25:00

by Kyle Moffett

[permalink] [raw]
Subject: Re: [Linux-fbdev-devel] Re: funny framebuffer fonts on PowerBook with radeonfb

On Mar 27, 2006, at 02:11:08, Antonino A. Daplas wrote:
> Benjamin Herrenschmidt wrote:
>> On Mon, 2006-03-27 at 05:37 +0200, Herbert Poetzl wrote:
>> Interesting... I suspect there is an endian bug in the new font
>> code that hits odd sized fonts (or non-multiple-of-8 fonts). Can
>> you try enabling 8x8 and 8x16 instead of 6x11 and 7x14 fonts and
>> tell me if those work ?
>>
>> Tony: If my suspition is confirmed, I think that's your call :)
>
> It probably is, a remnant of the console rotation code. If that is
> truly the case, the patch I just sent in another thread should fix it.

I ran into this same bug on my Dual 1GHz Windtunnel G4 with an
upgraded GPU (Radeon 9800) in the 2.6.16-rc4 timeframe. Turning off
the customized console font selection and reverting to the default
list of fonts fixed the problem for me. I think I had the console
rotation config option turned on, but I don't have that config any
more and can't be sure.

Cheers,
Kyle Moffett

2006-03-27 11:01:34

by Herbert Poetzl

[permalink] [raw]
Subject: Re: funny framebuffer fonts on PowerBook with radeonfb

On Mon, Mar 27, 2006 at 09:19:55AM +0800, Antonino A. Daplas wrote:
> Herbert Poetzl wrote:
> > Hey Ben!
> >
> > 2.6.16 and 2.6.15-something show a funny behaviour
> > when using the radeonfb driver (for text mode), they
> > kind of twist and break the fonts in various places
> > some characters or parts seem to be mirrored like
> > '[' becoming ']' but not on character boundary but
> > more on N pixels, colors seem to be correct for the
> > characters, and sometimes the font is perfectly fine
> > for larger runs, e.g. I can read the logon prompt
> > fine, but everything I type is garbled ...
> >
> > just for an example, when I type 'echo "Test"' then
> > all characters are mirrored and cut off on the right
> > side but the locations are as shown above, on enter
> > the T is only a few pixels wide, but the est part is
> > written perfectly fine ... this is a new behaviour
> > and going back to 2.6.13.3 doesn't show this ...
> >
> > if there is some testing I can do for you, or when
> > you need more info, please let me know. here a few
> > details for the machine:
> >
>
> What font are you using? I presume the dimensions are
> not divisible by 8.

precisely!

> Can you try this patch?

yes, I did, and I can confirm this one fixes it for me
thanks a lot for the fast response and the quite
accurate fix!

best,
Herbert

it's obvious, but if you can make use of that:

Acked-by: Herbert Poetzl <[email protected]>

> Tony
>
> diff --git a/drivers/video/cfbimgblt.c b/drivers/video/cfbimgblt.c
> index 910e233..8ba6152 100644
> --- a/drivers/video/cfbimgblt.c
> +++ b/drivers/video/cfbimgblt.c
> @@ -169,7 +169,7 @@ static inline void slow_imageblit(const
>
> while (j--) {
> l--;
> - color = (*s & 1 << (FB_BIT_NR(l))) ? fgcolor : bgcolor;
> + color = (*s & (1 << l)) ? fgcolor : bgcolor;
> val |= FB_SHIFT_HIGH(color, shift);
>
> /* Did the bitshift spill bits to the next long? */
> diff --git a/include/linux/fb.h b/include/linux/fb.h
> index 17fc771..4fe1d2d 100644
> --- a/include/linux/fb.h
> +++ b/include/linux/fb.h
> @@ -841,12 +841,10 @@ struct fb_info {
> #define FB_LEFT_POS(bpp) (32 - bpp)
> #define FB_SHIFT_HIGH(val, bits) ((val) >> (bits))
> #define FB_SHIFT_LOW(val, bits) ((val) << (bits))
> -#define FB_BIT_NR(b) (7 - (b))
> #else
> #define FB_LEFT_POS(bpp) (0)
> #define FB_SHIFT_HIGH(val, bits) ((val) << (bits))
> #define FB_SHIFT_LOW(val, bits) ((val) >> (bits))
> -#define FB_BIT_NR(b) (b)
> #endif
>
> /*
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/

2006-03-27 11:06:24

by Herbert Poetzl

[permalink] [raw]
Subject: Re: funny framebuffer fonts on PowerBook with radeonfb

On Mon, Mar 27, 2006 at 04:26:38PM +1100, Benjamin Herrenschmidt wrote:
> On Mon, 2006-03-27 at 05:37 +0200, Herbert Poetzl wrote:

thanks for the quick response, Tony's patch fixed
the issue for me, the console fonts are fine again.

> > after that, the screen goes white for half a second
> > and becomes black with a large terminal font on it
> > (the one I get without framebuffer, I think), the
> > text there is printed undistorted ... shortly after
> > that, I get a flash, and the mode switches to a much
> > smaller font (the final framebuffer font) and the
> > kernel messages written there are already distorted.
> > half a second later (or less) the penguin appears at
> > the top area (undistorted), when the bootup is done
> > I get the following prompt (which again is okay)
> >
> > bash-2.05b#
> >
> > typing anything there is distorted again ...
>
> Hrm... this is a a pristine 2.6.16 without any patch applied?

yep!

> Also, what video chip revision do you have exactly?
> (lspci will tell you)

it did and it should have told you too :)
(it's in the original mail)

> > pressing enter several times leaves 'copies' of
> > the caracters on the screen, forming vertical bars
> > the prompt (bash) is now always fine, the copy one
> > line above (as all the others) is distorted ...
> >
> > note, the bootup is not much different with older
> > kernels, except for the strange distortions ...
> >
> > attached my kernel configuration, just in case
> > it is related ...
>
> # CONFIG_VGA_CONSOLE is not set
> CONFIG_DUMMY_CONSOLE=y
> CONFIG_FRAMEBUFFER_CONSOLE=y
> # CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
> CONFIG_FONTS=y
> # CONFIG_FONT_8x8 is not set
> # CONFIG_FONT_8x16 is not set
> CONFIG_FONT_6x11=y
> CONFIG_FONT_7x14=y
> # CONFIG_FONT_PEARL_8x8 is not set
> # CONFIG_FONT_ACORN_8x8 is not set
> # CONFIG_FONT_MINI_4x6 is not set
> # CONFIG_FONT_SUN8x16 is not set
> # CONFIG_FONT_SUN12x22 is not set
> # CONFIG_FONT_10x18 is not set
>
> Interesting... I suspect there is an endian bug in the new
> font code that hits odd sized fonts (or non-multiple-of-8
> fonts). Can you try enabling 8x8 and 8x16 instead of 6x11
> and 7x14 fonts and tell me if those work ?

yep, 8x16 font works as it seems ...

> Tony: If my suspition is confirmed, I think that's your call :)

best,
Herbert

> Cheers,
> Ben.
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/