Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ic return something reasonable for WSDISPLAYIO_GINFO



details:   https://anonhg.NetBSD.org/src/rev/e99888ffcb90
branches:  trunk
changeset: 786085:e99888ffcb90
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Apr 14 16:37:32 2013 +0000

description:
return something reasonable for WSDISPLAYIO_GINFO

diffstat:

 sys/dev/ic/vga_raster.c |  40 +++++++++++++++++++++++++++-------------
 1 files changed, 27 insertions(+), 13 deletions(-)

diffs (82 lines):

diff -r a400fc684934 -r e99888ffcb90 sys/dev/ic/vga_raster.c
--- a/sys/dev/ic/vga_raster.c   Sun Apr 14 16:28:57 2013 +0000
+++ b/sys/dev/ic/vga_raster.c   Sun Apr 14 16:37:32 2013 +0000
@@ -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 @@
                *(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 @@
        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));
 }



Home | Main Index | Thread Index | Old Index