NetBSD Problem Report #48528
From www@NetBSD.org Thu Jan 16 23:43:12 2014
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
(Client CN "mail.NetBSD.org", Issuer "Postmaster NetBSD.org" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id 77E64A6475
for <gnats-bugs@gnats.NetBSD.org>; Thu, 16 Jan 2014 23:43:12 +0000 (UTC)
Message-Id: <20140116234310.A4633A6487@mollari.NetBSD.org>
Date: Thu, 16 Jan 2014 23:43:10 +0000 (UTC)
From: nathanialsloss@yahoo.com.au
Reply-To: nathanialsloss@yahoo.com.au
To: gnats-bugs@NetBSD.org
Subject: wsfb/genfb - display dramatically off center if GENFB_SHADOWFB is enabled
X-Send-Pr-Version: www-1.0
>Number: 48528
>Category: kern
>Synopsis: wsfb/genfb - display dramatically off center if GENFB_SHADOWFB is enabled
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: kern-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Jan 16 23:45:00 +0000 2014
>Last-Modified: Sat Jan 18 03:10:01 +0000 2014
>Originator: Nat Sloss
>Release: NetBSD 6.1.1
>Organization:
>Environment:
NetBSD beast 6.1.1_PATCH NetBSD 6.1.1_PATCH (SHADOWTEST) #6: Thu Jan 16 18:39:48 EST 2014 build@microrusty:/usr/src/sys/arch/i386/compile/obj/SHADOWTEST i386
>Description:
If "options GENFB_SHADOWFB" is built into the kernel and the computer is booted in a VESA mode then as soon as genfb attaches the screen text
is really off center.
If GENFB_SHADOWFB is not enabled then all is OK.
The problem seems to be that rasops_reconfig in genfb.c must be starting
with an offset in ri_bits, I have checked elements of the ri structure after rasops_reconfig and they seem OK.
I tried booting a current kernel (6.99.28) with GENFB_SHADOWFB enabled
but it paniced as soon as genfb attached in rasops_erasecols.
>How-To-Repeat:
Refer to above.
>Fix:
I applied this patch as this is what is done in sys/arch/x86/x86/genfb_machdep.c:
Index: src/sys/dev/wsfb/genfb.c
===================================================================
RCS file: /cvsroot/src/sys/dev/wsfb/genfb.c,v
retrieving revision 1.51
diff -u -r1.51 genfb.c
--- src/sys/dev/wsfb/genfb.c 9 Oct 2013 17:20:54 -0000 1.51
+++ src/sys/dev/wsfb/genfb.c 16 Jan 2014 23:08:20 -0000
@@ -544,7 +544,7 @@
ri->ri_flg |= RI_ENABLE_ALPHA | RI_8BIT_IS_RGB;
- rasops_init(ri, 0, 0);
+ rasops_init(ri, sc->sc_height / 8, sc->sc_width / 8);
ri->ri_caps = WSSCREEN_WSCOLORS;
rasops_reconfig(ri, sc->sc_height / ri->ri_font->fontheight,
Regards,
Nat.
>Audit-Trail:
From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: kern/48528: wsfb/genfb - display dramatically off center if GENFB_SHADOWFB is enabled
Date: Fri, 17 Jan 2014 18:52:29 +0100
On Thu, Jan 16, 2014 at 11:45:00PM +0000, nathanialsloss@yahoo.com.au wrote:
> + rasops_init(ri, sc->sc_height / 8, sc->sc_width / 8);
Isn't the divisor display mode depend?
Even if it is static (for now), it may be better to express it as such.
Martin
From: Nat Sloss <nathanialsloss@yahoo.com.au>
To: gnats-bugs@netbsd.org
Cc: Martin Husemann <martin@duskware.de>
Subject: Re: kern/48528: wsfb/genfb - display dramatically off center if GENFB_SHADOWFB is enabled
Date: Sat, 18 Jan 2014 10:16:00 +1100
> > + rasops_init(ri, sc->sc_height / 8, sc->sc_width / 8);
>
> Isn't the divisor display mode depend?
> Even if it is static (for now), it may be better to express it as such.
>
> Martin
My understanding is that by using the lowest font height and width in sthis
case eight pixels, rasops_reconfig adjusts the rows and columns based on
screen width, height and font size once fonts have been initialized.
So rasops_init should be called with the largest possible number of rows and
columns for the largest possible screen size.
As yet I have not found a define for the smallest font height and width, but
I'm still looking. :)
Regards,
Nat.
From: Nat Sloss <nathanialsloss@yahoo.com.au>
To: gnats-bugs@netbsd.org
Cc: Martin Husemann <martin@duskware.de>
Subject: Re: kern/48528: wsfb/genfb - display dramatically off center if GENFB_SHADOWFB is enabled
Date: Sat, 18 Jan 2014 14:08:07 +1100
On Sat, 18 Jan 2014 10:20:00 AM you wrote:
> The following reply was made to PR kern/48528; it has been noted by GNATS.
>
> From: Nat Sloss <nathanialsloss@yahoo.com.au>
> To: gnats-bugs@netbsd.org
> Cc: Martin Husemann <martin@duskware.de>
> Subject: Re: kern/48528: wsfb/genfb - display dramatically off center if
> GENFB_SHADOWFB is enabled Date: Sat, 18 Jan 2014 10:16:00 +1100
>
> > > + rasops_init(ri, sc->sc_height / 8, sc->sc_width / 8);
> >
> > Isn't the divisor display mode depend?
> > Even if it is static (for now), it may be better to express it as such.
> >
> > Martin
>
> My understanding is that by using the lowest font height and width in
> sthis case eight pixels, rasops_reconfig adjusts the rows and columns
> based on screen width, height and font size once fonts have been
> initialized.
>
> So rasops_init should be called with the largest possible number of rows
> and columns for the largest possible screen size.
>
> As yet I have not found a define for the smallest font height and width,
> but I'm still looking. :)
>
I've found the cause for the problem ri_bits accumulates on calling
raspos_reconfig because RI_CFGDONE is set. So this alternate patch also
works:
Index: src/sys/dev/wsfb/genfb.c
===================================================================
RCS file: /cvsroot/src/sys/dev/wsfb/genfb.c,v
retrieving revision 1.51
diff -u -r1.51 genfb.c
--- src/sys/dev/wsfb/genfb.c 9 Oct 2013 17:20:54 -0000 1.51
+++ src/sys/dev/wsfb/genfb.c 18 Jan 2014 02:58:33 -0000
@@ -547,6 +547,14 @@
rasops_init(ri, 0, 0);
ri->ri_caps = WSSCREEN_WSCOLORS;
+#ifdef GENFB_SHADOWFB
+ if (sc->sc_shadowfb != NULL) {
+
+ ri->ri_hwbits = (char *)sc->sc_fbaddr;
+ ri->ri_bits = (char *)sc->sc_shadowfb;
+ }
+#endif
+
rasops_reconfig(ri, sc->sc_height / ri->ri_font->fontheight,
sc->sc_width / ri->ri_font->fontwidth);
Regards,
Nat.
(Contact us)
$NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.