ntakahas@langue.is.tsukuba.ac.jp (TAKAHASHI Naoto) (02/15/91)
Submitted-by: ntakahas@langue.is.tsukuba.ac.jp (TAKAHASHI Naoto) Posting-number: Volume 11, Issue 77 Archive-name: xsun/part01 Here are patches to Xsun24 (X server for CG8/CG9), v10i023-24. The changes are: o Depth was changed from 32 to 24. o Both CG8 and CG9 are treated by an identical file, sunCG8C.c. See README for more information. TAKAHASHI Naoto Pattern Recognition Lab., Inst. of Inf. Sci. & Elec., Univ. of Tsukuba 1-1-1 Tennodai, Tsukuba, 305 Japan ---------------------------------------------------------------------- #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh <file", e.g.. If this archive is complete, you # will see the following message at the end: # "End of shell archive." # Contents: 1.0-to-1.1 # Wrapped by ntakahas@langue on Fri Feb 1 08:57:10 1991 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f '1.0-to-1.1' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'1.0-to-1.1'\" else echo shar: Extracting \"'1.0-to-1.1'\" \(14871 characters\) sed "s/^X//" >'1.0-to-1.1' <<'END_OF_FILE' Xdiff -arcN ../test/ddx/cfb/cfbbitblt.c ddx/cfb/cfbbitblt.c X*** ../test/ddx/cfb/cfbbitblt.c Tue Jan 8 03:25:51 1991 X--- ddx/cfb/cfbbitblt.c Thu Dec 27 23:14:42 1990 X*************** X*** 37,43 **** X X #ifdef sun X #include <pixrect/pixrect_hs.h> X! Pixrect *sun_pr_screen; X #endif X X cfbDoBitblt(pSrc, pDst, alu, prgnDst, pptSrc, planemask) X--- 37,43 ---- X X #ifdef sun X #include <pixrect/pixrect_hs.h> X! extern Pixrect *sun_pr_screen; X #endif X X cfbDoBitblt(pSrc, pDst, alu, prgnDst, pptSrc, planemask) X*************** X*** 1516,1524 **** X #endif X X #if (PPW == 1) X! unsigned long cfb32Pixelsfg, cfb32Pixelsbg; X X! cfbCopyPlane1to32 (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc, planemask) X DrawablePtr pSrcDrawable; X DrawablePtr pDstDrawable; X int rop; X--- 1516,1524 ---- X #endif X X #if (PPW == 1) X! unsigned long cfb24Pixelsfg, cfb24Pixelsbg; X X! cfbCopyPlane1to24 (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc, planemask) X DrawablePtr pSrcDrawable; X DrawablePtr pDstDrawable; X int rop; X*************** X*** 1609,1619 **** X #if BITMAP_BIT_ORDER == MSBFirst X while (i--) X *pdst++ = (tmp & (1 << i)) ? X! cfb32Pixelsfg : cfb32Pixelsbg; X #else X while (i--) X *pdst++ = (tmp & (1 << (31 - i))) ? X! cfb32Pixelsfg : cfb32Pixelsbg; X #endif X } X if (nl) X--- 1609,1619 ---- X #if BITMAP_BIT_ORDER == MSBFirst X while (i--) X *pdst++ = (tmp & (1 << i)) ? X! cfb24Pixelsfg : cfb24Pixelsbg; X #else X while (i--) X *pdst++ = (tmp & (1 << (31 - i))) ? X! cfb24Pixelsfg : cfb24Pixelsbg; X #endif X } X if (nl) X*************** X*** 1628,1638 **** X #if BITMAP_BIT_ORDER == MSBFirst X while (nl--) X *pdst++ = (tmp & (1 << i--)) ? X! cfb32Pixelsfg : cfb32Pixelsbg; X #else X while (nl--) X *pdst++ = (tmp & (1 << (31 - i--))) ? X! cfb32Pixelsfg : cfb32Pixelsbg; X #endif X } X } X--- 1628,1638 ---- X #if BITMAP_BIT_ORDER == MSBFirst X while (nl--) X *pdst++ = (tmp & (1 << i--)) ? X! cfb24Pixelsfg : cfb24Pixelsbg; X #else X while (nl--) X *pdst++ = (tmp & (1 << (31 - i--))) ? X! cfb24Pixelsfg : cfb24Pixelsbg; X #endif X } X } X*************** X*** 1663,1675 **** X { X #if BITMAP_BIT_ORDER == MSBFirst X if (tmp & (1 << i)) X! src = cfb32Pixelsfg; X #else X if (tmp & (1 << (31 - i))) X! src = cfb32Pixelsfg; X #endif X else X! src = cfb32Pixelsbg; X *pdst = *pdst & ~planemask | src; X pdst++; X } X--- 1663,1675 ---- X { X #if BITMAP_BIT_ORDER == MSBFirst X if (tmp & (1 << i)) X! src = cfb24Pixelsfg; X #else X if (tmp & (1 << (31 - i))) X! src = cfb24Pixelsfg; X #endif X else X! src = cfb24Pixelsbg; X *pdst = *pdst & ~planemask | src; X pdst++; X } X*************** X*** 1689,1701 **** X { X #if BITMAP_BIT_ORDER == MSBFirst X if (tmp & (1 << i)) X! src = cfb32Pixelsfg; X #else X if (tmp & (1 << (32 - i))) X! src = cfb32Pixelsfg; X #endif X else X! src = cfb32Pixelsbg; X *pdst = *pdst & ~planemask | X DoRop(rop, src, *pdst) & planemask; X pdst++; X--- 1689,1701 ---- X { X #if BITMAP_BIT_ORDER == MSBFirst X if (tmp & (1 << i)) X! src = cfb24Pixelsfg; X #else X if (tmp & (1 << (32 - i))) X! src = cfb24Pixelsfg; X #endif X else X! src = cfb24Pixelsbg; X *pdst = *pdst & ~planemask | X DoRop(rop, src, *pdst) & planemask; X pdst++; X*************** X*** 1715,1727 **** X { X #if BITMAP_BIT_ORDER == MSBFirst X if (tmp & (1 << i--)) X! src = cfb32Pixelsfg; X #else X if (tmp & (1 << (32 - i--))) X! src = cfb32Pixelsfg; X #endif X else X! src = cfb32Pixelsbg; X *pdst = *pdst & ~planemask | X DoRop(rop, src, *pdst) & planemask; X pdst++; X--- 1715,1727 ---- X { X #if BITMAP_BIT_ORDER == MSBFirst X if (tmp & (1 << i--)) X! src = cfb24Pixelsfg; X #else X if (tmp & (1 << (32 - i--))) X! src = cfb24Pixelsfg; X #endif X else X! src = cfb24Pixelsbg; X *pdst = *pdst & ~planemask | X DoRop(rop, src, *pdst) & planemask; X pdst++; X*************** X*** 1842,1854 **** X return ret; X X #elif (PPW == 1) X! if (pSrcDrawable->depth == 1 && pDstDrawable->depth == 32) X { X if (bitPlane == 1) X { X! cfb32Pixelsfg = pGC->fgPixel & pGC->planemask; X! cfb32Pixelsbg = pGC->bgPixel & pGC->planemask; X! doBitBlt = cfbCopyPlane1to32; X ret = cfbCopyArea (pSrcDrawable, pDstDrawable, X pGC, srcx, srcy, width, height, dstx, dsty); X doBitBlt = cfbDoBitblt; X--- 1842,1854 ---- X return ret; X X #elif (PPW == 1) X! if (pSrcDrawable->depth == 1 && pDstDrawable->depth == 24) X { X if (bitPlane == 1) X { X! cfb24Pixelsfg = pGC->fgPixel & pGC->planemask; X! cfb24Pixelsbg = pGC->bgPixel & pGC->planemask; X! doBitBlt = cfbCopyPlane1to24; X ret = cfbCopyArea (pSrcDrawable, pDstDrawable, X pGC, srcx, srcy, width, height, dstx, dsty); X doBitBlt = cfbDoBitblt; Xdiff -arcN ../test/ddx/cfb/cfbmskbits.h ddx/cfb/cfbmskbits.h X*** ../test/ddx/cfb/cfbmskbits.h Tue Jan 8 03:25:57 1991 X--- ddx/cfb/cfbmskbits.h Mon Nov 5 23:20:54 1990 X*************** X*** 86,92 **** X #define PLST 0 X #define PIM 0 X #define PWSH 0 X! #define PSZ 32 X #define PMSK 0x00FFFFFF X X /* the following notes use the following conventions: X--- 86,92 ---- X #define PLST 0 X #define PIM 0 X #define PWSH 0 X! #define PSZ 24 X #define PMSK 0x00FFFFFF X X /* the following notes use the following conventions: Xdiff -arcN ../test/ddx/cfb/cfbscrinit.c ddx/cfb/cfbscrinit.c X*** ../test/ddx/cfb/cfbscrinit.c Tue Jan 8 03:25:58 1991 X--- ddx/cfb/cfbscrinit.c Sun Nov 4 03:02:11 1990 X*************** X*** 61,67 **** X X static VisualRec visuals[] = { X /* vid class bpRGB cmpE nplan rMask gMask bMask oRed oGreen oBlue */ X! 0, TrueColor, 8, 256, 32, 0xff, 0xff00, 0xff0000, 0, 8, 16, X #ifndef STATIC_COLOR X 0, PseudoColor, _BP, 1<<PSZ, PSZ, 0, 0, 0, 0, 0, 0, X 0, DirectColor, _BP, _CE, PSZ, _RM, _GM, _BM, _RS, _GS, _BS, X--- 61,67 ---- X X static VisualRec visuals[] = { X /* vid class bpRGB cmpE nplan rMask gMask bMask oRed oGreen oBlue */ X! 0, TrueColor, _BP, _CE, PSZ, _RM, _GM, _BM, _RS, _GS, _BS, X #ifndef STATIC_COLOR X 0, PseudoColor, _BP, 1<<PSZ, PSZ, 0, 0, 0, 0, 0, 0, X 0, DirectColor, _BP, _CE, PSZ, _RM, _GM, _BM, _RS, _GS, _BS, X*************** X*** 79,85 **** X static DepthRec depths[] = { X /* depth numVid vids */ X 1, 0, NULL, X! 32, NUMVISUALS, VIDs X }; X X #define NUMDEPTHS ((sizeof depths)/(sizeof depths[0])) X--- 79,85 ---- X static DepthRec depths[] = { X /* depth numVid vids */ X 1, 0, NULL, X! 24, NUMVISUALS, VIDs X }; X X #define NUMDEPTHS ((sizeof depths)/(sizeof depths[0])) X*************** X*** 141,147 **** X pScreen->numDepths = NUMDEPTHS; X pScreen->allowedDepths = depths; X X! pScreen->rootDepth = 32; X pScreen->minInstalledCmaps = 1; X pScreen->maxInstalledCmaps = 1; X pScreen->backingStoreSupport = Always; X--- 141,147 ---- X pScreen->numDepths = NUMDEPTHS; X pScreen->allowedDepths = depths; X X! pScreen->rootDepth = 24; X pScreen->minInstalledCmaps = 1; X pScreen->maxInstalledCmaps = 1; X pScreen->backingStoreSupport = Always; X*************** X*** 158,164 **** X if (!pPixmap) X return FALSE; X pPixmap->drawable.type = DRAWABLE_PIXMAP; X! pPixmap->drawable.depth = 32; X pPixmap->drawable.pScreen = pScreen; X pPixmap->drawable.serialNumber = 0; X pPixmap->drawable.x = 0; X--- 158,164 ---- X if (!pPixmap) X return FALSE; X pPixmap->drawable.type = DRAWABLE_PIXMAP; X! pPixmap->drawable.depth = 24; X pPixmap->drawable.pScreen = pScreen; X pPixmap->drawable.serialNumber = 0; X pPixmap->drawable.x = 0; Xdiff -arcN ../test/ddx/sun/sun.h ddx/sun/sun.h X*** ../test/ddx/sun/sun.h Tue Jan 8 03:25:59 1991 X--- ddx/sun/sun.h Sun Nov 4 03:02:07 1990 X*************** X*** 196,202 **** X pointer fbPriv; /* Frame-buffer-dependent data */ X } fbFd; X X! extern Bool sunSupportsDepth32; X extern unsigned long sunGeneration; X X typedef struct _sunFbDataRec { X--- 196,202 ---- X pointer fbPriv; /* Frame-buffer-dependent data */ X } fbFd; X X! extern Bool sunSupportsDepth24; X extern unsigned long sunGeneration; X X typedef struct _sunFbDataRec { Xdiff -arcN ../test/ddx/sun/sunCG8C.c ddx/sun/sunCG8C.c X*** ../test/ddx/sun/sunCG8C.c Tue Jan 8 03:26:00 1991 X--- ddx/sun/sunCG8C.c Tue Jan 8 02:01:23 1991 X*************** X*** 42,49 **** X #include "sun.h" X X #include <sys/mman.h> X! #include <pixrect/memreg.h> X! #include <sundev/cg8reg.h> X #include "colormap.h" X #include "colormapst.h" X #include "resource.h" X--- 42,48 ---- X #include "sun.h" X X #include <sys/mman.h> X! #include <pixrect/pixrect_hs.h> X #include "colormap.h" X #include "colormapst.h" X #include "resource.h" X*************** X*** 51,57 **** X X /*- X * The cg8 frame buffer is divided into several pieces. X! * 1) an array of 32-bit pixels X * 2) a one-bit deep overlay plane X * 3) an enable plane X * 4) a colormap and status register X--- 50,56 ---- X X /*- X * The cg8 frame buffer is divided into several pieces. X! * 1) an array of 24-bit pixels X * 2) a one-bit deep overlay plane X * 3) an enable plane X * 4) a colormap and status register X*************** X*** 84,89 **** X--- 83,89 ---- X /* XXX - next line means only one CG8 - fix this */ X static ColormapPtr sunCG8CInstalledMap; X X+ extern Pixrect *sun_pr_screen; X extern int TellLostMap(), TellGainedMap(); X X static void X*************** X*** 477,483 **** X sunFbs[index].info = fbType; X sunFbs[index].fb = (pointer) CG8Cfb; X sunFbs[index].EnterLeave = sunCG8CSwitch; X! sunSupportsDepth32 = TRUE; X return TRUE; X } X X--- 477,530 ---- X sunFbs[index].info = fbType; X sunFbs[index].fb = (pointer) CG8Cfb; X sunFbs[index].EnterLeave = sunCG8CSwitch; X! sunSupportsDepth24 = TRUE; X! return TRUE; X! } X! Bool X! sunCG9CProbe (pScreenInfo, index, fbNum, argc, argv) X! ScreenInfo *pScreenInfo; /* The screenInfo struct */ X! int index; /* The index of pScreen in the ScreenInfo */ X! int fbNum; /* Index into the sunFbData array */ X! int argc; /* The number of the Server's arguments. */ X! char **argv; /* The arguments themselves. Don't change! */ X! { X! int fd; X! struct fbtype fbType; X! X! if ((fd = sunOpenFrameBuffer(FBTYPE_SUNROP_COLOR, &fbType, index, fbNum, X! argc, argv)) < 0) X! return FALSE; X! X! #ifdef _MAP_NEW X! if ((int)(CG8Cfb = (CG8CPtr) mmap((caddr_t) 0, X! CG8C_MONOLEN + CG8C_ENBLEN + CG8C_IMAGELEN, X! PROT_READ | PROT_WRITE, X! MAP_SHARED | _MAP_NEW, fd, 0)) == -1) { X! Error("Mapping cg9c"); X! (void) close(fd); X! return FALSE; X! } X! #else _MAP_NEW X! CG8Cfb = (CG8CPtr) valloc(CG8C_MONOLEN + CG8C_ENBLEN + CG8C_IMAGELEN); X! if (CG8Cfb == (CG8CPtr) NULL) { X! ErrorF("Could not allocate room for frame buffer.\n"); X! return FALSE; X! } X! X! if (mmap((caddr_t) CG8Cfb, CG8C_MONOLEN + CG8C_ENBLEN + CG8C_IMAGELEN, X! PROT_READ | PROT_WRITE, X! MAP_SHARED, fd, 0) < 0) { X! Error("Mapping cg9c"); X! (void) close(fd); X! return FALSE; X! } X! #endif _MAP_NEW X! X! sunFbs[index].fd = fd; X! sunFbs[index].info = fbType; X! sunFbs[index].fb = (pointer) CG8Cfb; X! sunFbs[index].EnterLeave = sunCG8CSwitch; X! sunSupportsDepth24 = TRUE; X return TRUE; X } X Xdiff -arcN ../test/ddx/sun/sunInit.c ddx/sun/sunInit.c X*** ../test/ddx/sun/sunInit.c Tue Jan 8 03:26:00 1991 X--- ddx/sun/sunInit.c Tue Jan 8 02:15:22 1991 X*************** X*** 59,79 **** X extern int sunKbdProc(); X extern Bool sunBW2Probe(), sunBW2Create(); X extern Bool sunCG8CProbe(), sunCG8CCreate(); X extern void ProcessInputEvents(); X X extern void SetInputCheck(); X extern char *strncpy(); X extern GCPtr CreateScratchGC(); X- extern Pixrect *sun_pr_screen; X X #define XDEVICE "XDEVICE" X #define PARENT "WINDOW_GFX" X X int sunSigIO = 0; /* For use with SetInputCheck */ X static int autoRepeatHandlersInstalled; /* FALSE each time InitOutput called */ X X static Bool sunDevsProbed = FALSE; X! Bool sunSupportsDepth32 = FALSE; X unsigned long sunGeneration = 0; X X X--- 59,80 ---- X extern int sunKbdProc(); X extern Bool sunBW2Probe(), sunBW2Create(); X extern Bool sunCG8CProbe(), sunCG8CCreate(); X+ extern Bool sunCG9CProbe(); X extern void ProcessInputEvents(); X X extern void SetInputCheck(); X extern char *strncpy(); X extern GCPtr CreateScratchGC(); X X #define XDEVICE "XDEVICE" X #define PARENT "WINDOW_GFX" X X+ Pixrect *sun_pr_screen = NULL; X int sunSigIO = 0; /* For use with SetInputCheck */ X static int autoRepeatHandlersInstalled; /* FALSE each time InitOutput called */ X X static Bool sunDevsProbed = FALSE; X! Bool sunSupportsDepth24 = FALSE; X unsigned long sunGeneration = 0; X X X*************** X*** 103,108 **** X--- 104,110 ---- X sunFbDataRec sunFbData[] = { X sunBW2Probe, "/dev/bwtwo0", sunBW2Create, X sunCG8CProbe, "/dev/cgeight0", sunCG8CCreate, X+ sunCG9CProbe, "/dev/cgnine0", sunCG8CCreate, X sunBW2Probe, "/dev/bwtwo0", sunBW2Create, X }; X X*************** X*** 117,123 **** X X static PixmapFormatRec formats[] = { X 1, 1, BITMAP_SCANLINE_PAD, /* 1-bit deep */ X! 32,32, BITMAP_SCANLINE_PAD, /*32-bit deep */ X }; X #define NUMFORMATS (sizeof formats)/(sizeof formats[0]) X X--- 119,125 ---- X X static PixmapFormatRec formats[] = { X 1, 1, BITMAP_SCANLINE_PAD, /* 1-bit deep */ X! 24,32, BITMAP_SCANLINE_PAD, /*24-bit deep */ X }; X #define NUMFORMATS (sizeof formats)/(sizeof formats[0]) X X*************** X*** 223,229 **** X if (n == 0) X return; X } X! if (!sunSupportsDepth32) X pScreenInfo->numPixmapFormats--; X for (i = NUMSCREENS, dev = devStart; --i > 0; dev++) { X if (sunFbData[dev].createProc) X--- 225,231 ---- X if (n == 0) X return; X } X! if (!sunSupportsDepth24) X pScreenInfo->numPixmapFormats--; X for (i = NUMSCREENS, dev = devStart; --i > 0; dev++) { X if (sunFbData[dev].createProc) X*************** X*** 676,684 **** X } X } X X! if (name) X { X! sun_pr_screen = pr_open(name); X pr_set_plane_group(sun_pr_screen, PIXPG_24BIT_COLOR); X } X X--- 678,686 ---- X } X } X X! if (!sun_pr_screen) X { X! sun_pr_screen = pr_open("/dev/fb"); X pr_set_plane_group(sun_pr_screen, PIXPG_24BIT_COLOR); X } X END_OF_FILE if test 14871 -ne `wc -c <'1.0-to-1.1'`; then echo shar: \"'1.0-to-1.1'\" unpacked with wrong size! fi # end of '1.0-to-1.1' fi echo shar: End of shell archive. exit 0 -- Dan Heller ------------------------------------------------ O'Reilly && Associates Zyrcom Inc Senior Writer President argv@ora.com argv@zipcode.com