Module Name:    src
Committed By:   christos
Date:           Sun Apr 14 16:37:32 UTC 2013

Modified Files:
        src/sys/dev/ic: vga_raster.c

Log Message:
return something reasonable for WSDISPLAYIO_GINFO


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/dev/ic/vga_raster.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/ic/vga_raster.c
diff -u src/sys/dev/ic/vga_raster.c:1.36 src/sys/dev/ic/vga_raster.c:1.37
--- src/sys/dev/ic/vga_raster.c:1.36	Mon Jan 21 14:49:15 2013
+++ src/sys/dev/ic/vga_raster.c	Sun Apr 14 12:37:32 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: vga_raster.c,v 1.36 2013/01/21 19:49:15 mlelstv Exp $	*/
+/*	$NetBSD: vga_raster.c,v 1.37 2013/04/14 16:37:32 christos Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002 Bang Jun-Young
@@ -56,7 +56,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vga_raster.c,v 1.36 2013/01/21 19:49:15 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vga_raster.c,v 1.37 2013/04/14 16:37:32 christos Exp $");
 
 #include "opt_wsmsgattrs.h" /* for WSDISPLAY_CUSTOM_OUTPUT */
 
@@ -632,22 +632,25 @@ vga_raster_ioctl(void *v, void *vs, u_lo
 		*(int *)data = vc->vc_type;
 		return 0;
 
-	case WSDISPLAYIO_GINFO:
-		/* XXX should get detailed hardware information here */
-		return EPASSTHROUGH;
+	case WSDISPLAYIO_GINFO: {
+		struct wsdisplay_fbinfo *fbi = data;
+		const struct wsscreen_descr *wd = vc->currenttype;
+		const struct videomode *vm = wd->modecookie;
+		fbi->width = vm->hdisplay;
+		fbi->height = vm->vdisplay;
+		fbi->depth = 24;	/* xxx: ? */
+		fbi->cmsize = 256;	/* xxx: from palette */
+		return 0;
+	}
 
 	case WSDISPLAYIO_GVIDEO:
-#if 1
 		*(int *)data = (vga_get_video(vc) ?
 		    WSDISPLAYIO_VIDEO_ON : WSDISPLAYIO_VIDEO_OFF);
 		return 0;
-#endif
 
 	case WSDISPLAYIO_SVIDEO:
-#if 1
 		vga_set_video(vc, *(int *)data == WSDISPLAYIO_VIDEO_ON);
 		return 0;
-#endif
 
 	case WSDISPLAYIO_GETCMAP:
 	case WSDISPLAYIO_PUTCMAP:
@@ -656,15 +659,26 @@ vga_raster_ioctl(void *v, void *vs, u_lo
 	case WSDISPLAYIO_GCURMAX:
 	case WSDISPLAYIO_GCURSOR:
 	case WSDISPLAYIO_SCURSOR:
+#ifdef DIAGNOSTIC
+		printf("%s: 0x%lx unsupported\n", __func__, cmd);
+#endif
 		/* NONE of these operations are by the generic VGA driver. */
 		return EPASSTHROUGH;
 	}
 
-	if (vc->vc_funcs == NULL)
-		return (EPASSTHROUGH);
+	if (vc->vc_funcs == NULL) {
+#ifdef DIAGNOSTIC
+		printf("%s: no vc_funcs\n", __func__);
+#endif
+		return EPASSTHROUGH;
+	}
 
-	if (vf->vf_ioctl == NULL)
-		return (EPASSTHROUGH);
+	if (vf->vf_ioctl == NULL) {
+#ifdef DIAGNOSTIC
+		printf("%s: no vf_ioctl\n", __func__);
+#endif
+		return EPASSTHROUGH;
+	}
 
 	return ((*vf->vf_ioctl)(v, cmd, data, flag, l));
 }

Reply via email to