Subject: wscons & framebuffers
To: None <tech-kern@netbsd.org>
From: Brett D. Slager <bds@snarf.thnet.com>
List: tech-kern
Date: 03/21/1999 23:47:17
The wscons WSDISPLAYIO_GINFO ioctl doesn't extract enough information
to set up programs to use a typical framebuffer.
Additional information that may be desired includes:

u_int	act_height;	/* actual fb height in pixels */
u_int	act_width;	/* actual fb width in pixels */
u_int	rowbytes;	/* bytes in one row of video */
u_int	fbdep;		/* fb dependent info/model... */
u_int	coresize;	/* fb core mmap size */
u_int	fboff;		/* fb core memory offset */
u_int	fbsize;		/* fb core memory size */
u_int	fbdispoff;	/* displayed memory offset
			 * from fboff */
u_int	regoff;		/* fb core registers offset */
u_int	regsize;	/* fb core registers size */

Could we add these to struct wsdisplay_fbinfo before too many things
depend on it to break?  It would be nice to also include a pad for
future needs of drivers.

The only in-tree program I could find that depends on this ioctl is the
macppc X server:  It uses an extension ioctl of it's own for the additional
information marked XXX.  (Why does it want to know the physical fb address
in user space?)

Otherwise, a new ioctl could be allocated for this information.

Here's a diff to add these fields and fix one other bug:

--- src/sys/dev/wscons/wsconsio.h	Fri Feb 12 07:16:41 1999
+++ wsconsio.h	Sat Mar 20 22:36:55 1999
@@ -179,10 +179,22 @@
 
 /* Basic display information.  Not applicable to all display types. */
 struct wsdisplay_fbinfo {
-	u_int	height;				/* height in pixels */
-	u_int	width;				/* width in pixels */
+	u_int	height;				/* displayed height in pixels */
+	u_int	width;				/* displayed width in pixels */
 	u_int	depth;				/* bits per pixel */
 	u_int	cmsize;				/* color map size (entries) */
+	u_int	act_height;			/* actual fb height in pixels */
+	u_int	act_width;			/* actual fb width in pixels */
+	u_int	rowbytes;			/* bytes in one row of video */
+	u_int	fbdep;				/* fb dependent info/model... */
+	u_int	coresize;			/* fb core mmap size */
+	u_int	fboff;				/* fb core memory offset */
+	u_int	fbsize;				/* fb core memory size */
+	u_int	fbdispoff;			/* displayed memory offset
+						 * from fboff */
+	u_int	regoff;				/* fb core registers offset */
+	u_int	regsize;			/* fb core registers size */
+	u_int	pad[18];			/* pad to 32 u_ints expansion */
 };
 #define	WSDISPLAYIO_GINFO	_IOR('W', 65, struct wsdisplay_fbinfo)
 
@@ -194,7 +206,7 @@
 	u_char	*green;				/* green color map elements */
 	u_char	*blue;				/* blue color map elements */
 };      
-#define WSDISPLAYIO_GETCMAP	_IOW('W', 66, struct wsdisplay_cmap)
+#define WSDISPLAYIO_GETCMAP	_IOR('W', 66, struct wsdisplay_cmap)
 #define WSDISPLAYIO_PUTCMAP	_IOW('W', 67, struct wsdisplay_cmap)
 
 /* Video control.  Not applicable to all display types. */
 
-- Brett