void
Permedia3EnableOffscreen (ScreenPtr pScreen)
{
    ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
    GLINTPtr pGlint = GLINTPTR(pScrn);
    BoxRec AvailFBArea;

    /* Available Framebuffer Area for XAA. */
    AvailFBArea.x1 = 0;
    AvailFBArea.y1 = 0;
    AvailFBArea.x2 = pScrn->displayWidth;
    /* X coords are short's so we have to do this to make sure we dont wrap*/
    AvailFBArea.y2 = ((pGlint->FbMapSize > 16384*1024) ? 16384*1024 :
	pGlint->FbMapSize)  / (pScrn->displayWidth *
	pScrn->bitsPerPixel / 8);

    /* Permedia3 has a maximum 4096x4096 framebuffer */
    if (AvailFBArea.y2 > 4095) AvailFBArea.y2 = 4095;

    xf86InitFBManager(pScreen, &AvailFBArea);
}
/*
 * Memory layour for XAA with DRI (no local_textures):
 * | front  | pixmaps, xv | back   | depth  | textures | c |
 *
 * 1024x768@16bpp with 8 MB:
 * | 1.5 MB | ~3.5 MB     | 1.5 MB | 1.5 MB | 0        | c |
 *
 * 1024x768@32bpp with 8 MB:
 * | 3.0 MB | ~0.5 MB     | 3.0 MB | 1.5 MB | 0        | c |
 *
 * "c" is the hw cursor which occupies 1KB
 */
