Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/hpcmips implement 8bpp CLUT of Plum2, TX3912 video ...



details:   https://anonhg.NetBSD.org/src/rev/f697547011e7
branches:  trunk
changeset: 485925:f697547011e7
user:      uch <uch%NetBSD.org@localhost>
date:      Mon May 08 21:57:56 2000 +0000

description:
implement 8bpp CLUT of Plum2, TX3912 video module.

diffstat:

 sys/arch/hpcmips/conf/TX3912         |    4 +-
 sys/arch/hpcmips/conf/TX3922         |    4 +-
 sys/arch/hpcmips/conf/files.hpcmips  |    4 +-
 sys/arch/hpcmips/dev/plumvideo.c     |  336 ++++++++++++++++++++++++++++++----
 sys/arch/hpcmips/dev/plumvideoreg.h  |    8 +-
 sys/arch/hpcmips/dev/video_subr.c    |   95 +++++++++
 sys/arch/hpcmips/dev/video_subr.h    |   41 ++++
 sys/arch/hpcmips/tx/tx3912video.c    |  266 ++++++++++++++++++++++++++-
 sys/arch/hpcmips/tx/tx3912videoreg.h |  284 +++++++++++++++++-----------
 sys/arch/hpcmips/tx/tx3912videovar.h |   45 ++++-
 10 files changed, 911 insertions(+), 176 deletions(-)

diffs (truncated from 1627 to 300 lines):

diff -r de97af02a4aa -r f697547011e7 sys/arch/hpcmips/conf/TX3912
--- a/sys/arch/hpcmips/conf/TX3912      Mon May 08 21:56:32 2000 +0000
+++ b/sys/arch/hpcmips/conf/TX3912      Mon May 08 21:57:56 2000 +0000
@@ -2,7 +2,7 @@
 # Distribution kernel (TOSHIBA TX3912 based model) kernel config file
 
 #
-#      $NetBSD: TX3912,v 1.20 2000/05/04 10:25:45 takemura Exp $
+#      $NetBSD: TX3912,v 1.21 2000/05/08 21:57:59 uch Exp $
 #
 include                "arch/hpcmips/conf/std.hpcmips"
 
@@ -165,6 +165,8 @@
 wskbd*         at btnmgr0 mux 1
 
 options        WSEMUL_VT100
+options        WS_KERNEL_FG=WSCOL_BROWN
+options        WS_KERNEL_BG=WSCOL_BLUE
 options        WSDISPLAY_DEFAULTSCREENS=4
 options        FONT_VT220L8x10
 # compatibility to other console drivers
diff -r de97af02a4aa -r f697547011e7 sys/arch/hpcmips/conf/TX3922
--- a/sys/arch/hpcmips/conf/TX3922      Mon May 08 21:56:32 2000 +0000
+++ b/sys/arch/hpcmips/conf/TX3922      Mon May 08 21:57:56 2000 +0000
@@ -1,7 +1,7 @@
 #
 # Distribution kernel (TOSHIBA TX3922 based model) kernel config file
 #
-#      $NetBSD: TX3922,v 1.20 2000/05/08 13:49:47 augustss Exp $
+#      $NetBSD: TX3922,v 1.21 2000/05/08 21:57:59 uch Exp $
 #
 include                "arch/hpcmips/conf/std.hpcmips"
 
@@ -227,6 +227,8 @@
 options        WSEMUL_VT100
 options        WSDISPLAY_DEFAULTSCREENS=4
 options        FONT_VT220L8x10
+options        WS_KERNEL_FG=WSCOL_BROWN
+options        WS_KERNEL_BG=WSCOL_BLUE
 # compatibility to other console drivers
 options        WSDISPLAY_COMPAT_PCVT           # emulate some ioctls
 options        WSDISPLAY_COMPAT_SYSCONS        # emulate some ioctls
