NetBSD Problem Report #49639
From www@NetBSD.org Wed Feb 4 12:16:36 2015
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
by mollari.NetBSD.org (Postfix) with ESMTPS id 9FBC6A654C
for <gnats-bugs@gnats.NetBSD.org>; Wed, 4 Feb 2015 12:16:36 +0000 (UTC)
Message-Id: <20150204121635.31285A65BE@mollari.NetBSD.org>
Date: Wed, 4 Feb 2015 12:16:35 +0000 (UTC)
From: phabrics@phabrics.com
Reply-To: phabrics@phabrics.com
To: gnats-bugs@NetBSD.org
Subject: wsfb/{cgthree,bwtwo}: X fails to start with wsfb using these sunfb drivers due to missing ioctl data
X-Send-Pr-Version: www-1.0
>Number: 49639
>Category: port-sparc
>Synopsis: wsfb/{cgthree,bwtwo}: X fails to start with wsfb using these sunfb drivers due to missing ioctl data
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: port-sparc-maintainer
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Feb 04 12:20:00 +0000 2015
>Closed-Date: Mon Jan 21 07:23:53 +0000 2019
>Last-Modified: Mon Jan 21 07:23:53 +0000 2019
>Originator: Ruben Agin
>Release: 7.0_BETA
>Organization:
Phabrics
>Environment:
NetBSD sibs8.phabrics.com 7.0_BETA NetBSD 7.0_BETA (GENERIC.201501301930Z) sparc
>Description:
When attempting to start X using a specific configuration with wsfb as the X device driver, the log file indicates that the WSDISPLAYIO_LINEBYTES ioctl is unsupported by these framebuffer drivers.
After fixing these in each of the fb driver's specific ioctl handlers, and trying to start X with the same config, an unsupported depth problem is reported. After further investigation, it appears that the fb driver's ioctl handler is using the wrong rasops_info structure for returning WSDISPLAYIO_GINFO; hence a depth of 0 gets returned.
Note that 'X -configure' does not autodetect the wsfb driver for these framebuffer devices, hence the need to configure manually. This might be a separate issue.
>How-To-Repeat:
On a sparc or ultrasparc machine with a bwtwo or cgthree framebuffer (e.g., in my case, I used the TME sun4c & sun4u emulations with both combinations), running a recent NetBSD generic release (versions 6.0 and up seems to be affected); just simply start X with:
X -config xorg.conf
where xorg.conf contents is:
Section "ServerLayout"
Identifier "TME"
Screen 0 "Screen0" 0 0
InputDevice "Mouse0" "CorePointer"
InputDevice "Keyboard0" "CoreKeyboard"
EndSection
Section "InputDevice"
Identifier "Mouse0"
Driver "mouse"
Option "Protocol" "wsmouse"
Option "Device" "/dev/wsmouse"
Option "ZAxisMapping" "4 5 6 7"
EndSection
Section "InputDevice"
Identifier "Keyboard0"
Driver "kbd"
Option "XkbRules" "xorg"
Option "XkbModel" "pc105"
Option "XkbLayout" "en"
Option "XkbOptions" "ctrl:nocaps"
EndSection
Section "Monitor"
Identifier "Monitor0"
VendorName "Monitor Vendor"
ModelName "Monitor Model"
EndSection
Section "Device"
Identifier "Card0"
Driver "wsfb"
EndSection
Section "Screen"
Identifier "Screen0"
Device "Card0"
Monitor "Monitor0"
EndSection
>Fix:
The following modifications to the respective kernel drivers seems to correct the issues. I am able to run X successfully after applying them & running with the rebuilt kernels.
Index: cgthree.c
===================================================================
RCS file: /cvsroot/src/sys/dev/sun/cgthree.c,v
retrieving revision 1.31
diff -u -r1.31 cgthree.c
--- cgthree.c 25 Jul 2014 08:10:39 -0000 1.31
+++ cgthree.c 4 Feb 2015 12:05:46 -0000
@@ -446,8 +446,9 @@
struct vcons_data *vd = v;
struct cgthree_softc *sc = vd->cookie;
struct wsdisplay_fbinfo *wdf;
- struct rasops_info *ri = &sc->sc_fb.fb_rinfo;
struct vcons_screen *ms = sc->vd.active;
+ struct rasops_info *ri = &ms->scr_ri;
+
switch (cmd) {
case WSDISPLAYIO_GTYPE:
*(u_int *)data = WSDISPLAY_TYPE_SUNTCX;
@@ -467,6 +468,10 @@
return cgthree_putcmap(sc,
(struct wsdisplay_cmap *)data);
+ case WSDISPLAYIO_LINEBYTES:
+ *(u_int *)data = sc->sc_stride;
+ return 0;
+
case WSDISPLAYIO_SMODE:
{
int new_mode = *(int*)data;
@@ -488,7 +493,7 @@
cgthree_mmap(void *v, void *vs, off_t offset, int prot)
{
/* I'm not at all sure this is the right thing to do */
- return cgthreemmap(0, offset, prot); /* assume minor dev 0 for now */
+ return cgthreemmap(0, offset + START, prot); /* assume minor dev 0 for now */
}
int
Index: bwtwo.c
===================================================================
RCS file: /cvsroot/src/sys/dev/sun/bwtwo.c,v
retrieving revision 1.34
diff -u -r1.34 bwtwo.c
--- bwtwo.c 25 Jul 2014 08:10:39 -0000 1.34
+++ bwtwo.c 4 Feb 2015 12:05:57 -0000
@@ -404,8 +404,8 @@
struct vcons_data *vd = v;
struct bwtwo_softc *sc = vd->cookie;
struct wsdisplay_fbinfo *wdf;
- struct rasops_info *ri = &sc->sc_fb.fb_rinfo;
struct vcons_screen *ms = sc->vd.active;
+ struct rasops_info *ri = &ms->scr_ri;
switch (cmd) {
case WSDISPLAYIO_GTYPE:
*(u_int *)data = WSDISPLAY_TYPE_GENFB;
@@ -423,6 +423,10 @@
case WSDISPLAYIO_PUTCMAP:
return EINVAL;
+ case WSDISPLAYIO_LINEBYTES:
+ *(u_int *)data = sc->sc_stride;
+ return 0;
+
case WSDISPLAYIO_SMODE:
{
int new_mode = *(int*)data;
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: kern-bug-people->port-sparc-maintainer
Responsible-Changed-By: dholland@NetBSD.org
Responsible-Changed-When: Mon, 10 Oct 2016 01:25:55 +0000
Responsible-Changed-Why:
while the driver is nominally machine-independent, it's people who know
about sun hardware that should look at this.
From: Michael <macallan@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: port-sparc/49639 (wsfb/{cgthree,bwtwo}: X fails to start with
wsfb using these sunfb drivers due to missing ioctl data)
Date: Mon, 10 Oct 2016 01:28:27 -0400
On Mon, 10 Oct 2016 01:25:55 +0000 (UTC)
dholland@NetBSD.org wrote:
> Synopsis: wsfb/{cgthree,bwtwo}: X fails to start with wsfb using these sunfb drivers due to missing ioctl data
>
> Responsible-Changed-From-To: kern-bug-people->port-sparc-maintainer
> Responsible-Changed-By: dholland@NetBSD.org
> Responsible-Changed-When: Mon, 10 Oct 2016 01:25:55 +0000
> Responsible-Changed-Why:
> while the driver is nominally machine-independent, it's people who know
> about sun hardware that should look at this.
Hmm, I have a cgthree clone, and I'm pretty sure I made wsfb work on it
a while ago - I'll have a look. I don't have a bwtwo though.
have fun
Michael
From: phabrics@phabrics.com
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: port-sparc/49639 (wsfb/{cgthree,bwtwo}: X fails to start with
wsfb using these sunfb drivers due to missing ioctl data)
Date: Sun, 23 Oct 2016 19:22:53 -0600
On 2016-10-09 23:30, Michael wrote:
> The following reply was made to PR port-sparc/49639; it has been noted
> by GNATS.
>
> From: Michael <macallan@netbsd.org>
> To: gnats-bugs@NetBSD.org
> Cc:
> Subject: Re: port-sparc/49639 (wsfb/{cgthree,bwtwo}: X fails to start
> with
> wsfb using these sunfb drivers due to missing ioctl data)
> Date: Mon, 10 Oct 2016 01:28:27 -0400
>
> On Mon, 10 Oct 2016 01:25:55 +0000 (UTC)
> dholland@NetBSD.org wrote:
>
> > Synopsis: wsfb/{cgthree,bwtwo}: X fails to start with wsfb using
> these sunfb drivers due to missing ioctl data
> >
> > Responsible-Changed-From-To: kern-bug-people->port-sparc-maintainer
> > Responsible-Changed-By: dholland@NetBSD.org
> > Responsible-Changed-When: Mon, 10 Oct 2016 01:25:55 +0000
> > Responsible-Changed-Why:
> > while the driver is nominally machine-independent, it's people who
> know
> > about sun hardware that should look at this.
>
> Hmm, I have a cgthree clone, and I'm pretty sure I made wsfb work on
> it
> a while ago - I'll have a look. I don't have a bwtwo though.
>
> have fun
> Michael
Any luck on replicating this? If you need any help with it, I can
assist... I haven't tried on actual metal; only
on the emulator. But, I don't know why it would be any different, and
looking at the code, it does seem to be
missing the hook. Maybe I'm missing something here? If there's a
workaround, or I am doing something wrong, please
let me know.
Thanks,
R Agin
From: "Michael Lorenz" <macallan@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/49639 CVS commit: src/sys/dev/sun
Date: Wed, 9 Nov 2016 19:54:25 +0000
Module Name: src
Committed By: macallan
Date: Wed Nov 9 19:54:25 UTC 2016
Modified Files:
src/sys/dev/sun: cgthree.c
Log Message:
- use bus_space_mmap()
- pass the right colour depth in ioctl()
should fix PR49639
To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/sun/cgthree.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: phabrics@phabrics.com
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: PR/49639 CVS commit: src/sys/dev/sun
Date: Mon, 14 Nov 2016 16:22:23 -0700
On 2016-11-09 12:55, Michael Lorenz wrote:
> The following reply was made to PR port-sparc/49639; it has been noted
> by GNATS.
>
> From: "Michael Lorenz" <macallan@netbsd.org>
> To: gnats-bugs@gnats.NetBSD.org
> Cc:
> Subject: PR/49639 CVS commit: src/sys/dev/sun
> Date: Wed, 9 Nov 2016 19:54:25 +0000
>
> Module Name: src
> Committed By: macallan
> Date: Wed Nov 9 19:54:25 UTC 2016
>
> Modified Files:
> src/sys/dev/sun: cgthree.c
>
> Log Message:
> - use bus_space_mmap()
> - pass the right colour depth in ioctl()
> should fix PR49639
>
>
> To generate a diff of this commit:
> cvs rdiff -u -r1.32 -r1.33 src/sys/dev/sun/cgthree.c
>
> Please note that diffs are not public domain; they are subject to the
> copyright notices on the relevant files.
Cool. Thanks, Michael!
I can independently confirm that these fixes work for me too.
As an added bonus, it looks like the equivalent changes will also work
for bwtwo driver,
as well as adding the WSDISPLAYIO_GET_FBINFO ioctl. Below is the diff
against the latest
revision I have (1.35), per "cvs diff -u bwtwo.c".
-Ruben
Index: sys/dev/sun/bwtwo.c
===================================================================
RCS file: /cvsroot/src/sys/dev/sun/bwtwo.c,v
retrieving revision 1.35
diff -u -r1.35 bwtwo.c
--- sys/dev/sun/bwtwo.c 21 Apr 2016 18:06:06 -0000 1.35
+++ sys/dev/sun/bwtwo.c 14 Nov 2016 23:13:10 -0000
@@ -413,7 +413,7 @@
wdf = (void *)data;
wdf->height = ri->ri_height;
wdf->width = ri->ri_width;
- wdf->depth = ri->ri_depth;
+ wdf->depth = 1;
wdf->cmsize = 0;
return 0;
@@ -434,6 +434,13 @@
}
}
}
+ return 0;
+ case WSDISPLAYIO_GET_FBINFO:
+ {
+ struct wsdisplayio_fbinfo *fbi = data;
+
+ return wsdisplayio_get_fbinfo(&ms->scr_ri, fbi);
+ }
}
return EPASSTHROUGH;
}
@@ -441,8 +448,16 @@
paddr_t
bwtwo_mmap(void *v, void *vs, off_t offset, int prot)
{
- /* I'm not at all sure this is the right thing to do */
- return bwtwommap(0, offset, prot); /* assume minor dev 0 for now */
+ struct vcons_data *vd = v;
+ struct bwtwo_softc *sc = vd->cookie;
+
+ if (offset < 0) return -1;
+ if (offset >= sc->sc_fb.fb_type.fb_size)
+ return -1;
+
+ return bus_space_mmap(sc->sc_bustag,
+ sc->sc_paddr, sc->sc_pixeloffset + offset,
+ prot, BUS_SPACE_MAP_LINEAR);
}
void
From: "Michael Lorenz" <macallan@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/49639 CVS commit: src/sys/dev/sun
Date: Mon, 21 Jan 2019 06:23:17 +0000
Module Name: src
Committed By: macallan
Date: Mon Jan 21 06:23:17 UTC 2019
Modified Files:
src/sys/dev/sun: bwtwo.c
Log Message:
apply patches from PR 49639
compile tested only for lack of hardware
To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/sun/bwtwo.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: open->closed
State-Changed-By: mrg@NetBSD.org
State-Changed-When: Mon, 21 Jan 2019 07:23:53 +0000
State-Changed-Why:
problem was resolved a while ago; final patch merged now.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.