NetBSD-Bugs archive

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

kern/49639: wsfb/{cgthree,bwtwo}: X fails to start with wsfb using these sunfb drivers due to missing ioctl data



>Number:         49639
>Category:       kern
>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:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Feb 04 12:20:00 +0000 2015
>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;



Home | Main Index | Thread Index | Old Index