diff -r de97af02a4aa -r f697547011e7 sys/arch/hpcmips/conf/files.hpcmips
--- a/sys/arch/hpcmips/conf/files.hpcmips       Mon May 08 21:56:32 2000 +0000
+++ b/sys/arch/hpcmips/conf/files.hpcmips       Mon May 08 21:57:56 2000 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.hpcmips,v 1.31 2000/05/04 08:18:59 takemura Exp $
+#      $NetBSD: files.hpcmips,v 1.32 2000/05/08 21:57:59 uch Exp $
 
 # maxpartitions must be first item in files.${ARCH}.
 maxpartitions 8
@@ -87,6 +87,8 @@
 attach btnmgr at mainbus
 file   arch/hpcmips/dev/btnmgr.c       btnmgr
 
+file   arch/hpcmips/dev/video_subr.c   tx3912video | plumvideo
+
 #
 # ISA bus support
 #
diff -r de97af02a4aa -r f697547011e7 sys/arch/hpcmips/dev/plumvideo.c
--- a/sys/arch/hpcmips/dev/plumvideo.c  Mon May 08 21:56:32 2000 +0000
+++ b/sys/arch/hpcmips/dev/plumvideo.c  Mon May 08 21:57:56 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: plumvideo.c,v 1.7 2000/05/02 17:50:51 uch Exp $ */
+/*     $NetBSD: plumvideo.c,v 1.8 2000/05/08 21:57:56 uch Exp $ */
 
 /*-
  * Copyright (c) 1999, 2000 UCHIYAMA Yasushi.  All rights reserved.
@@ -32,6 +32,10 @@
 #include <sys/systm.h>
 #include <sys/device.h>
 
+#include <sys/ioctl.h>
+#include <sys/buf.h>
+#include <vm/vm.h>
+
 #include <dev/cons.h> /* consdev */
 
 #include <machine/bus.h>
@@ -45,10 +49,15 @@
 
 #include <machine/bootinfo.h>
 
+#include <dev/wscons/wsdisplayvar.h>
+#include <dev/rasops/rasops.h>
+#include <arch/hpcmips/dev/video_subr.h>
+
 #include <dev/wscons/wsconsio.h>
 #include <arch/hpcmips/dev/hpcfbvar.h>
 #include <arch/hpcmips/dev/hpcfbio.h>
 
+
 #ifdef PLUMVIDEODEBUG
 int    plumvideo_debug = 1;
 #define        DPRINTF(arg) if (plumvideo_debug) printf arg;
@@ -58,26 +67,34 @@
 #define DPRINTFN(n, arg)
 #endif
 
-int    plumvideo_match __P((struct device*, struct cfdata*, void*));
-void   plumvideo_attach __P((struct device*, struct device*, void*));
-
 struct plumvideo_softc {
        struct device sc_dev;
+
        plum_chipset_tag_t sc_pc;
+       /* control register */
        bus_space_tag_t sc_regt;
        bus_space_handle_t sc_regh;
-       bus_space_tag_t sc_iot;
-       bus_space_handle_t sc_ioh;
+       /* frame buffer */
+       bus_space_tag_t sc_fbiot;
+       bus_space_handle_t sc_fbioh;
+       /* clut buffer (8bpp only) */
+       bus_space_tag_t sc_clutiot;
+       bus_space_handle_t sc_clutioh;
+       /* bitblt */
+       bus_space_tag_t sc_bitbltt;
+       bus_space_handle_t sc_bitblth;
 
        int sc_width;
        int sc_height;
        int sc_depth;
 
-       struct hpcfb_fbconf     sc_fbconf;
-       struct hpcfb_dspconf    sc_dspconf;
+       struct hpcfb_fbconf sc_fbconf;
+       struct hpcfb_dspconf sc_dspconf;
 };
 
-void   plumvideo_hpcfbinit __P((struct plumvideo_softc *));
+int    plumvideo_match __P((struct device*, struct cfdata*, void*));
+void   plumvideo_attach __P((struct device*, struct device*, void*));
+
 int    plumvideo_ioctl __P((void *, u_long, caddr_t, int, struct proc *));
 int    plumvideo_mmap __P((void *, off_t, int));
 
