Source-Changes-HG archive

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

[src/trunk]: src add NEWSMIPS_WSDISPLAYIO_GINFO ioctl to get frame buffer str...



details:   https://anonhg.NetBSD.org/src/rev/1d0301253a24
branches:  trunk
changeset: 568822:1d0301253a24
user:      uch <uch%NetBSD.org@localhost>
date:      Sun Aug 01 18:53:16 2004 +0000

description:
add NEWSMIPS_WSDISPLAYIO_GINFO ioctl to get frame buffer stride.

diffstat:

 distrib/sets/lists/comp/md.newsmips  |   3 ++-
 sys/arch/newsmips/apbus/xafb.c       |  23 ++++++++++++++---------
 sys/arch/newsmips/include/Makefile   |   4 ++--
 sys/arch/newsmips/include/wsconsio.h |  16 ++++++++++++++++
 4 files changed, 34 insertions(+), 12 deletions(-)

diffs (139 lines):

diff -r 0c559b6bdd29 -r 1d0301253a24 distrib/sets/lists/comp/md.newsmips
--- a/distrib/sets/lists/comp/md.newsmips       Sun Aug 01 18:52:03 2004 +0000
+++ b/distrib/sets/lists/comp/md.newsmips       Sun Aug 01 18:53:16 2004 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: md.newsmips,v 1.22 2004/05/08 21:53:23 kleink Exp $
+# $NetBSD: md.newsmips,v 1.23 2004/08/01 18:53:16 uch Exp $
 ./usr/include/ieeefp.h                         comp-c-include
 ./usr/include/newsmips                         comp-c-include
 ./usr/include/newsmips/_G_config.h             comp-obsolete           obsolete
@@ -61,4 +61,5 @@
 ./usr/include/newsmips/varargs.h               comp-c-include
 ./usr/include/newsmips/vmparam.h               comp-c-include
 ./usr/include/newsmips/wchar_limits.h          comp-c-include
+./usr/include/newsmips/wsconsio.h              comp-c-include
 ./usr/include/newsmips/z8530var.h              comp-c-include
diff -r 0c559b6bdd29 -r 1d0301253a24 sys/arch/newsmips/apbus/xafb.c
--- a/sys/arch/newsmips/apbus/xafb.c    Sun Aug 01 18:52:03 2004 +0000
+++ b/sys/arch/newsmips/apbus/xafb.c    Sun Aug 01 18:53:16 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: xafb.c,v 1.7 2003/11/13 03:09:28 chs Exp $     */
+/*     $NetBSD: xafb.c,v 1.8 2004/08/01 18:53:17 uch Exp $     */
 
 /*-
  * Copyright (c) 2000 Tsubai Masanari.  All rights reserved.
@@ -29,7 +29,7 @@
 /* "xa" frame buffer driver.  Currently supports 1280x1024x8 only. */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xafb.c,v 1.7 2003/11/13 03:09:28 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xafb.c,v 1.8 2004/08/01 18:53:17 uch Exp $");
 
 #include <sys/param.h>
 #include <sys/buf.h>
@@ -43,7 +43,7 @@
 #include <machine/adrsmap.h>
 #include <machine/apcall.h>
 
-#include <dev/wscons/wsconsio.h>
+#include <machine/wsconsio.h>
 #include <dev/wscons/wsdisplayvar.h>
 #include <dev/rasops/rasops.h>
 
@@ -62,6 +62,7 @@
 
 struct xafb_devconfig {
        volatile u_char *dc_fbbase;     /* VRAM base address */
+       paddr_t dc_fbpaddr;             /* VRAM physical address */
        struct xafb_reg *dc_reg;        /* register address */
        struct rasops_info dc_ri;
 };
