[comp.windows.x] X11R4 & VGA

roell@lan.informatik.tu-muenchen.dbp.de (Thomas Roell) (04/11/90)

I'm currently building a server for X11R4 for Interactive's ix/386 and a
VGA-Videocard. For the initial port I used the mfb code. But there is a big
Problem: I cann't believe it, mfb is buggy!!!! The story is that I used 
following defines in include/servermd.h:

	IMAGE_BYTE_ORDER  	LSBFirst
  	BITMAP_BIT_ORDER  	MSBFirst
	GLYPHPADBYTES     	4
	GETLEFTBITS_ALIGNMENT 	1	
	
Now, when I call xsetroot to set my rootwindow the pixmap appears in wrong
Byteorder. This is not too serious. The real bad thing is that working with
xterm with fixed fonts is nearly impossible, because when using the font 8x13
only every fourth letter is printed on the screen. Doing xterm with other
fixed fonts looks more like kanji then plain englisch.

Has anyboy out there the same problem ???

Really more important: HAS ANYBODY SOLVED THIS PROBLEM.???

- Thomas



--
_______________________________________________________________________________
Thomas Roell             Inst. f. Informatik / Technische Universitaet M"unchen
                         Arcisstr. 21 / 8000 Munich 2 / Fed.Rep. of Germany
E-Mail (domain):	 roell@lan.informatik.tu-muenchen.dbp.de
UUCP (when above fails): roell@tumult.{uucp | informatik.tu-muenchen.de}
-------------------------------------------------------------------------------

maslen@Neon.Stanford.EDU (Thomas Maslen) (04/14/90)

In article <1835@tuminfo1.lan.informatik.tu-muenchen.dbp.de> roell@lan.informatik.tu-muenchen.dbp.de (Thomas Roell) writes:
>
>I'm currently building a server for X11R4 for Interactive's ix/386 and a
>VGA-Videocard. For the initial port I used the mfb code. But there is a big
>Problem: I cann't believe it, mfb is buggy!!!! The story is that I used 

Credit where credit is due... the good folks at MIT (and elsewhere?)
have done a pretty impressive job on support -- in particular, mfb --
for the sensible cases (LSB/LSB and MSB/MSB).  The sillier cases are
about 95% right.  Your case (LSB/MSB, scanline unit == 8) breaks a few
things, and the framebuffer I'm dealing with (LSB/MSB, unit == 16)
breaks a few more, including normalizeimagebits() in Xlib.

>following defines in include/servermd.h:
>
>	IMAGE_BYTE_ORDER  	LSBFirst
>  	BITMAP_BIT_ORDER  	MSBFirst
>	GLYPHPADBYTES     	4
>	GETLEFTBITS_ALIGNMENT 	1	
>	
>Now, when I call xsetroot to set my rootwindow the pixmap appears in wrong
>Byteorder. This is not too serious. The real bad thing is that working with
>xterm with fixed fonts is nearly impossible, because when using the font 8x13
>only every fourth letter is printed on the screen. Doing xterm with other
>fixed fonts looks more like kanji then plain englisch.
>
>Has anyboy out there the same problem ???
>
>Really more important: HAS ANYBODY SOLVED THIS PROBLEM.???

I wouldn't say "solved", maybe "hacked around".  The font problem is
peculiar to terminal-emulator fonts <= 8 bits wide, and is caused by
the GetBits4 macro in mfbtegblt.c.  This macro passes a non-idempotent
argument (*char2++) to SCRRIGHT, which invokes LONG2CHARS, which
proceeds to increment the pointer four times.

So... you should either fix GetBits4 or change the macros in
maskbits.h so they have proper function-like behaviour.  Since we're
using GCC I took the latter course and turned one of the macros into
an inline function.

I'd be surprised if the root pixmap is really "in wrong byteorder",
but not the least surprised if it's curdled somehow in 32-bit columns.
In mfbfillsp.c it looks as though someone got halfway through
replacing instances of 32 with BITMAP_SCANLINE_UNIT and then went out
to lunch.  Changing them back to 32 did the trick for me, though I
don't like it.

In mfbzerarc.c, it seems reasonable that LEFTMOST should be redefined
to be just "endtab[1]", but I haven't tested it.

QUESTION for the server purists out there -- what's the right thing to
do in the following case...  The native order of my framebuffer
(LSB/MSB, unit == 16; grrr) confuses any client that uses XGetImage
(because of the bug in normalzeimagebits()) and at least one client
that does XPutImage (dunno why, because the R3 and R3 versions of the
XPutImage byte-swapping code look right, maybe the client was linked
with an older Xlib??).  If I pretend to be a VGA (unit == 8), things
work much better.  At present I've implemented this by hacking,
including byte-swapping code, in the DIX part of the server, because
it seemed the least untidy place to do it (don't want to byte-swap
server-internal GetImage and PutImage operations, only external ones),
but I'm not proud of it.  What would *you* do?

>Thomas Roell             Inst. f. Informatik / Technische Universitaet M"unchen
>                         Arcisstr. 21 / 8000 Munich 2 / Fed.Rep. of Germany
>E-Mail (domain):	 roell@lan.informatik.tu-muenchen.dbp.de

Not to be confused with...

Thomas Maslen					maslen@neon.stanford.edu