static Bool
ATIMach64SetupMemXAA
(
    ScrnInfoPtr pScreenInfo,
    ScreenPtr pScreen
)
{
    ATIPtr       pATI        = ATIPTR(pScreenInfo);

    ATIDRIServerInfoPtr pATIDRIServer = pATI->pDRIServerInfo;
    int cpp = pATI->bitsPerPixel >> 3;
    int widthBytes = pScreenInfo->displayWidth * cpp;
    int zWidthBytes = pScreenInfo->displayWidth * 2; /* always 16-bit z-buffer */
    int fbSize = pScreenInfo->videoRam * 1024;
    int bufferSize = pScreenInfo->virtualY * widthBytes;
    int zBufferSize = pScreenInfo->virtualY * zWidthBytes;
    int offscreenBytes, total, scanlines;

    pATIDRIServer->fbX = 0;
    pATIDRIServer->fbY = 0;
    pATIDRIServer->frontOffset = 0;
    pATIDRIServer->frontPitch = pScreenInfo->displayWidth;

    /* Calculate memory remaining for pixcache and textures after
     * front, back, and depth buffers
     */
    offscreenBytes = fbSize - ( 2 * bufferSize + zBufferSize );

    if ( !pATIDRIServer->IsPCI && !pATI->OptionLocalTextures ) {
        /* Don't allocate a local texture heap for AGP unless requested */
        pATIDRIServer->textureSize = 0;
    } else {
        int l, maxPixcache;

#ifdef XvExtension

        int xvBytes;

        /* Try for enough pixmap cache for DVD and a full viewport
         */
        xvBytes = 720*480*cpp; /* enough for single-buffered DVD */
        maxPixcache = xvBytes > bufferSize ? xvBytes : bufferSize;

#else /* XvExtension */

        /* Try for one viewport */
        maxPixcache = bufferSize;

#endif /* XvExtension */

        pATIDRIServer->textureSize = offscreenBytes - maxPixcache;

        /* If that gives us less than half the offscreen mem available for textures, split
         * the available mem between textures and pixmap cache
         */
        if (pATIDRIServer->textureSize < (offscreenBytes/2)) {
            pATIDRIServer->textureSize = offscreenBytes/2;
        }

        if (pATIDRIServer->textureSize <= 0)
            pATIDRIServer->textureSize = 0;

        l = ATIMinBits((pATIDRIServer->textureSize-1) / MACH64_NR_TEX_REGIONS);
        if (l < MACH64_LOG_TEX_GRANULARITY) l = MACH64_LOG_TEX_GRANULARITY;

        /* Round the texture size up to the nearest whole number of
         * texture regions.  Again, be greedy about this, don't round
         * down.
         */
        pATIDRIServer->logTextureGranularity = l;
        pATIDRIServer->textureSize =
            (pATIDRIServer->textureSize >> l) << l;
    }

    total = fbSize - pATIDRIServer->textureSize;
    scanlines = total / widthBytes;
    if (scanlines > ATIMach64MaxY) scanlines = ATIMach64MaxY;

    /* Recalculate the texture offset and size to accomodate any
     * rounding to a whole number of scanlines.
     * FIXME: Is this actually needed?
     */
    pATIDRIServer->textureOffset = scanlines * widthBytes;
    pATIDRIServer->textureSize = fbSize - pATIDRIServer->textureOffset;

    /* Set a minimum usable local texture heap size.  This will fit
     * two 256x256 textures.  We check this after any rounding of
     * the texture area.
     */
    if (pATIDRIServer->textureSize < 256*256 * cpp * 2) {
        pATIDRIServer->textureOffset = 0;
        pATIDRIServer->textureSize = 0;
        scanlines = fbSize / widthBytes;
        if (scanlines > ATIMach64MaxY) scanlines = ATIMach64MaxY;
    }

    pATIDRIServer->depthOffset = scanlines * widthBytes - zBufferSize;
    pATIDRIServer->depthPitch = pScreenInfo->displayWidth;
    pATIDRIServer->depthY = pATIDRIServer->depthOffset/widthBytes;
    pATIDRIServer->depthX =  (pATIDRIServer->depthOffset -
                              (pATIDRIServer->depthY * widthBytes)) / cpp;

    pATIDRIServer->backOffset = pATIDRIServer->depthOffset - bufferSize;
    pATIDRIServer->backPitch = pScreenInfo->displayWidth;
    pATIDRIServer->backY = pATIDRIServer->backOffset/widthBytes;
    pATIDRIServer->backX =  (pATIDRIServer->backOffset -
                             (pATIDRIServer->backY * widthBytes)) / cpp;

    scanlines = fbSize / widthBytes;
    if (scanlines > ATIMach64MaxY) scanlines = ATIMach64MaxY;

    if ( pATIDRIServer->IsPCI && pATIDRIServer->textureSize == 0 ) {
        xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING,
                   "Not enough memory for local textures, disabling DRI\n");
        ATIDRICloseScreen(pScreen);
        pATI->directRenderingEnabled = FALSE;
    } else {
        BoxRec ScreenArea;

        ScreenArea.x1 = 0;
        ScreenArea.y1 = 0;
        ScreenArea.x2 = pATI->displayWidth;
        ScreenArea.y2 = scanlines;

        if (!xf86InitFBManager(pScreen, &ScreenArea)) {
            xf86DrvMsg(pScreenInfo->scrnIndex, X_ERROR,
                       "Memory manager initialization to (%d,%d) (%d,%d) failed\n",
                       ScreenArea.x1, ScreenArea.y1,
                       ScreenArea.x2, ScreenArea.y2);
            return FALSE;
        } else {
            int width, height;

            xf86DrvMsg(pScreenInfo->scrnIndex, X_INFO,
                       "Memory manager initialized to (%d,%d) (%d,%d)\n",
                       ScreenArea.x1, ScreenArea.y1, ScreenArea.x2, ScreenArea.y2);

            if (xf86QueryLargestOffscreenArea(pScreen, &width, &height, 0, 0, 0)) {
                xf86DrvMsg(pScreenInfo->scrnIndex, X_INFO,
                           "Largest offscreen area available: %d x %d\n",
                           width, height);

                /* lines in offscreen area needed for depth buffer and textures */
                pATI->depthTexLines = scanlines
                                      - pATIDRIServer->depthOffset / widthBytes;
                pATI->backLines     = scanlines
                                      - pATIDRIServer->backOffset / widthBytes
                                      - pATI->depthTexLines;
                pATI->depthTexArea  = NULL;
                pATI->backArea      = NULL;
            } else {
                xf86DrvMsg(pScreenInfo->scrnIndex, X_ERROR,
                           "Unable to determine largest offscreen area available\n");
                return FALSE;
            }

        }

        xf86DrvMsg(pScreenInfo->scrnIndex, X_INFO, "Will use %d kB of offscreen memory for XAA\n",
                   (offscreenBytes - pATIDRIServer->textureSize)/1024);

        xf86DrvMsg(pScreenInfo->scrnIndex, X_INFO, "Will use back buffer at offset 0x%x\n",
                   pATIDRIServer->backOffset);

        xf86DrvMsg(pScreenInfo->scrnIndex, X_INFO, "Will use depth buffer at offset 0x%x\n",
                   pATIDRIServer->depthOffset);

        if (pATIDRIServer->textureSize > 0) {
            xf86DrvMsg(pScreenInfo->scrnIndex, X_INFO,
                       "Will use %d kB for local textures at offset 0x%x\n",
                       pATIDRIServer->textureSize/1024,
                       pATIDRIServer->textureOffset);
        }
    }

    return TRUE;
}
Bool
Permedia2AccelInit(ScreenPtr pScreen)
{
#ifdef HAVE_XAA_H
    XAAInfoRecPtr infoPtr;
    ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
    GLINTPtr pGlint = GLINTPTR(pScrn);
    BoxRec AvailFBArea;

    pGlint->AccelInfoRec = infoPtr = XAACreateInfoRec();
    if (!infoPtr) return FALSE;

    Permedia2InitializeEngine(pScrn);

    infoPtr->Flags = PIXMAP_CACHE |
		     OFFSCREEN_PIXMAPS |
		     LINEAR_FRAMEBUFFER;
 
    infoPtr->Sync = Permedia2Sync;

    infoPtr->SetClippingRectangle = Permedia2SetClippingRectangle;
    infoPtr->DisableClipping = Permedia2DisableClipping;
    infoPtr->ClippingFlags = HARDWARE_CLIP_MONO_8x8_FILL;

    infoPtr->SolidFillFlags = 0;
    infoPtr->ScreenToScreenCopyFlags = NO_TRANSPARENCY; 
    infoPtr->WriteBitmapFlags = 0;
    if (pScrn->bitsPerPixel == 24) {
    	infoPtr->SetupForSolidFill = 
				Permedia2SetupForFillRectSolid24bpp;
    	infoPtr->SubsequentSolidFillRect = 	
				Permedia2SubsequentFillRectSolid24bpp;
    } else {
        infoPtr->SolidLineFlags = 0;
        infoPtr->PolySegmentThinSolidFlags = 0;
        infoPtr->PolylinesThinSolidFlags = 0;
        infoPtr->SetupForSolidLine = Permedia2SetupForSolidLine;
        infoPtr->SubsequentSolidHorVertLine = Permedia2SubsequentHorVertLine;
        if (!(pScrn->overlayFlags & OVERLAY_8_32_PLANAR))
        {
        	infoPtr->SubsequentSolidBresenhamLine = 
				Permedia2SubsequentSolidBresenhamLine;
        }
 	infoPtr->PolySegmentThinSolid = Permedia2PolySegmentThinSolidWrapper;
	infoPtr->PolylinesThinSolid = Permedia2PolylinesThinSolidWrapper;
    	infoPtr->SetupForSolidFill = Permedia2SetupForFillRectSolid;
    	infoPtr->SubsequentSolidFillRect = Permedia2SubsequentFillRectSolid;
    }
    
    if (pScrn->bitsPerPixel >= 24) {
	infoPtr->SetupForScreenToScreenCopy = 	
				Permedia2SetupForScreenToScreenCopy2432bpp;
    	infoPtr->SubsequentScreenToScreenCopy = 		
				Permedia2SubsequentScreenToScreenCopy2432bpp;
    } else {
    	infoPtr->SetupForScreenToScreenCopy = 	
				Permedia2SetupForScreenToScreenCopy;
    	infoPtr->SubsequentScreenToScreenCopy = 		
				Permedia2SubsequentScreenToScreenCopy;
    }

    infoPtr->Mono8x8PatternFillFlags = 
    				HARDWARE_PATTERN_PROGRAMMED_ORIGIN |
    				HARDWARE_PATTERN_PROGRAMMED_BITS |
    				HARDWARE_PATTERN_SCREEN_ORIGIN;

    if (pScrn->bitsPerPixel == 24) {
	infoPtr->SetupForMono8x8PatternFill =
				Permedia2SetupForMono8x8PatternFill24bpp;
	infoPtr->SubsequentMono8x8PatternFillRect = 
				Permedia2SubsequentMono8x8PatternFillRect24bpp;
    } else {
	infoPtr->SetupForMono8x8PatternFill =
				Permedia2SetupForMono8x8PatternFill;
	infoPtr->SubsequentMono8x8PatternFillRect = 
				Permedia2SubsequentMono8x8PatternFillRect;
    }

    infoPtr->ScanlineCPUToScreenColorExpandFillFlags = 
						BIT_ORDER_IN_BYTE_LSBFIRST;

    infoPtr->NumScanlineColorExpandBuffers = 1;
    infoPtr->ScanlineColorExpandBuffers = 
					pGlint->XAAScanlineColorExpandBuffers;
    pGlint->XAAScanlineColorExpandBuffers[0] = 
					pGlint->IOBase + OutputFIFO + 4;

    infoPtr->SetupForScanlineCPUToScreenColorExpandFill =
			Permedia2SetupForScanlineCPUToScreenColorExpandFill;
    infoPtr->SubsequentScanlineCPUToScreenColorExpandFill = 
			Permedia2SubsequentScanlineCPUToScreenColorExpandFill;
    infoPtr->SubsequentColorExpandScanline = 
			Permedia2SubsequentColorExpandScanline;

    infoPtr->WriteBitmap = Permedia2WriteBitmap;

    if (pScrn->bitsPerPixel == 8) {
  	infoPtr->WritePixmap = Permedia2WritePixmap8bpp;
	infoPtr->WritePixmapFlags = NO_GXCOPY;
    } else
    if (pScrn->bitsPerPixel == 16) {
  	infoPtr->WritePixmap = Permedia2WritePixmap16bpp;
	infoPtr->WritePixmapFlags = NO_GXCOPY;
    } else
    if (pScrn->bitsPerPixel == 32)
  	infoPtr->WritePixmap = Permedia2WritePixmap32bpp;

    /* Now fixup if we are 24bpp */
    if (pScrn->bitsPerPixel == 24) {
	infoPtr->SolidFillFlags |= NO_PLANEMASK;
	infoPtr->ScreenToScreenCopyFlags |= NO_PLANEMASK;
        infoPtr->WriteBitmapFlags |= NO_PLANEMASK;
        infoPtr->ScanlineCPUToScreenColorExpandFillFlags |= NO_PLANEMASK;
        infoPtr->Mono8x8PatternFillFlags |= NO_PLANEMASK;
    }

    AvailFBArea.x1 = 0;
    AvailFBArea.y1 = 0;
    AvailFBArea.x2 = pScrn->displayWidth;
    AvailFBArea.y2 = pGlint->FbMapSize / (pScrn->displayWidth * 
					  pScrn->bitsPerPixel / 8);

    if (AvailFBArea.y2 > 2047) AvailFBArea.y2 = 2047;

    xf86InitFBManager(pScreen, &AvailFBArea);

    return(XAAInit(pScreen, infoPtr));
#else
    return FALSE;
#endif
}
Example #4
0
Bool
SiSAccelInit(ScreenPtr pScreen)
{
    XAAInfoRecPtr  infoPtr;
    ScrnInfoPtr    pScrn = xf86Screens[pScreen->myNum];
    SISPtr         pSiS = SISPTR(pScrn);
    BoxRec         AvailFBArea;
    int            topFB, i;
    int            reservedFbSize;
    int            UsableFbSize;
    unsigned char  *AvailBufBase;

    pSiS->AccelInfoPtr = infoPtr = XAACreateInfoRec();
    if (!infoPtr)  return FALSE;

    infoPtr->Flags = LINEAR_FRAMEBUFFER |
  		     OFFSCREEN_PIXMAPS |
  		     PIXMAP_CACHE;

    /* Sync */
    infoPtr->Sync = SiSSync;

    /* Screen To Screen copy */
    infoPtr->SetupForScreenToScreenCopy =  SiSSetupForScreenToScreenCopy;
    infoPtr->SubsequentScreenToScreenCopy = SiSSubsequentScreenToScreenCopy;
    infoPtr->ScreenToScreenCopyFlags = NO_TRANSPARENCY | NO_PLANEMASK;

    /* Solid fill */
    infoPtr->SetupForSolidFill = SiSSetupForFillRectSolid;
    infoPtr->SubsequentSolidFillRect = SiSSubsequentFillRectSolid;
    infoPtr->SolidFillFlags = NO_PLANEMASK;

    /* On 5597/5598 and 6326, clipping and lines only work
       for 1024, 2048, 4096 logical width */
    if(pSiS->ValidWidth) {
        /* Clipping */
        infoPtr->SetClippingRectangle = SiSSetClippingRectangle;
        infoPtr->DisableClipping = SiSDisableClipping;
        infoPtr->ClippingFlags =  
                    HARDWARE_CLIP_SOLID_LINE | 
                    HARDWARE_CLIP_SCREEN_TO_SCREEN_COPY |
                    HARDWARE_CLIP_MONO_8x8_FILL |
                    HARDWARE_CLIP_SOLID_FILL  ;

    	/* Solid Lines */
    	infoPtr->SetupForSolidLine = SiSSetupForSolidLine;
    	infoPtr->SubsequentSolidTwoPointLine = SiSSubsequentSolidTwoPointLine;
    	infoPtr->SubsequentSolidHorVertLine = SiSSubsequentSolidHorVertLine;
	infoPtr->SolidLineFlags = NO_PLANEMASK;
    }

    if(pScrn->bitsPerPixel != 24) {
        /* 8x8 mono pattern */
        infoPtr->SetupForMono8x8PatternFill = SiSSetupForMono8x8PatternFill;
        infoPtr->SubsequentMono8x8PatternFillRect = SiSSubsequentMono8x8PatternFillRect;
	infoPtr->Mono8x8PatternFillFlags =
                    NO_PLANEMASK |
                    HARDWARE_PATTERN_PROGRAMMED_BITS |
                    HARDWARE_PATTERN_PROGRAMMED_ORIGIN |
                    BIT_ORDER_IN_BYTE_MSBFIRST;
    }

#ifdef CTSCE
    if(pScrn->bitsPerPixel != 24) {
       /* TW: per-scanline color expansion (using indirect method) */
       pSiS->ColorExpandBufferNumber = 4;
       pSiS->ColorExpandBufferCountMask = 0x03;
       pSiS->PerColorExpandBufferSize = ((pScrn->virtualX + 31) / 32) * 4;

       infoPtr->NumScanlineColorExpandBuffers = pSiS->ColorExpandBufferNumber;
       infoPtr->ScanlineColorExpandBuffers = (unsigned char **)&pSiS->ColorExpandBufferAddr[0];

       infoPtr->SetupForScanlineCPUToScreenColorExpandFill =
	                            SiSSetupForScanlineCPUToScreenColorExpandFill;
       infoPtr->SubsequentScanlineCPUToScreenColorExpandFill =
	                            SiSSubsequentScanlineCPUToScreenColorExpandFill;
       infoPtr->SubsequentColorExpandScanline =
	                            SiSSubsequentColorExpandScanline;
       infoPtr->ScanlineCPUToScreenColorExpandFillFlags =
	    NO_PLANEMASK |
	    CPU_TRANSFER_PAD_DWORD |
	    SCANLINE_PAD_DWORD |
	    BIT_ORDER_IN_BYTE_MSBFIRST |
	    LEFT_EDGE_CLIPPING;
    } else {
       pSiS->ColorExpandBufferNumber = 0;
    }
#else
    pSiS->ColorExpandBufferNumber = 0;
#endif

    topFB = pSiS->maxxfbmem;

    reservedFbSize = pSiS->ColorExpandBufferNumber * pSiS->PerColorExpandBufferSize;

    UsableFbSize = topFB - reservedFbSize;

    /* Layout: (Sizes do not reflect correct proportions)
     * |--------------++++++++++++++++++++|  ====================~~~~~~~~~~~~|
     *   UsableFbSize  ColorExpandBuffers |        TurboQueue     HWCursor
     *                                  topFB
     */

    if(pSiS->ColorExpandBufferNumber) {
      AvailBufBase = pSiS->FbBase + UsableFbSize;
      for (i = 0; i < pSiS->ColorExpandBufferNumber; i++) {
	  pSiS->ColorExpandBufferAddr[i] = AvailBufBase +
		    i * pSiS->PerColorExpandBufferSize;
	  pSiS->ColorExpandBufferScreenOffset[i] = UsableFbSize +
		    i * pSiS->PerColorExpandBufferSize;
      }
    }
    AvailFBArea.x1 = 0;
    AvailFBArea.y1 = 0;
    AvailFBArea.x2 = pScrn->displayWidth;
    AvailFBArea.y2 = UsableFbSize / (pScrn->displayWidth * pScrn->bitsPerPixel / 8) - 1;

    if (AvailFBArea.y2 < 0)
	AvailFBArea.y2 = 32767;

    if(AvailFBArea.y2 < pScrn->currentMode->VDisplay) {
	xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
	 	"Not enough video RAM for accelerator. At least "
		"%dKB needed, %dKB available\n",
		((((pScrn->displayWidth * pScrn->bitsPerPixel/8)   /* TW: +8 for make it sure */
		     * pScrn->currentMode->VDisplay) + reservedFbSize) / 1024) + 8,
		pSiS->maxxfbmem/1024);
	pSiS->NoAccel = TRUE;
	pSiS->NoXvideo = TRUE;
	XAADestroyInfoRec(pSiS->AccelInfoPtr);
	pSiS->AccelInfoPtr = NULL;
	return FALSE;
    }

    xf86DrvMsg(pScrn->scrnIndex, X_INFO,
	   "Frame Buffer From (%d,%d) To (%d,%d)\n",
	   AvailFBArea.x1, AvailFBArea.y1, AvailFBArea.x2, AvailFBArea.y2);

    xf86InitFBManager(pScreen, &AvailFBArea);

    return(XAAInit(pScreen, infoPtr));
}
Example #5
0
Bool
SMI_AccelInit(ScreenPtr pScreen)
{
	XAAInfoRecPtr infoPtr;
	ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
	SMIPtr pSmi = SMIPTR(pScrn);
    /*BoxRec AvailFBArea;*/
	Bool ret;
    /*int numLines, maxLines;*/

	ENTER_PROC("SMI_AccelInit");

	pSmi->AccelInfoRec = infoPtr = XAACreateInfoRec();
	if (infoPtr == NULL)
	{
		LEAVE_PROC("SMI_AccelInit");
		return FALSE;
	}

	infoPtr->Flags = PIXMAP_CACHE
				   | LINEAR_FRAMEBUFFER
				   | OFFSCREEN_PIXMAPS;

	infoPtr->Sync = SMI_AccelSync;

	/* Screen to screen copies */
	infoPtr->ScreenToScreenCopyFlags = NO_PLANEMASK
									 | ONLY_TWO_BITBLT_DIRECTIONS;
	infoPtr->SetupForScreenToScreenCopy = SMI_SetupForScreenToScreenCopy;
	infoPtr->SubsequentScreenToScreenCopy = SMI_SubsequentScreenToScreenCopy;
	if (pScrn->bitsPerPixel == 24)
	{
		infoPtr->ScreenToScreenCopyFlags |= NO_TRANSPARENCY;
	}
	if ((pSmi->Chipset == SMI_LYNX3D) && (pScrn->bitsPerPixel == 8))
	{
		infoPtr->ScreenToScreenCopyFlags |= GXCOPY_ONLY;
	}

	/* Solid Fills */
	infoPtr->SolidFillFlags = NO_PLANEMASK;
	infoPtr->SetupForSolidFill = SMI_SetupForSolidFill;
	infoPtr->SubsequentSolidFillRect = SMI_SubsequentSolidFillRect;

	/* Solid Lines */
	infoPtr->SolidLineFlags = NO_PLANEMASK;
	infoPtr->SetupForSolidLine = SMI_SetupForSolidFill;
	infoPtr->SubsequentSolidHorVertLine = SMI_SubsequentSolidHorVertLine;

	/* Color Expansion Fills */
	infoPtr->CPUToScreenColorExpandFillFlags = ROP_NEEDS_SOURCE
											 | NO_PLANEMASK
											 | BIT_ORDER_IN_BYTE_MSBFIRST
											 | LEFT_EDGE_CLIPPING
											 | CPU_TRANSFER_PAD_DWORD
											 | SCANLINE_PAD_DWORD;
	infoPtr->ColorExpandBase = pSmi->DataPortBase;
	infoPtr->ColorExpandRange = pSmi->DataPortSize;
	infoPtr->SetupForCPUToScreenColorExpandFill =
			SMI_SetupForCPUToScreenColorExpandFill;
	infoPtr->SubsequentCPUToScreenColorExpandFill =
			SMI_SubsequentCPUToScreenColorExpandFill;

	/* 8x8 Mono Pattern Fills */
	infoPtr->Mono8x8PatternFillFlags = NO_PLANEMASK
									 | HARDWARE_PATTERN_PROGRAMMED_BITS
									 | HARDWARE_PATTERN_SCREEN_ORIGIN
									 | BIT_ORDER_IN_BYTE_MSBFIRST;
	infoPtr->SetupForMono8x8PatternFill = SMI_SetupForMono8x8PatternFill;
	infoPtr->SubsequentMono8x8PatternFillRect =
			SMI_SubsequentMono8x8PatternFillRect;

	/* 8x8 Color Pattern Fills */
	if (!SMI_LYNX3D_SERIES(pSmi->Chipset) || (pScrn->bitsPerPixel != 24))
	{
		infoPtr->Color8x8PatternFillFlags = NO_PLANEMASK
										  | HARDWARE_PATTERN_SCREEN_ORIGIN;
		infoPtr->SetupForColor8x8PatternFill =
				SMI_SetupForColor8x8PatternFill;
		infoPtr->SubsequentColor8x8PatternFillRect =
				SMI_SubsequentColor8x8PatternFillRect;
	}

#if SMI_USE_IMAGE_WRITES
	/* Image Writes */
	infoPtr->ImageWriteFlags = ROP_NEEDS_SOURCE
							 | NO_PLANEMASK
							 | CPU_TRANSFER_PAD_DWORD
							 | SCANLINE_PAD_DWORD;
	infoPtr->ImageWriteBase = pSmi->DataPortBase;
	infoPtr->ImageWriteRange = pSmi->DataPortSize;
	infoPtr->SetupForImageWrite = SMI_SetupForImageWrite;
	infoPtr->SubsequentImageWriteRect = SMI_SubsequentImageWriteRect;
#endif

	/* Clipping */
	infoPtr->ClippingFlags = HARDWARE_CLIP_SCREEN_TO_SCREEN_COPY
						   | HARDWARE_CLIP_MONO_8x8_FILL
						   | HARDWARE_CLIP_COLOR_8x8_FILL
						   | HARDWARE_CLIP_SOLID_FILL
						   | HARDWARE_CLIP_SOLID_LINE
						   | HARDWARE_CLIP_DASHED_LINE;
	infoPtr->SetClippingRectangle = SMI_SetClippingRectangle;
	infoPtr->DisableClipping = SMI_DisableClipping;

	/* Pixmap Cache */
	if (pScrn->bitsPerPixel == 24)
	{
		infoPtr->CachePixelGranularity = 16;
	}
	else
	{
		infoPtr->CachePixelGranularity = 128 / pScrn->bitsPerPixel;
	}

	/* Offscreen Pixmaps */
	infoPtr->maxOffPixWidth  = 4096;
	infoPtr->maxOffPixHeight = 4096;
	if (pScrn->bitsPerPixel == 24)
	{
		infoPtr->maxOffPixWidth = 4096 / 3;

		if (pSmi->Chipset == SMI_LYNX)
		{
			infoPtr->maxOffPixHeight = 4096 / 3;
		}
	}

	SMI_EngineReset(pScrn);


    /* CZ 18.06.2001: moved to smi_driver.c before the NoAccel question
       to have offscreen framebuffer in NoAccel mode */
#if 0
	maxLines = pSmi->FBReserved / (pSmi->width * pSmi->Bpp);
	if (pSmi->rotate)
	{
		numLines = maxLines;
	}
	else
	{
#if defined(XvExtension) && SMI_USE_VIDEO
		numLines = ((pSmi->FBReserved - pSmi->width * pSmi->Bpp * pSmi->height)
				 * 25 / 100 + pSmi->width * pSmi->Bpp - 1)
				 / (pSmi->width * pSmi->Bpp);
		numLines += pSmi->height;
#else
		numLines = maxLines;
#endif
	}

	AvailFBArea.x1 = 0;
	AvailFBArea.y1 = 0;
	AvailFBArea.x2 = pSmi->width;
	AvailFBArea.y2 = numLines;
	xf86DrvMsg(pScrn->scrnIndex, X_INFO, "FrameBuffer Box: %d,%d - %d,%d\n",
			AvailFBArea.x1, AvailFBArea.y1, AvailFBArea.x2, AvailFBArea.y2);
	xf86InitFBManager(pScreen, &AvailFBArea);
#endif

	ret = XAAInit(pScreen, infoPtr);
	if (ret && pSmi->shadowFB)										/* #671 */
	{
		pSmi->ValidatePolylines = infoPtr->ValidatePolylines;
		infoPtr->ValidatePolylines = SMI_ValidatePolylines;
	}

	LEAVE_PROC("SMI_AccelInit");
	return(ret);
}