@@ -160,8 +161,8 @@
        } else {
                dc = malloc(sizeof(struct xafb_devconfig), M_DEVBUF, M_WAITOK);
                bzero(dc, sizeof(struct xafb_devconfig));
-
-               dc->dc_fbbase = (void *)0xb0000000;             /* XXX */
+               dc->dc_fbpaddr = (paddr_t)0x10000000;
+               dc->dc_fbbase = (void *)MIPS_PHYS_TO_KSEG1(dc->dc_fbpaddr);
                dc->dc_reg = (void *)(apa->apa_hwbase + 0x3000);
                if (xafb_common_init(dc) != 0) {
                        printf(": couldn't initialize device\n");
@@ -258,15 +259,18 @@
 {
        struct xafb_softc *sc = v;
        struct xafb_devconfig *dc = sc->sc_dc;
-       struct wsdisplay_fbinfo *wdf;
+       struct newsmips_wsdisplay_fbinfo *nwdf = (void *)data;
+       struct wsdisplay_fbinfo *wdf = (void *)data;
 
        switch (cmd) {
        case WSDISPLAYIO_GTYPE:
                *(int *)data = WSDISPLAY_TYPE_UNKNOWN;  /* XXX */
                return 0;
 
+       case NEWSMIPS_WSDISPLAYIO_GINFO:
+               nwdf->stride = dc->dc_ri.ri_stride;
+               /* FALLTHROUGH */
        case WSDISPLAYIO_GINFO:
-               wdf = (void *)data;
                wdf->height = dc->dc_ri.ri_height;
                wdf->width = dc->dc_ri.ri_width;
                wdf->depth = dc->dc_ri.ri_depth;
@@ -297,7 +301,7 @@
        if (offset >= (ri->ri_stride * ri->ri_height) || offset < 0)
                return -1;
 
-       return mips_btop((int)dc->dc_fbbase + offset);
+       return mips_btop(dc->dc_fbpaddr + offset);
 }
 
 int
@@ -359,7 +363,8 @@
        if (!xafb_is_console())
                return -1;
 
-       dc->dc_fbbase = (void *)0xb0000000;                     /* XXX */
+       dc->dc_fbpaddr = (paddr_t)0x10000000;
+       dc->dc_fbbase = (void *)MIPS_PHYS_TO_KSEG1(dc->dc_fbpaddr);
        dc->dc_reg = (void *)0xb4903000;                        /* XXX */
        xafb_common_init(dc);
 
diff -r 0c559b6bdd29 -r 1d0301253a24 sys/arch/newsmips/include/Makefile
--- a/sys/arch/newsmips/include/Makefile        Sun Aug 01 18:52:03 2004 +0000
+++ b/sys/arch/newsmips/include/Makefile        Sun Aug 01 18:53:16 2004 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.28 2004/05/08 21:51:50 kleink Exp $
+#      $NetBSD: Makefile,v 1.29 2004/08/01 18:53:17 uch Exp $
 
 INCSDIR= /usr/include/newsmips
 
@@ -19,7 +19,7 @@
        setjmp.h signal.h stdarg.h \
        trap.h types.h \
        varargs.h vmparam.h \
-       wchar_limits.h \
+       wchar_limits.h wsconsio.h \
        z8530var.h
 
 .include <bsd.kinc.mk>
diff -r 0c559b6bdd29 -r 1d0301253a24 sys/arch/newsmips/include/wsconsio.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/newsmips/include/wsconsio.h      Sun Aug 01 18:53:16 2004 +0000
@@ -0,0 +1,16 @@
+/*     $NetBSD: wsconsio.h,v 1.1 2004/08/01 18:53:17 uch Exp $ */
+
+#ifndef _NEWSMIPS_WSCONSIO_H_
+#define        _NEWSMIPS_WSCONSIO_H_
+
+#include <dev/wscons/wsconsio.h>
+
+struct newsmips_wsdisplay_fbinfo {
+       struct wsdisplay_fbinfo wsdisplay_fbinfo;
+       u_int stride;
+};
+
+#define        NEWSMIPS_WSDISPLAYIO_GINFO                                              \
+       _IOR('n', 65, struct newsmips_wsdisplay_fbinfo)
+
+#endif /* !_NEWSMIPS_WSCONSIO_H_ */



Home | Main Index | Thread Index | Old Index