@@ -90,6 +107,18 @@
 };
 
 int    plumvideo_init __P((struct plumvideo_softc*));
+void   plumvideo_hpcfbinit __P((struct plumvideo_softc *));
+
+void   plumvideo_clut_default __P((struct plumvideo_softc *));
+void   plumvideo_clut_set __P((struct plumvideo_softc *, u_int32_t *, int,
+                               int));
+void   plumvideo_clut_get __P((struct plumvideo_softc *, u_int32_t *, int,
+                               int));
+void   __plumvideo_clut_access __P((struct plumvideo_softc *,
+                                    void (*) __P((bus_space_tag_t,
+                                                  bus_space_handle_t))));
+static void _flush_cache __P((void)) __attribute__((__unused__)); /* !!! */
+
 #ifdef PLUMVIDEODEBUG
 void   plumvideo_dump __P((struct plumvideo_softc*));
 #endif
@@ -103,7 +132,7 @@
        /*
         * VRAM area also uses as UHOSTC shared RAM.
         */
-       return 2; /* 1st attach group */
+       return (2); /* 1st attach group */
 }
 
 void
@@ -119,7 +148,7 @@
 
        sc->sc_pc       = pa->pa_pc;
        sc->sc_regt     = pa->pa_regt;
-       sc->sc_iot      = pa->pa_iot;
+       sc->sc_fbiot = sc->sc_clutiot = sc->sc_bitbltt  = pa->pa_iot;
 
        printf(": ");
        /*
@@ -200,21 +229,21 @@
        struct plumvideo_softc *sc;
 {
        struct hpcfb_fbconf *fb = &sc->sc_fbconf;
-       vaddr_t fbvaddr = (vaddr_t)sc->sc_ioh;
+       vaddr_t fbvaddr = (vaddr_t)sc->sc_fbioh;
        
        memset(fb, 0, sizeof(struct hpcfb_fbconf));
        
        fb->hf_conf_index       = 0;    /* configuration index          */
        fb->hf_nconfs           = 1;    /* how many configurations      */
-       strcpy(fb->hf_name, "PLUM built-in video");
-                                       /* frame buffer name            */
-       strcpy(fb->hf_conf_name, "LCD");
-                                       /* configuration name           */
+       strncpy(fb->hf_name, "PLUM built-in video", HPCFB_MAXNAMELEN);
+       /* frame buffer name            */
+       strncpy(fb->hf_conf_name, "LCD", HPCFB_MAXNAMELEN);
+       /* configuration name           */
        fb->hf_height           = sc->sc_height;
        fb->hf_width            = sc->sc_width;
        fb->hf_baseaddr         = mips_ptob(mips_btop(fbvaddr));
        fb->hf_offset           = (u_long)fbvaddr - fb->hf_baseaddr;
-                                       /* frame buffer start offset    */
+       /* frame buffer start offset    */
        fb->hf_bytes_per_line   = (sc->sc_width * sc->sc_depth) / NBBY;
        fb->hf_nplanes          = 1;
        fb->hf_bytes_per_plane  = sc->sc_height * fb->hf_bytes_per_line;
@@ -236,7 +265,8 @@
                fb->hf_pixel_width = 16;
 
                fb->hf_class_data_length = sizeof(struct hf_rgb_tag);
-               fb->hf_u.hf_rgb.hf_flags = 0;   /* reserved for future use */
+               /* reserved for future use */
+               fb->hf_u.hf_rgb.hf_flags = 0;
 
                fb->hf_u.hf_rgb.hf_red_width = 5;
                fb->hf_u.hf_rgb.hf_red_shift = 11;
@@ -255,7 +285,8 @@
                fb->hf_pixels_per_pack = 1;
                fb->hf_pixel_width = 8;
                fb->hf_class_data_length = sizeof(struct hf_indexed_tag);
