Ejemplo n.º 1
0
/*
 * ATIInitializeAcceleration --
 *
 * This function is called to initialise both the framebuffer manager and XAA
 * on a screen.
 */
Bool
ATIInitializeAcceleration
(
    ScreenPtr   pScreen,
    ScrnInfoPtr pScreenInfo,
    ATIPtr      pATI
)
{
    int maxScanlines = 32767, maxPixelArea, PixelArea;

    if (pATI->OptionAccel)
    {
        if (!(pATI->pXAAInfo = XAACreateInfoRec()))
            return FALSE;

        switch (pATI->Adapter)
        {
            case ATI_ADAPTER_MACH64:
                maxScanlines = ATIMach64AccelInit(pATI, pATI->pXAAInfo);
                break;

            default:
                break;
        }
    }

#ifndef AVOID_CPIO

    if (!pATI->BankInfo.BankSize)

#endif /* AVOID_CPIO */

#ifdef XF86DRI_DEVEL

        /* If DRI is enabled, we've already set up the FB manager in ATIScreenInit */
        if (!pATI->directRenderingEnabled)

#endif /* XF86DRI */
    {
        /*
         * Note:  If PixelArea exceeds the engine's maximum, the excess is
         *        never used, even though it would be useful for such things
         *        as XVideo buffers.
         */
        maxPixelArea = maxScanlines * pScreenInfo->displayWidth;
        PixelArea = pScreenInfo->videoRam * 1024 * 8 / pATI->bitsPerPixel;
        if (PixelArea > maxPixelArea)
            PixelArea = maxPixelArea;
        xf86InitFBManagerArea(pScreen, PixelArea, 2);
    }

    if (!pATI->OptionAccel || XAAInit(pScreen, pATI->pXAAInfo))
        return TRUE;

    XAADestroyInfoRec(pATI->pXAAInfo);
    pATI->pXAAInfo = NULL;
    return FALSE;
}
Ejemplo n.º 2
0
/*
 * ATIInitializeAcceleration --
 *
 * This function is called to initialise both the framebuffer manager and XAA
 * on a screen.
 */
Bool
ATIInitializeAcceleration
(
    ScreenPtr   pScreen,
    ScrnInfoPtr pScreenInfo,
    ATIPtr      pATI
)
{
    int maxScanlines = 32767, maxPixelArea, PixelArea;

    if (pATI->OptionAccel)
    {
        if (!(pATI->pXAAInfo = XAACreateInfoRec()))
            return FALSE;

        switch (pATI->Adapter)
        {
            case ATI_ADAPTER_MACH64:
                maxScanlines = ATIMach64AccelInit(pATI, pATI->pXAAInfo);
                break;

            default:
                break;
        }
    }

#ifndef AVOID_CPIO

    if (!pATI->BankInfo.BankSize)

#endif /* AVOID_CPIO */

    {
        maxPixelArea = maxScanlines * pScreenInfo->displayWidth;
        PixelArea = pScreenInfo->videoRam * 1024 * 8 / pATI->bitsPerPixel;
        if (PixelArea > maxPixelArea)
            PixelArea = maxPixelArea;
        xf86InitFBManagerArea(pScreen, PixelArea, 2);
    }

    if (!pATI->OptionAccel || XAAInit(pScreen, pATI->pXAAInfo))
        return TRUE;

    XAADestroyInfoRec(pATI->pXAAInfo);
    pATI->pXAAInfo = NULL;
    return FALSE;
}
Ejemplo n.º 3
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));
}