NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/46184: wsfb/genfb screen not centred and leaves a line of text at the top of the screen.



>Number:         46184
>Category:       kern
>Synopsis:       wsfb/genfb screen not centred and leaves a line of text at the 
>top of the screen.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Mar 13 12:00:01 +0000 2012
>Originator:     Nat Sloss
>Release:        NetBSD Current 6.99.3
>Organization:
>Environment:
NetBSD beast 6.99.3 NetBSD 6.99.3 (LOCKDEBUG) #15: Tue Mar 13 22:18:01 EST 2012 
 
build@beast:/home/build/NetBSD-5.0.1_source_tree/usr/src/sys/arch/i386/compile/obj/LOCKDEBUG
 i386

>Description:
The problem is that the screen is initially centred when starting with 
wsfb/genfb but when genfb attaches the screen is not centred and moves to the 
bottom of the screen leaving a distorted line of text at the top of the screen. 
 

Note this only happens at 800x600 I haven't noticed it at other resolutions.
>How-To-Repeat:
Boot with a vesa mode 800x600.

Wait for login prompt.

There should be the tops of characters of a line of text at the top of the 
screen.
>Fix:
There were many solutions to this problem.

The best would be to modify rasops.c rasops_reconfig routine.

Consider the following from rasops.c rasops_reconfig routine.

   362          /* Now centre our window if needs be */
   363          ri->ri_origbits = ri->ri_bits;
   364          ri->ri_hworigbits = ri->ri_hwbits;

   365          if ((ri->ri_flg & RI_CENTER) != 0) {
   366                  ri->ri_bits += (((ri->ri_width * bpp >> 3) -
   367                      ri->ri_emustride) >> 1) & ~3;
   368                  ri->ri_bits += ((ri->ri_height - ri->ri_emuheight) >> 1)
 *
   369                      ri->ri_stride;
   370                  if (ri->ri_hwbits != NULL) {
   371                          ri->ri_hwbits += (((ri->ri_width * bpp >> 3) -
   372                              ri->ri_emustride) >> 1) & ~3;
   373                          ri->ri_hwbits += ((ri->ri_height - ri->ri_emuhei
ght) >> 1) *
   374                              ri->ri_stride;
   375                  }
   376                  ri->ri_yorigin = (int)(ri->ri_bits - ri->ri_origbits)
   377                     / ri->ri_stride;
   378                  ri->ri_xorigin = (((int)(ri->ri_bits - ri->ri_origbits)
   379                     % ri->ri_stride) * 8 / bpp);
   380          } else
   381                  ri->ri_xorigin = ri->ri_yorigin = 0;


Now you can see lines 376-389 xorigin and yorigin are always zero because 
ri_bits and ri_origbits are equal made so in line 363.

This should be changed, but I'm not sure of what values to use.

So what I did was to manually centre the screen in wsfb/genfb.c

--- wsfb/genfb.c.orig   2012-01-29 19:54:44.000000000 +1100
+++ wsfb/genfb.c        2012-03-13 22:14:47.000000000 +1100
@@ -487,7 +487,7 @@
        ri->ri_width = sc->sc_width;
        ri->ri_height = sc->sc_height;
        ri->ri_stride = sc->sc_stride;
-       ri->ri_flg = RI_CENTER;
+       ri->ri_flg = 0;
        if (sc->sc_want_clear)
                ri->ri_flg |= RI_FULLCLEAR;

@@ -517,10 +517,13 @@
        rasops_init(ri, 0, 0);
        ri->ri_caps = WSSCREEN_WSCOLORS;

+       /* Centre the screen */
+       ri->ri_yorigin = (sc->sc_height % ri->ri_font->fontheight) / 2;
+       ri->ri_xorigin = (sc->sc_width % ri->ri_font->fontwidth) / 2;
+
        rasops_reconfig(ri, sc->sc_height / ri->ri_font->fontheight,
                    sc->sc_width / ri->ri_font->fontwidth);

-       /* TODO: actually center output */
        ri->ri_hw = scr;

 #ifdef GENFB_DISABLE_TEXT

I hope this helps.

Regards,

Nat.

PS: Could you pull up NetBSD 6 when an appropriate solution is found.



Home | Main Index | Thread Index | Old Index