-               fb->hf_u.hf_indexed.hf_flags = 0; /* reserved for future use */
+               /* reserved for future use */
+               fb->hf_u.hf_indexed.hf_flags = 0;
                break;
        }
 }
@@ -269,9 +300,18 @@
        plumreg_t reg;
        size_t vram_size;
        int bpp, vram_pitch;
-
+#if notyet
+       /* map BitBlt area */
+       if (bus_space_map(sc->sc_bitbltt,
+                         PLUM_VIDEO_BITBLT_IOBASE,
+                         PLUM_VIDEO_BITBLT_IOSIZE, 0, 
+                         &sc->sc_bitblth)) {
+               printf(": BitBlt map failed\n");
+               return (1);
+       }
+#endif
        reg = plum_conf_read(regt, regh, PLUM_VIDEO_PLGMD_REG);
-       switch (reg & PLUM_VIDEO_PLGMD_MASK) {
+       switch (reg & PLUM_VIDEO_PLGMD_GMODE_MASK) {
        case PLUM_VIDEO_PLGMD_16BPP:            
 #ifdef PLUM_BIG_OHCI_BUFFER
                printf("(16bpp disabled) ");
@@ -282,9 +322,14 @@
 #endif /* PLUM_BIG_OHCI_BUFFER */
        default:
                bootinfo->fb_type = BIFB_D8_FF; /* over ride */
-               reg &= ~PLUM_VIDEO_PLGMD_MASK;
+               reg &= ~PLUM_VIDEO_PLGMD_GMODE_MASK;
+               plum_conf_write(regt, regh, PLUM_VIDEO_PLGMD_REG, reg);
                reg |= PLUM_VIDEO_PLGMD_8BPP;
                plum_conf_write(regt, regh, PLUM_VIDEO_PLGMD_REG, reg);
+#if notyet
+               /* change BitBlt color depth */
+               plum_conf_write(sc->sc_bitbltt, sc->sc_bitblth, 0x8, 0);
+#endif
                /* FALLTHROUGH */
        case PLUM_VIDEO_PLGMD_8BPP:
                bpp = 8;
@@ -297,27 +342,36 @@
        /*
         * set line byte length to bootinfo and LCD controller.
         */
-       bootinfo->fb_line_bytes = (bootinfo->fb_width * bpp) / 8;
+       bootinfo->fb_line_bytes = (sc->sc_width * bpp) / NBBY;
 
-       vram_pitch = bootinfo->fb_width / (8 / bpp);
+       vram_pitch = sc->sc_width / (8 / bpp);
        plum_conf_write(regt, regh, PLUM_VIDEO_PLPIT1_REG, vram_pitch);
        plum_conf_write(regt, regh, PLUM_VIDEO_PLPIT2_REG,
                        vram_pitch & PLUM_VIDEO_PLPIT2_MASK);
        plum_conf_write(regt, regh, PLUM_VIDEO_PLOFS_REG, vram_pitch);
 
        /*
-        * boot messages.
+        * boot messages and map CLUT(if any).
         */
        printf("display mode: ");
-       reg = plum_conf_read(regt, regh, PLUM_VIDEO_PLGMD_REG);
-       switch (reg & PLUM_VIDEO_PLGMD_MASK) {  
-       case PLUM_VIDEO_PLGMD_DISABLE:
+       switch (bpp) {
+       default:
                printf("disabled ");
                break;
-       case PLUM_VIDEO_PLGMD_8BPP:
+       case 8:
                printf("8bpp ");
+               /* map CLUT area */
+               if (bus_space_map(sc->sc_clutiot,
+                                 PLUM_VIDEO_CLUT_LCD_IOBASE,
+                                 PLUM_VIDEO_CLUT_LCD_IOSIZE, 0, 
+                                 &sc->sc_clutioh)) {
+                       printf(": CLUT map failed\n");
+                       return (1);
+               }
+               /* install default CLUT */
+               plumvideo_clut_default(sc);



Home | Main Index | Thread Index | Old Index