Subject: Re: cg4 problems revisited...
To: None <>
From: Brad Spencer <>
List: port-sun3
Date: 07/11/1996 18:31:14

>> I suspect that this is the same thing I saw on my 4/110 with a cgfour.
>> Basically, the driver get the wrong plane mapped for the X server.
>> The X server thinks it has an 8 bit color plane, when, in fact, the 2
>> bit mono place is mapped.
>That explanation seems to make sense...corresponds to the vertical
>I'm seeing which end up about every 4th pixel or so.
>Did you determine a fix for the problem?  I'm dinking around with
>trying to twiddle with what offset is returned, but not having any success.
>I also tried using the BT_INIT() and BT_BLANK() functions from the Sparc
>port, w/o any noticable change...I'm running out of places to look. ;-)
>    Scott
>   //////////////////////////////////////////////////////////////////////
>  //  Scott Ellis   //   //   //
> //////////////////////////////////////////////////////////////////////
>// WARNING: This signature warps  time and space in its vicinity    //

Basically, I redid the mmap function in the driver.  I sorta stumbled
on the change by mistake.

Here is the config line I use:

cgfour0 at obio0 addr 0x0b300000 level 4        # P4 4/100

I have not had a lot of time lately to fiddle with my 4/110, but the
last time I thunked on it, the following worked [around the 1.2
version of cgfour.c].  The information was derrived from staring at
the cgfour driver in OpenBSD and by some guesses [I don't know if
there ever was a cgfour on the Sun 4 that wasn't on a P4 bus.  That is
what the 0x300000 is all about in the return()].

#define CG4REG_CMAP     0x200000 
#define CG4REG_OVERLAY  0x400000
#define CG4REG_ENABLE   0x600000
#define CG4REG_COLOUR   0x800000
#define CG4REG_END      0xa00000
cgfourmmap(dev, off, prot)
        dev_t dev;
        int off, prot;
        register struct cgfour_softc *sc = cgfourcd.cd_devs[minor(dev)];
        int poff;

#define START_ENABLE    (128*1024)
#define START_COLOUR    (128*1024 + 128*1024)
#define COLOUR_SIZE     (sc->sc_fb.fb_type.fb_width * sc->sc_fb.fb_type.fb_heigh
#define NOOVERLAY       (0x04000000)
        if (off & PGOFSET)
        if ((u_int)off >= NOOVERLAY)
            off = off - NOOVERLAY;

             * X11 maps a huge chunk of the frame buffer; far more than
             * there really is. We compensate by double-mapping the
             * first page for as many other pages as it wants
            while (off >= COLOUR_SIZE)
              off = 0;
            poff = off + (CG4REG_COLOUR - CG4REG_OVERLAY);
          if ((u_int)off < START_ENABLE)        /* in overlay plane */
            poff = off;
            if ((u_int)off < START_COLOUR)      /* in enable plane */
              poff = off + (CG4REG_ENABLE - CG4REG_OVERLAY) - START_ENABLE;
              if ((u_int)off < (CG4REG_END - CG4REG_OVERLAY))   /* in colour pla
ne */
                poff = off + (CG4REG_COLOUR - CG4REG_OVERLAY) - START_COLOUR;
                return (-1);
        return (REG2PHYS(&sc->sc_phys, poff + CG4REG_OVERLAY - 0x300000, sc->sc_
bustype) | PMAP_NC);

Brad Spencer -