Subject: Re: X11 on cgfour?
To: None <perseant@hitl.washington.edu>
From: Brad Spencer <brad@anduin.eldar.org>
List: port-sparc
Date: 05/29/1996 19:33:49
>I wonder what the status is of X11 on the cgfour framebuffer?  Under PK's
>snapshot of May 2, X fails with the error:
>
>         molotov# /usr/bin/X11/X :0                     
>         mapping frame buffer memory: Invalid argument
>         Couldn't allocate frame buffer memory: Cannot allocate memory
>
>         Fatal server error:
>         no screens found
>
>I get the same error with "X :0 -dev /dev/cgfour0"; /dev/bwtwo0 simply
>does not work.
>
>I *had* gotten a monochrome X server running under Jason's
>February-28(?) 4/100-specific kernel; but this snapshot (as well as
>-current as of a few days ago) does not seem to support X (although in
>all other respects the machine is running beautifully).  Is this a known
>problem?  (Have I just picked the wrong time to grab -current?)  My
>machine description follows; any
>suggestions will be welcome.

[snip]


I fiddled with this for a while and managed to get the cgfour to work.
The above error is caused because the mmap function for the cgfour is
wrong.  Try this one:

-------
#define CG4REG_CMAP     0x200000
#define CG4REG_OVERLAY  0x400000
#define CG4REG_ENABLE   0x600000
#define CG4REG_COLOUR   0x800000
#define CG4REG_END      0xa00000
int
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
t)
#define END_COLOUR      (START_COLOUR + COLOUR_SIZE)
#define NOOVERLAY       (0x04000000)

        if (off & PGOFSET)
                panic("cgfourmap");

        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);
          }
        else
          if ((u_int)off < START_ENABLE)        /* in overlay plane */
            poff = off;
          else
            if ((u_int)off < START_COLOUR)      /* in enable plane */
              poff = off + (CG4REG_ENABLE - CG4REG_OVERLAY) - START_ENABLE;
            else
              if ((u_int)off < (CG4REG_END - CG4REG_OVERLAY))   /* in colour pla
ne */ 
                poff = off + (CG4REG_COLOUR - CG4REG_OVERLAY) - START_COLOUR;
              else
                return (-1);
        return (REG2PHYS(&sc->sc_phys, poff + CG4REG_OVERLAY - 0x300000, sc->sc_
bustype) | PMAP_NC);
}
--------

I didn't have any problems with the bwtwo, except that the
RASTERCONSOLE does not seem to work properly.  If I compiled a kernel
without that option, the bwtwo seems to work [X :0 -dev /dev/bwtwo0].
The device *is* created???

I have not had much time to play with my 4/110, so all the above may
be false.



Brad Spencer - brad@anduin.eldar.org   http://anduin.eldar.org