diff options
author | Carlos Romero <kcrashcore@bellsouth.net> | 2004-05-30 13:51:18 +0000 |
---|---|---|
committer | Carlos Romero <kcrashcore@bellsouth.net> | 2004-05-30 13:51:18 +0000 |
commit | 8124810950d7e0b9db7f66dadee7218b0c26c4c3 (patch) | |
tree | 27b6b0cee6ae3a026861b884bf9b497a629e66e2 /hw/kdrive/pm2/pm2.h | |
parent | ea1bbf8d83d3780ccce5ebcdff48f0b19863cee1 (diff) |
Initialize permedia engine for acceleration to work.
Diffstat (limited to 'hw/kdrive/pm2/pm2.h')
-rw-r--r-- | hw/kdrive/pm2/pm2.h | 226 |
1 files changed, 103 insertions, 123 deletions
diff --git a/hw/kdrive/pm2/pm2.h b/hw/kdrive/pm2/pm2.h index ded9978bc..cc39b38e2 100644 --- a/hw/kdrive/pm2/pm2.h +++ b/hw/kdrive/pm2/pm2.h @@ -10,140 +10,55 @@ typedef volatile CARD8 VOL8; typedef volatile CARD16 VOL16; typedef volatile CARD32 VOL32; -#if 0 -typedef struct { - VOL32 StartXDom; - VOL32 dXDom; - VOL32 StartXSub; - VOL32 dXSub; - VOL32 StartY; - VOL32 dY; - VOL32 GLINTCount; - VOL32 Render; - VOL32 ContinueNewLine; - VOL32 ContinueNewDom; - VOL32 ContinueNewSub; - VOL32 Continue; - VOL32 FlushSpan; - VOL32 BitMaskPattern; -} PMRender; - -typedef struct { - VOL32 PointTable0; - VOL32 PointTable1; - VOL32 PointTable2; - VOL32 PointTable3; - VOL32 RasterizerMode; - VOL32 YLimits; - VOL32 ScanLineOwnership; - VOL32 WaitForCompletion; - VOL32 PixelSize; - VOL32 XLimits; - VOL32 RectangleOrigin; - VOL32 RectangleSize; -} PMRectangle; - -typedef struct { - VOL32 FilterMode; - VOL32 StatisticMode; - VOL32 MinRegion; - VOL32 MaxRegion; - VOL32 ResetPickResult; - VOL32 MitHitRegion; - VOL32 MaxHitRegion; - VOL32 PickResult; - VOL32 GlintSync; - VOL32 reserved00; - VOL32 reserved01; - VOL32 reserved02; - VOL32 reserved03; - VOL32 FBBlockColorU; - VOL32 FBBlockColorL; - VOL32 SuspendUntilFrameBlank; -} PMMode; - -typedef struct { - VOL32 ScissorMode; - VOL32 ScissorMinXY; - VOL32 ScissorMaxXY; - VOL32 ScreenSize; - VOL32 AreaStippleMode; - VOL32 LineStippleMode; - VOL32 LoadLineStippleCounters; - VOL32 UpdateLineStippleCounters; - VOL32 SaveLineStippleState; - VOL32 WindowOrigin; -} PMScissor; - -typedef struct { - VOL32 RStart; - VOL32 dRdx; - VOL32 dRdyDom; - VOL32 GStart; - VOL32 dGdx; - VOL32 dGdyDom; - VOL32 BStart; - VOL32 dBdx; - VOL32 dBdyDom; - VOL32 AStart; - VOL32 dAdx; - VOL32 dAdyDom; - VOL32 ColorDDAMode; - VOL32 ConstantColor; - VOL32 GLINTColor; -} PMColor; -#endif - #define PM2_REG_BASE(c) ((c)->attr.address[0] & 0xFFFFC000) #define PM2_REG_SIZE(c) (0x10000) -#define minb(p) *(volatile CARD8 *)(pm2c->reg_base + (p)) -#define moutb(p,v) *(volatile CARD8 *)(pm2c->reg_base + (p)) = (v) - - -/* Memory mapped register access macros */ -#define INREG8(addr) *(volatile CARD8 *)(pm2c->reg_base + (addr)) -#define INREG16(addr) *(volatile CARD16 *)(pm2c->reg_base + (addr)) -#define INREG(addr) *(volatile CARD32 *)(pm2c->reg_base + (addr)) - -#define OUTREG8(addr, val) do { \ - *(volatile CARD8 *)(pm2c->reg_base + (addr)) = (val); \ -} while (0) +typedef struct _PM2CardInfo { + VesaCardPrivRec vesa; + CARD8 *reg_base; -#define OUTREG16(addr, val) do { \ - *(volatile CARD16 *)(pm2c->reg_base + (addr)) = (val); \ -} while (0) + int InFifoSpace; + int FIFOSize; -#define OUTREG(addr, val) do { \ - *(volatile CARD32 *)(pm2c->reg_base + (addr)) = (val); \ -} while (0) + int pprod; + int bppalign; -typedef struct _PM2CardInfo { - VesaCardPrivRec vesa; - CARD8 *reg_base; + int ClippingOn; - int in_fifo_space; - int fifo_size; + int ROP; - int pprod; - int bppalign; + int x; + int y; + int w; + int h; - int clipping_on; + int FrameBufferReadMode; + int BppShift; + int BltScanDirection; - int ROP; + int RasterizerSwap; + int PixelWidth; + int TexMapFormat; + int startxdom; + int startxsub; + int starty; + int count; + int dy; + int dxdom; + int planemask; } PM2CardInfo; #define getPM2CardInfo(kd) ((PM2CardInfo *) ((kd)->card->driver)) #define pmCardInfo(kd) PM2CardInfo *pm2c = getPM2CardInfo(kd) typedef struct _PM2ScreenInfo { - VesaScreenPrivRec vesa; - CARD8 *cursor_base; - CARD8 *screen; - CARD8 *off_screen; - int off_screen_size; - KdVideoAdaptorPtr pAdaptor; + VesaScreenPrivRec vesa; + CARD8 *cursor_base; + CARD8 *screen; + CARD8 *off_screen; + int off_screen_size; + KdVideoAdaptorPtr pAdaptor; } PM2ScreenInfo; #define getPM2ScreenInfo(kd) ((PM2ScreenInfo *) ((kd)->screen->driver)) @@ -173,12 +88,77 @@ pmDrawFini (ScreenPtr); extern KdCardFuncs PM2Funcs; -#define PM2R_MEM_CONFIG 0x10c0 +#define MMIO_OUT32(base, offset, val) \ +do { \ + *(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset)) = (val); \ +} while (0) -#define PM2F_MEM_CONFIG_RAM_MASK (3L<<29) -#define PM2F_MEM_BANKS_1 0L -#define PM2F_MEM_BANKS_2 (1L<<29) -#define PM2F_MEM_BANKS_3 (2L<<29) -#define PM2F_MEM_BANKS_4 (3L<<29) +# define MMIO_IN32(base, offset) \ + *(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset)) + +#define GLINT_WRITE_REG(v,r) \ + MMIO_OUT32(mmio,(unsigned long)(r), (v)) + +#define GLINT_READ_REG(r) \ + MMIO_IN32(mmio,(unsigned long)(r)) + +#define GLINT_SLOW_WRITE_REG(v,r) \ +do{ \ + GLINT_WAIT(card->FIFOSize); \ + GLINT_WRITE_REG(v,r); \ +}while(0) + +#define REPLICATE(r) \ +{ \ + if (pScreenPriv->screen->fb[0].bitsPerPixel == 16) { \ + r &= 0xFFFF; \ + r |= (r<<16); \ + } else \ + if (pScreenPriv->screen->fb[0].bitsPerPixel == 8) { \ + r &= 0xFF; \ + r |= (r<<8); \ + r |= (r<<16); \ + } \ +} + +#define DO_PLANEMASK(planemask) \ +{ \ + if (planemask != card->planemask) { \ + card->planemask = planemask; \ + REPLICATE(planemask); \ + GLINT_WRITE_REG(planemask, FBHardwareWriteMask);\ + } \ +} + +#define LOADROP(rop) \ +{ \ + if (card->ROP != rop) { \ + GLINT_WRITE_REG(rop<<1|UNIT_ENABLE, LogicalOpMode); \ + card->ROP = rop; \ + } \ +} + +#define GLINT_WAIT(n) \ +do{ \ + if (card->InFifoSpace>=(n)) \ + card->InFifoSpace -= (n); \ + else { \ + int tmp; \ + while((tmp=GLINT_READ_REG(InFIFOSpace))<(n)); \ + /* Clamp value due to bugs in PM3 */ \ + if (tmp > card->FIFOSize) \ + tmp = card->FIFOSize; \ + card->InFifoSpace = tmp - (n); \ + } \ +}while(0) + +#define CHECKCLIPPING \ +{ \ + if (card->ClippingOn) { \ + card->ClippingOn = FALSE; \ + GLINT_WAIT(1); \ + GLINT_WRITE_REG(0, ScissorMode); \ + } \ +} #endif /* _PM2_H_ */ |