[BACK]Return to cgsix.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / sys / dev / sun

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /src/sys/dev/sun/cgsix.c between version 1.27 and 1.27.2.4

version 1.27, 2005/06/28 20:55:21 version 1.27.2.4, 2007/10/27 11:34:18
Line 104  __KERNEL_RCSID(0, "$NetBSD$");
Line 104  __KERNEL_RCSID(0, "$NetBSD$");
   
 #include <uvm/uvm_extern.h>  #include <uvm/uvm_extern.h>
   
 #include <machine/bus.h>  #include <sys/bus.h>
   
 #include <dev/sun/fbio.h>  #include <dev/sun/fbio.h>
 #include <dev/sun/fbvar.h>  #include <dev/sun/fbvar.h>
Line 116  __KERNEL_RCSID(0, "$NetBSD$");
Line 116  __KERNEL_RCSID(0, "$NetBSD$");
 #include <dev/wscons/wsconsio.h>  #include <dev/wscons/wsconsio.h>
 #include <dev/wsfont/wsfont.h>  #include <dev/wsfont/wsfont.h>
 #include <dev/rasops/rasops.h>  #include <dev/rasops/rasops.h>
   #include <dev/wscons/wsdisplay_vconsvar.h>
   
 #include "opt_wsemul.h"  #include "opt_wsemul.h"
 #include "rasops_glue.h"  #include "rasops_glue.h"
Line 124  __KERNEL_RCSID(0, "$NetBSD$");
Line 125  __KERNEL_RCSID(0, "$NetBSD$");
 #include <dev/sun/cgsixvar.h>  #include <dev/sun/cgsixvar.h>
   
 static void     cg6_unblank(struct device *);  static void     cg6_unblank(struct device *);
   static void     cg6_blank(struct cgsix_softc *, int);
   
 extern struct cfdriver cgsix_cd;  extern struct cfdriver cgsix_cd;
   
Line 134  dev_type_mmap(cgsixmmap);
Line 136  dev_type_mmap(cgsixmmap);
   
 const struct cdevsw cgsix_cdevsw = {  const struct cdevsw cgsix_cdevsw = {
         cgsixopen, cgsixclose, noread, nowrite, cgsixioctl,          cgsixopen, cgsixclose, noread, nowrite, cgsixioctl,
         nostop, notty, nopoll, cgsixmmap, nokqfilter,          nostop, notty, nopoll, cgsixmmap, nokqfilter, D_OTHER
 };  };
   
 /* frame buffer generic driver */  /* frame buffer generic driver */
