Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/tpctl Try to use standard wsdisplay ioctls when HPC...



details:   https://anonhg.NetBSD.org/src/rev/0d14a2a284ae
branches:  trunk
changeset: 826294:0d14a2a284ae
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sun Aug 27 02:19:08 2017 +0000

description:
Try to use standard wsdisplay ioctls when HPCFBIO_GCONF is not available.

diffstat:

 usr.sbin/tpctl/fb.c |  24 ++++++++++++++++++++----
 1 files changed, 20 insertions(+), 4 deletions(-)

diffs (52 lines):

diff -r a64a27761c64 -r 0d14a2a284ae usr.sbin/tpctl/fb.c
--- a/usr.sbin/tpctl/fb.c       Sun Aug 27 00:29:57 2017 +0000
+++ b/usr.sbin/tpctl/fb.c       Sun Aug 27 02:19:08 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fb.c,v 1.4 2008/05/10 15:31:05 martin Exp $    */
+/*     $NetBSD: fb.c,v 1.5 2017/08/27 02:19:08 jmcneill Exp $  */
 
 /*-
  * Copyright (c) 2002 TAKEMRUA Shin
@@ -41,7 +41,7 @@
 
 #ifndef lint
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: fb.c,v 1.4 2008/05/10 15:31:05 martin Exp $");
+__RCSID("$NetBSD: fb.c,v 1.5 2017/08/27 02:19:08 jmcneill Exp $");
 #endif /* not lint */
 
 #define INVALID_CACHE -1
@@ -69,6 +69,8 @@
 int
 fb_init(struct fb *fb, int fd)
 {
+       struct wsdisplay_fbinfo fbinfo;
+       u_int linebytes;
        int y;
        size_t size;
 
@@ -77,8 +79,22 @@
        fb->conf.hf_conf_index = HPCFB_CURRENT_CONFIG;
        if (ioctl(fb->fd, WSDISPLAYIO_GMODE, &fb->dispmode) < 0)
                return (-1);
-       if (ioctl(fb->fd, HPCFBIO_GCONF, &fb->conf) < 0)
-               return (-1);
+       if (ioctl(fb->fd, HPCFBIO_GCONF, &fb->conf) < 0) {
+               if (ioctl(fb->fd, WSDISPLAYIO_GINFO, &fbinfo) < 0 ||
+                   ioctl(fb->fd, WSDISPLAYIO_LINEBYTES, &linebytes) < 0)
+                       return (-1);
+               memset(&fb->conf, 0, sizeof(fb->conf));
+               fb->conf.hf_width = fbinfo.width;
+               fb->conf.hf_height = fbinfo.height;
+               fb->conf.hf_bytes_per_line = linebytes;
+               fb->conf.hf_nplanes = 1;
+               fb->conf.hf_bytes_per_plane = fbinfo.height * linebytes;
+               fb->conf.hf_pack_width = fbinfo.depth;
+               fb->conf.hf_pixels_per_pack = 1;
+               fb->conf.hf_pixel_width = 1;
+               fb->conf.hf_access_flags = HPCFB_ACCESS_STATIC |
+                   HPCFB_ACCESS_BYTE | HPCFB_ACCESS_WORD | HPCFB_ACCESS_DWORD;
+       }
 
        if (fb_dispmode(fb, WSDISPLAYIO_MODE_MAPPED) < 0)
                return (-1);



Home | Main Index | Thread Index | Old Index