Source-Changes-HG archive

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

[src/fvdl-softdep]: src/sys/dev/tc Enable 'WSSCREEN_REVERSE' scr-capability.



details:   https://anonhg.NetBSD.org/src/rev/daf6eb7ff31b
branches:  fvdl-softdep
changeset: 477500:daf6eb7ff31b
user:      nisimura <nisimura%NetBSD.org@localhost>
date:      Tue Oct 19 00:49:34 1999 +0000

description:
Enable 'WSSCREEN_REVERSE' scr-capability.

diffstat:

 sys/dev/tc/cfb.c  |  821 +++++++++++++++++++++++++++++++++++++++++++++++++
 sys/dev/tc/mfb.c  |  716 +++++++++++++++++++++++++++++++++++++++++++
 sys/dev/tc/tfb.c  |  893 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 sys/dev/tc/xcfb.c |  775 ++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 3205 insertions(+), 0 deletions(-)

diffs (truncated from 3221 to 300 lines):

diff -r 2514b8212cf9 -r daf6eb7ff31b sys/dev/tc/cfb.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/dev/tc/cfb.c  Tue Oct 19 00:49:34 1999 +0000
@@ -0,0 +1,821 @@
+/* $NetBSD: cfb.c,v 1.13.2.2 1999/10/19 00:49:35 nisimura Exp $ */
+
+/*
+ * Copyright (c) 1998, 1999 Tohru Nishimura.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *      This product includes software developed by Tohru Nishimura
+ *     for the NetBSD Project.
+ * 4. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
+
+__KERNEL_RCSID(0, "$NetBSD: cfb.c,v 1.13.2.2 1999/10/19 00:49:35 nisimura Exp $");
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/kernel.h>
+#include <sys/device.h>
+#include <sys/malloc.h>
+#include <sys/buf.h>
+#include <sys/ioctl.h>
+#include <vm/vm.h>
+
+#include <machine/bus.h>
+#include <machine/intr.h>
+
+#include <dev/rcons/raster.h>
+#include <dev/wscons/wsconsio.h>
+#include <dev/wscons/wscons_raster.h>
+#include <dev/wscons/wsdisplayvar.h>
+
+#include <dev/tc/tcvar.h>
+#include <dev/ic/bt459reg.h>   
+
+#include <uvm/uvm_extern.h>
+
+#if defined(pmax)
+#define        machine_btop(x) mips_btop(x)
+#define        MACHINE_KSEG0_TO_PHYS(x) MIPS_KSEG1_TO_PHYS(x)
+#endif
+
+#if defined(__alpha__) || defined(alpha)
+/*
+ * Digital UNIX never supports PMAG-BA
+ */
+#define machine_btop(x) alpha_btop(x)
+#define MACHINE_KSEG0_TO_PHYS(x) ALPHA_K0SEG_TO_PHYS(x)
+#endif
+
+/*
+ * N.B., Bt459 registers are 8bit width.  Some of TC framebuffers have
+ * obscure register layout such as 2nd and 3rd Bt459 registers are
+ * adjacent each other in a word, i.e.,
+ *     struct bt459triplet {
+ *             struct {
+ *                     u_int8_t u0;
+ *                     u_int8_t u1;
+ *                     u_int8_t u2;
+ *                     unsigned :8; 
+ *             } bt_lo;
+ *             ...
+ * Although CX has single Bt459, 32bit R/W can be done w/o any trouble.
+ *
+ * struct bt459reg {
+ *         u_int32_t       bt_lo;
+ *         u_int32_t       bt_hi;
+ *         u_int32_t       bt_reg;
+ *         u_int32_t       bt_cmap;
+ * };
+ *
+ */
+
+/* Bt459 hardware registers */
+#define bt_lo  0
+#define bt_hi  1
+#define bt_reg 2
+#define bt_cmap 3
+
+#define REG(base, index)       *((u_int32_t *)(base) + (index))
+#define SELECT(vdac, regno) do {                       \
+       REG(vdac, bt_lo) = ((regno) & 0x00ff);          \
+       REG(vdac, bt_hi) = ((regno) & 0x0f00) >> 8;     \
+       tc_wmb();                                       \
+   } while (0)
+
+struct fb_devconfig {
+       vaddr_t dc_vaddr;               /* memory space virtual base address */
+       paddr_t dc_paddr;               /* memory space physical base address */
+       vsize_t dc_size;                /* size of slot memory */
+       int     dc_wid;                 /* width of frame buffer */
+       int     dc_ht;                  /* height of frame buffer */
+       int     dc_depth;               /* depth, bits per pixel */
+       int     dc_rowbytes;            /* bytes in a FB scan line */
+       vaddr_t dc_videobase;           /* base of flat frame buffer */
+       struct raster   dc_raster;      /* raster description */
+       struct rcons    dc_rcons;       /* raster blitter control info */
+       int         dc_blanked;         /* currently has video disabled */
+};
+
+struct hwcmap256 {
+#define        CMAP_SIZE       256     /* 256 R/G/B entries */
+       u_int8_t r[CMAP_SIZE];
+       u_int8_t g[CMAP_SIZE];
+       u_int8_t b[CMAP_SIZE];
+};
+
+struct hwcursor64 {
+       struct wsdisplay_curpos cc_pos;
+       struct wsdisplay_curpos cc_hot;
+       struct wsdisplay_curpos cc_size;
+       struct wsdisplay_curpos cc_magic;
+#define        CURSOR_MAX_SIZE 64
+       u_int8_t cc_color[6];
+       u_int64_t cc_image[64 + 64];
+};
+
+struct cfb_softc {
+       struct device sc_dev;
+       struct fb_devconfig *sc_dc;     /* device configuration */
+       struct hwcmap256 sc_cmap;       /* software copy of colormap */
+       struct hwcursor64 sc_cursor;    /* software copy of cursor */
+       int sc_curenb;                  /* cursor sprite enabled */
+       int sc_changed;                 /* need update of colormap */
+#define        DATA_ENB_CHANGED        0x01    /* cursor enable changed */
+#define        DATA_CURCMAP_CHANGED    0x02    /* cursor colormap changed */
+#define        DATA_CURSHAPE_CHANGED   0x04    /* cursor size, image, mask changed */
+#define        DATA_CMAP_CHANGED       0x08    /* colormap changed */
+#define        DATA_ALL_CHANGED        0x0f
+       int nscreens;
+};
+
+#define        CX_MAGIC_X      220
+#define        CX_MAGIC_Y      35
+
+#define        CX_FB_OFFSET    0x000000
+#define        CX_FB_SIZE      0x100000
+#define        CX_BT459_OFFSET 0x200000
+#define        CX_OFFSET_IREQ  0x300000        /* Interrupt req. control */
+
+int  cfbmatch __P((struct device *, struct cfdata *, void *));
+void cfbattach __P((struct device *, struct device *, void *));
+
+struct cfattach cfb_ca = {
+       sizeof(struct cfb_softc), cfbmatch, cfbattach,
+};
+
+void cfb_getdevconfig __P((tc_addr_t, struct fb_devconfig *));
+struct fb_devconfig cfb_console_dc;
+tc_addr_t cfb_consaddr;
+
+struct wsdisplay_emulops cfb_emulops = {
+       rcons_cursor,                   /* could use hardware cursor; punt */
+       rcons_mapchar,
+       rcons_putchar,
+       rcons_copycols,
+       rcons_erasecols,
+       rcons_copyrows,
+       rcons_eraserows,
+       rcons_alloc_attr
+};
+
+struct wsscreen_descr cfb_stdscreen = {
+       "std", 0, 0,
+       &cfb_emulops,
+       0, 0,
+       WSSCREEN_REVERSE
+};
+
+const struct wsscreen_descr *_cfb_scrlist[] = {
+       &cfb_stdscreen,
+};
+
+struct wsscreen_list cfb_screenlist = {
+       sizeof(_cfb_scrlist) / sizeof(struct wsscreen_descr *), _cfb_scrlist
+};
+
+int    cfbioctl __P((void *, u_long, caddr_t, int, struct proc *));
+int    cfbmmap __P((void *, off_t, int));
+
+int    cfb_alloc_screen __P((void *, const struct wsscreen_descr *,
+                                     void **, int *, int *, long *));
+void   cfb_free_screen __P((void *, void *));
+void   cfb_show_screen __P((void *, void *));
+
+struct wsdisplay_accessops cfb_accessops = {
+       cfbioctl,
+       cfbmmap,
+       cfb_alloc_screen,
+       cfb_free_screen,
+       cfb_show_screen,
+       0 /* load_font */
+};
+
+int  cfb_cnattach __P((tc_addr_t));
+int  cfbintr __P((void *));
+void cfbinit __P((struct fb_devconfig *));
+
+static int  get_cmap __P((struct cfb_softc *, struct wsdisplay_cmap *));
+static int  set_cmap __P((struct cfb_softc *, struct wsdisplay_cmap *));
+static int  set_cursor __P((struct cfb_softc *, struct wsdisplay_cursor *));
+static int  get_cursor __P((struct cfb_softc *, struct wsdisplay_cursor *));
+static void set_curpos __P((struct cfb_softc *, struct wsdisplay_curpos *));
+static void bt459_set_curpos __P((struct cfb_softc *));
+
+/*
+ * Compose 2 bit/pixel cursor image.  Bit order will be reversed.
+ *   M M M M I I I I           M I M I M I M I
+ *     [ before ]                 [ after ]
+ *   3 2 1 0 3 2 1 0           0 0 1 1 2 2 3 3
+ *   7 6 5 4 7 6 5 4           4 4 5 5 6 6 7 7
+ */
+const static u_int8_t shuffle[256] = {
+       0x00, 0x40, 0x10, 0x50, 0x04, 0x44, 0x14, 0x54,
+       0x01, 0x41, 0x11, 0x51, 0x05, 0x45, 0x15, 0x55,
+       0x80, 0xc0, 0x90, 0xd0, 0x84, 0xc4, 0x94, 0xd4,
+       0x81, 0xc1, 0x91, 0xd1, 0x85, 0xc5, 0x95, 0xd5,
+       0x20, 0x60, 0x30, 0x70, 0x24, 0x64, 0x34, 0x74,
+       0x21, 0x61, 0x31, 0x71, 0x25, 0x65, 0x35, 0x75,
+       0xa0, 0xe0, 0xb0, 0xf0, 0xa4, 0xe4, 0xb4, 0xf4,
+       0xa1, 0xe1, 0xb1, 0xf1, 0xa5, 0xe5, 0xb5, 0xf5,
+       0x08, 0x48, 0x18, 0x58, 0x0c, 0x4c, 0x1c, 0x5c,
+       0x09, 0x49, 0x19, 0x59, 0x0d, 0x4d, 0x1d, 0x5d,
+       0x88, 0xc8, 0x98, 0xd8, 0x8c, 0xcc, 0x9c, 0xdc,
+       0x89, 0xc9, 0x99, 0xd9, 0x8d, 0xcd, 0x9d, 0xdd,
+       0x28, 0x68, 0x38, 0x78, 0x2c, 0x6c, 0x3c, 0x7c,
+       0x29, 0x69, 0x39, 0x79, 0x2d, 0x6d, 0x3d, 0x7d,
+       0xa8, 0xe8, 0xb8, 0xf8, 0xac, 0xec, 0xbc, 0xfc,
+       0xa9, 0xe9, 0xb9, 0xf9, 0xad, 0xed, 0xbd, 0xfd,
+       0x02, 0x42, 0x12, 0x52, 0x06, 0x46, 0x16, 0x56,
+       0x03, 0x43, 0x13, 0x53, 0x07, 0x47, 0x17, 0x57,
+       0x82, 0xc2, 0x92, 0xd2, 0x86, 0xc6, 0x96, 0xd6,
+       0x83, 0xc3, 0x93, 0xd3, 0x87, 0xc7, 0x97, 0xd7,
+       0x22, 0x62, 0x32, 0x72, 0x26, 0x66, 0x36, 0x76,
+       0x23, 0x63, 0x33, 0x73, 0x27, 0x67, 0x37, 0x77,
+       0xa2, 0xe2, 0xb2, 0xf2, 0xa6, 0xe6, 0xb6, 0xf6,
+       0xa3, 0xe3, 0xb3, 0xf3, 0xa7, 0xe7, 0xb7, 0xf7,
+       0x0a, 0x4a, 0x1a, 0x5a, 0x0e, 0x4e, 0x1e, 0x5e,
+       0x0b, 0x4b, 0x1b, 0x5b, 0x0f, 0x4f, 0x1f, 0x5f,
+       0x8a, 0xca, 0x9a, 0xda, 0x8e, 0xce, 0x9e, 0xde,
+       0x8b, 0xcb, 0x9b, 0xdb, 0x8f, 0xcf, 0x9f, 0xdf,
+       0x2a, 0x6a, 0x3a, 0x7a, 0x2e, 0x6e, 0x3e, 0x7e,
+       0x2b, 0x6b, 0x3b, 0x7b, 0x2f, 0x6f, 0x3f, 0x7f,
+       0xaa, 0xea, 0xba, 0xfa, 0xae, 0xee, 0xbe, 0xfe,
+       0xab, 0xeb, 0xbb, 0xfb, 0xaf, 0xef, 0xbf, 0xff,
+};
+
+int
+cfbmatch(parent, match, aux)
+       struct device *parent;
+       struct cfdata *match;
+       void *aux;
+{
+       struct tc_attach_args *ta = aux;
+
+       if (strncmp("PMAG-BA ", ta->ta_modname, TC_ROM_LLEN) != 0)
+               return (0);
+
+       return (1);
+}
+
+void
+cfb_getdevconfig(dense_addr, dc)
+       tc_addr_t dense_addr;
+       struct fb_devconfig *dc;
+{
+       struct raster *rap;
+       struct rcons *rcp;
+       int i;
+
+       dc->dc_vaddr = dense_addr;
+       dc->dc_paddr = MACHINE_KSEG0_TO_PHYS(dc->dc_vaddr + CX_FB_OFFSET);
+
+       dc->dc_wid = 1024;
+       dc->dc_ht = 864;



Home | Main Index | Thread Index | Old Index