Line 150  static void cg6_setcursor (struct cgsix_
Line 152  static void cg6_setcursor (struct cgsix_
 static void cg6_loadcursor (struct cgsix_softc *);/* set shape */  static void cg6_loadcursor (struct cgsix_softc *);/* set shape */
   
 #if NWSDISPLAY > 0  #if NWSDISPLAY > 0
   #ifdef RASTERCONSOLE
   #error RASTERCONSOLE and wsdisplay are mutually exclusive
   #endif
   
 static void cg6_setup_palette(struct cgsix_softc *);  static void cg6_setup_palette(struct cgsix_softc *);
   
 struct wsscreen_descr cgsix_defaultscreen = {  struct wsscreen_descr cgsix_defaultscreen = {
Line 157  struct wsscreen_descr cgsix_defaultscree
Line 163  struct wsscreen_descr cgsix_defaultscree
         0, 0,   /* will be filled in -- XXX shouldn't, it's global */          0, 0,   /* will be filled in -- XXX shouldn't, it's global */
         NULL,           /* textops */          NULL,           /* textops */
         8, 16,  /* font width/height */          8, 16,  /* font width/height */
         WSSCREEN_WSCOLORS       /* capabilities */          WSSCREEN_WSCOLORS,      /* capabilities */
           NULL    /* modecookie */
 };  };
   
 static int      cgsix_ioctl(void *, u_long, caddr_t, int, struct proc *);  static int      cgsix_ioctl(void *, void *, u_long, void *, int, struct lwp *);
 static paddr_t  cgsix_mmap(void *, off_t, int);  static paddr_t  cgsix_mmap(void *, void *, off_t, int);
 void            cgsix_init_screen(struct cgsix_softc *, struct cg6_screen *,  static void     cgsix_init_screen(void *, struct vcons_screen *, int, long *);
                         int, long *);  
   static void     cgsix_clearscreen(struct cgsix_softc *);
 static int      cgsix_alloc_screen(void *, const struct wsscreen_descr *,  
                                 void **, int *, int *, long *);  
 static void     cgsix_free_screen(void *, void *);  
 static int      cgsix_show_screen(void *, void *, int,  
                                 void (*) (void *, int, int), void *);  
 void    cgsix_switch_screen(struct cgsix_softc *);  
 void    cgsix_restore_screen(struct cg6_screen *, const struct wsscreen_descr *,                u_int16_t *);  
 void    cgsix_clearscreen(struct cgsix_softc *);  
 void    cgsix_setup_mono(struct cgsix_softc *, int, int, int, int, uint32_t,  void    cgsix_setup_mono(struct cgsix_softc *, int, int, int, int, uint32_t,
                 uint32_t);                  uint32_t);
 void    cgsix_feed_line(struct cgsix_softc *, int, uint8_t *);  void    cgsix_feed_line(struct cgsix_softc *, int, uint8_t *);
Line 183  int cgsix_getcmap(struct cgsix_softc *, 
Line 183  int cgsix_getcmap(struct cgsix_softc *, 
 void    cgsix_putchar(void *, int, int, u_int, long);  void    cgsix_putchar(void *, int, int, u_int, long);
 void    cgsix_cursor(void *, int, int, int);  void    cgsix_cursor(void *, int, int, int);
   
   
 struct wsdisplay_accessops cgsix_accessops = {  struct wsdisplay_accessops cgsix_accessops = {
         cgsix_ioctl,          cgsix_ioctl,
         cgsix_mmap,          cgsix_mmap,
         cgsix_alloc_screen,          NULL,   /* alloc_screen */
         cgsix_free_screen,          NULL,   /* free_screen */
         cgsix_show_screen,          NULL,   /* show_screen */
         NULL,   /* load_font */          NULL,   /* load_font */
         NULL,   /* pollc */          NULL,   /* pollc */
         NULL,   /* getwschar */  
         NULL,   /* putwschar */  
         NULL    /* scroll */          NULL    /* scroll */
 };  };
   
Line 215  extern const u_char rasops_cmap[768];
Line 212  extern const u_char rasops_cmap[768];
 void    cg6_invert(struct cgsix_softc *, int, int, int, int);  void    cg6_invert(struct cgsix_softc *, int, int, int, int);
   
 /* need this for both cases because ri_hw points to it */  /* need this for both cases because ri_hw points to it */
 static struct cg6_screen cg6_console_screen;  static struct vcons_screen cg6_console_screen;
 #endif  #endif
   
 #ifdef RASTERCONSOLE  #ifdef RASTERCONSOLE
Line 344  cg6_ras_init(struct cgsix_softc *sc)
Line 341  cg6_ras_init(struct cgsix_softc *sc)
 static void  static void
 cg6_ras_copyrows(void *cookie, int src, int dst, int n)  cg6_ras_copyrows(void *cookie, int src, int dst, int n)
 {  {
         struct rasops_info *ri=cookie;          struct rasops_info *ri = cookie;
         struct cg6_screen *scr=ri->ri_hw;          struct vcons_screen *scr = ri->ri_hw;
         struct cgsix_softc *sc=scr->sc;          struct cgsix_softc *sc = scr->scr_cookie;
           volatile struct cg6_fbc *fbc = sc->sc_fbc;
 #if NWSDISPLAY > 0  
         int from, to, len;  
   
         from = ri->ri_cols * src;  
         to = ri->ri_cols * dst;  
         len = ri->ri_cols * n;  
   
         memmove(&scr->attrs[to], &scr->attrs[from], len * sizeof(long));  
         memmove(&scr->chars[to], &scr->chars[from], len * sizeof(uint16_t));  
   
         if ((scr->active) && (sc->sc_mode == WSDISPLAYIO_MODE_EMUL)) {  
 #endif  
                 volatile struct cg6_fbc *fbc = sc->sc_fbc;  
   
                 if (dst == src)          if (dst == src)
                         return;                  return;
                 if (src < 0) {          if (src < 0) {
                         n += src;                  n += src;
                         src = 0;                  src = 0;
                 }          }
                 if (src+n > ri->ri_rows)          if (src+n > ri->ri_rows)
                         n = ri->ri_rows - src;                  n = ri->ri_rows - src;
                 if (dst < 0) {          if (dst < 0) {
                         n += dst;                  n += dst;
                         dst = 0;                  dst = 0;
                 }          }
                 if (dst+n > ri->ri_rows)          if (dst+n > ri->ri_rows)
                         n = ri->ri_rows - dst;                  n = ri->ri_rows - dst;
                 if (n <= 0)          if (n <= 0)
                         return;                  return;
                 n *= ri->ri_font->fontheight;          n *= ri->ri_font->fontheight;
                 src *= ri->ri_font->fontheight;          src *= ri->ri_font->fontheight;
                 dst *= ri->ri_font->fontheight;          dst *= ri->ri_font->fontheight;
                 fbc->fbc_clip = 0;          fbc->fbc_clip = 0;
                 fbc->fbc_s = 0;          fbc->fbc_s = 0;
                 fbc->fbc_offx = 0;          fbc->fbc_offx = 0;
                 fbc->fbc_offy = 0;          fbc->fbc_offy = 0;
                 fbc->fbc_clipminx = 0;          fbc->fbc_clipminx = 0;
                 fbc->fbc_clipminy = 0;          fbc->fbc_clipminy = 0;
                 fbc->fbc_clipmaxx = ri->ri_width - 1;          fbc->fbc_clipmaxx = ri->ri_width - 1;
                 fbc->fbc_clipmaxy = ri->ri_height - 1;          fbc->fbc_clipmaxy = ri->ri_height - 1;
                 fbc->fbc_alu = CG6_ALU_COPY;          fbc->fbc_alu = CG6_ALU_COPY;
                 fbc->fbc_x0 = ri->ri_xorigin;          fbc->fbc_x0 = ri->ri_xorigin;
                 fbc->fbc_y0 = ri->ri_yorigin + src;          fbc->fbc_y0 = ri->ri_yorigin + src;
                 fbc->fbc_x1 = ri->ri_xorigin + ri->ri_emuwidth - 1;          fbc->fbc_x1 = ri->ri_xorigin + ri->ri_emuwidth - 1;
                 fbc->fbc_y1 = ri->ri_yorigin + src + n - 1;          fbc->fbc_y1 = ri->ri_yorigin + src + n - 1;
                 fbc->fbc_x2 = ri->ri_xorigin;          fbc->fbc_x2 = ri->ri_xorigin;
                 fbc->fbc_y2 = ri->ri_yorigin + dst;          fbc->fbc_y2 = ri->ri_yorigin + dst;
                 fbc->fbc_x3 = ri->ri_xorigin + ri->ri_emuwidth - 1;          fbc->fbc_x3 = ri->ri_xorigin + ri->ri_emuwidth - 1;
                 fbc->fbc_y3 = ri->ri_yorigin + dst + n - 1;          fbc->fbc_y3 = ri->ri_yorigin + dst + n - 1;
                 CG6_BLIT_WAIT(fbc);          CG6_BLIT_WAIT(fbc);
                 CG6_DRAIN(fbc);          CG6_DRAIN(fbc);
 #if NWSDISPLAY > 0  
         }  
 #endif  
 }  }
   
 static void  static void
 cg6_ras_copycols(void *cookie, int row, int src, int dst, int n)  cg6_ras_copycols(void *cookie, int row, int src, int dst, int n)
 {  {
         struct rasops_info *ri=cookie;          struct rasops_info *ri = cookie;
         struct cg6_screen *scr=ri->ri_hw;          struct vcons_screen *scr = ri->ri_hw;
         struct cgsix_softc *sc=scr->sc;          struct cgsix_softc *sc = scr->scr_cookie;
           volatile struct cg6_fbc *fbc = sc->sc_fbc;
 #if NWSDISPLAY > 0  
         int from, to;  
   
         from = src + row * ri->ri_cols;  
         to = dst + row * ri->ri_cols;  
   
         memmove(&scr->attrs[to], &scr->attrs[from], n * sizeof(long));  
         memmove(&scr->chars[to], &scr->chars[from], n * sizeof(uint16_t));  
   
         if ((scr->active) && (sc->sc_mode == WSDISPLAYIO_MODE_EMUL)) {  
 #endif  
                 volatile struct cg6_fbc *fbc = sc->sc_fbc;  
   
                 if (dst == src)          if (dst == src)
                         return;                  return;
                 if ((row < 0) || (row >= ri->ri_rows))          if ((row < 0) || (row >= ri->ri_rows))
                         return;                  return;
                 if (src < 0) {          if (src < 0) {
                         n += src;                  n += src;
                         src = 0;                  src = 0;
                 }          }
                 if (src+n > ri->ri_cols)          if (src+n > ri->ri_cols)
                         n = ri->ri_cols - src;                  n = ri->ri_cols - src;
                 if (dst < 0) {          if (dst < 0) {
                         n += dst;                  n += dst;
                         dst = 0;                  dst = 0;
                 }          }
                 if (dst+n > ri->ri_cols)          if (dst+n > ri->ri_cols)
                         n = ri->ri_cols - dst;                  n = ri->ri_cols - dst;
                 if (n <= 0)          if (n <= 0)
                         return;                  return;
                 n *= ri->ri_font->fontwidth;          n *= ri->ri_font->fontwidth;
                 src *= ri->ri_font->fontwidth;          src *= ri->ri_font->fontwidth;
                 dst *= ri->ri_font->fontwidth;          dst *= ri->ri_font->fontwidth;
                 row *= ri->ri_font->fontheight;          row *= ri->ri_font->fontheight;
                 fbc->fbc_clip = 0;          fbc->fbc_clip = 0;
                 fbc->fbc_s = 0;          fbc->fbc_s = 0;
                 fbc->fbc_offx = 0;          fbc->fbc_offx = 0;
                 fbc->fbc_offy = 0;          fbc->fbc_offy = 0;
                 fbc->fbc_clipminx = 0;          fbc->fbc_clipminx = 0;
                 fbc->fbc_clipminy = 0;          fbc->fbc_clipminy = 0;
                 fbc->fbc_clipmaxx = ri->ri_width - 1;          fbc->fbc_clipmaxx = ri->ri_width - 1;
                 fbc->fbc_clipmaxy = ri->ri_height - 1;          fbc->fbc_clipmaxy = ri->ri_height - 1;
                 fbc->fbc_alu = CG6_ALU_COPY;          fbc->fbc_alu = CG6_ALU_COPY;
                 fbc->fbc_x0 = ri->ri_xorigin + src;          fbc->fbc_x0 = ri->ri_xorigin + src;
                 fbc->fbc_y0 = ri->ri_yorigin + row;          fbc->fbc_y0 = ri->ri_yorigin + row;
                 fbc->fbc_x1 = ri->ri_xorigin + src + n - 1;          fbc->fbc_x1 = ri->ri_xorigin + src + n - 1;
                 fbc->fbc_y1 = ri->ri_yorigin + row +          fbc->fbc_y1 = ri->ri_yorigin + row +
                     ri->ri_font->fontheight - 1;              ri->ri_font->fontheight - 1;
                 fbc->fbc_x2 = ri->ri_xorigin + dst;          fbc->fbc_x2 = ri->ri_xorigin + dst;
                 fbc->fbc_y2 = ri->ri_yorigin + row;          fbc->fbc_y2 = ri->ri_yorigin + row;
                 fbc->fbc_x3 = ri->ri_xorigin + dst + n - 1;          fbc->fbc_x3 = ri->ri_xorigin + dst + n - 1;
                 fbc->fbc_y3 = ri->ri_yorigin + row +          fbc->fbc_y3 = ri->ri_yorigin + row +
                     ri->ri_font->fontheight - 1;              ri->ri_font->fontheight - 1;
                 CG6_BLIT_WAIT(fbc);          CG6_BLIT_WAIT(fbc);
                 CG6_DRAIN(fbc);          CG6_DRAIN(fbc);
 #if NWSDISPLAY > 0  
         }  
 #endif  
 }  }
   
 static void  static void
 cg6_ras_erasecols(void *cookie, int row, int col, int n, long int attr)  cg6_ras_erasecols(void *cookie, int row, int col, int n, long int attr)
 {  {
         struct rasops_info *ri=cookie;          struct rasops_info *ri = cookie;
         struct cg6_screen *scr=ri->ri_hw;          struct vcons_screen *scr = ri->ri_hw;
         struct cgsix_softc *sc=scr->sc;          struct cgsix_softc *sc = scr->scr_cookie;
           volatile struct cg6_fbc *fbc = sc->sc_fbc;
 #if NWSDISPLAY > 0  
         int start, end, i;  
   
         start = col + row * ri->ri_cols;  
         end = start + n;  
   
         for (i = start; i < end; i++) {  
                 scr->attrs[i] = attr;  
                 scr->chars[i] = 0x20;  
         }  
         if ((scr->active) && (sc->sc_mode == WSDISPLAYIO_MODE_EMUL)) {  
 #endif  
                 volatile struct cg6_fbc *fbc = sc->sc_fbc;  
   
                 if ((row < 0) || (row >= ri->ri_rows))          if ((row < 0) || (row >= ri->ri_rows))
                         return;                  return;
                 if (col < 0) {          if (col < 0) {
                         n += col;                  n += col;
                         col = 0;                  col = 0;
                 }          }
                 if (col+n > ri->ri_cols)          if (col+n > ri->ri_cols)
                         n = ri->ri_cols - col;                  n = ri->ri_cols - col;
                 if (n <= 0)          if (n <= 0)
                         return;                  return;
                 n *= ri->ri_font->fontwidth;          n *= ri->ri_font->fontwidth;
                 col *= ri->ri_font->fontwidth;          col *= ri->ri_font->fontwidth;
                 row *= ri->ri_font->fontheight;          row *= ri->ri_font->fontheight;
                 fbc->fbc_clip = 0;          fbc->fbc_clip = 0;
                 fbc->fbc_s = 0;          fbc->fbc_s = 0;
                 fbc->fbc_offx = 0;          fbc->fbc_offx = 0;
                 fbc->fbc_offy = 0;          fbc->fbc_offy = 0;
                 fbc->fbc_clipminx = 0;          fbc->fbc_clipminx = 0;
                 fbc->fbc_clipminy = 0;          fbc->fbc_clipminy = 0;
                 fbc->fbc_clipmaxx = ri->ri_width - 1;          fbc->fbc_clipmaxx = ri->ri_width - 1;
                 fbc->fbc_clipmaxy = ri->ri_height - 1;          fbc->fbc_clipmaxy = ri->ri_height - 1;
                 fbc->fbc_alu = CG6_ALU_FILL;          fbc->fbc_alu = CG6_ALU_FILL;
                 fbc->fbc_fg = ri->ri_devcmap[(attr >> 16) & 0xff];          fbc->fbc_fg = ri->ri_devcmap[(attr >> 16) & 0xff];
                 fbc->fbc_arecty = ri->ri_yorigin + row;          fbc->fbc_arecty = ri->ri_yorigin + row;
                 fbc->fbc_arectx = ri->ri_xorigin + col;          fbc->fbc_arectx = ri->ri_xorigin + col;
                 fbc->fbc_arecty = ri->ri_yorigin + row +          fbc->fbc_arecty = ri->ri_yorigin + row +
                     ri->ri_font->fontheight - 1;              ri->ri_font->fontheight - 1;
                 fbc->fbc_arectx = ri->ri_xorigin + col + n - 1;          fbc->fbc_arectx = ri->ri_xorigin + col + n - 1;
                 CG6_DRAW_WAIT(fbc);          CG6_DRAW_WAIT(fbc);
                 CG6_DRAIN(fbc);          CG6_DRAIN(fbc);
 #if NWSDISPLAY > 0  
         }  
 #endif  
 }  }
   
 static void  static void
 cg6_ras_eraserows(void *cookie, int row, int n, long int attr)  cg6_ras_eraserows(void *cookie, int row, int n, long int attr)
 {  {
         struct rasops_info *ri=cookie;          struct rasops_info *ri = cookie;
         struct cg6_screen *scr=ri->ri_hw;          struct vcons_screen *scr = ri->ri_hw;
         struct cgsix_softc *sc=scr->sc;          struct cgsix_softc *sc = scr->scr_cookie;
           volatile struct cg6_fbc *fbc = sc->sc_fbc;
 #if NWSDISPLAY > 0  
         int start, end, i;  
   
         start = ri->ri_cols*row;  
         end = ri->ri_cols * (row + n);  
   
         for (i = start; i < end; i++) {  
                 scr->attrs[i] = attr;  
                 scr->chars[i] = 0x20;  
         }  
   
         if ((scr->active) && (sc->sc_mode == WSDISPLAYIO_MODE_EMUL)) {  
 #endif  
                 volatile struct cg6_fbc *fbc = sc->sc_fbc;  
   
                 if (row < 0) {          if (row < 0) {
                         n += row;                  n += row;
                         row = 0;                  row = 0;
                 }          }
                 if (row+n > ri->ri_rows)          if (row+n > ri->ri_rows)
                         n = ri->ri_rows - row;                  n = ri->ri_rows - row;
                 if (n <= 0)          if (n <= 0)
                         return;                  return;
                 fbc->fbc_clip = 0;          fbc->fbc_clip = 0;
                 fbc->fbc_s = 0;          fbc->fbc_s = 0;
                 fbc->fbc_offx = 0;          fbc->fbc_offx = 0;
                 fbc->fbc_offy = 0;          fbc->fbc_offy = 0;
                 fbc->fbc_clipminx = 0;          fbc->fbc_clipminx = 0;
                 fbc->fbc_clipminy = 0;          fbc->fbc_clipminy = 0;
                 fbc->fbc_clipmaxx = ri->ri_width - 1;          fbc->fbc_clipmaxx = ri->ri_width - 1;
                 fbc->fbc_clipmaxy = ri->ri_height - 1;          fbc->fbc_clipmaxy = ri->ri_height - 1;
                 fbc->fbc_alu = CG6_ALU_FILL;          fbc->fbc_alu = CG6_ALU_FILL;
                 fbc->fbc_fg = ri->ri_devcmap[(attr >> 16) & 0xff];          fbc->fbc_fg = ri->ri_devcmap[(attr >> 16) & 0xff];
                 if ((n == ri->ri_rows) && (ri->ri_flg & RI_FULLCLEAR)) {          if ((n == ri->ri_rows) && (ri->ri_flg & RI_FULLCLEAR)) {
                         fbc->fbc_arecty = 0;                  fbc->fbc_arecty = 0;
                         fbc->fbc_arectx = 0;                  fbc->fbc_arectx = 0;
                         fbc->fbc_arecty = ri->ri_height - 1;                  fbc->fbc_arecty = ri->ri_height - 1;
                         fbc->fbc_arectx = ri->ri_width - 1;                  fbc->fbc_arectx = ri->ri_width - 1;
                 } else {          } else {
                         row *= ri->ri_font->fontheight;                  row *= ri->ri_font->fontheight;
                         fbc->fbc_arecty = ri->ri_yorigin + row;                  fbc->fbc_arecty = ri->ri_yorigin + row;
                         fbc->fbc_arectx = ri->ri_xorigin;                  fbc->fbc_arectx = ri->ri_xorigin;
                         fbc->fbc_arecty = ri->ri_yorigin + row +                  fbc->fbc_arecty = ri->ri_yorigin + row +
                             (n * ri->ri_font->fontheight) - 1;                      (n * ri->ri_font->fontheight) - 1;
                         fbc->fbc_arectx = ri->ri_xorigin + ri->ri_emuwidth - 1;                  fbc->fbc_arectx = ri->ri_xorigin + ri->ri_emuwidth - 1;
                 }  
                 CG6_DRAW_WAIT(fbc);  
                 CG6_DRAIN(fbc);  
 #if NWSDISPLAY > 0  
         }          }
 #endif          CG6_DRAW_WAIT(fbc);
           CG6_DRAIN(fbc);
 }  }
   
 #if defined(RASTERCONSOLE) && defined(CG6_BLIT_CURSOR)  #if defined(RASTERCONSOLE) && defined(CG6_BLIT_CURSOR)
Line 599  cg6_ras_eraserows(void *cookie, int row,
Line 532  cg6_ras_eraserows(void *cookie, int row,
 static void  static void
 cg6_ras_do_cursor(struct rasops_info *ri)  cg6_ras_do_cursor(struct rasops_info *ri)
 {  {
         struct cg6_screen *scr = ri->ri_hw;          struct vcons_screen *scr = ri->ri_hw;
         struct cgsix_softc *sc = scr->sc;          struct cgsix_softc *sc = scr->cookie;
         int row, col;          int row, col;
   
         row = ri->ri_crow * ri->ri_font->fontheight;          row = ri->ri_crow * ri->ri_font->fontheight;
Line 618  cg6attach(struct cgsix_softc *sc, const 
Line 551  cg6attach(struct cgsix_softc *sc, const 
         struct fbdevice *fb = &sc->sc_fb;          struct fbdevice *fb = &sc->sc_fb;
 #if NWSDISPLAY > 0  #if NWSDISPLAY > 0
         struct wsemuldisplaydev_attach_args aa;          struct wsemuldisplaydev_attach_args aa;
         struct rasops_info *ri = &cg6_console_screen.ri;          struct rasops_info *ri = &cg6_console_screen.scr_ri;
         unsigned long defattr;          unsigned long defattr;
 #endif  #endif
           volatile struct cg6_fbc *fbc = sc->sc_fbc;
   
         fb->fb_driver = &cg6_fbdriver;          fb->fb_driver = &cg6_fbdriver;
   
         /* Don't have to map the pfour register on the cgsix. */          /* Don't have to map the pfour register on the cgsix. */
Line 656  cg6attach(struct cgsix_softc *sc, const 
Line 590  cg6attach(struct cgsix_softc *sc, const 
                          * we don't use the screen struct but keep it here to                           * we don't use the screen struct but keep it here to
                          * avoid ugliness in the cg6_ras_* functions                           * avoid ugliness in the cg6_ras_* functions
                          */                           */
                         cg6_console_screen.sc = sc;                          cg6_console_screen.scr_cookie = sc;
                         sc->sc_fb.fb_rinfo.ri_hw = &cg6_console_screen;                          sc->sc_fb.fb_rinfo.ri_hw = &cg6_console_screen;
                         sc->sc_fb.fb_rinfo.ri_ops.copyrows = cg6_ras_copyrows;                          sc->sc_fb.fb_rinfo.ri_ops.copyrows = cg6_ras_copyrows;
                         sc->sc_fb.fb_rinfo.ri_ops.copycols = cg6_ras_copycols;                          sc->sc_fb.fb_rinfo.ri_ops.copycols = cg6_ras_copycols;
Line 678  cg6attach(struct cgsix_softc *sc, const 
Line 612  cg6attach(struct cgsix_softc *sc, const 
   
         printf("%s: framebuffer size: %d MB\n", sc->sc_dev.dv_xname,          printf("%s: framebuffer size: %d MB\n", sc->sc_dev.dv_xname,
             sc->sc_ramsize >> 20);              sc->sc_ramsize >> 20);
           printf("%s: FBC: %08x\n", sc->sc_dev.dv_xname, fbc->fbc_mode);
   
 #if NWSDISPLAY  #if NWSDISPLAY
         /* setup rasops and so on for wsdisplay */          /* setup rasops and so on for wsdisplay */
Line 686  cg6attach(struct cgsix_softc *sc, const 
Line 621  cg6attach(struct cgsix_softc *sc, const 
         sc->sc_mode = WSDISPLAYIO_MODE_EMUL;          sc->sc_mode = WSDISPLAYIO_MODE_EMUL;
         sc->sc_bg = WS_DEFAULT_BG;          sc->sc_bg = WS_DEFAULT_BG;
   
         LIST_INIT(&sc->screens);          vcons_init(&sc->vd, sc, &cgsix_defaultscreen, &cgsix_accessops);
         sc->active = NULL;          sc->vd.init_screen = cgsix_init_screen;
         sc->currenttype = &cgsix_defaultscreen;  
         callout_init(&sc->switch_callout);  
   
         if(isconsole) {          if(isconsole) {
                 /* we mess with cg6_console_screen only once */                  /* we mess with cg6_console_screen only once */
                 cgsix_init_screen(sc, &cg6_console_screen, 1, &defattr);                  vcons_init_screen(&sc->vd, &cg6_console_screen, 1,
                       &defattr);
                   cg6_console_screen.scr_flags |= VCONS_SCREEN_IS_STATIC;
   
                 cgsix_defaultscreen.textops = &ri->ri_ops;                  cgsix_defaultscreen.textops = &ri->ri_ops;
                 cgsix_defaultscreen.capabilities = ri->ri_caps;                  cgsix_defaultscreen.capabilities = ri->ri_caps;
                 cgsix_defaultscreen.nrows = ri->ri_rows;                  cgsix_defaultscreen.nrows = ri->ri_rows;
                 cgsix_defaultscreen.ncols = ri->ri_cols;                  cgsix_defaultscreen.ncols = ri->ri_cols;
                 cg6_console_screen.active = 1;                  SCREEN_VISIBLE(&cg6_console_screen);
                 sc->active = &cg6_console_screen;                  sc->vd.active = &cg6_console_screen;
                 wsdisplay_cnattach(&cgsix_defaultscreen, ri, 0, 0, defattr);                  wsdisplay_cnattach(&cgsix_defaultscreen, ri, 0, 0, defattr);
         } else {          } else {
                 /*                  /*
Line 720  cg6attach(struct cgsix_softc *sc, const 
Line 656  cg6attach(struct cgsix_softc *sc, const 
                         cgsix_defaultscreen.nrows = ri->ri_rows;                          cgsix_defaultscreen.nrows = ri->ri_rows;
                         cgsix_defaultscreen.ncols = ri->ri_cols;                          cgsix_defaultscreen.ncols = ri->ri_cols;
                 }                  }
                 sc->active = NULL;  
                 cgsix_clearscreen(sc);  
         }          }
   
         cg6_setup_palette(sc);          cg6_setup_palette(sc);
           cgsix_clearscreen(sc);
   
         aa.scrdata = &cgsix_screenlist;          aa.scrdata = &cgsix_screenlist;
         aa.console = isconsole;          aa.console = isconsole;
         aa.accessops = &cgsix_accessops;          aa.accessops = &cgsix_accessops;
         aa.accesscookie = sc;          aa.accesscookie = &sc->vd;
         config_found(&sc->sc_dev, &aa, wsemuldisplaydevprint);          config_found(&sc->sc_dev, &aa, wsemuldisplaydevprint);
 #else  #else
         bt_initcmap(&sc->sc_cmap, 256);          bt_initcmap(&sc->sc_cmap, 256);
         cg6_loadcmap(sc, 0, 256);          cg6_loadcmap(sc, 0, 256);
   
 #endif  #endif
   
 }  }
   
   
 int  int
 cgsixopen(dev_t dev, int flags, int mode, struct proc *p)  cgsixopen(dev_t dev, int flags, int mode, struct lwp *l)
 {  {
         int unit = minor(dev);          int unit = minor(dev);
   
Line 751  cgsixopen(dev_t dev, int flags, int mode
Line 685  cgsixopen(dev_t dev, int flags, int mode
 }  }
   
 int  int
 cgsixclose(dev_t dev, int flags, int mode, struct proc *p)  cgsixclose(dev_t dev, int flags, int mode, struct lwp *l)
 {  {
         struct cgsix_softc *sc = cgsix_cd.cd_devs[minor(dev)];          struct cgsix_softc *sc = cgsix_cd.cd_devs[minor(dev)];
   
Line 770  cgsixclose(dev_t dev, int flags, int mod
Line 704  cgsixclose(dev_t dev, int flags, int mod
 }  }
   
 int  int
 cgsixioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct proc *p)  cgsixioctl(dev_t dev, u_long cmd, void *data, int flags, struct lwp *l)
 {  {
         struct cgsix_softc *sc = cgsix_cd.cd_devs[minor(dev)];          struct cgsix_softc *sc = cgsix_cd.cd_devs[minor(dev)];
         union cursor_cmap tcm;          union cursor_cmap tcm;
Line 821  cgsixioctl(dev_t dev, u_long cmd, caddr_
Line 755  cgsixioctl(dev_t dev, u_long cmd, caddr_
                 break;                  break;
   
         case FBIOSVIDEO:          case FBIOSVIDEO:
                 if (*(int *)data)                  cg6_blank(sc, !(*(int *)data));
                         cg6_unblank(&sc->sc_dev);  
                 else if (!sc->sc_blanked) {  
                         sc->sc_blanked = 1;  
                         sc->sc_thc->thc_misc &= ~THC_MISC_VIDEN;  
                 }  
                 break;                  break;
   
 /* these are for both FBIOSCURSOR and FBIOGCURSOR */  /* these are for both FBIOSCURSOR and FBIOGCURSOR */
Line 939  cgsixioctl(dev_t dev, u_long cmd, caddr_
Line 868  cgsixioctl(dev_t dev, u_long cmd, caddr_
         default:          default:
 #ifdef DEBUG  #ifdef DEBUG
                 log(LOG_NOTICE, "cgsixioctl(0x%lx) (%s[%d])\n", cmd,                  log(LOG_NOTICE, "cgsixioctl(0x%lx) (%s[%d])\n", cmd,
                     p->p_comm, p->p_pid);                      l->l_proc->p_comm, l->l_proc->p_pid);
 #endif  #endif
                 return ENOTTY;                  return ENOTTY;
         }          }
Line 1070  cg6_loadomap(struct cgsix_softc *sc)
Line 999  cg6_loadomap(struct cgsix_softc *sc)
         bt->bt_omap = i << 8;           /* B */          bt->bt_omap = i << 8;           /* B */
 }  }
   
   /* blank or unblank the screen */
   static void
   cg6_blank(struct cgsix_softc *sc, int flag)
   {
   
           if (sc->sc_blanked != flag) {
                   sc->sc_blanked = flag;
                   if (flag) {
                           sc->sc_thc->thc_misc &= ~THC_MISC_VIDEN;
                   } else {
                           sc->sc_thc->thc_misc |= THC_MISC_VIDEN;
                   }
           }
   }
   
   /*
    * this is called on panic or ddb entry - force the console to the front, reset
    * the colour map and enable drawing so we actually see the message even when X
    * is running
    */
 static void  static void
 cg6_unblank(struct device *dev)  cg6_unblank(struct device *dev)
 {  {
         struct cgsix_softc *sc = (struct cgsix_softc *)dev;          struct cgsix_softc *sc = (struct cgsix_softc *)dev;
   
         if (sc->sc_blanked) {          cg6_blank(sc, 0);
                 sc->sc_blanked = 0;  
                 sc->sc_thc->thc_misc |= THC_MISC_VIDEN;  
         }  
 }  }
   
 /* XXX the following should be moved to a "user interface" header */  /* XXX the following should be moved to a "user interface" header */
Line 1182  cg6_setup_palette(struct cgsix_softc *sc
Line 1128  cg6_setup_palette(struct cgsix_softc *sc
 }  }
   
 int  int
 cgsix_ioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p)  cgsix_ioctl(void *v, void *vs, u_long cmd, void *data, int flag,
           struct lwp *l)
 {  {
         /* we'll probably need to add more stuff here */          /* we'll probably need to add more stuff here */
         struct cgsix_softc *sc = v;          struct vcons_data *vd = v;
           struct cgsix_softc *sc = vd->cookie;
         struct wsdisplay_fbinfo *wdf;          struct wsdisplay_fbinfo *wdf;
         struct rasops_info *ri = &sc->sc_fb.fb_rinfo;          struct rasops_info *ri = &sc->sc_fb.fb_rinfo;
         struct cg6_screen *ms = sc->active;          struct vcons_screen *ms = sc->vd.active;
 #ifdef CGSIX_DEBUG  #ifdef CGSIX_DEBUG
         printf("cgsix_ioctl(%ld)\n",cmd);          printf("cgsix_ioctl(%ld)\n",cmd);
 #endif  #endif
Line 1221  cgsix_ioctl(void *v, u_long cmd, caddr_t
Line 1169  cgsix_ioctl(void *v, u_long cmd, caddr_t
                                         {                                          {
                                                 cg6_reset(sc);                                                  cg6_reset(sc);
                                                 cg6_ras_init(sc);                                                  cg6_ras_init(sc);
                                                 /* restore the screen content */                                                  cg6_setup_palette(sc);
                                                 cgsix_restore_screen(ms,                                                  vcons_redraw_screen(ms);
                                                     ms->type, ms->chars);  
                                                 /*  
                                                  * because X likes to bork up  
                                                  * our colour map  
                                                  */  
                                                 cg6_setup_palette(sc);                                                                  /* and draw the cursor */  
                                                 cgsix_cursor(ms, ms->cursoron,  
                                                     ms->cursorrow,  
                                                     ms->cursorcol);  
                                         }                                          }
                                 }                                  }
                         }                          }
Line 1240  cgsix_ioctl(void *v, u_long cmd, caddr_t
Line 1179  cgsix_ioctl(void *v, u_long cmd, caddr_t
 }  }
   
 paddr_t  paddr_t
 cgsix_mmap(void *v, off_t offset, int prot)  cgsix_mmap(void *v, void *vs, off_t offset, int prot)
 {  {
         struct cgsix_softc *sc = v;          struct vcons_data *vd = v;
           struct cgsix_softc *sc = vd->cookie;
   
         if(offset<sc->sc_ramsize) {          if(offset<sc->sc_ramsize) {
                 return bus_space_mmap(sc->sc_bustag, sc->sc_paddr,                  return bus_space_mmap(sc->sc_bustag, sc->sc_paddr,
                     CGSIX_RAM_OFFSET+offset, prot, BUS_SPACE_MAP_LINEAR);                      CGSIX_RAM_OFFSET+offset, prot, BUS_SPACE_MAP_LINEAR);
Line 1311  cgsix_getcmap(struct cgsix_softc *sc, st
Line 1252  cgsix_getcmap(struct cgsix_softc *sc, st
 }  }
   
 void  void
 cgsix_init_screen(struct cgsix_softc *sc, struct cg6_screen *scr,  cgsix_init_screen(void *cookie, struct vcons_screen *scr,
     int existing, long *defattr)      int existing, long *defattr)
 {  {
         struct rasops_info *ri = &scr->ri;          struct cgsix_softc *sc = cookie;
         int cnt;          struct rasops_info *ri = &scr->scr_ri;
         scr->sc = sc;  
         /*scr->type = type;*/  
         scr->cursorcol = 0;  
         scr->cursorrow = 0;  
         scr->cursordrawn = 0;  
   
         ri->ri_depth = 8;          ri->ri_depth = 8;
         ri->ri_width = sc->sc_width;          ri->ri_width = sc->sc_width;
         ri->ri_height = sc->sc_height;          ri->ri_height = sc->sc_height;
Line 1331  cgsix_init_screen(struct cgsix_softc *sc
Line 1267  cgsix_init_screen(struct cgsix_softc *sc
         ri->ri_bits = sc->sc_fb.fb_pixels;          ri->ri_bits = sc->sc_fb.fb_pixels;
   
         rasops_init(ri, sc->sc_height/8, sc->sc_width/8);          rasops_init(ri, sc->sc_height/8, sc->sc_width/8);
         ri->ri_caps=WSSCREEN_WSCOLORS;          ri->ri_caps = WSSCREEN_WSCOLORS | WSSCREEN_REVERSE;
         rasops_reconfig(ri, sc->sc_height / ri->ri_font->fontheight,          rasops_reconfig(ri, sc->sc_height / ri->ri_font->fontheight,
                     sc->sc_width / ri->ri_font->fontwidth);                      sc->sc_width / ri->ri_font->fontwidth);
         ri->ri_ops.allocattr(ri, 0, 0, 0, defattr);  
   
         cnt = ri->ri_rows * ri->ri_cols;  
         /*  
          * we allocate both chars and attributes in one chunk, attributes first  
          * because they have the (potentially) bigger alignment  
          */  
         scr->attrs = (long *)malloc(cnt * (sizeof(long) + sizeof(uint16_t)),  
             M_DEVBUF, M_WAITOK);  
         scr->chars = (uint16_t *)&scr->attrs[cnt];  
   
         /* enable acceleration */          /* enable acceleration */
         ri->ri_hw = scr;          ri->ri_hw = scr;
Line 1353  cgsix_init_screen(struct cgsix_softc *sc
Line 1279  cgsix_init_screen(struct cgsix_softc *sc
         ri->ri_ops.erasecols = cg6_ras_erasecols;          ri->ri_ops.erasecols = cg6_ras_erasecols;
         ri->ri_ops.cursor = cgsix_cursor;          ri->ri_ops.cursor = cgsix_cursor;
         ri->ri_ops.putchar = cgsix_putchar;          ri->ri_ops.putchar = cgsix_putchar;
         if (existing) {  
                 scr->active = 1;  
         } else {  
                 scr->active = 0;  
         }  
   
         cg6_ras_eraserows(&scr->ri, 0, ri->ri_rows, *defattr);  
   
         LIST_INSERT_HEAD(&sc->screens, scr, next);  
 }  
   
 int  
 cgsix_alloc_screen(void *v, const struct wsscreen_descr *type, void **cookiep,  
     int *curxp, int *curyp, long *defattrp)  
 {  
         struct cgsix_softc *sc = v;  
         struct cg6_screen *scr;  
   
         scr = malloc(sizeof(struct cg6_screen), M_DEVBUF, M_WAITOK|M_ZERO);  
         cgsix_init_screen(sc, scr, 0, defattrp);  
   
         if (sc->active == NULL) {  
                 scr->active = 1;  
                 sc->active = scr;  
                 sc->currenttype = type;  
         }  
   
         *cookiep = scr;  
         *curxp = scr->cursorcol;  
         *curyp = scr->cursorrow;  
         return 0;  
 }  
   
 void  
 cgsix_free_screen(void *v, void *cookie)  
 {  
         struct cgsix_softc *sc = v;  
         struct cg6_screen *scr = cookie;  
   
         LIST_REMOVE(scr, next);  
         if (scr != &cg6_console_screen) {  
                 free(scr->attrs, M_DEVBUF);  
                 free(scr, M_DEVBUF);  
         } else  
                 panic("cgsix_free_screen: console");  
   
         if (sc->active == scr)  
                 sc->active = 0;  
 }  
   
 int  
 cgsix_show_screen(void *v, void *cookie, int waitok,  
     void (*cb)(void *, int, int), void *cbarg)  
 {  
         struct cgsix_softc *sc = v;  
         struct cg6_screen *scr, *oldscr;  
   
         scr = cookie;  
         oldscr = sc->active;  
         if (scr == oldscr)  
                 return 0;  
   
         sc->wanted = scr;  
         sc->switchcb = cb;  
         sc->switchcbarg = cbarg;  
         if (cb) {  
                 callout_reset(&sc->switch_callout, 0,  
                     (void(*)(void *))cgsix_switch_screen, sc);  
                 return EAGAIN;  
         }  
   
         cgsix_switch_screen(sc);  
         return 0;  
 }  
   
 void  
 cgsix_switch_screen(struct cgsix_softc *sc)  
 {  
         struct cg6_screen *scr, *oldscr;  
   
         scr = sc->wanted;  
         if (!scr) {  
                 printf("cgsix_switch_screen: disappeared\n");  
                 (*sc->switchcb)(sc->switchcbarg, EIO, 0);  
                 return;  
         }  
         oldscr = sc->active; /* can be NULL! */  
 #ifdef DIAGNOSTIC  
         if (oldscr) {  
                 if (!oldscr->active)  
                         panic("cgsix_switch_screen: not active");  
         }  
 #endif  
         if (scr == oldscr)  
                 return;  
   
 #ifdef DIAGNOSTIC  
         if (scr->active)  
                 panic("cgsix_switch_screen: active");  
 #endif  
   
         if (oldscr)  
                 oldscr->active = 0;  
 #ifdef notyet  
         if (sc->currenttype != type) {  
                 cgsix_set_screentype(sc, type);  
                 sc->currenttype = type;  
         }  
 #endif  
   
         /* Clear the entire screen. */  
   
         scr->active = 1;  
         cgsix_restore_screen(scr, &cgsix_defaultscreen, scr->chars);  
   
         sc->active = scr;  
   
         scr->ri.ri_ops.cursor(scr, scr->cursoron, scr->cursorrow,  
             scr->cursorcol);  
   
         sc->wanted = 0;  
         if (sc->switchcb)  
                 (*sc->switchcb)(sc->switchcbarg, 0, 0);  
 }  
   
 void  
 cgsix_restore_screen(struct cg6_screen *scr,  
     const struct wsscreen_descr *type, u_int16_t *mem)  
 {  
         int i, j, offset = 0;  
         uint16_t *charptr = scr->chars;  
         long *attrptr = scr->attrs;  
   
         cgsix_clearscreen(scr->sc);  
         for (i = 0; i < scr->ri.ri_rows; i++) {  
                 for (j = 0; j < scr->ri.ri_cols; j++) {  
                         cgsix_putchar(scr, i, j, charptr[offset],  
                             attrptr[offset]);  
                         offset++;  
                 }  
         }  
         scr->cursordrawn = 0;  
 }  }
   
 void  void
Line 1564  cgsix_feed_line(struct cgsix_softc *sc, 
Line 1348  cgsix_feed_line(struct cgsix_softc *sc, 
 void  void
 cgsix_putchar(void *cookie, int row, int col, u_int c, long attr)  cgsix_putchar(void *cookie, int row, int col, u_int c, long attr)
 {  {
         struct rasops_info *ri=cookie;          struct rasops_info *ri = cookie;
         struct cg6_screen *scr=ri->ri_hw;          struct vcons_screen *scr = ri->ri_hw;
         struct cgsix_softc *sc=scr->sc;          struct cgsix_softc *sc = scr->scr_cookie;
         int pos;          int inv;
   
         if ((row >= 0) && (row < ri->ri_rows) && (col >= 0) &&          if ((row >= 0) && (row < ri->ri_rows) && (col >= 0) &&
             (col < ri->ri_cols)) {              (col < ri->ri_cols)) {
                 pos = col + row * ri->ri_cols;  
                 scr->attrs[pos] = attr;  
                 scr->chars[pos] = c;  
   
                 if ((scr->active) && (sc->sc_mode == WSDISPLAYIO_MODE_EMUL)) {                  if (sc->sc_mode == WSDISPLAYIO_MODE_EMUL) {
                         /*cgsix_sync(sc);*/  
                         int fg, bg, uc, i;                          int fg, bg, uc, i;
                         uint8_t *data;                          uint8_t *data;
                         int x, y, wi, he;                          int x, y, wi, he;
Line 1587  cgsix_putchar(void *cookie, int row, int
Line 1368  cgsix_putchar(void *cookie, int row, int
   
                         if (!CHAR_IN_FONT(c, ri->ri_font))                          if (!CHAR_IN_FONT(c, ri->ri_font))
                                 return;                                  return;
                         bg = (u_char)ri->ri_devcmap[(attr >> 16) & 0xff];                          inv = ((attr >> 8) & WSATTR_REVERSE);
                         fg = (u_char)ri->ri_devcmap[(attr >> 24) & 0xff];                          if (inv) {
                                   fg = (u_char)ri->ri_devcmap[(attr >> 16) &
                                       0xff];
                                   bg = (u_char)ri->ri_devcmap[(attr >> 24) &
                                       0xff];
                           } else {
                                   bg = (u_char)ri->ri_devcmap[(attr >> 16) &
                                       0xff];
                                   fg = (u_char)ri->ri_devcmap[(attr >> 24) &
                                       0xff];
                           }
   
                         x = ri->ri_xorigin + col * wi;                          x = ri->ri_xorigin + col * wi;
                         y = ri->ri_yorigin + row * he;                          y = ri->ri_yorigin + row * he;
   
                         if (c == 0x20) {                          if (c == 0x20) {
                                 cgsix_rectfill(sc, x, y, wi, he, bg);                                  cgsix_rectfill(sc, x, y, wi, he, bg);
                         } else {                          } else {
Line 1608  cgsix_putchar(void *cookie, int row, int
Line 1401  cgsix_putchar(void *cookie, int row, int
                                 fbc->fbc_incy = 0;                                  fbc->fbc_incy = 0;
                                 /* nosrc, color8 */                                  /* nosrc, color8 */
                                 fbc->fbc_mode = 0x00120000;                                  fbc->fbc_mode = 0x00120000;
                                 fbc->fbc_mode &= ~CG6_MODE_MASK;                                  /*fbc->fbc_mode &= ~CG6_MODE_MASK;
                                 fbc->fbc_mode |= CG6_MODE;                                  fbc->fbc_mode |= CG6_MODE;*/
                         }                          }
                 }                  }
         }          }
Line 1618  cgsix_putchar(void *cookie, int row, int
Line 1411  cgsix_putchar(void *cookie, int row, int
 void  void
 cgsix_cursor(void *cookie, int on, int row, int col)  cgsix_cursor(void *cookie, int on, int row, int col)
 {  {
         struct rasops_info *ri=cookie;          struct rasops_info *ri = cookie;
         struct cg6_screen *scr=ri->ri_hw;          struct vcons_screen *scr = ri->ri_hw;
         struct cgsix_softc *sc=scr->sc;          struct cgsix_softc *sc = scr->scr_cookie;
         int x, y, wi, he;          int x, y, wi, he;
   
         wi = ri->ri_font->fontwidth;          wi = ri->ri_font->fontwidth;
         he = ri->ri_font->fontheight;          he = ri->ri_font->fontheight;
   
         if((scr->active) && (sc->sc_mode == WSDISPLAYIO_MODE_EMUL)) {          if (sc->sc_mode == WSDISPLAYIO_MODE_EMUL) {
                 x = scr->cursorcol * wi + ri->ri_xorigin;                  x = ri->ri_ccol * wi + ri->ri_xorigin;
                 y = scr->cursorrow * he + ri->ri_yorigin;                  y = ri->ri_crow * he + ri->ri_yorigin;
                 if(scr->cursordrawn) {                  if (ri->ri_flg & RI_CURSOR) {
                         cg6_invert(sc, x, y, wi, he);                          cg6_invert(sc, x, y, wi, he);
                         scr->cursordrawn = 0;                          ri->ri_flg &= ~RI_CURSOR;
                 }                  }
                 scr->cursorrow = row;                  ri->ri_crow = row;
                 scr->cursorcol = col;                  ri->ri_ccol = col;
                 if((scr->cursoron = on) != 0)                  if (on)
                 {                  {
                         x = scr->cursorcol * wi + ri->ri_xorigin;                          x = ri->ri_ccol * wi + ri->ri_xorigin;
                         y = scr->cursorrow * he + ri->ri_yorigin;                          y = ri->ri_crow * he + ri->ri_yorigin;
                         cg6_invert(sc, x, y, wi, he);                          cg6_invert(sc, x, y, wi, he);
                         scr->cursordrawn = 1;                          ri->ri_flg |= RI_CURSOR;
                 }                  }
         } else {          } else
                 scr->cursoron = on;          {
                 scr->cursorrow = row;                  ri->ri_crow = row;
                 scr->cursorcol = col;                  ri->ri_ccol = col;
                 scr->cursordrawn = 0;                  ri->ri_flg &= ~RI_CURSOR;
         }          }
 }  }
   
 void  void
 cgsix_clearscreen(struct cgsix_softc *sc)  cgsix_clearscreen(struct cgsix_softc *sc)
 {  {
         struct rasops_info *ri=&cg6_console_screen.ri;          struct rasops_info *ri = &cg6_console_screen.scr_ri;
   
         if (sc->sc_mode == WSDISPLAYIO_MODE_EMUL) {          if (sc->sc_mode == WSDISPLAYIO_MODE_EMUL) {
                 volatile struct cg6_fbc *fbc = sc->sc_fbc;                  volatile struct cg6_fbc *fbc = sc->sc_fbc;
Line 1684  void
Line 1477  void
 cg6_invert(struct cgsix_softc *sc, int x, int y, int wi, int he)  cg6_invert(struct cgsix_softc *sc, int x, int y, int wi, int he)
 {  {
         volatile struct cg6_fbc *fbc = sc->sc_fbc;          volatile struct cg6_fbc *fbc = sc->sc_fbc;
         struct rasops_info *ri = &cg6_console_screen.ri;          struct rasops_info *ri = &cg6_console_screen.scr_ri;
   
         CG6_DRAIN(fbc);          CG6_DRAIN(fbc);
         fbc->fbc_clip = 0;          fbc->fbc_clip = 0;
Line 1704  cg6_invert(struct cgsix_softc *sc, int x
Line 1497  cg6_invert(struct cgsix_softc *sc, int x
 }  }
   
 #endif  #endif
   

Legend:
Removed from v.1.27  
changed lines
  Added in v.1.27.2.4

CVSweb <webmaster@jp.NetBSD.org>