[comp.windows.x] cg8 Server Prob

dan@ece.arizona.edu (Dan Filiberti) (03/27/91)

We have a RasterOps SparcCard in our Sparcstation 1+ (24-bit fb)...At one time
we were able to get X running using the cg8 server on the net...but then we 
installed the update to the RasterOps driver and it busted X..X is there, but
the screen is black...

After many attempts to get info, we were told the following...

-------
Dan, I am assuming you have source for the server. If you do what you need to
do is make an ioctl call (PIPIO_G_FB_INFO) to obtain the memory map offset for
the various frame buffers on the card. This call is described in the file
/usr/include/sun/pipio.h. The values returned are described in that file also.
Rather than using the hardwired offset for the true color buffer (40000
hex, I e
lieve)
use the value returned in the mmap_offset field for the entry whose
group fieldi
s the value PIXPG_24BIT_COLOR (which is defined in
/usr/include/pixrect/pr_plane
groups.h).
-------

Can anyone help me decipher this...where exactly do I put the calls in
the
cg8 server?

All help greatly appreciated.[:)}

		Daniel Filiberti
		dan@helios.ece.arizona.edu

andy@research.canon.oz.au (Andy Newman) (03/27/91)

I had exactly this trouble. In the later release of the RasterOps card
the memory mapping (mmap) of the framebuffer has changed. There is now
an approximately 1Mb space between the monochrome fb and the colour fb.
The new CG8C strucuture for sunCG8C.c looks like this:

	#define	CG8_HEIGHT	900
	#define	CG8_WIDTH	1152

	typedef struct cg8c {
		u_char mpixel[128*1024];		/* bit-per-pixel memory */
		u_char epixel[128*1024];		/* enable plane */

		/* VVVVVVVVVVVVVVVVVVVVV */
		u_char padding[1016*1024];		/* space in RasterOps board */
		/* ^^^^^^^^^^^^^^^^^^^^^ */

		u_long cpixel[CG8_HEIGHT][CG8_WIDTH];	/* word-per-pixel memory */
	} CG8C, CG8CRec, *CG8CPtr;

I had to experiment a bit to find the correct values due to the
"fantastic" documentation supplied by RasterOps (at least in Oz).

Hope this helps.
-- 
Andy Newman (andy@research.canon.oz.au) Canon Info. Systems Research Australia
"X: 2. An over-sized, over-featured, over-engineered window system developed
at MIT and widely used on UNIX systems." from the jargon file.

christos@theory.tn.cornell.edu (Christos S. Zoulas) (03/27/91)

In article <1991Mar26.223513.5306@research.canon.oz.au> andy@research.canon.oz.au (Andy Newman) writes:
>
>I had exactly this trouble. In the later release of the RasterOps card
>the memory mapping (mmap) of the framebuffer has changed. There is now
>an approximately 1Mb space between the monochrome fb and the colour fb.
[stuff deleted]
>
And in addition, if you want to enable the double frame buffer sun hack
you can apply the following patch....

[I added the sunCG9.c patch too]

*** sunInit.c.dist	Tue Mar 19 14:48:42 1991
--- sunInit.c	Thu Mar 21 14:50:26 1991
***************
*** 639,645 ****
      } else if (name) {
  	fd = open(name, O_RDWR, 0);
          if (fd < 0) {
! 	    return (-1);
  	} 
  	if (ioctl(fd, FBIOGATTR, &fbattr) < 0)
  	{
--- 639,652 ----
      } else if (name) {
  	fd = open(name, O_RDWR, 0);
          if (fd < 0) {
! 	    /*
! 	     * The rasterops cgeight0 has a bwtwo0 but does not
! 	     * advertize it.
! 	     */
! 	    if (strcmp(name, "/dev/bwtwo0") == 0) 
! 		fd = open("/dev/cgeight0", O_RDWR, 0);
! 	    if (fd < 0)
! 		return (-1);
  	} 
  	if (ioctl(fd, FBIOGATTR, &fbattr) < 0)
  	{
*** sunCG9C.c.old	Tue Mar 19 14:48:40 1991
--- sunCG9C.c	Tue Mar 19 15:30:16 1991
***************
*** 58,70 ****
   */
  #define	CG9_HEIGHT	900
  #define	CG9_WIDTH	1152
- 
- typedef struct cg9c {
- 	u_char mpixel[128*1024];		/* bit-per-pixel memory */
- 	u_char epixel[128*1024];		/* enable plane */
- 	u_long cpixel[CG9_HEIGHT][CG9_WIDTH];	/* word-per-pixel memory */
- } CG9C, CG9CRec, *CG9CPtr;
- 
  #define CG9C_IMAGE(fb)	    ((caddr_t)(&(fb)->cpixel))
  #define CG9C_IMAGEOFF	    ((off_t)0x0)
  #define CG9C_IMAGELEN	    (((4*CG9_HEIGHT*CG9_WIDTH + 8191)/8192)*8192)
--- 58,63 ----
***************
*** 72,78 ****
--- 65,88 ----
  #define	CG9C_MONOLEN	    (128*1024)
  #define	CG9C_ENABLE(fb)	    ((caddr_t)(&(fb)->epixel))
  #define	CG9C_ENBLEN	    CG9C_MONOLEN
+ #ifdef PIP_NFBS
+ /* RasterOps card */
+ # define CG8C_PADLEN	    (CG9C_MONOLEN * 7 + 240 * 512)
+ #else
+ /* True cg8 */
+ # define CG8C_PADLEN	    0
+ #endif 
  
+ typedef struct cg9c {
+ 	u_char mpixel[128*1024];		/* bit-per-pixel memory */
+ 	u_char epixel[128*1024];		/* enable plane */
+ #ifdef PIP_NFBS
+ 	u_char ppixel[CG8C_PADLEN];		/* padding plane */
+ #endif
+ 	u_long cpixel[CG9_HEIGHT][CG9_WIDTH];	/* word-per-pixel memory */
+ } CG9C, CG9CRec, *CG9CPtr;
+ 
+ 
  static CG9CPtr CG9Cfb = NULL;
  
  static int  sunCG9CScreenIndex;
***************
*** 427,433 ****
  
  #ifdef	_MAP_NEW
      if ((int)(CG9Cfb = (CG9CPtr) mmap((caddr_t) 0,
! 	     CG9C_MONOLEN + CG9C_ENBLEN + CG9C_IMAGELEN,
  	     PROT_READ | PROT_WRITE,
  	     MAP_SHARED | _MAP_NEW, fd, 0)) == -1) {
  	Error("Mapping cg8c");
--- 437,443 ----
  
  #ifdef	_MAP_NEW
      if ((int)(CG9Cfb = (CG9CPtr) mmap((caddr_t) 0,
! 	     CG9C_MONOLEN + CG9C_ENBLEN + CG8C_PADLEN + CG9C_IMAGELEN,
  	     PROT_READ | PROT_WRITE,
  	     MAP_SHARED | _MAP_NEW, fd, 0)) == -1) {
  	Error("Mapping cg8c");
-- 
+------------------------------------------------------------------------+
| Christos Zoulas         | 389 Theory Center, Electrical Engineering,   |
| christos@ee.cornell.edu | Cornell University, Ithaca NY 14853.         |
| christos@crnlee.bitnet  | Phone: (607) 255 0302 |  Fax: (607) 254 4565 |