Subject: Re: OpenFirmware screen reset
To: Bill Studenmund <wrstuden@netbsd.org>
From: Tim Kelly <hockey@dialectronics.com>
List: port-macppc
Date: 11/28/2004 11:41:17
At 4:53 PM -0800 11/27/04, Bill Studenmund wrote:
>I'd suggest forgetting OF and just making sure X and enough of the kernel
>knows how to clean up after itself. We are the only OS on the mac that
>expects to call into OF after boot, and I'm concerned that in the long run
>we'll run into problems.

After an extensive examination in which I determined lots of things that
would not work but nothing that would, it seems that any solution to this
problem via OF will be rather unpleasant as it would be hardware, and
possibly version, dependent. Michael did find a command (fb8-install) that
when called from the kernel on his S900 would clean up the console, but it
has no effect on my AGP G4. Although I could routinely turn the monitor on
and off from a telnet session to OF on my G4, nothing that worked well in
the user interface had any effect through the client interface. The most
recent path I'd been examining was using OF to reinitialize the card. I
would say I am some distance from achieving this and I have no problem
abandoning this (one uses lots of "f" words when working with Forth).

The only positive that I can report is that on my AGP G4, the display
device has two interesting words, show-modes and set-mode. For me,

dev screen 1d set-mode

in the user interface changes my display resolution to 1024x768 and

dev-screen d set-mode

changes it to 832x624.

The main obstacle is that if the screen is 1024x768 or larger the console
will use large 12 point font instead of the still readable 8 point font,
and adjust the columns and rows accordingly (down). The solution is to go
one dimesion higher in resolution before using the bigger font.

I built a GENERIC_MD, minus the file system from crunchgen, and tested it
with both OFB_ENABLE_CACHE on and off. I didn't see any difference in
speed, but now I get

ofb0 1024x768 8bpp

for my ofb node. Columns and rows are adjusted accordingly. Previously the
MD would revert to 640x480. This may or may not be useful to others, and it
may or may not have been a previously discussed topic.

tim


Index: ofb.c
===================================================================
RCS file: /cvsroot/src/sys/arch/macppc/dev/ofb.c,v
retrieving revision 1.39
diff -d -u -r1.39 ofb.c
--- ofb.c       24 Apr 2004 15:49:00 -0000      1.39
+++ ofb.c       28 Nov 2004 01:53:31 -0000
@@ -282,7 +282,7 @@
        ri->ri_flg = RI_FORCEMONO | RI_FULLCLEAR | RI_CENTER;

        /* If screen is smaller than 1024x768, use small font. */
-       if ((width < 1024 || height < 768) && copy_rom_font() == 0) {
+       if ((width <= 1024 || height <= 768) && copy_rom_font() == 0) {
                int cols, rows;

                OF_interpret("#lines", 1, &rows);
@@ -477,7 +477,7 @@

        ofb_common_init(node, dc);

-       if (ri->ri_width >= 1024 && ri->ri_height >= 768) {
+       if (ri->ri_width > 1024 && ri->ri_height > 768) {
                int i, screenbytes = ri->ri_stride * ri->ri_height;

                for (i = 0; i < screenbytes; i += sizeof(u_int32_t))