Пример #1
0
static void
Neo2097SubsequentScreenToScreenCopy(ScrnInfoPtr pScrn,
                                    int srcX, int srcY,
                                    int dstX, int dstY,
                                    int w, int h)
{
    NEOPtr nPtr = NEOPTR(pScrn);
    NEOACLPtr nAcl = NEOACLPTR(pScrn);

    if ((dstY < srcY) || ((dstY == srcY) && (dstX < srcX))) {
        /* start with upper left corner */
        WAIT_ENGINE_IDLE();
        OUTREG(NEOREG_BLTCNTL, nAcl->tmpBltCntlFlags);
        OUTREG(NEOREG_SRCSTARTOFF, (srcY<<16) | (srcX & 0xffff));
        OUTREG(NEOREG_DSTSTARTOFF, (dstY<<16) | (dstX & 0xffff));
        OUTREG(NEOREG_XYEXT, (h<<16) | (w & 0xffff));
    }
    else {
        /* start with lower right corner */
        WAIT_ENGINE_IDLE();
        OUTREG(NEOREG_BLTCNTL, (nAcl->tmpBltCntlFlags | NEO_BC0_X_DEC
                                | NEO_BC0_DST_Y_DEC
                                | NEO_BC0_SRC_Y_DEC));
        OUTREG(NEOREG_SRCSTARTOFF, ((srcY+h-1)<<16) | ((srcX+w-1) & 0xffff));
        OUTREG(NEOREG_DSTSTARTOFF, ((dstY+h-1)<<16) | ((dstX+w-1) & 0xffff));
        OUTREG(NEOREG_XYEXT, (h<<16) | (w & 0xffff));
    }
}
Пример #2
0
static void
Neo2097SubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
        int x, int y,
        int w, int h,
        int skipleft)
{
    NEOPtr nPtr = NEOPTR(pScrn);
    NEOACLPtr nAcl = NEOACLPTR(pScrn);

#ifdef NEO_DO_CLIPPING
    w = (w + 31) & ~31;
#else
    nAcl->CPUToScreenColorExpandFill_x = x;
    nAcl->CPUToScreenColorExpandFill_y = y;
    nAcl->CPUToScreenColorExpandFill_w = w;
    nAcl->CPUToScreenColorExpandFill_h = h;
#endif
    WAIT_ENGINE_IDLE();
#ifdef NEO_DO_CLIPPING
    OUTREG(NEOREG_CLIPLT, (y << 16) | (x + skipleft));
    OUTREG(NEOREG_CLIPRB, ((y + h) << 16) | (x + w));
    WAIT_ENGINE_IDLE();
#endif
    OUTREG(NEOREG_SRCSTARTOFF, 0);
    OUTREG(NEOREG_DSTSTARTOFF, (y<<16) | (x & 0xffff));
#ifdef NEO_DO_CLIPPING
    OUTREG(NEOREG_XYEXT, (h<<16) | (w & 0xffff));
#else
    OUTREG(NEOREG_XYEXT, (1<<16) | (w & 0xffff));
#endif
}
Пример #3
0
static void
Neo2070SetupForSolidFillRect(ScrnInfoPtr pScrn, int color, int rop,
			     unsigned int planemask)
{
    NEOPtr nPtr = NEOPTR(pScrn);
    NEOACLPtr nAcl = NEOACLPTR(pScrn);

    planemask &= nAcl->PlaneMask;
    if (!rop) color=0;

    WAIT_ENGINE_IDLE();

    OUTREG(NEO2070_BLTCNTL, nAcl->BltCntlFlags  |
                            NEO_BC0_SRC_IS_FG    | neo2070Rop[3]);
    OUTREG(NEO2070_PLANEMASK, planemask |= (planemask << nAcl->ColorShiftAmt));
    if (pScrn->bitsPerPixel == 8) 
	OUTREG(NEO2070_FGCOLOR, color |= (color << 8));
    else
	/* swap bytes in color */
	OUTREG(NEO2070_FGCOLOR, ((color&0xff00) >> 8) | (color << 8));
    OUTREG(NEO2070_SRCPITCH, nAcl->Pitch);
    OUTREG(NEO2070_DSTPITCH, nAcl->Pitch);
    OUTREG(NEO2070_SRCBITOFF, 0);
    OUTREG(NEO2070_DSTBITOFF, 0);
}
Пример #4
0
Bool 
Neo2200AccelInit(ScreenPtr pScreen)
{
    XAAInfoRecPtr infoPtr;
    ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
    NEOPtr nPtr = NEOPTR(pScrn);
    NEOACLPtr nAcl = NEOACLPTR(pScrn);

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

    /*
     * Set up the main acceleration flags.
     */
    infoPtr->Flags = LINEAR_FRAMEBUFFER | OFFSCREEN_PIXMAPS;
    if(nAcl->cacheEnd > nAcl->cacheStart) infoPtr->Flags |= PIXMAP_CACHE;
#if 0
    infoPtr->PixmapCacheFlags |= DO_NOT_BLIT_STIPPLES;
#endif
    /* sync */
    infoPtr->Sync = Neo2200Sync;

    /* screen to screen copy */
    infoPtr->ScreenToScreenCopyFlags = (NO_TRANSPARENCY | NO_PLANEMASK);
    infoPtr->SetupForScreenToScreenCopy = 
	Neo2200SetupForScreenToScreenCopy;
    infoPtr->SubsequentScreenToScreenCopy
#ifdef NOT_BROKEN
	= Neo2200SubsequentScreenToScreenCopy;
#else
	= Neo2200SubsequentScreenToScreenCopyBroken;
Пример #5
0
static void
Neo2070SubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y, int w, int h)
{
    NEOPtr nPtr = NEOPTR(pScrn);
    NEOACLPtr nAcl = NEOACLPTR(pScrn);

    WAIT_ENGINE_IDLE();
    OUTREG(NEO2070_XYEXT, ((h-1)<<16) | ((w-1) & 0xffff));
    OUTREG(NEO2070_DSTSTART, (y * nAcl->Pitch) + (x * nAcl->PixelWidth));
}
Пример #6
0
static void
Neo2097SetupScanlineForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
        int fg, int bg,
        int rop,
        unsigned int planemask)
{
    NEOPtr nPtr = NEOPTR(pScrn);
    NEOACLPtr nAcl = NEOACLPTR(pScrn);

    if (bg == -1) {
        /* transparent setup */
        WAIT_ENGINE_IDLE();
#ifdef NEO_DO_CLIPPING
        OUTREG(NEOREG_BLTCNTL, nAcl->BltCntlFlags  |
               NEO_BC0_SYS_TO_VID   |
               NEO_BC0_SRC_MONO     |
               NEO_BC0_SRC_TRANS    |
               NEO_BC3_SKIP_MAPPING |
               NEO_BC3_CLIP_ON      |
               NEO_BC3_DST_XY_ADDR  | neo2097Rop[rop]);
#else
        OUTREG(NEOREG_BLTCNTL, nAcl->BltCntlFlags  |
               NEO_BC0_SYS_TO_VID   |
               NEO_BC0_SRC_MONO     |
               NEO_BC0_SRC_TRANS    |
               NEO_BC3_SKIP_MAPPING |
               NEO_BC3_DST_XY_ADDR  | neo2097Rop[rop]);
#endif

        OUTREG(NEOREG_FGCOLOR, fg |= (fg << nAcl->ColorShiftAmt));
    }
    else {
        /* opaque setup */
        WAIT_ENGINE_IDLE();
#ifdef NEO_DO_CLIPPING
        OUTREG(NEOREG_BLTCNTL, nAcl->BltCntlFlags  |
               NEO_BC0_SYS_TO_VID   |
               NEO_BC0_SRC_MONO     |
               NEO_BC3_SKIP_MAPPING |
               NEO_BC3_CLIP_ON      |
               NEO_BC3_DST_XY_ADDR  | neo2097Rop[rop]);
#else
        OUTREG(NEOREG_BLTCNTL, nAcl->BltCntlFlags  |
               NEO_BC0_SYS_TO_VID   |
               NEO_BC0_SRC_MONO     |
               NEO_BC3_SKIP_MAPPING |
               NEO_BC3_DST_XY_ADDR  | neo2097Rop[rop]);
#endif

        OUTREG(NEOREG_FGCOLOR, fg |= (fg << nAcl->ColorShiftAmt));
        OUTREG(NEOREG_BGCOLOR, bg |= (bg << nAcl->ColorShiftAmt));
    }
}
Пример #7
0
static void
Neo2097SetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir,
                                  int rop,
                                  unsigned int planemask,
                                  int trans_color)
{
    NEOACLPtr nAcl = NEOACLPTR(pScrn);

    nAcl->tmpBltCntlFlags = (nAcl->BltCntlFlags  |
                             NEO_BC3_SKIP_MAPPING |
                             NEO_BC3_DST_XY_ADDR  |
                             NEO_BC3_SRC_XY_ADDR  | neo2097Rop[rop]);
}
Пример #8
0
static void
Neo2097SubsequentScanlineImageWriteRect(
    ScrnInfoPtr pScrn,
    int x, int y, int w, int h,
    int skipleft
) {
    NEOPtr nPtr = NEOPTR(pScrn);
    NEOACLPtr nAcl = NEOACLPTR(pScrn);

    WAIT_ENGINE_IDLE();
    OUTREG(NEOREG_BLTCNTL, nAcl->tmpBltCntlFlags);
    OUTREG(NEOREG_SRCSTARTOFF, 0);
    OUTREG(NEOREG_DSTSTARTOFF, (y << 16) | (x & 0xffff));
    OUTREG(NEOREG_XYEXT, (h << 16) | w);
}
Пример #9
0
static void
Neo2097SetupForScanlineImageWrite(
    ScrnInfoPtr pScrn,
    int rop,
    unsigned int planemask,
    int transparency_color,
    int bpp, int depth
) {
    NEOACLPtr nAcl = NEOACLPTR(pScrn);

    nAcl->tmpBltCntlFlags = (nAcl->BltCntlFlags   |
                             NEO_BC0_SYS_TO_VID   |
                             NEO_BC3_SKIP_MAPPING |
                             NEO_BC3_DST_XY_ADDR  | neo2097Rop[rop]);
}
Пример #10
0
static void
Neo2097SubsequentMono8x8PatternFill(ScrnInfoPtr pScrn,
                                    int patternx,
                                    int patterny,
                                    int x, int y,
                                    int w, int h)
{
    NEOPtr nPtr = NEOPTR(pScrn);
    NEOACLPtr nAcl = NEOACLPTR(pScrn);

    patterny &= 0x7;

    WAIT_ENGINE_IDLE();
    OUTREG(NEOREG_BLTCNTL, nAcl->tmpBltCntlFlags | (patterny << 20));
    /*   OUTREG(NEOREG_SRCBITOFF, patternx);  Bad Register */
    OUTREG(NEOREG_DSTSTARTOFF, (y<<16) | (x & 0xffff));
    OUTREG(NEOREG_XYEXT, (h<<16) | (w & 0xffff));
}
Пример #11
0
static void
Neo2070SetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir,
				  int rop,
				  unsigned int planemask,
				  int trans_color)
{
    NEOPtr nPtr = NEOPTR(pScrn);
    NEOACLPtr nAcl = NEOACLPTR(pScrn);

    /* set blt control */
    WAIT_ENGINE_IDLE();
    OUTREG(NEO2070_BLTCNTL, nAcl->tmpBltCntlFlags);
    OUTREG(NEO2070_PLANEMASK, planemask |= (planemask << nAcl->ColorShiftAmt));
    OUTREG(NEO2070_SRCPITCH, nAcl->Pitch);
    OUTREG(NEO2070_DSTPITCH, nAcl->Pitch);
    OUTREG(NEO2070_SRCBITOFF, 0);
    OUTREG(NEO2070_DSTBITOFF, 0);
}
Пример #12
0
static void
Neo2097SetupForSolidFillRect(ScrnInfoPtr pScrn, int color, int rop,
                             unsigned int planemask)
{
    NEOPtr nPtr = NEOPTR(pScrn);
    NEOACLPtr nAcl = NEOACLPTR(pScrn);

    WAIT_ENGINE_IDLE();

    /* set blt control */
    OUTREG(NEOREG_BLTCNTL, nAcl->BltCntlFlags  |
           NEO_BC0_SRC_IS_FG    |
           NEO_BC3_SKIP_MAPPING |
           NEO_BC3_DST_XY_ADDR  |
           NEO_BC3_SRC_XY_ADDR  | neo2097Rop[rop]);

    /* set foreground color */
    OUTREG(NEOREG_FGCOLOR, color |= (color << nAcl->ColorShiftAmt));
}
Пример #13
0
static void
Neo2097SubsequentColorExpandScanline(ScrnInfoPtr pScrn,	int bufno)
{
#ifdef NEO_DO_CLIPPING
    /* Should I be waiting for fifo slots to prevent retries ?
       How do I do that on this engine ? */
#else
    NEOPtr nPtr = NEOPTR(pScrn);
    NEOACLPtr nAcl = NEOACLPTR(pScrn);

    if (!(--nAcl->CPUToScreenColorExpandFill_h))
        return;

    WAIT_ENGINE_IDLE();
    OUTREG(NEOREG_SRCSTARTOFF, 0);
    OUTREG(NEOREG_DSTSTARTOFF, ((++nAcl->CPUToScreenColorExpandFill_y)<<16)
           | (nAcl->CPUToScreenColorExpandFill_x & 0xffff));
    OUTREG(NEOREG_XYEXT, (1<<16)
           | (nAcl->CPUToScreenColorExpandFill_w & 0xffff));
#endif
}
Пример #14
0
static void
Neo2097SetupForMono8x8PatternFill(ScrnInfoPtr pScrn,
                                  int patternx,
                                  int patterny,
                                  int fg, int bg,
                                  int rop, unsigned int planemask)
{
    NEOPtr nPtr = NEOPTR(pScrn);
    NEOACLPtr nAcl = NEOACLPTR(pScrn);

    if (bg == -1) {
        /* transparent setup */
        nAcl->tmpBltCntlFlags = ( nAcl->BltCntlFlags    |
                                  NEO_BC0_SRC_MONO     |
                                  NEO_BC0_FILL_PAT     |
                                  NEO_BC0_SRC_TRANS    |
                                  NEO_BC3_SKIP_MAPPING |
                                  NEO_BC3_SRC_XY_ADDR  |
                                  NEO_BC3_DST_XY_ADDR  | neo2097Rop[rop]);

        WAIT_ENGINE_IDLE();
        OUTREG(NEOREG_FGCOLOR, fg |= (fg << nAcl->ColorShiftAmt));
        OUTREG(NEOREG_SRCSTARTOFF, (patterny << 16) | patternx);
    }
    else {
        /* opaque setup */
        nAcl->tmpBltCntlFlags = ( nAcl->BltCntlFlags    |
                                  NEO_BC0_SRC_MONO     |
                                  NEO_BC0_FILL_PAT     |
                                  NEO_BC3_SKIP_MAPPING |
                                  NEO_BC3_SRC_XY_ADDR  |
                                  NEO_BC3_DST_XY_ADDR  | neo2097Rop[rop]);

        WAIT_ENGINE_IDLE();
        OUTREG(NEOREG_FGCOLOR, fg |= (fg << nAcl->ColorShiftAmt));
        OUTREG(NEOREG_BGCOLOR, bg |= (bg << nAcl->ColorShiftAmt));
        OUTREG(NEOREG_SRCSTARTOFF, (patterny << 16) | patternx);
    }
}
Пример #15
0
Bool
Neo2097AccelInit(ScreenPtr pScreen)
{
    XAAInfoRecPtr infoPtr;
    ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
    NEOPtr nPtr = NEOPTR(pScrn);
    NEOACLPtr nAcl = NEOACLPTR(pScrn);

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

    /*
     * Set up the main acceleration flags.
     */
    infoPtr->Flags = LINEAR_FRAMEBUFFER | OFFSCREEN_PIXMAPS;
    if(nAcl->cacheEnd > nAcl->cacheStart) infoPtr->Flags |= PIXMAP_CACHE;

    infoPtr->PixmapCacheFlags = DO_NOT_BLIT_STIPPLES;

    /* sync */
    infoPtr->Sync = Neo2097Sync;

    /* screen to screen copy */
    infoPtr->ScreenToScreenCopyFlags = (NO_TRANSPARENCY | NO_PLANEMASK);
    infoPtr->SetupForScreenToScreenCopy =
        Neo2097SetupForScreenToScreenCopy;
    infoPtr->SubsequentScreenToScreenCopy =
        Neo2097SubsequentScreenToScreenCopy;

    /* solid filled rectangles */
    infoPtr->SolidFillFlags = NO_PLANEMASK;
    infoPtr->SetupForSolidFill =
        Neo2097SetupForSolidFillRect;
    infoPtr->SubsequentSolidFillRect =
        Neo2097SubsequentSolidFillRect;

    if (!nPtr->strangeLockups) {
        /* cpu to screen color expansion */
        /*
         * We do CPUToScreenColorExpand (ab)using the Scanline functions:
         * the neo chipsets need byte padding however we can only do dword
         * padding. Fortunately the graphics engine doesn't choke if we
         * transfer up to 3 bytes more than it wants.
         */
        infoPtr->ScanlineColorExpandBuffers =
            (unsigned char **)xnfalloc(sizeof(char*));
        infoPtr->ScanlineColorExpandBuffers[0] = (unsigned char *)(nPtr->NeoMMIOBase + 0x100000);
        infoPtr->NumScanlineColorExpandBuffers = 1;
        infoPtr->ScanlineCPUToScreenColorExpandFillFlags = ( NO_PLANEMASK |
#ifdef NEO_DO_CLIPPING
                LEFT_EDGE_CLIPPING |
#endif
                CPU_TRANSFER_PAD_DWORD |
                BIT_ORDER_IN_BYTE_MSBFIRST );
        infoPtr->SetupForScanlineCPUToScreenColorExpandFill =
            Neo2097SetupScanlineForCPUToScreenColorExpandFill;
        infoPtr->SubsequentScanlineCPUToScreenColorExpandFill =
            Neo2097SubsequentScanlineCPUToScreenColorExpandFill;
        infoPtr->SubsequentColorExpandScanline =
            Neo2097SubsequentColorExpandScanline;
    }

#if 0
    /* 8x8 pattern fills */
    infoPtr->Mono8x8PatternFillFlags = NO_PLANEMASK
                                       | HARDWARE_PATTERN_PROGRAMMED_ORIGIN
                                       | BIT_ORDER_IN_BYTE_MSBFIRST;

    infoPtr->SetupForMono8x8PatternFill =
        Neo2097SetupForMono8x8PatternFill;
    infoPtr->SubsequentMono8x8PatternFillRect =
        Neo2097SubsequentMono8x8PatternFill;
#endif

    if (!nPtr->strangeLockups) {
        /* image writes */
        infoPtr->ScanlineImageWriteFlags =  ( CPU_TRANSFER_PAD_DWORD |
                                              SCANLINE_PAD_DWORD |
                                              NO_TRANSPARENCY |
                                              NO_PLANEMASK );

        infoPtr->SetupForScanlineImageWrite =
            Neo2097SetupForScanlineImageWrite;
        infoPtr->SubsequentScanlineImageWriteRect =
            Neo2097SubsequentScanlineImageWriteRect;
        infoPtr->SubsequentImageWriteScanline =
            Neo2097SubsequentImageWriteScanline;
        infoPtr->NumScanlineImageWriteBuffers = 1;
        infoPtr->ScanlineImageWriteBuffers =
            infoPtr->ScanlineColorExpandBuffers;
    }

    /*
     * Setup some global variables
     */
    nAcl->ColorShiftAmt = 0;

    /* Initialize for 8bpp or 15/16bpp support accellerated */
    switch (pScrn->bitsPerPixel) {
    case 8:
        nAcl->BltCntlFlags = NEO_BC1_DEPTH8;
        nAcl->ColorShiftAmt = 8;
        break;
    case 15:
    case 16:
        nAcl->BltCntlFlags = NEO_BC1_DEPTH16;
        nAcl->ColorShiftAmt = 0;
        break;
    case 24:
    default:
        return FALSE;
    }

    /* Initialize for widths */
    switch (pScrn->displayWidth) {
    case 640:
        nAcl->BltCntlFlags |= NEO_BC1_X_640;
        break;
    case 800:
        nAcl->BltCntlFlags |= NEO_BC1_X_800;
        break;
    case 1024:
        nAcl->BltCntlFlags |= NEO_BC1_X_1024;
        break;
    default:
        return FALSE;
    }

    return (xaaSetupWrapper(pScreen, infoPtr, pScrn->depth, &nPtr->accelSync));
}
Пример #16
0
Bool 
Neo2070AccelInit(ScreenPtr pScreen)
{
    XAAInfoRecPtr infoPtr;
    ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
    NEOPtr nPtr = NEOPTR(pScrn);
    NEOACLPtr nAcl = NEOACLPTR(pScrn);

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

    /*
     * Set up the main acceleration flags.
     */
    infoPtr->Flags = LINEAR_FRAMEBUFFER | OFFSCREEN_PIXMAPS;
    if(nAcl->cacheEnd > nAcl->cacheStart) infoPtr->Flags |= PIXMAP_CACHE;
#if 0
    infoPtr->PixmapCacheFlags |= DO_NOT_BLIT_STIPPLES;
#endif
    /* sync */
    infoPtr->Sync = Neo2070Sync;

    /* screen to screen copy */
    infoPtr->ScreenToScreenCopyFlags = (NO_TRANSPARENCY | GXCOPY_ONLY);
    infoPtr->SetupForScreenToScreenCopy = 
	Neo2070SetupForScreenToScreenCopy;
    infoPtr->SubsequentScreenToScreenCopy = 
	Neo2070SubsequentScreenToScreenCopy;

    /* solid filled rectangles */
    infoPtr->SolidFillFlags = GXCOPY_ONLY;
    infoPtr->SetupForSolidFill = 
	Neo2070SetupForSolidFillRect;
    infoPtr->SubsequentSolidFillRect = 
	Neo2070SubsequentSolidFillRect;

    /*
     * Setup some global variables
     */
    
    /* Initialize for 8bpp or 15/16bpp support accellerated */
    switch (pScrn->bitsPerPixel) {
    case 8:
	nAcl->BltCntlFlags = NEO_BC1_DEPTH8;
	nAcl->ColorShiftAmt = 8;
	nAcl->PixelWidth = 1;
	nAcl->PlaneMask = 0xff;
	break;
    case 15:
    case 16:
	nAcl->BltCntlFlags = NEO_BC1_DEPTH16;
	nAcl->ColorShiftAmt = 0;
	nAcl->PixelWidth = 2;
	nAcl->PlaneMask = 0xffff;
	break;
    case 24: /* not supported, but check anyway */
    default:
	return FALSE;
    }
    
    return(XAAInit(pScreen, infoPtr));

}