Skip to contentSkip to conversation

Bug in vga16fb?

DISCUSSION Ondrej Zajicek 3 participants 6 messages Apr 4, 2006 – Apr 6, 2006 Framebuffer layer

lore
Share & tools
lore
#0 lore raw

Hello

I tried vga16fb driver in 320x200x4 nonstd mode (on i386 - little endian). In this mode framebuffer reports PACKED PIXELS type. Drawing through framebuffer is OK, but console is broken - it looks like that even and odd columns are exchanged.

Framebuffer structure of this mode is that even pixel is in high nibble and odd pixel is in low nibble.

It looks like vga16fb use cfbimgblt.c/slow_imageblit in this mode for image-blit and this function in CFB4 writes even pixel in low nibble and odd pixel in high nibble.

What is correct framebuffer structure for CFB4 mode?

Signature · 5 lines
Elen sila lumenn' omentielvo

Ondrej 'SanTiago' Zajicek (email: [email protected], jabber: [email protected])
OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net)
"To err is human -- to blame it on a computer is even more so."
#1 lore raw
Quoted 7 lines · Ondrej Zajicek

Hello

I tried vga16fb driver in 320x200x4 nonstd mode (on i386 - little endian). In this mode framebuffer reports PACKED PIXELS type. Drawing through framebuffer is OK, but console is broken - it looks like that even and odd columns are exchanged.

Quoted 8 lines

Framebuffer structure of this mode is that even pixel is in high nibble and odd pixel is in low nibble.

It looks like vga16fb use cfbimgblt.c/slow_imageblit in this mode for image-blit and this function in CFB4 writes even pixel in low nibble and odd pixel in high nibble.

What is correct framebuffer structure for CFB4 mode?

Unfortunately there is no standard, as CFB4 itself is quite non-standard VGA mode. Some videocards first output low nibble, followed by high, and some do otherwise. I've experimented with this back in 2000, and I've found that Matrox Millennium does exactly opposite than some ATI Mach64 card I had in another box at that time.

So your only option is providing two CFB4 modes. Unfortunately I have no idea how to autodetect what your hardware actually does without adding camera to the system...
Petr Vandrovec

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642

#2 lore raw
Quoted 25 lines · Petr Vandrovec
Quoted 9 lines · Ondrej Zajicek

Hello

I tried vga16fb driver in 320x200x4 nonstd mode (on i386 - little endian). In
this mode framebuffer reports PACKED PIXELS type. Drawing through framebuffer
is OK, but console is broken - it looks like that even and odd columns are exchanged.

Quoted 8 lines

Framebuffer structure of this mode is that even pixel is in high nibble and odd pixel is in low nibble.

It looks like vga16fb use cfbimgblt.c/slow_imageblit in this mode for image-blit and this function in CFB4 writes even pixel in low nibble and odd pixel in high nibble.

What is correct framebuffer structure for CFB4 mode?

Unfortunately there is no standard, as CFB4 itself is quite non-standard VGA mode. Some videocards first output low nibble, followed by high, and some do otherwise. I've experimented with this back in 2000, and I've found that Matrox Millennium does exactly opposite than some ATI Mach64 card I had in another box at that time.

Quoted 3 lines

So your only option is providing two CFB4 modes. Unfortunately I have no idea how to autodetect what your hardware actually does without adding camera to the system...

Even if we find some possibility to autodetect what hardware does (or in case of another, non-VGA hardware using CFB4 mode) there would be problem that driver cannot say it to userspace (or generic kernel functions like cfb_imageblit). Maybe there should be some flag in type_aux specifying whether given packed pixel mode is LSB-first or MSB-first (relevant only for bpp % 8 != 0) ?

Signature · 5 lines
Elen sila lumenn' omentielvo

Ondrej 'SanTiago' Zajicek (email: [email protected], jabber: [email protected])
OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net)
"To err is human -- to blame it on a computer is even more so."
#3 lore raw
Quoted 10 lines · Ondrej Zajicek
Quoted 1 line · Petr Vandrovec

Ondrej Zajicek wrote:

Even if we find some possibility to autodetect what hardware does (or in case of another, non-VGA hardware using CFB4 mode) there would be problem that driver cannot say it to userspace (or generic kernel functions like cfb_imageblit). Maybe there should be some flag in type_aux specifying whether given packed pixel mode is LSB-first or MSB-first (relevant only for bpp % 8 != 0) ?

var->{red|green|blue|transp}.msb_right

This field is currently ignored by fbcon, but you can use this field to inform userspace what you want.

And once a driver uses this flag, we can probably alter the drawing functions to not ignore this flag.

Tony

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642

#4 lore raw
Quoted 12 lines · Antonino A. Daplas
Quoted 10 lines · Ondrej Zajicek
Quoted 1 line · Petr Vandrovec

Ondrej Zajicek wrote:

Even if we find some possibility to autodetect what hardware does (or in case of another, non-VGA hardware using CFB4 mode) there would be problem that driver cannot say it to userspace (or generic kernel functions like cfb_imageblit). Maybe there should be some flag in type_aux specifying whether given packed pixel mode is LSB-first or MSB-first (relevant only for bpp % 8 != 0) ?

Quoted 1 line

var->{red|green|blue|transp}.msb_right

I think that this bit says something different - ordering of bits inside one color component. This is OK for all VGA (MSB bit of color index is left), i hope.

Problem is in ordering of pixels inside a byte, which is completely orthogonal to bitplane.msb_right-ness.

But maybe i misunderstood of meaning of
var->{red|green|blue|transp}.msb_right ...

Signature · 5 lines
Elen sila lumenn' omentielvo

Ondrej 'SanTiago' Zajicek (email: [email protected], jabber: [email protected])
OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net)
"To err is human -- to blame it on a computer is even more so."
#5 lore raw
Quoted 17 lines · Ondrej Zajicek
Quoted 11 lines · Antonino A. Daplas
Quoted 9 lines · Ondrej Zajicek
Quoted 1 line · Petr Vandrovec

Ondrej Zajicek wrote:

Even if we find some possibility to autodetect what hardware does (or in case of another, non-VGA hardware using CFB4 mode) there would be problem that driver cannot say it to userspace (or generic kernel functions like cfb_imageblit). Maybe there should be some flag in type_aux specifying whether given packed pixel mode is LSB-first or MSB-first (relevant only for bpp % 8 != 0) ?

var->{red|green|blue|transp}.msb_right

I think that this bit says something different - ordering of bits inside one color component. This is OK for all VGA (MSB bit of color index is left), i hope.

Quoted 7 lines

Problem is in ordering of pixels inside a byte, which is completely orthogonal to bitplane.msb_right-ness.

But maybe i misunderstood of meaning of
var->{red|green|blue|transp}.msb_right ...

I know, but since it is completely unused, you can use that to tell userspace what the format is. Or if you want something less specific, use var->nonstd. Or if you want to standardize, add another FB_VISUAL_* entry.

Tony

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642