# Remove .o and backup files
clean:
- -rm -f *.o */*.o *~ *.o *~ *.so server/*.o
+ -rm -f *.o */*.o *~ *.o *~ *.so server/*.o server/*~
include $(TOP)/Make-config
#include "driver.h"
#include "drm.h"
+#include "imports.h"
#endif
#include "dri_util.h"
static void VIADRICloseScreen(DRIDriverContext * ctx);
static int VIADRIFinishScreenInit(DRIDriverContext * ctx);
-/* TODO XXX _SOLO temp macros */
-typedef unsigned char CARD8;
-typedef unsigned short CARD16;
+/* _SOLO : missing macros normally defined by X code */
#define xf86DrvMsg(a, b, ...) fprintf(stderr, __VA_ARGS__)
#define MMIO_IN8(base, addr) ((*(((volatile CARD8*)base)+(addr)))+0)
#define MMIO_OUT8(base, addr, val) ((*(((volatile CARD8*)base)+(addr)))=((CARD8)val))
#define MMIO_OUT16(base, addr, val) ((*(volatile CARD16*)(((CARD8*)base)+(addr)))=((CARD16)val))
-#define VGA_MISC_OUT_R 0x3cc
-#define VGA_MISC_OUT_W 0x3c2
#define VIDEO 0
#define AGP 1
#if 0
xf86DrvMsg(pScreen->myNum, X_INFO,
- "[drm] agpBase = %p\n", pVia->agpBase);
+ "[drm] agpBase = 0x%08lx\n", pVia->agpBase);
xf86DrvMsg(pScreen->myNum, X_INFO,
"[drm] agpAddr = 0x%08lx\n", pVia->agpAddr);
#endif
xf86DrvMsg(pScreen->myNum, X_INFO,
- "[drm] agpSize = 0x%08x\n", pVia->agpSize);
+ "[drm] agpSize = 0x%08lx\n", pVia->agpSize);
xf86DrvMsg(pScreen->myNum, X_INFO,
"[drm] agp physical addr = 0x%08lx\n", agp_phys);
- {
- drm_via_agp_t agp;
- agp.offset = 0;
- agp.size = AGP_SIZE;
- if (drmCommandWrite(pVia->drmFD, DRM_VIA_AGP_INIT, &agp,
- sizeof(drm_via_agp_t)) < 0)
- return FALSE;
- }
-
+ drmVIAAgpInit(pVia->drmFD, 0, AGP_SIZE);
return TRUE;
+
}
static int VIADRIFBInit(DRIDriverContext * ctx, VIAPtr pVia)
VIADRIPtr pVIADRI = pVia->devPrivate;
pVIADRI->fbOffset = FBOffset;
pVIADRI->fbSize = pVia->videoRambytes;
-
- {
- drm_via_fb_t fb;
- fb.offset = FBOffset;
- fb.size = FBSize;
-
- if (drmCommandWrite(pVia->drmFD, DRM_VIA_FB_INIT, &fb,
- sizeof(drm_via_fb_t)) < 0) {
- xf86DrvMsg(pScreen->myNum, X_ERROR,
- "[drm] failed to init frame buffer area\n");
- return FALSE;
- } else {
- xf86DrvMsg(pScreen->myNum, X_INFO,
- "[drm] FBFreeStart= 0x%08x FBFreeEnd= 0x%08x "
- "FBSize= 0x%08x\n",
- pVia->FBFreeStart, pVia->FBFreeEnd, FBSize);
- return TRUE;
- }
+
+ if (drmVIAFBInit(pVia->drmFD, FBOffset, FBSize) < 0) {
+ xf86DrvMsg(pScreen->myNum, X_ERROR,"[drm] failed to init frame buffer area\n");
+ return FALSE;
+ }
+ else {
+ xf86DrvMsg(pScreen->myNum, X_INFO,"[drm] FBFreeStart= 0x%08lx FBFreeEnd= 0x%08lx FBSize= 0x%08lx\n", pVia->FBFreeStart, pVia->FBFreeEnd, FBSize);
+ return TRUE;
}
}
fprintf(stderr, "[drm] framebuffer handle = 0x%08lx\n",
ctx->shared.hFrameBuffer);
- pVIADRI = (VIADRIPtr) calloc(1, sizeof(VIADRIRec));
+ pVIADRI = (VIADRIPtr) CALLOC(sizeof(VIADRIRec));
if (!pVIADRI) {
drmClose(ctx->drmFD);
return FALSE;
pVIADRI->regs.size = VIA_MMIO_REGSIZE;
pVIADRI->regs.map = 0;
pVIADRI->regs.handle = pVia->registerHandle;
- xf86DrvMsg(ctx->myNum, X_INFO, "[drm] mmio Registers = 0x%08lx\n",
+ xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] mmio Registers = 0x%08lx\n",
pVIADRI->regs.handle);
+
+ /*pVIADRI->drixinerama = pVia->drixinerama;*/
+ /*=* John Sheng [2003.12.9] Tuxracer & VQ *=*/
+ pVIADRI->VQEnable = pVia->VQEnable;
if (drmMap(pVia->drmFD,
pVIADRI->regs.handle,
/* Initialize the kernel data structures. */
static int VIADRIKernelInit(DRIDriverContext * ctx, VIAPtr pVia)
{
- drm_via_init_t drmInfo;
- memset(&drmInfo, 0, sizeof(drm_via_init_t));
- drmInfo.func = VIA_INIT_MAP;
+ drmVIAInit drmInfo;
+ memset(&drmInfo, 0, sizeof(drmVIAInit));
drmInfo.sarea_priv_offset = sizeof(XF86DRISAREARec);
drmInfo.fb_offset = pVia->FrameBufferBase;
drmInfo.mmio_offset = pVia->registerHandle;
else
drmInfo.agpAddr = (CARD32)pVia->agpAddr;
- if ((drmCommandWrite(pVia->drmFD, DRM_VIA_MAP_INIT,&drmInfo,
- sizeof(drm_via_init_t))) < 0)
- return FALSE;
+ if (drmVIAInitMAP(pVia->drmFD, &drmInfo) < 0) return FALSE;
return TRUE;
}
const __GLcontextModes __glModes[] =
{
- /* 32 bit, RGBA Depth=24 Stencil=8 */
+ /* 32 bit, RGBA Depth=16 Stencil=8 */
{.rgbMode = GL_TRUE, .colorIndexMode = GL_FALSE, .doubleBufferMode = GL_TRUE, .stereoMode = GL_FALSE,
.haveAccumBuffer = GL_FALSE, .haveDepthBuffer = GL_TRUE, .haveStencilBuffer = GL_TRUE,
.redBits = 8, .greenBits = 8, .blueBits = 8, .alphaBits = 8,
.rgbBits = 32, .indexBits = 0,
.accumRedBits = 0, .accumGreenBits = 0, .accumBlueBits = 0, .accumAlphaBits = 0,
.depthBits = 16, .stencilBits = 8,
- .numAuxBuffers= 0, .level = 0, .pixmapMode = GL_FALSE, },
+ .numAuxBuffers= 0, .level = 0, .pixmapMode = GL_TRUE, },
+#if 0
/* 16 bit, RGB Depth=16 */
{.rgbMode = GL_TRUE, .colorIndexMode = GL_FALSE, .doubleBufferMode = GL_TRUE, .stereoMode = GL_FALSE,
.haveAccumBuffer = GL_FALSE, .haveDepthBuffer = GL_TRUE, .haveStencilBuffer = GL_FALSE,
.rgbBits = 16, .indexBits = 0,
.accumRedBits = 0, .accumGreenBits = 0, .accumBlueBits = 0, .accumAlphaBits = 0,
.depthBits = 16, .stencilBits = 0,
- .numAuxBuffers= 0, .level = 0, .pixmapMode = GL_FALSE, },
+ .numAuxBuffers= 0, .level = 0, .pixmapMode = GL_TRUE, },
+#endif
};
static int viaInitContextModes(const DRIDriverContext *ctx,
val = VGAIN8(0x3c3);
VGAOUT8(0x3c3, val | 0x01);
- val = VGAIN8(VGA_MISC_OUT_R);
- VGAOUT8(VGA_MISC_OUT_W, val | 0x01);
+ val = VGAIN8(0x3cc);
+ VGAOUT8(0x3c2, val | 0x01);
/* Unlock Extended IO Space */
VGAOUT8(0x3c4, 0x10);
VGAOUT8(0x3c5, val | 0x38);
}
+ /* Unlock CRTC registers */
+ VGAOUT8(0x3d4, 0x47);
+ VGAOUT8(0x3d5, 0x00);
+
return;
}
static void VIADisableExtendedFIFO(DRIDriverContext *ctx)
{
VIAPtr pVia = VIAPTR(ctx);
- CARD32 dwTemp;
-
- dwTemp = (CARD32)VIAGETREG(0x298);
- dwTemp |= 0x20000000;
- VIASETREG(0x298, dwTemp);
-
- dwTemp = (CARD32)VIAGETREG(0x230);
- dwTemp &= ~0x00200000;
- VIASETREG(0x230, dwTemp);
-
- dwTemp = (CARD32)VIAGETREG(0x298);
- dwTemp &= ~0x20000000;
- VIASETREG(0x298, dwTemp);
+ CARD32 dwGE230, dwGE298;
+
+ /* Cause of exit XWindow will dump back register value, others chipset no
+ * need to set extended fifo value */
+ if (pVia->Chipset == VIA_CLE266 && pVia->ChipRev < 15 &&
+ (ctx->shared.virtualWidth > 1024 || pVia->HasSecondary)) {
+ /* Turn off Extend FIFO */
+ /* 0x298[29] */
+ dwGE298 = VIAGETREG(0x298);
+ VIASETREG(0x298, dwGE298 | 0x20000000);
+ /* 0x230[21] */
+ dwGE230 = VIAGETREG(0x230);
+ VIASETREG(0x230, dwGE230 & ~0x00200000);
+ /* 0x298[29] */
+ dwGE298 = VIAGETREG(0x298);
+ VIASETREG(0x298, dwGE298 & ~0x20000000);
+ }
}
static void VIAEnableExtendedFIFO(DRIDriverContext *ctx)
{
VIAPtr pVia = VIAPTR(ctx);
- CARD32 dwTemp;
- CARD8 bTemp;
-
- dwTemp = (CARD32)VIAGETREG(0x298);
- dwTemp |= 0x20000000;
- VIASETREG(0x298, dwTemp);
-
- dwTemp = (CARD32)VIAGETREG(0x230);
- dwTemp |= 0x00200000;
- VIASETREG(0x230, dwTemp);
-
- dwTemp = (CARD32)VIAGETREG(0x298);
- dwTemp &= ~0x20000000;
- VIASETREG(0x298, dwTemp);
-
- VGAOUT8(0x3C4, 0x17);
- bTemp = VGAIN8(0x3C5);
- bTemp &= ~0x7F;
- bTemp |= 0x2F;
- VGAOUT8(0x3C5, bTemp);
-
- VGAOUT8(0x3C4, 0x16);
- bTemp = VGAIN8(0x3C5);
- bTemp &= ~0x3F;
- bTemp |= 0x17;
- VGAOUT8(0x3C5, bTemp);
-
- VGAOUT8(0x3C4, 0x18);
- bTemp = VGAIN8(0x3C5);
- bTemp &= ~0x3F;
- bTemp |= 0x17;
- bTemp |= 0x40; /* force the preq always higher than treq */
- VGAOUT8(0x3C5, bTemp);
+ CARD8 bRegTemp;
+ CARD32 dwGE230, dwGE298;
+
+ switch (pVia->Chipset) {
+ case VIA_CLE266:
+ if (pVia->ChipRev > 14) { /* For 3123Cx */
+ if (pVia->HasSecondary) { /* SAMM or DuoView case */
+ if (ctx->shared.virtualWidth >= 1024)
+ {
+ /* 3c5.16[0:5] */
+ VGAOUT8(0x3C4, 0x16);
+ bRegTemp = VGAIN8(0x3C5);
+ bRegTemp &= ~0x3F;
+ bRegTemp |= 0x1C;
+ VGAOUT8(0x3C5, bRegTemp);
+ /* 3c5.17[0:6] */
+ VGAOUT8(0x3C4, 0x17);
+ bRegTemp = VGAIN8(0x3C5);
+ bRegTemp &= ~0x7F;
+ bRegTemp |= 0x3F;
+ VGAOUT8(0x3C5, bRegTemp);
+ pVia->EnableExtendedFIFO = TRUE;
+ }
+ }
+ else /* Single view or Simultaneoue case */
+ {
+ if (ctx->shared.virtualWidth > 1024)
+ {
+ /* 3c5.16[0:5] */
+ VGAOUT8(0x3C4, 0x16);
+ bRegTemp = VGAIN8(0x3C5);
+ bRegTemp &= ~0x3F;
+ bRegTemp |= 0x17;
+ VGAOUT8(0x3C5, bRegTemp);
+ /* 3c5.17[0:6] */
+ VGAOUT8(0x3C4, 0x17);
+ bRegTemp = VGAIN8(0x3C5);
+ bRegTemp &= ~0x7F;
+ bRegTemp |= 0x2F;
+ VGAOUT8(0x3C5, bRegTemp);
+ pVia->EnableExtendedFIFO = TRUE;
+ }
+ }
+ /* 3c5.18[0:5] */
+ VGAOUT8(0x3C4, 0x18);
+ bRegTemp = VGAIN8(0x3C5);
+ bRegTemp &= ~0x3F;
+ bRegTemp |= 0x17;
+ bRegTemp |= 0x40; /* force the preq always higher than treq */
+ VGAOUT8(0x3C5, bRegTemp);
+ }
+ else { /* for 3123Ax */
+ if (ctx->shared.virtualWidth > 1024 || pVia->HasSecondary) {
+ /* Turn on Extend FIFO */
+ /* 0x298[29] */
+ dwGE298 = VIAGETREG(0x298);
+ VIASETREG(0x298, dwGE298 | 0x20000000);
+ /* 0x230[21] */
+ dwGE230 = VIAGETREG(0x230);
+ VIASETREG(0x230, dwGE230 | 0x00200000);
+ /* 0x298[29] */
+ dwGE298 = VIAGETREG(0x298);
+ VIASETREG(0x298, dwGE298 & ~0x20000000);
+
+ /* 3c5.16[0:5] */
+ VGAOUT8(0x3C4, 0x16);
+ bRegTemp = VGAIN8(0x3C5);
+ bRegTemp &= ~0x3F;
+ bRegTemp |= 0x17;
+ /* bRegTemp |= 0x10; */
+ VGAOUT8(0x3C5, bRegTemp);
+ /* 3c5.17[0:6] */
+ VGAOUT8(0x3C4, 0x17);
+ bRegTemp = VGAIN8(0x3C5);
+ bRegTemp &= ~0x7F;
+ bRegTemp |= 0x2F;
+ /*bRegTemp |= 0x1F;*/
+ VGAOUT8(0x3C5, bRegTemp);
+ /* 3c5.18[0:5] */
+ VGAOUT8(0x3C4, 0x18);
+ bRegTemp = VGAIN8(0x3C5);
+ bRegTemp &= ~0x3F;
+ bRegTemp |= 0x17;
+ bRegTemp |= 0x40; /* force the preq always higher than treq */
+ VGAOUT8(0x3C5, bRegTemp);
+ pVia->EnableExtendedFIFO = TRUE;
+ }
+ }
+ break;
+ case VIA_KM400:
+ if (pVia->HasSecondary) { /* SAMM or DuoView case */
+ if ((ctx->shared.virtualWidth >= 1600) &&
+ (pVia->MemClk <= VIA_MEM_DDR200)) {
+ /* enable CRT extendded FIFO */
+ VGAOUT8(0x3C4, 0x17);
+ VGAOUT8(0x3C5, 0x1C);
+ /* revise second display queue depth and read threshold */
+ VGAOUT8(0x3C4, 0x16);
+ bRegTemp = VGAIN8(0x3C5);
+ bRegTemp &= ~0x3F;
+ bRegTemp = (bRegTemp) | (0x09);
+ VGAOUT8(0x3C5, bRegTemp);
+ }
+ else {
+ /* enable CRT extendded FIFO */
+ VGAOUT8(0x3C4, 0x17);
+ VGAOUT8(0x3C5,0x3F);
+ /* revise second display queue depth and read threshold */
+ VGAOUT8(0x3C4, 0x16);
+ bRegTemp = VGAIN8(0x3C5);
+ bRegTemp &= ~0x3F;
+ bRegTemp = (bRegTemp) | (0x1C);
+ VGAOUT8(0x3C5, bRegTemp);
+ }
+ /* 3c5.18[0:5] */
+ VGAOUT8(0x3C4, 0x18);
+ bRegTemp = VGAIN8(0x3C5);
+ bRegTemp &= ~0x3F;
+ bRegTemp |= 0x17;
+ bRegTemp |= 0x40; /* force the preq always higher than treq */
+ VGAOUT8(0x3C5, bRegTemp);
+ pVia->EnableExtendedFIFO = TRUE;
+ }
+ else {
+ if ( (ctx->shared.virtualWidth > 1024) && (ctx->shared.virtualWidth <= 1280) )
+ {
+ /* enable CRT extendded FIFO */
+ VGAOUT8(0x3C4, 0x17);
+ VGAOUT8(0x3C5, 0x3F);
+ /* revise second display queue depth and read threshold */
+ VGAOUT8(0x3C4, 0x16);
+ bRegTemp = VGAIN8(0x3C5);
+ bRegTemp &= ~0x3F;
+ bRegTemp = (bRegTemp) | (0x17);
+ VGAOUT8(0x3C5, bRegTemp);
+ pVia->EnableExtendedFIFO = TRUE;
+ }
+ else if ((ctx->shared.virtualWidth > 1280))
+ {
+ /* enable CRT extendded FIFO */
+ VGAOUT8(0x3C4, 0x17);
+ VGAOUT8(0x3C5, 0x3F);
+ /* revise second display queue depth and read threshold */
+ VGAOUT8(0x3C4, 0x16);
+ bRegTemp = VGAIN8(0x3C5);
+ bRegTemp &= ~0x3F;
+ bRegTemp = (bRegTemp) | (0x1C);
+ VGAOUT8(0x3C5, bRegTemp);
+ pVia->EnableExtendedFIFO = TRUE;
+ }
+ else
+ {
+ /* enable CRT extendded FIFO */
+ VGAOUT8(0x3C4, 0x17);
+ VGAOUT8(0x3C5, 0x3F);
+ /* revise second display queue depth and read threshold */
+ VGAOUT8(0x3C4, 0x16);
+ bRegTemp = VGAIN8(0x3C5);
+ bRegTemp &= ~0x3F;
+ bRegTemp = (bRegTemp) | (0x10);
+ VGAOUT8(0x3C5, bRegTemp);
+ }
+ /* 3c5.18[0:5] */
+ VGAOUT8(0x3C4, 0x18);
+ bRegTemp = VGAIN8(0x3C5);
+ bRegTemp &= ~0x3F;
+ bRegTemp |= 0x17;
+ bRegTemp |= 0x40; /* force the preq always higher than treq */
+ VGAOUT8(0x3C5, bRegTemp);
+ }
+ break;
+ case VIA_K8M800:
+ /*=* R1 Display FIFO depth (384 /8 -1 -> 0xbf) SR17[7:0] (8bits) *=*/
+ VGAOUT8(0x3c4, 0x17);
+ VGAOUT8(0x3c5, 0xbf);
+
+ /*=* R2 Display fetch datum threshold value (328/4 -> 0x52)
+ SR16[5:0], SR16[7] (7bits) *=*/
+ VGAOUT8(0x3c4, 0x16);
+ bRegTemp = VGAIN8(0x3c5) & ~0xBF;
+ bRegTemp |= (0x52 & 0x3F);
+ bRegTemp |= ((0x52 & 0x40) << 1);
+ VGAOUT8(0x3c5, bRegTemp);
+
+ /*=* R3 Switch to the highest agent threshold value (74 -> 0x4a)
+ SR18[5:0], SR18[7] (7bits) *=*/
+ VGAOUT8(0x3c4, 0x18);
+ bRegTemp = VGAIN8(0x3c5) & ~0xBF;
+ bRegTemp |= (0x4a & 0x3F);
+ bRegTemp |= ((0x4a & 0x40) << 1);
+ VGAOUT8(0x3c5, bRegTemp);
+#if 0
+ /*=* R4 Fetch Number for a scan line (unit: 8 bytes)
+ SR1C[7:0], SR1D[1:0] (10bits) *=*/
+ wRegTemp = (pBIOSInfo->offsetWidthByQWord >> 1) + 4;
+ VGAOUT8(0x3c4, 0x1c);
+ VGAOUT8(0x3c5, (CARD8)(wRegTemp & 0xFF));
+ VGAOUT8(0x3c4, 0x1d);
+ bRegTemp = VGAIN8(0x3c5) & ~0x03;
+ VGAOUT8(0x3c5, bRegTemp | ((wRegTemp & 0x300) >> 8));
+#endif
+ if (ctx->shared.virtualWidth >= 1400 && ctx->bpp == 32)
+ {
+ /*=* Max. length for a request SR22[4:0] (64/4 -> 0x10) *=*/
+ VGAOUT8(0x3c4, 0x22);
+ bRegTemp = VGAIN8(0x3c5) & ~0x1F;
+ VGAOUT8(0x3c5, bRegTemp | 0x10);
+ }
+ else
+ {
+ /*=* Max. length for a request SR22[4:0]
+ (128/4 -> over flow 0x0) *=*/
+ VGAOUT8(0x3c4, 0x22);
+ bRegTemp = VGAIN8(0x3c5) & ~0x1F;
+ VGAOUT8(0x3c5, bRegTemp);
+ }
+ break;
+ case VIA_PM800:
+ /*=* R1 Display FIFO depth (96-1 -> 0x5f) SR17[7:0] (8bits) *=*/
+ VGAOUT8(0x3c4, 0x17);
+ VGAOUT8(0x3c5, 0x5f);
+
+ /*=* R2 Display fetch datum threshold value (32 -> 0x20)
+ SR16[5:0], SR16[7] (7bits) *=*/
+ VGAOUT8(0x3c4, 0x16);
+ bRegTemp = VGAIN8(0x3c5) & ~0xBF;
+ bRegTemp |= (0x20 & 0x3F);
+ bRegTemp |= ((0x20 & 0x40) << 1);
+ VGAOUT8(0x3c5, bRegTemp);
+
+ /*=* R3 Switch to the highest agent threshold value (16 -> 0x10)
+ SR18[5:0], SR18[7] (7bits) *=*/
+ VGAOUT8(0x3c4, 0x18);
+ bRegTemp = VGAIN8(0x3c5) & ~0xBF;
+ bRegTemp |= (0x10 & 0x3F);
+ bRegTemp |= ((0x10 & 0x40) << 1);
+ VGAOUT8(0x3c5, bRegTemp);
+#if 0
+ /*=* R4 Fetch Number for a scan line (unit: 8 bytes)
+ SR1C[7:0], SR1D[1:0] (10bits) *=*/
+ wRegTemp = (pBIOSInfo->offsetWidthByQWord >> 1) + 4;
+ VGAOUT8(0x3c4, 0x1c);
+ VGAOUT8(0x3c5, (CARD8)(wRegTemp & 0xFF));
+ VGAOUT8(0x3c4, 0x1d);
+ bRegTemp = VGAIN8(0x3c5) & ~0x03;
+ VGAOUT8(0x3c5, bRegTemp | ((wRegTemp & 0x300) >> 8));
+#endif
+ if (ctx->shared.virtualWidth >= 1400 && ctx->bpp == 32)
+ {
+ /*=* Max. length for a request SR22[4:0] (64/4 -> 0x10) *=*/
+ VGAOUT8(0x3c4, 0x22);
+ bRegTemp = VGAIN8(0x3c5) & ~0x1F;
+ VGAOUT8(0x3c5, bRegTemp | 0x10);
+ }
+ else
+ {
+ /*=* Max. length for a request SR22[4:0] (0x1F) *=*/
+ VGAOUT8(0x3c4, 0x22);
+ bRegTemp = VGAIN8(0x3c5) & ~0x1F;
+ VGAOUT8(0x3c5, bRegTemp | 0x1F);
+ }
+ break;
+ default:
+ break;
+ }
}
static void VIAInitialize2DEngine(DRIDriverContext *ctx)
VIASETREG(0x3c, 0x0);
VIASETREG(0x40, 0x0);
+ VIADisableMMIO(ctx);
+
/* Init AGP and VQ regs */
VIASETREG(0x43c, 0x00100000);
VIASETREG(0x440, 0x00000000);
break;
}
#endif
+
+ VIAEnableMMIO(ctx);
/* Set BPP and Pitch */
VIASETREG(VIA_REG_GEMODE, dwGEMode);
(((ctx->shared.virtualWidth * ctx->bpp >> 3) >> 3) << 16));
}
+static int b3DRegsInitialized = 0;
+
static void VIAInitialize3DEngine(DRIDriverContext *ctx)
{
VIAPtr pVia = VIAPTR(ctx);
int i;
- if (!pVia->sharedData->b3DRegsInitialized)
+ if (!b3DRegsInitialized)
{
VIASETREG(0x43C, 0x00010000);
VIASETREG(0x440,0x52000000);
VIASETREG(0x440,0x53000000);
- pVia->sharedData->b3DRegsInitialized = 1;
+ b3DRegsInitialized = 1;
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"3D Engine has been initialized.\n");
}
VIASETREG(0x440,0x20000000);
}
+static int
+WaitIdleCLE266(VIAPtr pVia)
+{
+ int loop = 0;
+
+ /*mem_barrier();*/
+
+ while (!(VIAGETREG(VIA_REG_STATUS) & VIA_VR_QUEUE_BUSY) && (loop++ < MAXLOOP))
+ ;
+
+ while ((VIAGETREG(VIA_REG_STATUS) &
+ (VIA_CMD_RGTR_BUSY | VIA_2D_ENG_BUSY | VIA_3D_ENG_BUSY)) &&
+ (loop++ < MAXLOOP))
+ ;
+
+ return loop >= MAXLOOP;
+}
+
static int viaInitFBDev(DRIDriverContext *ctx)
{
- VIAPtr pVia = calloc(1, sizeof(*pVia));
+ VIAPtr pVia = CALLOC(sizeof(*pVia));
ctx->driverPrivate = (void *)pVia;
- pVia->Chipset = ctx->chipset;
+ switch (ctx->chipset) {
+ case PCI_CHIP_CLE3122:
+ case PCI_CHIP_CLE3022:
+ pVia->Chipset = VIA_CLE266;
+ break;
+ case PCI_CHIP_VT7205:
+ case PCI_CHIP_VT3205:
+ pVia->Chipset = VIA_KM400;
+ break;
+ case PCI_CHIP_VT3204:
+ pVia->Chipset = VIA_K8M800;
+ break;
+ case PCI_CHIP_VT3259:
+ pVia->Chipset = VIA_PM800;
+ break;
+ default:
+ xf86DrvMsg(0, X_ERROR, "VIA: Unknown device ID (0x%x)\n", ctx->chipset);
+ }
+
+ /* _SOLO TODO XXX need to read ChipRev too */
+ pVia->ChipRev = 0;
pVia->videoRambytes = ctx->shared.fbSize;
pVia->MmioBase = ctx->MMIOStart;
ctx->shared.virtualHeight;
pVia->FBFreeEnd = pVia->videoRambytes;
- pVia->sharedData = (ViaSharedPtr) calloc(1, sizeof(ViaSharedRec));
-
if (!VIADRIScreenInit(ctx))
return 0;
VIAEnableMMIO(ctx);
+ /* Get video memory clock. */
+ VGAOUT8(0x3D4, 0x3D);
+ pVia->MemClk = (VGAIN8(0x3D5) & 0xF0) >> 4;
+ xf86DrvMsg(0, X_INFO, "[dri] MemClk (0x%x)\n", pVia->MemClk);
+
/* 3D rendering has noise if not enabled. */
VIAEnableExtendedFIFO(ctx);
VIAInitialize2DEngine(ctx);
- VIAInitialize3DEngine(ctx);
/* Must disable MMIO or 3D won't work. */
VIADisableMMIO(ctx);
+ VIAInitialize3DEngine(ctx);
+
return 1;
}
* DEALINGS IN THE SOFTWARE.
*/
-#ifndef _VIA_DRIVER_H_
-#define _VIA_DRIVER_H_ 1
+#ifndef _VIA_DRIVER_H
+#define _VIA_DRIVER_H
#if 0 /* DEBUG is use in VIA DRI code as a flag */
/* #define DEBUG_PRINT */
#include "via_dri.h"
#endif
#else
-#include "via_priv.h"
#include "via_regs.h"
#include "sarea.h"
#include "via_dri.h"
#endif
+typedef unsigned char CARD8;
+typedef unsigned short CARD16;
+typedef enum Bool { FALSE, TRUE } Bool;
+
+/* _SOLO : copied from via_bios.h */
+/* System Memory CLK */
+#define VIA_MEM_SDR66 0x00
+#define VIA_MEM_SDR100 0x01
+#define VIA_MEM_SDR133 0x02
+#define VIA_MEM_DDR200 0x03
+#define VIA_MEM_DDR266 0x04
+#define VIA_MEM_DDR333 0x05
+#define VIA_MEM_DDR400 0x06
+
#define DRIVER_NAME "via"
#define DRIVER_VERSION "4.1.0"
#define VERSION_MAJOR 4
#define VERSION_MINOR 1
-#define PATCHLEVEL 30
+#define PATCHLEVEL 41
#define VIA_VERSION ((VERSION_MAJOR<<24) | (VERSION_MINOR<<16) | PATCHLEVEL)
#define VGAIN8(addr) MMIO_IN8(pVia->MapBase+0x8000, addr)
unsigned char CR13, CR30, CR31, CR32, CR33, CR34, CR35, CR36;
unsigned char CR37, CR38, CR39, CR3A, CR40, CR41, CR42, CR43;
unsigned char CR44, CR45, CR46, CR47, CR48, CR49, CR4A;
- unsigned char CRTCRegs[68];
- unsigned char TVRegs[0xFF];
+ unsigned char CRTCRegs[83];
+ unsigned char TVRegs[0xCF];
+ unsigned char TVRegs2[0xCF];
/* unsigned char LCDRegs[0x40];*/
-} VIARegRec, *VIARegPtr;
-/*Definition for CapturePortID*/
-#define PORT0 0 /* Capture Port 0*/
-#define PORT1 1 /* Capture Port 1*/
-
-typedef struct __viaVideoControl {
- CARD32 PORTID;
- CARD32 dwCompose;
- CARD32 dwHighQVDO;
- CARD32 VideoStatus;
- CARD32 dwAction;
-#define ACTION_SET_PORTID 0
-#define ACTION_SET_COMPOSE 1
-#define ACTION_SET_HQV 2
-#define ACTION_SET_BOB 4
-#define ACTION_SET_VIDEOSTATUS 8
- Bool Cap0OnScreen1; /* True: Capture0 On Screen1 ; False: Capture0 On Screen0 */
- Bool Cap1OnScreen1; /* True: Capture1 On Screen1 ; False: Capture1 On Screen0 */
- Bool MPEGOnScreen1; /* True: MPEG On Screen1 ; False: MPEG On Screen0 */
-} VIAVideoControlRec, VIAVideoControlPtr;
-
-/*For Video HW Difference */
-#define VIA_REVISION_CLEC0 0x10
-#define VIA_REVISION_CLEC1 0x11
-#define VIA_REVISION_CLECX 0x10
-
-#define VID_HWDIFF_TRUE 0x00000001
-#define VID_HWDIFF_FALSE 0x00000000
-
-/*
- * Video HW Difference Structure
- */
-
-typedef struct __VIAHWRec
-{
- unsigned long dwThreeHQVBuffer; /* Use Three HQV Buffers*/
- unsigned long dwV3SrcHeightSetting; /* Set Video Source Width and Height*/
- unsigned long dwSupportExtendFIFO; /* Support Extand FIFO*/
- unsigned long dwHQVFetchByteUnit; /* HQV Fetch Count unit is byte*/
- unsigned long dwHQVInitPatch; /* Initialize HQV Engine 2 times*/
- unsigned long dwSupportV3Gamma; /* Support V3 Gamma */
- unsigned long dwUpdFlip; /* Set HQV3D0[15] to flip video*/
- unsigned long dwHQVDisablePatch; /* Change Video Engine Clock setting for HQV disable bug*/
- unsigned long dwSUBFlip; /* Set HQV3D0[15] to flip video for sub-picture blending*/
- unsigned long dwNeedV3Prefetch; /* V3 pre-fetch function for K8*/
- unsigned long dwNeedV4Prefetch; /* V4 pre-fetch function for K8*/
- unsigned long dwUseSystemMemory; /* Use system memory for DXVA compressed data buffers*/
- unsigned long dwExpandVerPatch; /* Patch video HW bug in expand SIM mode or same display path*/
- unsigned long dwExpandVerHorPatch; /* Patch video HW bug in expand SAMM mode or same display path*/
- unsigned long dwV3ExpireNumTune; /* Change V3 expire number setting for V3 bandwidth issue*/
- unsigned long dwV3FIFOThresholdTune; /* Change V3 FIFO, Threshold and Pre-threshold setting for V3 bandwidth issue*/
- unsigned long dwCheckHQVFIFOEmpty; /* HW Flip path, need to check HQV FIFO status */
- unsigned long dwUseMPEGAGP; /* Use MPEG AGP function*/
- unsigned long dwV3FIFOPatch; /* For CLE V3 FIFO Bug (srcWidth <= 8)*/
- unsigned long dwSupportTwoColorKey; /* Support two color key*/
- unsigned long dwCxColorSpace; /* CLE_Cx ColorSpace*/
-} VIAHWRec;
-
-/*Wait Function Structure and Flag*/
-typedef struct _WaitHWINFO
-{
- unsigned char * pjVideo; /* MMIO Address Info*/
- unsigned long dwVideoFlag; /* Video Flag*/
-}WaitHWINFO, * LPWaitHWINFO;
-
-#if 0
-/* VIA Tuners */
-typedef struct
-{
- int decoderType; /* Decoder I2C Type */
-#define SAA7108H 0
-#define SAA7113H 1
-#define SAA7114H 2
- I2CDevPtr I2C; /* Decoder I2C */
- I2CDevPtr FMI2C; /* FM Tuner I2C */
-
- /* Not yet used */
- int autoDetect; /* Autodetect mode */
- int tunerMode; /* Fixed mode */
-} ViaTunerRec, *ViaTunerPtr;
-#endif
-
-/*
- * New style overlay structure for the SubPicture overlay
- */
-
-#if 0
-typedef struct
-{
- VIAMem Memory;
- int visible:1; /* Idea is for the top bits to become a generic class */
- CARD32 width;
- CARD32 height;
- CARD32 pitch;
- CARD32 base[2]; /* Some channels have 3 so 3 for the generic unit */
- struct
- {
- CARD8 Y;
- CARD8 Cb;
- CARD8 Cr;
- } palette[16];
-} ViaSubPictureRecord;
-
-typedef struct
-{
- VIAMem Memory;
- int visible:1; /* Visible */
- CARD32 width;
- CARD32 height;
- CARD32 pitch;
- CARD32 base[3];
- int Channel;
- int HQV; /* Own HQV */
-} ViaTVRecord;
-
-typedef struct
-{
- VIAMem Memory;
- CARD32 base[3];
- int Busy;
-} ViaHQVRecord;
-#endif
-
-/*
- * Variables that need to be shared among different screens.
- */
-typedef struct {
- Bool b3DRegsInitialized;
-} ViaSharedRec, *ViaSharedPtr;
+} VIARegRec, *VIARegPtr;
typedef struct _VIA {
VIARegRec SavedReg;
VIARegRec ModeReg;
- //xf86CursorInfoPtr CursorInfoRec;
+#if 0
+ xf86CursorInfoPtr CursorInfoRec;
+ int stateMode;
+ VIAModeInfoPtr VIAModeList;
+#endif
Bool ModeStructInit;
int Bpp, Bpl, ScissB;
unsigned PlaneMask;
unsigned char* MapBaseDense;
unsigned char* FBBase;
unsigned char* FBStart;
-
- /* Private memory pool management */
- int SWOVUsed[MEM_BLOCKS]; /* Free map for SWOV pool */
- unsigned long SWOVPool; /* Base of SWOV pool */
- unsigned long SWOVSize; /* Size of SWOV blocks */
Bool PrimaryVidMapped;
int dacSpeedBpp;
Bool NoDDCValue;
int rotate;
- //CloseScreenProcPtr CloseScreen;
- //pciVideoPtr PciInfo;
- //PCITAG PciTag;
+#if 0
+ CloseScreenProcPtr CloseScreen;
+ pciVideoPtr PciInfo;
+ PCITAG PciTag;
+#endif
int Chipset;
int ChipId;
int ChipRev;
- //vbeInfoPtr pVbe;
+ /*vbeInfoPtr pVbe;*/
int EntityIndex;
/* Support for shadowFB and rotation */
void (*PointerMoved)(int index, int x, int y);
/* Support for XAA acceleration */
- //XAAInfoRecPtr AccelInfoRec;
- //xRectangle Rect;
+#if 0
+ XAAInfoRecPtr AccelInfoRec;
+ xRectangle Rect;
+#endif
CARD32 SavedCmd;
CARD32 SavedFgColor;
CARD32 SavedBgColor;
CARD32 SavedPattern1;
CARD32 SavedPatternAddr;
+#if 0
/* Support for Int10 processing */
- //xf86Int10InfoPtr pInt10;
+ xf86Int10InfoPtr pInt10;
/* BIOS Info Ptr */
- //VIABIOSInfoPtr pBIOSInfo;
+ VIABIOSInfoPtr pBIOSInfo;
+ VGABIOSVERPtr pBIOSVer;
+#endif
/* Support for DGA */
int numDGAModes;
- //DGAModePtr DGAModes;
+ /*DGAModePtr DGAModes;*/
Bool DGAactive;
int DGAViewportStatus;
- int DGAOldDisplayWidth;
- int DGAOldBitsPerPixel;
- int DGAOldDepth;
+
/* The various wait handlers. */
int (*myWaitIdle)(struct _VIA*);
+#if 0
/* I2C & DDC */
- //I2CBusPtr I2C_Port1;
- //I2CBusPtr I2C_Port2;
- //xf86MonPtr DDC1;
- //xf86MonPtr DDC2;
+ I2CBusPtr I2C_Port1;
+ I2CBusPtr I2C_Port2;
+ xf86MonPtr DDC1;
+ xf86MonPtr DDC2;
+#endif
/* MHS */
Bool IsSecondary;
Bool HasSecondary;
- /* Capture de-interlace Mode */
+#if 0
+ /* Capture information */
+ VIACAPINFO CapInfo[2]; /* 2 capture information */
+#endif
+
+/*
CARD32 Cap0_Deinterlace;
CARD32 Cap1_Deinterlace;
Bool Cap0_FieldSwap;
-
+ Bool NoCap0_HFilter;
+ Bool Capture_OverScanOff;
+ Bool NoMPEGHQV_VFilter;
+*/
#ifdef XF86DRI
Bool directRenderingEnabled;
DRIInfoPtr pDRIInfo;
VIAConfigPrivPtr pVisualConfigsPriv;
unsigned long agpHandle;
unsigned long registerHandle;
- unsigned long agpAddr;
+ CARD32 agpAddr;
unsigned char *agpBase;
unsigned int agpSize;
Bool IsPCI;
unsigned int agpSize;
Bool IsPCI;
#endif
- Bool OldDRI; /* True if DRM < 2.0 found */
-
- unsigned char ActiveDevice; /* if SAMM, non-equal pBIOSInfo->ActiveDevice */
- unsigned char *CursorImage;
- CARD32 CursorFG;
- CARD32 CursorBG;
- CARD32 CursorMC;
-#if 0
- /* Video */
- swovRec swov;
- VIAVideoControlRec Video;
- VIAHWRec ViaHW;
- unsigned long dwV1, dwV3;
- unsigned long OverlaySupported;
- unsigned long dwFrameNum;
-
- pointer VidReg;
- unsigned long gdwVidRegCounter;
- unsigned long old_dwUseExtendedFIFO;
-
- /* Overlay TV Tuners */
- ViaTunerPtr Tuner[2];
- I2CDevPtr CXA2104S;
- int AudioMode;
- int AudioMute;
-#endif
+ Bool V4LEnabled;
+ CARD16 ActiveDevice; /* if SAMM, non-equal pBIOSInfo->ActiveDevice */
+ unsigned char *CursorImage;
+ CARD32 CursorFG;
+ CARD32 CursorBG;
+ CARD32 CursorMC;
- /* SubPicture */
- //ViaSubPictureRecord SubPicture;
- //ViaHQVRecord HQV;
- //ViaTVRecord TV0, TV1;
-
- /* TODO: MPEG TV0 TV1 */
-
- /* Global 2D state block - needs to slowly die */
- //ViaGraphicRec graphicInfo;
- ViaSharedPtr sharedData;
-
- VIADRIPtr devPrivate;
+ unsigned char MemClk;
+ Bool EnableExtendedFIFO;
+ VIADRIPtr devPrivate;
} VIARec, *VIAPtr;
-#if 0
-typedef struct
-{
- Bool IsDRIEnabled;
-
- Bool HasSecondary;
- Bool BypassSecondary;
- /*These two registers are used to make sure the CRTC2 is
- retored before CRTC_EXT, otherwise it could lead to blank screen.*/
- Bool IsSecondaryRestored;
- Bool RestorePrimary;
-
- ScrnInfoPtr pSecondaryScrn;
- ScrnInfoPtr pPrimaryScrn;
-}VIAEntRec, *VIAEntPtr;
-#endif
-
-
/* Shortcuts. These depend on a local symbol "pVia". */
#define WaitIdle() pVia->myWaitIdle(pVia)
#define VIAPTR(p) ((VIAPtr)((p)->driverPrivate))
+#endif /* _VIA_DRIVER_H */
-#if 0
-/* Prototypes. */
-void VIAAdjustFrame(int scrnIndex, int y, int x, int flags);
-Bool VIASwitchMode(int scrnIndex, DisplayModePtr mode, int flags);
-
-/* In HwDiff.c */
-void VIAvfInitHWDiff(VIAPtr pVia );
-
-/* In via_cursor.c. */
-Bool VIAHWCursorInit(ScreenPtr pScreen);
-void VIAShowCursor(ScrnInfoPtr);
-void VIAHideCursor(ScrnInfoPtr);
-
-
-/* In via_accel.c. */
-Bool VIAInitAccel(ScreenPtr);
-void VIAInitialize2DEngine(ScrnInfoPtr);
-void VIAAccelSync(ScrnInfoPtr);
-void VIAInitLinear(ScreenPtr pScreen);
-
-
-/* In via_shadow.c */
-void VIAPointerMoved(int index, int x, int y);
-void VIARefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox);
-void VIARefreshArea8(ScrnInfoPtr pScrn, int num, BoxPtr pbox);
-void VIARefreshArea16(ScrnInfoPtr pScrn, int num, BoxPtr pbox);
-void VIARefreshArea24(ScrnInfoPtr pScrn, int num, BoxPtr pbox);
-void VIARefreshArea32(ScrnInfoPtr pScrn, int num, BoxPtr pbox);
-
-
-/* In via_bios.c */
-void VIAEnableLCD(VIABIOSInfoPtr pBIOSInfo);
-void VIADisableLCD(VIABIOSInfoPtr pBIOSInfo);
-
-/* In via_dga.c */
-Bool VIADGAInit(ScreenPtr);
-
-/* In via_i2c.c */
-Bool VIAI2CInit(ScrnInfoPtr pScrn);
-
-/* In via_gpioi2c.c */
-Bool VIAGPIOI2C_Write(VIABIOSInfoPtr pBIOSInfo, int SubAddress, CARD8 Data);
-Bool VIAGPIOI2C_Read(VIABIOSInfoPtr pBIOSInfo, int SubAddress, CARD8 *Buffer, int BufferLen);
-Bool VIAGPIOI2C_ReadByte(VIABIOSInfoPtr pBIOSInfo, int SubAddress, CARD8 *Buffer);
-Bool VIAGPIOI2C_Initial(VIABIOSInfoPtr pBIOSInfo, CARD8 SlaveDevice);
-
-/*In via_video.c*/
-void viaInitVideo(ScreenPtr pScreen);
-void viaExitVideo(ScrnInfoPtr pScrn);
-void viaResetVideo(ScrnInfoPtr pScrn);
-void viaSaveVideo(ScrnInfoPtr pScrn);
-void viaRestoreVideo(ScrnInfoPtr pScrn);
-
-/*In via_utility.c */
-void VIAXVUtilityProc(ScrnInfoPtr pScrn, unsigned char* buf);
-Bool VIAUTGetInfo(VIABIOSInfoPtr pBIOSInfo);
-Bool VIALoadUserSetting(VIABIOSInfoPtr pBIOSInfo);
-Bool VIALoadGammaSetting(VIABIOSInfoPtr pBIOSInfo);
-Bool VIARestoreUserSetting(VIABIOSInfoPtr pBIOSInfo);
-void VIAUTRemoveRestartFlag(VIABIOSInfoPtr pBIOSInfo);
-
-/* in via_overlay.c */
-unsigned long viaOverlayHQVCalcZoomHeight (VIAPtr pVia, unsigned long srcHeight,unsigned long dstHeight,
- unsigned long * lpzoomCtl, unsigned long * lpminiCtl, unsigned long * lpHQVfilterCtl, unsigned long * lpHQVminiCtl,unsigned long * lpHQVzoomflag);
-unsigned long viaOverlayGetSrcStartAddress (VIAPtr pVia, unsigned long dwVideoFlag,RECTL rSrc,RECTL rDest, unsigned long dwSrcPitch,LPDDPIXELFORMAT lpDPF,unsigned long * lpHQVoffset );
-void viaOverlayGetDisplayCount(VIAPtr pVIa, unsigned long dwVideoFlag,LPDDPIXELFORMAT lpDPF,unsigned long dwSrcWidth,unsigned long * lpDisplayCountW);
-unsigned long viaOverlayHQVCalcZoomWidth(VIAPtr pVia, unsigned long dwVideoFlag, unsigned long srcWidth , unsigned long dstWidth,
- unsigned long * lpzoomCtl, unsigned long * lpminiCtl, unsigned long * lpHQVfilterCtl, unsigned long * lpHQVminiCtl,unsigned long * lpHQVzoomflag);
-void viaOverlayGetV1Format(VIAPtr pVia, unsigned long dwVideoFlag,LPDDPIXELFORMAT lpDPF, unsigned long * lpdwVidCtl,unsigned long * lpdwHQVCtl );
-void viaOverlayGetV3Format(VIAPtr pVia, unsigned long dwVideoFlag,LPDDPIXELFORMAT lpDPF, unsigned long * lpdwVidCtl,unsigned long * lpdwHQVCtl );
-
-/* In via_memory.c */
-void VIAFreeLinear(VIAMemPtr);
-unsigned long VIAAllocLinear(VIAMemPtr, ScrnInfoPtr, unsigned long);
-void VIAInitPool(VIAPtr, unsigned long, unsigned long);
-
-/* In via_tuner.c */
-void ViaTunerStandard(ViaTunerPtr, int);
-void ViaTunerBrightness(ViaTunerPtr, int);
-void ViaTunerContrast(ViaTunerPtr, int);
-void ViaTunerHue(ViaTunerPtr, int);
-void ViaTunerLuminance(ViaTunerPtr, int);
-void ViaTunerSaturation(ViaTunerPtr, int);
-void ViaTunerInput(ViaTunerPtr, int);
-#define MODE_TV 0
-#define MODE_SVIDEO 1
-#define MODE_COMPOSITE 2
-
-void ViaTunerChannel(ViaTunerPtr, int, int);
-void ViaAudioSelect(VIAPtr pVia, int tuner);
-void ViaAudioInit(VIAPtr pVia);
-void ViaAudioMode(VIAPtr pVia, int mode);
-void ViaAudioMute(VIAPtr pVia, int mute);
-void ViaTunerProbe(ScrnInfoPtr pScrn);
-void ViaTunerDestroy(ScrnInfoPtr pScrn);
-
-/* In via_lib.c */
-int VIACLECXChipset(VIAPtr pVia);
-void VIASetColorspace(VIAPtr pVia, int check_secondary);
-void VIAYUVFillBlack(VIAPtr pVia, int offset, int pixels);
-
-/* In via_subp.c */
-unsigned long VIACreateSubPictureSurface(ScrnInfoPtr pScrn, CARD32 width, CARD32 height);
-void VIADestroySubPictureSurface(ScrnInfoPtr pScrn);
-void VIASubPicturePalette(ScrnInfoPtr pScrn);
-void VIASubPictureStart(ScrnInfoPtr pScrn, int frame);
-void VIASubPictureStop(ScrnInfoPtr pScrn);
-
-/* In via_tv0.c */
-unsigned long VIACreateTV0Surface(ScrnInfoPtr pScrn, CARD32 width, CARD32 height);
-void VIADestroyTV0Surface(ScrnInfoPtr pScrn);
-#endif
-
-#endif /* _VIA_DRIVER_H_ */
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/via/via_regs.h,v 1.3 2003/08/27 15:16:13 tsi Exp $ */
/*
* Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
* Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
*
************************************************************************/
-#ifndef _VIA_REGS_H_
-#define _VIA_REGS_H_ 1
+#ifndef _VIA_REGS_H
+#define _VIA_REGS_H
#include "via_driver.h"
-#define VIA_SERIES(chip) (chip == VIA_CLE266)
+/*#define VIA_SERIES(chip) (chip == VIA_CLE266)*/
/* Chip tags. These are used to group the adapters into
VIA_CLE266,
VIA_KM400,
VIA_K8M800,
+ VIA_PM800,
VIA_LAST
};
#define PCI_CHIP_CLE3022 0x3022
#define PCI_CHIP_VT3205 0x3205
#define PCI_CHIP_VT7205 0x7205
-#define PCI_CHIP_VT3204 0x3204
-#define PCI_CHIP_VT7204 0x7204
+#define PCI_CHIP_VT3204 0x3108
+#define PCI_CHIP_VT3259 0x3118
#define BIOS_BSIZE 1024
#define VIAGETREG(addr) *(volatile unsigned int *)(pVia->MapBase + (addr))
-#endif /* _VIA_REGS_H_ */
+#endif /* _VIA_REGS_H */
#define VIA_TEX_SETUP_SIZE 8
-#define DRM_VIA_ALLOCMEM 0
-#define DRM_VIA_FREEMEM 1
-#define DRM_VIA_AGP_INIT 2
-#define DRM_VIA_FB_INIT 3
-#define DRM_VIA_MAP_INIT 4
-
#define VIA_FRONT 0x1
#define VIA_BACK 0x2
#define VIA_DEPTH 0x4
#include "glheader.h"
#include "context.h"
-/*#include "mem.h"*/
#include "matrix.h"
#include "simple_list.h"
#include "extensions.h"
viaDestroyContext(__DRIcontextPrivate *driContextPriv)
{
viaContextPtr vmesa = (viaContextPtr)driContextPriv->driverPrivate;
+ /*=* John Sheng [2003.12.9] Tuxracer & VQ *=*/
+ __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv;
+ viaScreenPrivate *viaScreen = (viaScreenPrivate *)sPriv->private;
#ifdef DEBUG
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
#endif
assert(vmesa); /* should never be null */
viaFlushPrimsLocked(vmesa);
WAIT_IDLE
+ /*=* John Sheng [2003.12.9] Tuxracer & VQ *=*/
+ /* Enable VQ */
+ if (viaScreen->VQEnable) {
+ *vmesa->regTranSet = 0x00fe0000;
+ *vmesa->regTranSet = 0x00fe0000;
+ *vmesa->regTranSpace = 0x00000006;
+ *vmesa->regTranSpace = 0x40008c0f;
+ *vmesa->regTranSpace = 0x44000000;
+ *vmesa->regTranSpace = 0x45080c04;
+ *vmesa->regTranSpace = 0x46800408;
+ }
if (vmesa) {
/*=* John Sheng [2003.5.31] flip *=*/
if(vmesa->doPageFlip) {
GLuint side = 0;
__DRIdrawablePrivate *dPriv = vmesa->driDrawable;
- GLuint destMask = vmesa->glCtx->Color._DrawDestMask;
- if (destMask & FRONT_LEFT_BIT)
+ switch (vmesa->glCtx->Color._DrawDestMask) {
+ case __GL_FRONT_BUFFER_MASK:
viaXMesaSetFrontClipRects(vmesa);
- if (destMask & BACK_LEFT_BIT)
+ break;
+ case __GL_BACK_BUFFER_MASK:
viaXMesaSetBackClipRects(vmesa);
+ break;
+ default:
+ break;
+ }
#ifdef _SOLO
vmesa->viaScreen->fbOffset = 0;
DRM_UNLOCK(psp->fd, &psp->pSAREA->lock,
pdp->driContextPriv->hHWContext);
DRM_SPINLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID);
-#ifdef _SOLO
__driUtilUpdateDrawableInfo(dPriv);
-#else
- __driUtilUpdateDrawableInfo(vmesa->display, psp->myNum, dPriv);
-#endif
DRM_SPINUNLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID);
DRM_LIGHT_LOCK(psp->fd, &psp->pSAREA->lock,
pdp->driContextPriv->hHWContext);
DRM_SPINLOCK(&sPriv->pSAREA->drawable_lock, sPriv->drawLockID);
-#ifdef _SOLO
- __driUtilUpdateDrawableInfo(dPriv);
-#else
if (scrn == S1)
- __driUtilUpdateDrawableInfo(vmesa->display, scrn, dPriv);
+ __driUtilUpdateDrawableInfo(dPriv);
else
- DRI_VALIDATE_DRAWABLE_INFO_ONCE(vmesa->display, scrn, dPriv);
-#endif
+ DRI_VALIDATE_DRAWABLE_INFO_ONCE(dPriv);
viaXMesaWindowMoved(vmesa);
DRM_SPINUNLOCK(&sPriv->pSAREA->drawable_lock, sPriv->drawLockID);
vmesa = (viaContextPtr)dPriv->driContextPriv->driverPrivate;
ctx = vmesa->glCtx;
if (ctx->Visual.doubleBufferMode) {
-#ifdef _SOLO
_mesa_notifySwapBuffers(ctx);
-#else
- _mesa_swapbuffers(ctx);
-#endif
if (vmesa->doPageFlip) {
viaPageFlip(dPriv);
}
/* Hardware state
*/
GLuint dirty;
- int vertex_size;
- int vertex_stride_shift;
+ int vertexSize;
+ int vertexStrideShift;
GLint lastStamp;
GLboolean stippleInHw;
volatile GLuint* regTranSpace;
GLuint* agpBase;
GLuint drawType;
+ /*=* John Sheng [2003.12.9] Tuxracer & VQ *=*/
+ int VQEnable;
};
/*#define DMA_OFFSET 16*/
#define DMA_OFFSET 32
/* TODO XXX _SOLO temp defines to make code compilable */
#ifndef GLX_PBUFFER_BIT
-#define GLX_PBUFFER_BIT 0x00000004
+#define GLX_PBUFFER_BIT 0x00000004
#endif
#ifndef GLX_WINDOW_BIT
-#define GLX_WINDOW_BIT 0x00000001
+#define GLX_WINDOW_BIT 0x00000001
#endif
-#ifndef VERT_CLIP
-#define VERT_CLIP 0x1000000
+#ifndef VERT_BIT_CLIP
+#define VERT_BIT_CLIP 0x1000000
#endif
-#ifndef VERT_RGBA
-#define VERT_RGBA 0x2
-#endif
-#ifndef PRIM_PARITY
-#define PRIM_PARITY 0x400
-#endif
-#ifndef PRIM_LAST
-#define PRIM_LAST 0x800
-#endif
-#ifndef VERT_TEX
-#define VERT_TEX _TNL_BIT_TEX
-#endif
-
-typedef enum Bool { FALSE, TRUE } Bool;
#endif
else {
GLfloat *vbindex = (GLfloat*) VB->IndexPtr[1]->data;
if (!DO_FLAT) {
- //VERT_SAVE_IND( 0 );
- //VERT_SAVE_IND( 1 );
+ VERT_SAVE_IND( 0 );
+ VERT_SAVE_IND( 1 );
VERT_SET_IND(v[0], vbindex[e0]);
VERT_SET_IND(v[1], vbindex[e1]);
}
- //VERT_SAVE_IND( 2 );
+ VERT_SAVE_IND( 2 );
VERT_SET_IND(v[2], vbindex[e2]);
}
}
}
}
else {
-#if 0 // XXX TODO _SOLO
- GLuint *vbindex = VB->IndexPtr[0]->data;
- if (!DO_FLAT) {
- VERT_SET_IND(v[0], vbindex[e0]);
- VERT_SET_IND(v[1], vbindex[e1]);
- }
- VERT_SET_IND(v[2], vbindex[e2]);
-#else
if (!DO_FLAT) {
VERT_RESTORE_IND( 0 );
VERT_RESTORE_IND( 1 );
}
VERT_RESTORE_IND( 2 );
-#endif
}
}
else {
GLfloat *vbindex = (GLfloat*) VB->IndexPtr[1]->data;
if (!DO_FLAT) {
- //VERT_SAVE_IND( 0 );
- //VERT_SAVE_IND( 1 );
- //VERT_SAVE_IND( 2 );
+ VERT_SAVE_IND( 0 );
+ VERT_SAVE_IND( 1 );
+ VERT_SAVE_IND( 2 );
VERT_SET_IND(v[0], vbindex[e0]);
VERT_SET_IND(v[1], vbindex[e1]);
VERT_SET_IND(v[2], vbindex[e2]);
}
- //VERT_SAVE_IND( 3 );
+ VERT_SAVE_IND( 3 );
VERT_SET_IND(v[3], vbindex[e3]);
}
}
}
}
else {
-#if 0 // XXX TODO _SOLO
- GLuint *vbindex = VB->IndexPtr[0]->data;
- if (!DO_FLAT) {
- VERT_SET_IND(v[0], vbindex[e0]);
- VERT_SET_IND(v[1], vbindex[e1]);
- VERT_SET_IND(v[2], vbindex[e2]);
- }
- VERT_SET_IND(v[3], vbindex[e3]);
-#else
if (!DO_FLAT) {
VERT_RESTORE_IND( 0 );
VERT_RESTORE_IND( 1 );
VERT_RESTORE_IND( 2 );
}
VERT_RESTORE_IND( 3 );
-#endif
}
}
(void) s;
- //ASSERT(stride == 4);
+ /*ASSERT(stride == 4);*/
#ifdef DEBUG
if (VIA_DEBUG) {
fprintf(stderr, "TAG-emit for DO_XYZW\n");
#endif
if (DO_SPEC)
- setup_tab[IND].copy_pv = copy_pv_rgba4_spec5;
+ setup_tab[IND].copyPv = copy_pv_rgba4_spec5;
else if (HAVE_HW_DIVIDE || DO_SPEC || DO_FOG || DO_TEX0 || DO_TEX1 ||
DO_TEX2 || DO_TEX3 || !HAVE_TINY_VERTICES)
- setup_tab[IND].copy_pv = copy_pv_rgba4;
+ setup_tab[IND].copyPv = copy_pv_rgba4;
else
- setup_tab[IND].copy_pv = copy_pv_rgba3;
+ setup_tab[IND].copyPv = copy_pv_rgba3;
if (DO_TEX3) {
if (DO_PTEX && HAVE_PTEX_VERTICES) {
ASSERT(HAVE_PTEX_VERTICES);
- setup_tab[IND].vertex_format = PROJ_TEX3_VERTEX_FORMAT;
- setup_tab[IND].vertex_size = 18;
- setup_tab[IND].vertex_stride_shift = 7;
+ setup_tab[IND].vertexFormat = PROJ_TEX3_VERTEX_FORMAT;
+ setup_tab[IND].vertexSize = 18;
+ setup_tab[IND].vertexStrideShift = 7;
}
else {
- setup_tab[IND].vertex_format = TEX3_VERTEX_FORMAT;
- setup_tab[IND].vertex_size = 14;
- setup_tab[IND].vertex_stride_shift = 6;
+ setup_tab[IND].vertexFormat = TEX3_VERTEX_FORMAT;
+ setup_tab[IND].vertexSize = 14;
+ setup_tab[IND].vertexStrideShift = 6;
}
}
else if (DO_TEX2) {
if (DO_PTEX && HAVE_PTEX_VERTICES) {
ASSERT(HAVE_PTEX_VERTICES);
- setup_tab[IND].vertex_format = PROJ_TEX3_VERTEX_FORMAT;
- setup_tab[IND].vertex_size = 18;
- setup_tab[IND].vertex_stride_shift = 7;
+ setup_tab[IND].vertexFormat = PROJ_TEX3_VERTEX_FORMAT;
+ setup_tab[IND].vertexSize = 18;
+ setup_tab[IND].vertexStrideShift = 7;
}
else {
- setup_tab[IND].vertex_format = TEX2_VERTEX_FORMAT;
- setup_tab[IND].vertex_size = 12;
- setup_tab[IND].vertex_stride_shift = 6;
+ setup_tab[IND].vertexFormat = TEX2_VERTEX_FORMAT;
+ setup_tab[IND].vertexSize = 12;
+ setup_tab[IND].vertexStrideShift = 6;
}
}
else if (DO_TEX1) {
if (DO_PTEX && HAVE_PTEX_VERTICES) {
ASSERT(HAVE_PTEX_VERTICES);
- setup_tab[IND].vertex_format = PROJ_TEX1_VERTEX_FORMAT;
- setup_tab[IND].vertex_size = 12;
- setup_tab[IND].vertex_stride_shift = 6;
+ setup_tab[IND].vertexFormat = PROJ_TEX1_VERTEX_FORMAT;
+ setup_tab[IND].vertexSize = 12;
+ setup_tab[IND].vertexStrideShift = 6;
}
else {
- setup_tab[IND].vertex_format = TEX1_VERTEX_FORMAT;
- setup_tab[IND].vertex_size = 10;
- setup_tab[IND].vertex_stride_shift = 6;
+ setup_tab[IND].vertexFormat = TEX1_VERTEX_FORMAT;
+ setup_tab[IND].vertexSize = 10;
+ setup_tab[IND].vertexStrideShift = 6;
}
}
else if (DO_TEX0) {
if (DO_PTEX && HAVE_PTEX_VERTICES) {
- setup_tab[IND].vertex_format = PROJ_TEX1_VERTEX_FORMAT;
- setup_tab[IND].vertex_size = 12;
- setup_tab[IND].vertex_stride_shift = 6;
+ setup_tab[IND].vertexFormat = PROJ_TEX1_VERTEX_FORMAT;
+ setup_tab[IND].vertexSize = 12;
+ setup_tab[IND].vertexStrideShift = 6;
}
else {
- setup_tab[IND].vertex_format = TEX0_VERTEX_FORMAT;
- setup_tab[IND].vertex_size = 8;
- setup_tab[IND].vertex_stride_shift = 5;
+ setup_tab[IND].vertexFormat = TEX0_VERTEX_FORMAT;
+ setup_tab[IND].vertexSize = 8;
+ setup_tab[IND].vertexStrideShift = 5;
}
}
else if (!HAVE_HW_DIVIDE && !DO_SPEC && !DO_FOG && HAVE_TINY_VERTICES) {
- setup_tab[IND].vertex_format = TINY_VERTEX_FORMAT;
- setup_tab[IND].vertex_size = 4;
- setup_tab[IND].vertex_stride_shift = 4;
+ setup_tab[IND].vertexFormat = TINY_VERTEX_FORMAT;
+ setup_tab[IND].vertexSize = 4;
+ setup_tab[IND].vertexStrideShift = 4;
}
else if (HAVE_NOTEX_VERTICES) {
- setup_tab[IND].vertex_format = NOTEX_VERTEX_FORMAT;
- setup_tab[IND].vertex_size = 6;
- setup_tab[IND].vertex_stride_shift = 5;
+ setup_tab[IND].vertexFormat = NOTEX_VERTEX_FORMAT;
+ setup_tab[IND].vertexSize = 6;
+ setup_tab[IND].vertexStrideShift = 5;
}
else {
- setup_tab[IND].vertex_format = TEX0_VERTEX_FORMAT;
- setup_tab[IND].vertex_size = 8;
- setup_tab[IND].vertex_stride_shift = 5;
+ setup_tab[IND].vertexFormat = TEX0_VERTEX_FORMAT;
+ setup_tab[IND].vertexSize = 8;
+ setup_tab[IND].vertexStrideShift = 5;
}
- assert(setup_tab[IND].vertex_size * 4 <=
- 1 << setup_tab[IND].vertex_stride_shift);
+ assert(setup_tab[IND].vertexSize * 4 <=
+ 1 << setup_tab[IND].vertexStrideShift);
}
#undef IND
currentsz = dmasz;
}
- if ((flags & PRIM_PARITY) && count - start > 2) {
- EMIT_VERTS(ctx, start, 1);
- currentsz--;
- }
-
/* From here on emit even numbers of tris when wrapping over buffers:
*/
dmasz -= (dmasz & 1);
int irqEnabled;
unsigned int scrnX, scrnY;
int sarea_priv_offset;
+ /*=* John Sheng [2003.12.9] Tuxracer & VQ *=*/
+ int VQEnable;
} VIADRIRec, *VIADRIPtr;
typedef struct {
vmesa->back.index = fb.index;
#ifdef DEBUG
if (VIA_DEBUG) {
- fprintf(stderr, "offset = %08x\n", vmesa->back.offset);
- fprintf(stderr, "index = %d\n", vmesa->back.index);
+ fprintf(stderr, "back offset = %08x\n", vmesa->back.offset);
+ fprintf(stderr, "back index = %d\n", vmesa->back.index);
}
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__);
vmesa->front.index = fb.index;
#ifdef DEBUG
if (VIA_DEBUG) {
- fprintf(stderr, "offset = %08x\n", vmesa->front.offset);
- fprintf(stderr, "index = %d\n", vmesa->front.index);
+ fprintf(stderr, "front offset = %08x\n", vmesa->front.offset);
+ fprintf(stderr, "front index = %d\n", vmesa->front.index);
}
vmesa->depth.index = fb.index;
#ifdef DEBUG
if (VIA_DEBUG) {
- fprintf(stderr, "offset = %08x\n", vmesa->depth.offset);
- fprintf(stderr, "index = %d\n", vmesa->depth.index);
+ fprintf(stderr, "depth offset = %08x\n", vmesa->depth.offset);
+ fprintf(stderr, "depth index = %d\n", vmesa->depth.index);
}
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__);
}
/* Release System command buffer */
else {
-
+ /*=* John Sheng [2003.7.18] viewperf frames/sec *=*/
+ /*dma.address = (unsigned long *)vmesa->dma[0].offset;*/
dma.address = (unsigned long *)vmesa->dma[0].map;
/*=* John Sheng [2003.6.16] fix pci path *=*/
dma.size = (unsigned int)vmesa->dma[0].size;
drmVIAReleaseDMA(vmesa->driFd, &dma);
-
+ /*=* John Sheng [2003.7.18] viewperf frames/sec *=*/
+ /*dma.address = (unsigned long *)vmesa->dma[1].offset;*/
dma.address = (unsigned long *)vmesa->dma[1].map;
/*=* John Sheng [2003.6.16] fix pci path *=*/
dma.size = (unsigned int)vmesa->dma[1].size;
drmVIAReleaseDMA(vmesa->driFd, &dma);
+ /*=* John Sheng [2003.7.18] viewperf frames/sec *=*/
+ /*vmesa->dma[0].offset = 0;
+ vmesa->dma[1].offset = 0;*/
vmesa->dma[0].map = 0;
vmesa->dma[1].map = 0;
}
#define SetReg2DAGP(nReg, nData) { \
*((GLuint *)(vb)) = ((nReg) >> 2) | 0xF0000000; \
*((GLuint *)(vb) + 1) = (nData); \
- vb += 2; \
+ vb = ((GLuint *)vb) + 2; \
vmesa->dmaLow +=8; \
}
if(vmesa->currentPage) {
vmesa->currentPage = 0;
- if (vmesa->glCtx->Color._DrawDestMask & BACK_LEFT_BIT) {
- ctx->Driver.DrawBuffer(ctx, GL_BACK_LEFT);
+ if (vmesa->glCtx->Color._DrawDestMask == __GL_BACK_BUFFER_MASK) {
+ ctx->Driver.DrawBuffer(ctx, GL_BACK);
}
else {
- ctx->Driver.DrawBuffer(ctx, GL_FRONT_LEFT);
+ ctx->Driver.DrawBuffer(ctx, GL_FRONT);
}
}
else {
vmesa->currentPage = 1;
- if (vmesa->glCtx->Color._DrawDestMask & BACK_LEFT_BIT) {
- ctx->Driver.DrawBuffer(ctx, GL_BACK_LEFT);
+ if (vmesa->glCtx->Color._DrawDestMask == __GL_BACK_BUFFER_MASK) {
+ ctx->Driver.DrawBuffer(ctx, GL_BACK);
}
else {
- ctx->Driver.DrawBuffer(ctx, GL_FRONT_LEFT);
+ ctx->Driver.DrawBuffer(ctx, GL_FRONT);
}
}
#ifdef DEBUG
}
}
- if (vmesa->glCtx->Color._DrawDestMask & BACK_LEFT_BIT) {
+ if (vmesa->glCtx->Color._DrawDestMask == __GL_BACK_BUFFER_MASK) {
viaFlushPrimsLocked(vmesa);
}
}
}
}
- if (vmesa->glCtx->Color._DrawDestMask & BACK_LEFT_BIT) {
+ if (vmesa->glCtx->Color._DrawDestMask == __GL_BACK_BUFFER_MASK) {
viaFlushPrimsLocked(vmesa);
}
}
}
}
- if (vmesa->glCtx->Color._DrawDestMask & BACK_LEFT_BIT) {
+ if (vmesa->glCtx->Color._DrawDestMask == __GL_BACK_BUFFER_MASK) {
viaFlushPrimsLocked(vmesa);
}
}
/*=* [DBG] make draw to front buffer *=*/
if(DRAW_FRONT)
- vmesa->glCtx->Color._DrawDestMask = FRONT_LEFT_BIT;
+ vmesa->glCtx->Color._DrawDestMask = __GL_FRONT_BUFFER_MASK;
- if (vmesa->glCtx->Color._DrawDestMask & BACK_LEFT_BIT) {
+ if (vmesa->glCtx->Color._DrawDestMask == __GL_BACK_BUFFER_MASK) {
*vb++ = HC_HEADER2;
*vb++ = (HC_ParaType_NotTex << 16);
}
#ifdef DEBUG
- if (VIA_DEBUG && 0/*FIXME*/) {
+ if (VIA_DEBUG) {
volatile GLuint *pnEngBase = (volatile GLuint *)((GLuint)pnMMIOBase + 0x400);
int nStatus;
int i = 0;
/*=* [DBG] make draw to front buffer *=*/
if(DRAW_FRONT)
- vmesa->glCtx->Color._DrawDestMask = FRONT_LEFT_BIT;
+ vmesa->glCtx->Color._DrawDestMask = __GL_FRONT_BUFFER_MASK;
- if (vmesa->glCtx->Color._DrawDestMask & BACK_LEFT_BIT) {
+ if (vmesa->glCtx->Color._DrawDestMask == __GL_BACK_BUFFER_MASK) {
*vb++ = HC_HEADER2;
*vb++ = (HC_ParaType_NotTex << 16);
/*=* [DBG] make draw to front buffer *=*/
if(DRAW_FRONT)
- vmesa->glCtx->Color._DrawDestMask = FRONT_LEFT_BIT;
+ vmesa->glCtx->Color._DrawDestMask = __GL_FRONT_BUFFER_MASK;
+
/*=* John Sheng [2003.6.20] fix pci *=*/
{
i++;
}
}
-
- if (vmesa->glCtx->Color._DrawDestMask & BACK_LEFT_BIT) {
+ /*=* John Sheng [2003.12.9] Tuxracer & VQ *=*/
+ /*=* Disable VQ *=*/
+ if (vmesa->VQEnable)
+ {
+ WAIT_IDLE
+ *vmesa->regTranSet = 0x00fe0000;
+ *vmesa->regTranSet = 0x00fe0000;
+ *vmesa->regTranSpace = 0x00000004;
+ *vmesa->regTranSpace = 0x40008c0f;
+ *vmesa->regTranSpace = 0x44000000;
+ *vmesa->regTranSpace = 0x45080c04;
+ *vmesa->regTranSpace = 0x46800408;
+ vmesa->VQEnable = 0;
+ }
+ if (vmesa->glCtx->Color._DrawDestMask == __GL_BACK_BUFFER_MASK) {
*vb++ = HC_HEADER2;
*vb++ = (HC_ParaType_NotTex << 16);
vb = head;
}
}
+ /*=* John Sheng [2003.6.20] debug pci *=*/
+ if (VIA_DEBUG) {
+ GLuint *pnEngBase = (GLuint *)((GLuint)pnMMIOBase + 0x400);
+ int nStatus;
+ int i = 0;
+
+ while (1) {
+ nStatus = *pnEngBase;
+ if ((nStatus & 0xFFFEFFFF) == 0x00020000) {
+ break;
+ }
+ else {
+ GLuint j;
+ GLuint *data;
+ data = (GLuint *)vmesa->dmaAddr;
+ /*=* John Sheng [2003.12.9] Tuxracer & VQ *=*/
+ GLuint k;
+ GLuint *ES;
+ ES = pnEngBase;
+
+ if (i == 500000) {
+ /*=* John Sheng [2003.12.9] Tuxracer & VQ *=*/
+ for (k =0 ; k < 35; k++) {
+ fprintf(stderr, "%02xh - %02xh\n", k*4 + 3, k*4);
+ fprintf(stderr, "%08x\n", *ES);
+ ES++;
+ }
+ fprintf(stderr, "current command buffer");
+ fprintf(stderr, "i = %d\n", i);
+ for (j = 0; j < vmesa->dmaLow; j += 16) {
+ fprintf(stderr, "%08x ", *data++);
+ fprintf(stderr, "%08x ", *data++);
+ fprintf(stderr, "%08x ", *data++);
+ fprintf(stderr, "%08x\n", *data++);
+ }
+ }
+ if (vmesa->dmaIndex) {
+ data = (GLuint *)vmesa->dma[0].map;
+ }
+ else {
+ data = (GLuint *)vmesa->dma[1].map;
+ }
+ if (i == 500000) {
+ fprintf(stderr, "previous command buffer");
+ fprintf(stderr, "i = %d\n", i);
+ for (j = 0; j < dmaLow; j += 16) {
+ fprintf(stderr, "%08x ", *data++);
+ fprintf(stderr, "%08x ", *data++);
+ fprintf(stderr, "%08x ", *data++);
+ fprintf(stderr, "%08x\n", *data++);
+ }
+ }
+ }
+ i++;
+ }
+ }
+ dmaLow = vmesa->dmaLow;
return 0;
}
#include "context.h"
#include "macros.h"
#include "mtypes.h"
-/*#include "mmath.h" _SOLO */
#include "tnl/t_context.h"
tnl->Driver.Render.BuildVertices(ctx, start, count, ~0);
tnl->Driver.Render.PrimTabVerts[flags & PRIM_MODE_MASK](ctx, start,
count, flags);
- VIA_CONTEXT(ctx)->setupNewInputs = VERT_CLIP;
+ VIA_CONTEXT(ctx)->setupNewInputs = VERT_BIT_CLIP;
#ifdef DEBUG
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__);
#endif
#define NEW_PRIMITIVE() VIA_STATECHANGE(vmesa, 0)
#define NEW_BUFFER() VIA_FIREVERTICES(vmesa)
#define GET_CURRENT_VB_MAX_VERTS() \
- (((int)vmesa->dmaHigh - (int)vmesa->dmaLow) / (vmesa->vertex_size * 4))
+ (((int)vmesa->dmaHigh - (int)vmesa->dmaLow) / (vmesa->vertexSize * 4))
#define GET_SUBSEQUENT_VB_MAX_VERTS() \
- (VIA_DMA_BUF_SZ - 4) / (vmesa->vertex_size * 4)
+ (VIA_DMA_BUF_SZ - 4) / (vmesa->vertexSize * 4)
#define EMIT_VERTS(ctx, j, nr) \
#ifdef DEBUG
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
#endif
- vmesa->setupNewInputs = VERT_CLIP;
+ vmesa->setupNewInputs = VERT_BIT_CLIP;
vmesa->primitiveRendered = GL_TRUE;
tnl->Driver.Render.Start(ctx);
static void via_check_fastrender(GLcontext *ctx, struct tnl_pipeline_stage *stage)
{
- GLuint inputs = VERT_CLIP | VERT_RGBA;
+ GLuint inputs = VERT_BIT_CLIP | VERT_BIT_COLOR0;
if (ctx->RenderMode == GL_RENDER) {
if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR)
inputs |= VERT_BIT_COLOR1;
if (ctx->Texture.Unit[0]._ReallyEnabled)
- inputs |= VERT_TEX(0);
+ inputs |= VERT_BIT_TEX0;
if (ctx->Texture.Unit[1]._ReallyEnabled)
- inputs |= VERT_TEX(1);
+ inputs |= VERT_BIT_TEX1;
if (ctx->Fog.Enabled)
inputs |= VERT_BIT_FOG;
/**********************************************************************/
/* Clip single primitives */
/**********************************************************************/
+#undef DIFFERENT_SIGNS
#if defined(USE_IEEE)
#define NEGATIVE(x) (GET_FLOAT_BITS(x) & (1 << 31))
#define DIFFERENT_SIGNS(x, y) ((GET_FLOAT_BITS(x) ^ GET_FLOAT_BITS(y)) & (1 << 31))
#define X(i) coord[i][0]
#define SIZE 4
#define TAG(x) x##_4
-#include "tnl/t_vb_cliptmp.h" /* tnl_ */
+#include "via_vb_cliptmp.h"
/**********************************************************************/
} while (0)
#define RENDER_TRI(v1, v2, v3) \
+ if (VIA_DEBUG) fprintf(stderr, "RENDER_TRI - clip\n"); \
do { \
GLubyte c1 = mask[v1], c2 = mask[v2], c3 = mask[v3]; \
GLubyte ormask = c1 | c2 | c3; \
#define RESET_STIPPLE if (stipple) tnl->Driver.Render.ResetLineStipple(ctx)
#define RESET_OCCLUSION ctx->OcclusionResult = GL_TRUE
#define PRESERVE_VB_DEFS
-#include "tnl/t_vb_rendertmp.h"
+#include "via_vb_rendertmp.h"
/* Elts, with the possibility of clipping.
#undef TAG
#define ELT(x) elt[x]
#define TAG(x) clip_##x##_elts
-#include "tnl/t_vb_rendertmp.h"
+#include "via_vb_rendertmp.h"
/* TODO: do this for all primitives, verts and elts:
*/
GLuint flags = VB->Primitive[i].mode;
GLuint start = VB->Primitive[i].start;
GLuint length= VB->Primitive[i].count;
- ASSERT(length || (flags & PRIM_LAST));
+ ASSERT(length || (flags & PRIM_END));
ASSERT((flags & PRIM_MODE_MASK) <= GL_POLYGON + 1);
if (length)
tab[flags & PRIM_MODE_MASK](ctx, start, start + length,flags);
tnl->Driver.Render.Finish(ctx);
/*=* DBG - flush : if hw idel *=*/
- {
+ /*{
GLuint volatile *pnEnginStatus = vmesa->regEngineStatus;
GLuint nStatus;
nStatus = *pnEnginStatus;
if ((nStatus & 0xFFFEFFFF) == 0x00020000)
viaFlushPrims(vmesa);
- }
+ }*/
/*=* DBG viewperf7.0 : fix command buffer overflow *=*/
if (vmesa->dmaLow > (vmesa->dma[0].size / 2))
static void via_check_render(GLcontext *ctx, struct tnl_pipeline_stage *stage)
{
- GLuint inputs = VERT_CLIP;
+ GLuint inputs = VERT_BIT_CLIP;
if (ctx->Visual.rgbMode) {
- inputs |= VERT_RGBA;
+ inputs |= VERT_BIT_COLOR0;
if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR)
inputs |= VERT_BIT_COLOR1;
if (ctx->Texture.Unit[0]._ReallyEnabled) {
- inputs |= VERT_TEX(0);
+ inputs |= VERT_BIT_TEX0;
}
if (ctx->Texture.Unit[1]._ReallyEnabled) {
- inputs |= VERT_TEX(1);
+ inputs |= VERT_BIT_TEX1;
}
}
else {
- /*inputs |= VERT_INDEX; _SOLO*/
+ /*inputs |= VERT_BIT_INDEX;*/
}
/*if (ctx->Point._Attenuated)
* DEALINGS IN THE SOFTWARE.
*/
-/*#include <X11/Xlibint.h> _SOLO*/
#include <stdio.h>
#include "utils.h"
#include "via_tris.h"
#include "via_ioctl.h"
#include "via_screen.h"
+#include "via_fb.h"
#include "via_dri.h"
extern viaContextPtr current_mesa;
#ifndef _SOLO
viaScreen->drixinerama = gDRIPriv->drixinerama;
#endif
+ /*=* John Sheng [2003.12.9] Tuxracer & VQ *=*/
+ viaScreen->VQEnable = gDRIPriv->VQEnable;
#ifdef DEBUG
if (VIA_DEBUG) {
fprintf(stderr, "deviceID = %08x\n", viaScreen->deviceID);
#ifdef DEBUG
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
#endif
-#if 0
/*=* John Sheng [2003.7.2] for visual config & patch viewperf *=*/
if (mesaVis->depthBits == 32 && vmesa->depthBits == 16) {
vmesa->depthBits = mesaVis->depthBits;
return GL_FALSE;
}
- mesaVis->depthBits = 16;
+ ((__GLcontextModes*)mesaVis)->depthBits = 16; /* XXX : sure you want to change read-only data? */
}
-#endif
if (isPixmap) {
-#ifdef _SOLO
- ASSERT(0);
- return GL_FALSE; /* not implemented */
-#else
driDrawPriv->driverPrivate = (void *)
_mesa_create_framebuffer(mesaVis,
GL_FALSE, /* software depth buffer? */
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__);
#endif
return (driDrawPriv->driverPrivate != NULL);
-#endif
}
else {
driDrawPriv->driverPrivate = (void *)
__DRIscreenPrivate *driScrnPriv;
drmBufMapPtr bufs;
unsigned int sareaPrivOffset;
+ /*=* John Sheng [2003.12.9] Tuxracer & VQ *=*/
+ int VQEnable;
} viaScreenPrivate;
extern GLboolean
#include "swrast/swrast.h"
#define DBG 0
-#if 0
#define LOCAL_VARS \
- viaContextPtr vmesa = VIA_CONTEXT(ctx); \
__DRIdrawablePrivate *dPriv = vmesa->driDrawable; \
viaScreenPrivate *viaScreen = vmesa->viaScreen; \
GLuint pitch = vmesa->drawPitch; \
dPriv->x * viaScreen->bytesPerPixel + \
dPriv->y * pitch); \
(void)read_buf; (void)buf; (void)p
-#endif
#define LOCAL_DEPTH_VARS \
- viaContextPtr vmesa = VIA_CONTEXT(ctx); \
__DRIdrawablePrivate *dPriv = vmesa->driDrawable; \
viaScreenPrivate *viaScreen = vmesa->viaScreen; \
GLuint pitch = viaScreen->backPitch; \
dPriv->x * 2 + \
dPriv->y * pitch); \
(void)read_buf; (void)buf; (void)p*/
-
+
+#undef LOCAL_VARS
#define LOCAL_VARS \
__DRIdrawablePrivate *dPriv = vmesa->driDrawable; \
GLuint pitch = vmesa->drawPitch; \
GLushort p; \
char *buf, *read_buf; \
p = 0; \
- if (vmesa->glCtx->Color._DrawDestMask & BACK_LEFT_BIT) { \
+ if (vmesa->glCtx->Color._DrawDestMask == __GL_BACK_BUFFER_MASK) { \
buf = (char *)(vmesa->drawMap); \
read_buf = (char *)(vmesa->readMap); \
} \
/*=* [DBG] csmash : fix options worng position *=*/
/*#define LOCAL_VARS \
- viaContextPtr vmesa = VIA_CONTEXT(ctx); \
__DRIdrawablePrivate *dPriv = vmesa->driDrawable; \
GLuint pitch = vmesa->drawPitch; \
GLuint height = dPriv->h; \
dPriv->y * pitch); \
(void)read_buf; (void)buf; (void)p*/
#define LOCAL_VARS \
- viaContextPtr vmesa = VIA_CONTEXT(ctx); \
__DRIdrawablePrivate *dPriv = vmesa->driDrawable; \
GLuint pitch = vmesa->drawPitch; \
GLuint height = dPriv->h; \
GLuint p; \
char *buf, *read_buf; \
p = 0; \
- if (vmesa->glCtx->Color._DrawDestMask & BACK_LEFT_BIT) { \
+ if (vmesa->glCtx->Color._DrawDestMask == __GL_BACK_BUFFER_MASK) { \
buf = (char *)(vmesa->drawMap); \
read_buf = (char *)(vmesa->readMap); \
} \
dPriv->x * 2 + \
dPriv->y * pitch) */
#define LOCAL_DEPTH_VARS \
- viaContextPtr vmesa = VIA_CONTEXT(ctx); \
__DRIdrawablePrivate *dPriv = vmesa->driDrawable; \
/*viaScreenPrivate *viaScreen = vmesa->viaScreen;*/ \
GLuint pitch = vmesa->depth.pitch; \
*/
-void viaSetBuffer(GLcontext *ctx, GLframebuffer *colorBuffer,
+static void viaSetBuffer(GLcontext *ctx, GLframebuffer *colorBuffer,
GLuint bufferBit)
{
viaContextPtr vmesa = VIA_CONTEXT(ctx);
#ifdef DEBUG
if (VIA_DEBUG) fprintf(stderr, "%s in\n", __FUNCTION__);
#endif
- if (mode == GL_FRONT_LEFT) {
+ if (mode == GL_FRONT) {
VIA_FIREVERTICES(vmesa);
VIA_STATECHANGE(vmesa, VIA_UPLOAD_BUFFERS);
vmesa->drawMap = (char *)vmesa->driScreen->pFB;
FALLBACK(vmesa, VIA_FALLBACK_DRAW_BUFFER, GL_FALSE);
return;
}
- else if (mode == GL_BACK_LEFT) {
+ else if (mode == GL_BACK) {
VIA_FIREVERTICES(vmesa);
VIA_STATECHANGE(vmesa, VIA_UPLOAD_BUFFERS);
vmesa->drawMap = vmesa->back.map;
/*=* John Sheng [2003.7.18] texenv *=*/
/*if (!vmesa->drawMap && !vmesa->readMap) {*/
if (1) {
- if (vmesa->glCtx->Color._DrawDestMask & BACK_LEFT_BIT) {
- viaDrawBuffer(ctx, GL_BACK_LEFT);
+ if (vmesa->glCtx->Color._DrawDestMask == __GL_BACK_BUFFER_MASK) {
+ viaDrawBuffer(ctx, GL_BACK);
}
else {
- viaDrawBuffer(ctx, GL_FRONT_LEFT);
+ viaDrawBuffer(ctx, GL_FRONT);
}
}
/*=* [DBG] csmash : white option words become brown *=*/
vmesa->regCmdB = HC_ACMD_HCmdB | HC_HVPMSK_X | HC_HVPMSK_Y | HC_HVPMSK_Z;
vmesa->regEnable = HC_HenCW_MASK;
- if (vmesa->glCtx->Color._DrawDestMask & BACK_LEFT_BIT) {
+ if (vmesa->glCtx->Color._DrawDestMask == __GL_BACK_BUFFER_MASK) {
vmesa->drawMap = vmesa->back.map;
vmesa->readMap = vmesa->back.map;
}
break;
/*=* John Sheng [2003.7.18] texture combine *=*/
case GL_COMBINE:
- switch (texUnit0->CombineModeRGB) {
+ switch (texUnit0->Combine.ModeRGB) {
case GL_REPLACE:
- switch (texUnit0->CombineSourceRGB[0]) {
+ switch (texUnit0->Combine.SourceRGB[0]) {
case GL_TEXTURE:
- switch (texUnit0->CombineOperandRGB[0]) {
+ switch (texUnit0->Combine.OperandRGB[0]) {
case GL_SRC_COLOR:
vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 |
CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[1], g);
CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[2], b);
CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[3], a);
- switch (texUnit0->CombineOperandRGB[0]) {
+ switch (texUnit0->Combine.OperandRGB[0]) {
case GL_SRC_COLOR:
vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 |
}
break;
case GL_PRIMARY_COLOR :
- switch (texUnit0->CombineOperandRGB[0]) {
+ switch (texUnit0->Combine.OperandRGB[0]) {
case GL_SRC_COLOR:
vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 |
}
break;
case GL_PREVIOUS :
- switch (texUnit0->CombineOperandRGB[0]) {
+ switch (texUnit0->Combine.OperandRGB[0]) {
case GL_SRC_COLOR:
vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 |
}
break;
}
- switch ((GLint)(texUnit0->CombineScaleShiftRGB)) {
+ switch ((GLint)(texUnit0->Combine.ScaleShiftRGB)) {
case 1:
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCshift_No;
break;
HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0;
vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK | HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0;
- switch (texUnit0->CombineOperandRGB[0]) {
+ switch (texUnit0->Combine.OperandRGB[0]) {
case GL_SRC_COLOR:
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_TOPC;
AlphaCombine[0]=0;
AlphaCombine[0]=1;
break;
}
- switch (texUnit0->CombineOperandRGB[1]) {
+ switch (texUnit0->Combine.OperandRGB[1]) {
case GL_SRC_COLOR:
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_TOPC;
AlphaCombine[1]=0;
AlphaCombine[1]=1;
break;
}
- switch (texUnit0->CombineSourceRGB[0]) {
+ switch (texUnit0->Combine.SourceRGB[0]) {
case GL_TEXTURE:
if (AlphaCombine[0]==0) {
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_Tex;
}
break;
}
- switch (texUnit0->CombineSourceRGB[1]) {
+ switch (texUnit0->Combine.SourceRGB[1]) {
case GL_TEXTURE:
if (AlphaCombine[1]==0) {
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_Tex;
}
break;
}
- switch ((GLint)(texUnit0->CombineScaleShiftRGB)) {
+ switch ((GLint)(texUnit0->Combine.ScaleShiftRGB)) {
case 1:
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCshift_No;
break;
break;
case GL_ADD:
case GL_SUBTRACT :
- if (texUnit0->CombineModeRGB==GL_ADD) {
+ if (texUnit0->Combine.ModeRGB==GL_ADD) {
vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add |
HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0;
}
vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK | HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_HTXnTBLRC;
vmesa->regHTXnTBLRCa_0 = ( 255<<16 | 255<<8 |255 );
- switch (texUnit0->CombineOperandRGB[0]) {
+ switch (texUnit0->Combine.OperandRGB[0]) {
case GL_SRC_COLOR:
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_TOPC;
AlphaCombine[0]=0;
AlphaCombine[0]=1;
break;
}
- switch (texUnit0->CombineOperandRGB[1]) {
+ switch (texUnit0->Combine.OperandRGB[1]) {
case GL_SRC_COLOR:
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCc_TOPC;
AlphaCombine[1]=0;
AlphaCombine[1]=1;
break;
}
- switch (texUnit0->CombineSourceRGB[0]) {
+ switch (texUnit0->Combine.SourceRGB[0]) {
case GL_TEXTURE:
if (AlphaCombine[0]==0) {
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_Tex;
}
break;
}
- switch (texUnit0->CombineSourceRGB[1]) {
+ switch (texUnit0->Combine.SourceRGB[1]) {
case GL_TEXTURE:
if (AlphaCombine[1]==0) {
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCc_Tex;
}
break;
}
- switch ((GLint)(texUnit0->CombineScaleShiftRGB)) {
+ switch ((GLint)(texUnit0->Combine.ScaleShiftRGB)) {
case 1:
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCshift_No;
break;
HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_HTXnTBLRC;
vmesa->regHTXnTBLRCa_0 = ( 255<<16 | 255<<8 |255 );
vmesa->regHTXnTBLRCc_0 = ( 128<<16 | 128<<8 |128 );
- switch (texUnit0->CombineOperandRGB[0]) {
+ switch (texUnit0->Combine.OperandRGB[0]) {
case GL_SRC_COLOR:
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_TOPC;
AlphaCombine[0]=0;
AlphaCombine[0]=1;
break;
}
- switch (texUnit0->CombineOperandRGB[1]) {
+ switch (texUnit0->Combine.OperandRGB[1]) {
case GL_SRC_COLOR:
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCbias_Cbias;
AlphaCombine[1]=0;
AlphaCombine[1]=1;
break;
}
- switch (texUnit0->CombineSourceRGB[0]) {
+ switch (texUnit0->Combine.SourceRGB[0]) {
case GL_TEXTURE:
if (AlphaCombine[0]==0) {
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_Tex;
}
break;
}
- switch (texUnit0->CombineSourceRGB[1]) {
+ switch (texUnit0->Combine.SourceRGB[1]) {
case GL_TEXTURE:
if (AlphaCombine[1]==0) {
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCbias_Tex;
}
break;
}
- switch ((GLint)(texUnit0->CombineScaleShiftRGB)) {
+ switch ((GLint)(texUnit0->Combine.ScaleShiftRGB)) {
case 1:
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCshift_No;
break;
case GL_INTERPOLATE :
vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Sub;
vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- switch (texUnit0->CombineOperandRGB[0]) {
+ switch (texUnit0->Combine.OperandRGB[0]) {
case GL_SRC_COLOR:
vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCb_TOPC;
AlphaCombine[0]=0;
AlphaCombine[0]=1;
break;
}
- switch (texUnit0->CombineOperandRGB[1]) {
+ switch (texUnit0->Combine.OperandRGB[1]) {
case GL_SRC_COLOR:
vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCc_TOPC;
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCbias_Cbias;
AlphaCombine[1]=1;
break;
}
- switch (texUnit0->CombineOperandRGB[2]) {
+ switch (texUnit0->Combine.OperandRGB[2]) {
case GL_SRC_COLOR:
vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCa_TOPC;
AlphaCombine[2]=0;
AlphaCombine[2]=1;
break;
}
- switch (texUnit0->CombineSourceRGB[0]) {
+ switch (texUnit0->Combine.SourceRGB[0]) {
case GL_TEXTURE:
if (AlphaCombine[0]==0) {
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_Tex;
}
break;
}
- switch (texUnit0->CombineSourceRGB[1]) {
+ switch (texUnit0->Combine.SourceRGB[1]) {
case GL_TEXTURE:
if (AlphaCombine[0]==0) {
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCc_Tex;
}
break;
}
- switch (texUnit0->CombineSourceRGB[2]) {
+ switch (texUnit0->Combine.SourceRGB[2]) {
case GL_TEXTURE:
if (AlphaCombine[0]==0) {
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_Tex;
}
break;
}
- switch ((GLint)(texUnit0->CombineScaleShiftRGB)) {
+ switch ((GLint)(texUnit0->Combine.ScaleShiftRGB)) {
case 1:
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCshift_No;
break;
}
break;
}
- switch (texUnit0->CombineModeA) {
+ switch (texUnit0->Combine.ModeA) {
case GL_REPLACE:
- switch (texUnit0->CombineSourceA[0]) {
+ switch (texUnit0->Combine.SourceA[0]) {
case GL_TEXTURE:
- switch (texUnit0->CombineOperandA[0]) {
+ switch (texUnit0->Combine.OperandA[0]) {
case GL_SRC_ALPHA:
vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
break;
case GL_CONSTANT :
CLAMPED_FLOAT_TO_UBYTE(texUnit0->EnvColor[3], a);
- switch (texUnit0->CombineOperandA[0]) {
+ switch (texUnit0->Combine.OperandA[0]) {
case GL_SRC_ALPHA:
vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
break;
case GL_PRIMARY_COLOR :
case GL_PREVIOUS :
- switch (texUnit0->CombineOperandA[0]) {
+ switch (texUnit0->Combine.OperandA[0]) {
case GL_SRC_ALPHA:
vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
}
break;
}
- switch ((GLint)(texUnit0->CombineScaleShiftA)) {
+ switch ((GLint)(texUnit0->Combine.ScaleShiftA)) {
case 1:
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAshift_No;
break;
vmesa->regHTXnTBLRFog_0 = 0x0;
vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK | HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
vmesa->regHTXnTBLRAa_0= 0x0;
- switch (texUnit0->CombineOperandA[0]) {
+ switch (texUnit0->Combine.OperandA[0]) {
case GL_SRC_ALPHA:
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAa_TOPA;
break;
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAa_InvTOPA;
break;
}
- switch (texUnit0->CombineOperandA[1]) {
+ switch (texUnit0->Combine.OperandA[1]) {
case GL_SRC_ALPHA:
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_TOPA;
break;
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_InvTOPA;
break;
}
- switch (texUnit0->CombineSourceA[0]) {
+ switch (texUnit0->Combine.SourceA[0]) {
case GL_TEXTURE:
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAa_Atex;
break;
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAa_Adif;
break;
}
- switch (texUnit0->CombineSourceA[1]) {
+ switch (texUnit0->Combine.SourceA[1]) {
case GL_TEXTURE:
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_Atex;
break;
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_Adif;
break;
}
- switch ((GLint)(texUnit0->CombineScaleShiftA)) {
+ switch ((GLint)(texUnit0->Combine.ScaleShiftA)) {
case 1:
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAshift_No;
break;
break;
case GL_ADD:
case GL_SUBTRACT :
- if(texUnit0->CombineModeA==GL_ADD) {
+ if(texUnit0->Combine.ModeA==GL_ADD) {
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add | HC_HTXnTBLAbias_HTXnTBLRAbias;
}
else {
vmesa->regHTXnTBLRFog_0 = 0;
vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK | HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA;
vmesa->regHTXnTBLRAa_0 = 0x0 | ( 255<<16 );
- switch (texUnit0->CombineOperandA[0]) {
+ switch (texUnit0->Combine.OperandA[0]) {
case GL_SRC_ALPHA:
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_TOPA;
break;
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_InvTOPA;
break;
}
- switch (texUnit0->CombineOperandA[1]) {
+ switch (texUnit0->Combine.OperandA[1]) {
case GL_SRC_ALPHA:
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAc_TOPA;
break;
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAc_InvTOPA;
break;
}
- switch (texUnit0->CombineSourceA[0]) {
+ switch (texUnit0->Combine.SourceA[0]) {
case GL_TEXTURE:
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_Atex;
break;
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_Adif;
break;
}
- switch (texUnit0->CombineSourceA[1]) {
+ switch (texUnit0->Combine.SourceA[1]) {
case GL_TEXTURE:
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAc_Atex;
break;
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAc_Adif;
break;
}
- switch ((GLint)(texUnit0->CombineScaleShiftA)) {
+ switch ((GLint)(texUnit0->Combine.ScaleShiftA)) {
case 1:
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAshift_No;
break;
HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA|
HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
vmesa->regHTXnTBLRAa_0 = ( 255<<16 | 0<<8 |128 );
- switch (texUnit0->CombineOperandA[0]) {
+ switch (texUnit0->Combine.OperandA[0]) {
case GL_SRC_ALPHA:
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_TOPA;
break;
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_InvTOPA;
break;
}
- switch (texUnit0->CombineOperandA[1]) {
+ switch (texUnit0->Combine.OperandA[1]) {
case GL_SRC_ALPHA:
break;
case GL_ONE_MINUS_SRC_ALPHA:
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAbias_Inv;
break;
}
- switch (texUnit0->CombineSourceA[0]) {
+ switch (texUnit0->Combine.SourceA[0]) {
case GL_TEXTURE:
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_Atex;
break;
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_Adif;
break;
}
- switch (texUnit0->CombineSourceA[1]) {
+ switch (texUnit0->Combine.SourceA[1]) {
case GL_TEXTURE:
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAbias_Atex;
break;
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAbias_Adif;
break;
}
- switch ((GLint)(texUnit0->CombineScaleShiftA)) {
+ switch ((GLint)(texUnit0->Combine.ScaleShiftA)) {
case 1:
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAshift_No;
break;
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Sub;
vmesa->regHTXnTBLRAa_0 = 0x0;
vmesa->regHTXnTBLRFog_0 = 0x0;
- switch (texUnit0->CombineOperandA[0]) {
+ switch (texUnit0->Combine.OperandA[0]) {
case GL_SRC_ALPHA:
vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAb_TOPA;
break;
vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAb_InvTOPA;
break;
}
- switch (texUnit0->CombineOperandA[1]) {
+ switch (texUnit0->Combine.OperandA[1]) {
case GL_SRC_ALPHA:
vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAc_TOPA;
break;
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAbias_Inv;
break;
}
- switch (texUnit0->CombineOperandA[2]) {
+ switch (texUnit0->Combine.OperandA[2]) {
case GL_SRC_ALPHA:
vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAa_TOPA;
break;
vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAa_InvTOPA;
break;
}
- switch (texUnit0->CombineSourceA[0]) {
+ switch (texUnit0->Combine.SourceA[0]) {
case GL_TEXTURE:
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_Atex;
break;
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_Adif;
break;
}
- switch (texUnit0->CombineSourceA[1]) {
+ switch (texUnit0->Combine.SourceA[1]) {
case GL_TEXTURE:
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAc_Atex;
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAbias_Atex;
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAbias_Adif;
break;
}
- switch (texUnit0->CombineSourceA[2]) {
+ switch (texUnit0->Combine.SourceA[2]) {
case GL_TEXTURE:
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAa_Atex;
break;
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAa_Adif;
break;
}
- switch (texUnit0->CombineScaleShiftA) {
+ switch (texUnit0->Combine.ScaleShiftA) {
case 1:
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAshift_No;
break;
HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
vmesa->regHTXnTBLRAa_0 = 0x0;
- switch (texUnit0->CombineOperandRGB[0]) {
+ switch (texUnit0->Combine.OperandRGB[0]) {
case GL_SRC_COLOR:
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_TOPC;
break;
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_InvTOPC;
break;
}
- switch (texUnit0->CombineOperandRGB[1]) {
+ switch (texUnit0->Combine.OperandRGB[1]) {
case GL_SRC_COLOR:
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_TOPC;
break;
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_InvTOPC;
break;
}
- switch (texUnit0->CombineSourceRGB[0]) {
+ switch (texUnit0->Combine.SourceRGB[0]) {
case GL_TEXTURE:
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_Tex;
break;
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_Dif;
break;
}
- switch (texUnit0->CombineSourceRGB[1]) {
+ switch (texUnit0->Combine.SourceRGB[1]) {
case GL_TEXTURE:
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_Tex;
break;
break;
/*=* John Sheng [2003.7.18] texture combine *=*/
case GL_COMBINE:
- switch (texUnit1->CombineModeRGB) {
+ switch (texUnit1->Combine.ModeRGB) {
case GL_REPLACE:
- switch (texUnit1->CombineSourceRGB[0]) {
+ switch (texUnit1->Combine.SourceRGB[0]) {
case GL_TEXTURE:
- switch (texUnit1->CombineOperandRGB[0]) {
+ switch (texUnit1->Combine.OperandRGB[0]) {
case GL_SRC_COLOR:
vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 |
CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[1], g);
CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[2], b);
CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[3], a);
- switch (texUnit1->CombineOperandRGB[0]) {
+ switch (texUnit1->Combine.OperandRGB[0]) {
case GL_SRC_COLOR:
vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 |
}
break;
case GL_PRIMARY_COLOR :
- switch (texUnit1->CombineOperandRGB[0]) {
+ switch (texUnit1->Combine.OperandRGB[0]) {
case GL_SRC_COLOR:
vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 |
}
break;
case GL_PREVIOUS :
- switch (texUnit1->CombineOperandRGB[0]) {
+ switch (texUnit1->Combine.OperandRGB[0]) {
case GL_SRC_COLOR:
vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK |
HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_0 |
}
break;
}
- switch ((GLint)(texUnit1->CombineScaleShiftRGB)) {
+ switch ((GLint)(texUnit1->Combine.ScaleShiftRGB)) {
case 1:
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCshift_No;
break;
HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0;
vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK | HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_0;
- switch (texUnit1->CombineOperandRGB[0]) {
+ switch (texUnit1->Combine.OperandRGB[0]) {
case GL_SRC_COLOR:
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_TOPC;
AlphaCombine[0]=0;
AlphaCombine[0]=1;
break;
}
- switch (texUnit1->CombineOperandRGB[1]) {
+ switch (texUnit1->Combine.OperandRGB[1]) {
case GL_SRC_COLOR:
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_TOPC;
AlphaCombine[1]=0;
AlphaCombine[1]=1;
break;
}
- switch (texUnit1->CombineSourceRGB[0]) {
+ switch (texUnit1->Combine.SourceRGB[0]) {
case GL_TEXTURE:
if (AlphaCombine[0]==0) {
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_Tex;
}
break;
}
- switch (texUnit1->CombineSourceRGB[1]) {
+ switch (texUnit1->Combine.SourceRGB[1]) {
case GL_TEXTURE:
if (AlphaCombine[1]==0) {
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_Tex;
}
break;
}
- switch ((GLint)(texUnit1->CombineScaleShiftRGB)) {
+ switch ((GLint)(texUnit1->Combine.ScaleShiftRGB)) {
case 1:
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCshift_No;
break;
break;
case GL_ADD:
case GL_SUBTRACT :
- if (texUnit1->CombineModeRGB==GL_ADD) {
+ if (texUnit1->Combine.ModeRGB==GL_ADD) {
vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Add |
HC_HTXnTBLCbias_Cbias | HC_HTXnTBLCbias_0;
}
vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCsat_MASK | HC_HTXnTBLCa_TOPC | HC_HTXnTBLCa_HTXnTBLRC;
vmesa->regHTXnTBLRCa_0 = ( 255<<16 | 255<<8 |255 );
- switch (texUnit1->CombineOperandRGB[0]) {
+ switch (texUnit1->Combine.OperandRGB[0]) {
case GL_SRC_COLOR:
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_TOPC;
AlphaCombine[0]=0;
AlphaCombine[0]=1;
break;
}
- switch (texUnit1->CombineOperandRGB[1]) {
+ switch (texUnit1->Combine.OperandRGB[1]) {
case GL_SRC_COLOR:
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCc_TOPC;
AlphaCombine[1]=0;
AlphaCombine[1]=1;
break;
}
- switch (texUnit1->CombineSourceRGB[0]) {
+ switch (texUnit1->Combine.SourceRGB[0]) {
case GL_TEXTURE:
if (AlphaCombine[0]==0) {
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_Tex;
}
break;
}
- switch (texUnit1->CombineSourceRGB[1]) {
+ switch (texUnit1->Combine.SourceRGB[1]) {
case GL_TEXTURE:
if (AlphaCombine[1]==0) {
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCc_Tex;
}
break;
}
- switch ((GLint)(texUnit1->CombineScaleShiftRGB)) {
+ switch ((GLint)(texUnit1->Combine.ScaleShiftRGB)) {
case 1:
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCshift_No;
break;
HC_HTXnTBLCc_TOPC | HC_HTXnTBLCc_HTXnTBLRC;
vmesa->regHTXnTBLRCa_0 = ( 255<<16 | 255<<8 |255 );
vmesa->regHTXnTBLRCc_0 = ( 128<<16 | 128<<8 |128 );
- switch (texUnit1->CombineOperandRGB[0]) {
+ switch (texUnit1->Combine.OperandRGB[0]) {
case GL_SRC_COLOR:
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_TOPC;
AlphaCombine[0]=0;
AlphaCombine[0]=1;
break;
}
- switch (texUnit1->CombineOperandRGB[1]) {
+ switch (texUnit1->Combine.OperandRGB[1]) {
case GL_SRC_COLOR:
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCbias_Cbias;
AlphaCombine[1]=0;
AlphaCombine[1]=1;
break;
}
- switch (texUnit1->CombineSourceRGB[0]) {
+ switch (texUnit1->Combine.SourceRGB[0]) {
case GL_TEXTURE:
if (AlphaCombine[0]==0) {
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_Tex;
}
break;
}
- switch (texUnit1->CombineSourceRGB[1]) {
+ switch (texUnit1->Combine.SourceRGB[1]) {
case GL_TEXTURE:
if (AlphaCombine[1]==0) {
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCbias_Tex;
}
break;
}
- switch ((GLint)(texUnit1->CombineScaleShiftRGB)) {
+ switch ((GLint)(texUnit1->Combine.ScaleShiftRGB)) {
case 1:
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCshift_No;
break;
case GL_INTERPOLATE :
vmesa->regHTXnTBLCop_0 = HC_HTXnTBLCop_Sub;
vmesa->regHTXnTBLMPfog_0 = HC_HTXnTBLMPfog_Fog;
- switch (texUnit1->CombineOperandRGB[0]) {
+ switch (texUnit1->Combine.OperandRGB[0]) {
case GL_SRC_COLOR:
vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCb_TOPC;
AlphaCombine[0]=0;
AlphaCombine[0]=1;
break;
}
- switch (texUnit1->CombineOperandRGB[1]) {
+ switch (texUnit1->Combine.OperandRGB[1]) {
case GL_SRC_COLOR:
vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCc_TOPC;
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCbias_Cbias;
AlphaCombine[1]=1;
break;
}
- switch (texUnit1->CombineOperandRGB[2]) {
+ switch (texUnit1->Combine.OperandRGB[2]) {
case GL_SRC_COLOR:
vmesa->regHTXnTBLCsat_0 = HC_HTXnTBLCa_TOPC;
AlphaCombine[2]=0;
AlphaCombine[2]=1;
break;
}
- switch (texUnit1->CombineSourceRGB[0]) {
+ switch (texUnit1->Combine.SourceRGB[0]) {
case GL_TEXTURE:
if (AlphaCombine[0]==0) {
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_Tex;
}
break;
}
- switch (texUnit1->CombineSourceRGB[1]) {
+ switch (texUnit1->Combine.SourceRGB[1]) {
case GL_TEXTURE:
if (AlphaCombine[0]==0) {
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCc_Tex;
}
break;
}
- switch (texUnit1->CombineSourceRGB[2]) {
+ switch (texUnit1->Combine.SourceRGB[2]) {
case GL_TEXTURE:
if (AlphaCombine[0]==0) {
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_Tex;
}
break;
}
- switch ((GLint)(texUnit1->CombineScaleShiftRGB)) {
+ switch ((GLint)(texUnit1->Combine.ScaleShiftRGB)) {
case 1:
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCshift_No;
break;
HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
vmesa->regHTXnTBLRAa_0 = 0x0;
- switch (texUnit1->CombineOperandRGB[0]) {
+ switch (texUnit1->Combine.OperandRGB[0]) {
case GL_SRC_COLOR:
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_TOPC;
break;
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_InvTOPC;
break;
}
- switch (texUnit1->CombineOperandRGB[1]) {
+ switch (texUnit1->Combine.OperandRGB[1]) {
case GL_SRC_COLOR:
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_TOPC;
break;
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_InvTOPC;
break;
}
- switch (texUnit1->CombineSourceRGB[0]) {
+ switch (texUnit1->Combine.SourceRGB[0]) {
case GL_TEXTURE:
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_Tex;
break;
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_Dif;
break;
}
- switch (texUnit1->CombineSourceRGB[1]) {
+ switch (texUnit1->Combine.SourceRGB[1]) {
case GL_TEXTURE:
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_Tex;
break;
break;
}
- switch (texUnit1->CombineModeA) {
+ switch (texUnit1->Combine.ModeA) {
case GL_REPLACE:
- switch (texUnit1->CombineSourceA[0]) {
+ switch (texUnit1->Combine.SourceA[0]) {
case GL_TEXTURE:
- switch (texUnit1->CombineOperandA[0]) {
+ switch (texUnit1->Combine.OperandA[0]) {
case GL_SRC_ALPHA:
vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
break;
case GL_CONSTANT :
CLAMPED_FLOAT_TO_UBYTE(texUnit1->EnvColor[3], a);
- switch (texUnit1->CombineOperandA[0]) {
+ switch (texUnit1->Combine.OperandA[0]) {
case GL_SRC_ALPHA:
vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
break;
case GL_PRIMARY_COLOR :
case GL_PREVIOUS :
- switch (texUnit1->CombineOperandA[0]) {
+ switch (texUnit1->Combine.OperandA[0]) {
case GL_SRC_ALPHA:
vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK |
HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA |
}
break;
}
- switch ((GLint)(texUnit1->CombineScaleShiftA)) {
+ switch ((GLint)(texUnit1->Combine.ScaleShiftA)) {
case 1:
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAshift_No;
break;
vmesa->regHTXnTBLRFog_0 = 0x0;
vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK | HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
vmesa->regHTXnTBLRAa_0= 0x0;
- switch (texUnit1->CombineOperandA[0]) {
+ switch (texUnit1->Combine.OperandA[0]) {
case GL_SRC_ALPHA:
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAa_TOPA;
break;
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAa_InvTOPA;
break;
}
- switch (texUnit1->CombineOperandA[1]) {
+ switch (texUnit1->Combine.OperandA[1]) {
case GL_SRC_ALPHA:
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_TOPA;
break;
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_InvTOPA;
break;
}
- switch (texUnit1->CombineSourceA[0]) {
+ switch (texUnit1->Combine.SourceA[0]) {
case GL_TEXTURE:
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAa_Atex;
break;
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAa_Adif;
break;
}
- switch (texUnit1->CombineSourceA[1]) {
+ switch (texUnit1->Combine.SourceA[1]) {
case GL_TEXTURE:
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_Atex;
break;
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_Adif;
break;
}
- switch ((GLint)(texUnit1->CombineScaleShiftA)) {
+ switch ((GLint)(texUnit1->Combine.ScaleShiftA)) {
case 1:
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAshift_No;
break;
break;
case GL_ADD:
case GL_SUBTRACT :
- if(texUnit1->CombineModeA==GL_ADD) {
+ if(texUnit1->Combine.ModeA==GL_ADD) {
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Add | HC_HTXnTBLAbias_HTXnTBLRAbias;
}
else {
vmesa->regHTXnTBLRFog_0 = 0;
vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAsat_MASK | HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA;
vmesa->regHTXnTBLRAa_0 = 0x0 | ( 255<<16 );
- switch (texUnit1->CombineOperandA[0]) {
+ switch (texUnit1->Combine.OperandA[0]) {
case GL_SRC_ALPHA:
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_TOPA;
break;
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_InvTOPA;
break;
}
- switch (texUnit1->CombineOperandA[1]) {
+ switch (texUnit1->Combine.OperandA[1]) {
case GL_SRC_ALPHA:
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAc_TOPA;
break;
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAc_InvTOPA;
break;
}
- switch (texUnit1->CombineSourceA[0]) {
+ switch (texUnit1->Combine.SourceA[0]) {
case GL_TEXTURE:
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_Atex;
break;
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_Adif;
break;
}
- switch (texUnit1->CombineSourceA[1]) {
+ switch (texUnit1->Combine.SourceA[1]) {
case GL_TEXTURE:
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAc_Atex;
break;
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAc_Adif;
break;
}
- switch ((GLint)(texUnit1->CombineScaleShiftA)) {
+ switch ((GLint)(texUnit1->Combine.ScaleShiftA)) {
case 1:
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAshift_No;
break;
HC_HTXnTBLAa_TOPA | HC_HTXnTBLAa_HTXnTBLRA|
HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
vmesa->regHTXnTBLRAa_0 = ( 255<<16 | 0<<8 |128 );
- switch (texUnit1->CombineOperandA[0]) {
+ switch (texUnit1->Combine.OperandA[0]) {
case GL_SRC_ALPHA:
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_TOPA;
break;
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_InvTOPA;
break;
}
- switch (texUnit1->CombineOperandA[1]) {
+ switch (texUnit1->Combine.OperandA[1]) {
case GL_SRC_ALPHA:
break;
case GL_ONE_MINUS_SRC_ALPHA:
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAbias_Inv;
break;
}
- switch (texUnit1->CombineSourceA[0]) {
+ switch (texUnit1->Combine.SourceA[0]) {
case GL_TEXTURE:
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_Atex;
break;
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_Adif;
break;
}
- switch (texUnit1->CombineSourceA[1]) {
+ switch (texUnit1->Combine.SourceA[1]) {
case GL_TEXTURE:
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAbias_Atex;
break;
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAbias_Adif;
break;
}
- switch ((GLint)(texUnit1->CombineScaleShiftA)) {
+ switch ((GLint)(texUnit1->Combine.ScaleShiftA)) {
case 1:
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAshift_No;
break;
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAop_Sub;
vmesa->regHTXnTBLRAa_0 = 0x0;
vmesa->regHTXnTBLRFog_0 = 0x0;
- switch (texUnit1->CombineOperandA[0]) {
+ switch (texUnit1->Combine.OperandA[0]) {
case GL_SRC_ALPHA:
vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAb_TOPA;
break;
vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAb_InvTOPA;
break;
}
- switch (texUnit1->CombineOperandA[1]) {
+ switch (texUnit1->Combine.OperandA[1]) {
case GL_SRC_ALPHA:
vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAc_TOPA;
break;
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAbias_Inv;
break;
}
- switch (texUnit1->CombineOperandA[2]) {
+ switch (texUnit1->Combine.OperandA[2]) {
case GL_SRC_ALPHA:
vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAa_TOPA;
break;
vmesa->regHTXnTBLAsat_0 = HC_HTXnTBLAa_InvTOPA;
break;
}
- switch (texUnit1->CombineSourceA[0]) {
+ switch (texUnit1->Combine.SourceA[0]) {
case GL_TEXTURE:
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_Atex;
break;
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAb_Adif;
break;
}
- switch (texUnit1->CombineSourceA[1]) {
+ switch (texUnit1->Combine.SourceA[1]) {
case GL_TEXTURE:
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAc_Atex;
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAbias_Atex;
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAbias_Adif;
break;
}
- switch (texUnit1->CombineSourceA[2]) {
+ switch (texUnit1->Combine.SourceA[2]) {
case GL_TEXTURE:
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAa_Atex;
break;
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAa_Adif;
break;
}
- switch (texUnit1->CombineScaleShiftA) {
+ switch (texUnit1->Combine.ScaleShiftA) {
case 1:
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAshift_No;
break;
HC_HTXnTBLAb_TOPA | HC_HTXnTBLAb_HTXnTBLRA |
HC_HTXnTBLAc_TOPA | HC_HTXnTBLAc_HTXnTBLRA;
vmesa->regHTXnTBLRAa_0 = 0x0;
- switch (texUnit1->CombineOperandRGB[0]) {
+ switch (texUnit1->Combine.OperandRGB[0]) {
case GL_SRC_COLOR:
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_TOPC;
break;
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_InvTOPC;
break;
}
- switch (texUnit1->CombineOperandRGB[1]) {
+ switch (texUnit1->Combine.OperandRGB[1]) {
case GL_SRC_COLOR:
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_TOPC;
break;
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_InvTOPC;
break;
}
- switch (texUnit1->CombineSourceRGB[0]) {
+ switch (texUnit1->Combine.SourceRGB[0]) {
case GL_TEXTURE:
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_Tex;
break;
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_Dif;
break;
}
- switch (texUnit1->CombineSourceRGB[1]) {
+ switch (texUnit1->Combine.SourceRGB[1]) {
case GL_TEXTURE:
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_Tex;
break;
vmesa->dirty |= (VIA_UPLOAD_FOG | VIA_UPLOAD_ENABLE);
}
else {
- if((!ctx->Texture.Unit[0]._ReallyEnabled) &&
- (!ctx->Texture.Unit[1]._ReallyEnabled)) {
+ if (!ctx->Texture._EnabledUnits) {
vmesa->regCmdB &= ~ HC_HVPMSK_W;
vmesa->regCmdB &= ~ HC_HVPMSK_Cs;
}
*/
ctx->Driver.AlphaFunc = viaAlphaFunc;
ctx->Driver.BlendEquationSeparate = viaBlendEquationSeparate;
- //ctx->Driver.BlendFunc = viaBlendFunc;
ctx->Driver.BlendFuncSeparate = viaBlendFuncSeparate;
ctx->Driver.ClearColor = viaClearColor;
ctx->Driver.ColorMask = viaColorMask;
#include <stdio.h>
#include "glheader.h"
-/*#include "mem.h" _SOLO */
#include "mtypes.h"
#include "simple_list.h"
#include "enums.h"
#define _VIATEX_H
#include "mtypes.h"
-/*#include "mmath.h"*/
#include "mm.h"
#include "via_context.h"
viaVertexPtr v1,
viaVertexPtr v2)
{
- GLuint vertsize = vmesa->vertex_size;
+ GLuint vertsize = vmesa->vertexSize;
GLuint *vb = viaCheckDma(vmesa, 3 * 4 * vertsize);
int j;
viaVertexPtr v2,
viaVertexPtr v3)
{
- GLuint vertsize = vmesa->vertex_size;
+ GLuint vertsize = vmesa->vertexSize;
GLuint *vb = viaCheckDma(vmesa, 6 * 4 * vertsize);
int j;
#ifdef DEBUG
viaVertexPtr v0)
{
/*GLfloat sz = vmesa->glCtx->Point._Size * .5;*/
- int vertsize = vmesa->vertex_size;
+ int vertsize = vmesa->vertexSize;
/*GLuint *vb = viaCheckDma(vmesa, 2 * 4 * vertsize);*/
GLuint *vb = viaCheckDma(vmesa, 4 * vertsize);
int j;
viaVertexPtr v0,
viaVertexPtr v1)
{
- GLuint vertsize = vmesa->vertex_size;
+ GLuint vertsize = vmesa->vertexSize;
GLuint *vb = viaCheckDma(vmesa, 2 * 4 * vertsize);
int j;
#ifdef DEBUG
#define LINE(v0, v1) \
do { \
- if( VIA_DEBUG) fprintf(stderr, "hw LINE\n");\
+ if(VIA_DEBUG) fprintf(stderr, "hw LINE\n");\
if (DO_FALLBACK) \
vmesa->drawLine(vmesa, v0, v1); \
else \
#define VERT_Y(_v) _v->v.y
#define VERT_Z(_v) _v->v.z
#define AREA_IS_CCW(a) (a > 0)
-#define GET_VERTEX(e) (vmesa->verts + (e<<vmesa->vertex_stride_shift))
+#define GET_VERTEX(e) (vmesa->verts + (e<<vmesa->vertexStrideShift))
#define VERT_SET_RGBA(v, c) VIA_COLOR(v->ub4[coloroffset], c)
#define VERT_COPY_RGBA(v0, v1) v0->ui[coloroffset] = v1->ui[coloroffset]
#define LOCAL_VARS(n) \
viaContextPtr vmesa = VIA_CONTEXT(ctx); \
GLuint color[n], spec[n]; \
- GLuint coloroffset = (vmesa->vertex_size == 4 ? 3 : 4); \
- GLboolean havespec = (vmesa->vertex_size > 4); \
+ GLuint coloroffset = (vmesa->vertexSize == 4 ? 3 : 4); \
+ GLboolean havespec = (vmesa->vertexSize > 4); \
(void)color; (void)spec; (void)coloroffset; (void)havespec;
#define LOCAL_VARS \
viaContextPtr vmesa = VIA_CONTEXT(ctx); \
GLubyte *vertptr = (GLubyte *)vmesa->verts; \
- const GLuint vertshift = vmesa->vertex_stride_shift; \
+ const GLuint vertshift = vmesa->vertexStrideShift; \
const GLuint * const elt = TNL_CONTEXT(ctx)->vb.Elts; \
(void)elt;
#define POSTFIX \
GLuint n)
{
viaContextPtr vmesa = VIA_CONTEXT(ctx);
- GLuint vertsize = vmesa->vertex_size;
+ GLuint vertsize = vmesa->vertexSize;
GLuint *vb = viaCheckDma(vmesa, (n - 2) * 3 * 4 * vertsize);
GLubyte *vertptr = (GLubyte *)vmesa->verts;
- const GLuint vertshift = vmesa->vertex_stride_shift;
+ const GLuint vertshift = vmesa->vertexStrideShift;
const GLuint *start = (const GLuint *)V(elts[0]);
GLuint *temp1;
GLuint *temp2;
i++;
}
- if (ctx->Texture.Unit[0]._ReallyEnabled) {
+ if (ctx->Texture._EnabledUnits) {
struct gl_texture_unit *texUnit0 = &ctx->Texture.Unit[0];
struct gl_texture_unit *texUnit1 = &ctx->Texture.Unit[1];
*vb++ = HC_HEADER2;
*vb++ = (HC_ParaType_Tex << 16) | (HC_SubType_TexGeneral << 24);
- if (ctx->Texture.Unit[1]._ReallyEnabled) {
+ if (ctx->Texture._EnabledUnits > 1) {
#ifdef DEBUG
if (VIA_DEBUG) fprintf(stderr, "multi texture\n");
#endif
GLuint *vb = viaCheckDma(vmesa, 0);
GLuint cmdA = vmesa->regCmdA_End | HC_HPLEND_MASK | HC_HPMValidN_MASK | HC_HE3Fire_MASK;
- if ((vmesa->dmaLow & 0x1) || !vmesa->useAgp) {
+ /*=* John Sheng [2003.6.20] fix pci *=*/
+ /*if (vmesa->dmaLow & 0x1) {*/
+ if (vmesa->dmaLow & 0x1 || !vmesa->useAgp) {
*vb++ = cmdA ;
vmesa->dmaLow += 4;
}
#include "imports.h"
#include "macros.h"
#include "colormac.h"
-/*#include "mmath.h" _SOLO*/
-/*#include "mem.h" _SOLO*/
#include "swrast_setup/swrast_setup.h"
#include "tnl/t_context.h"
static struct {
void (*emit)(GLcontext *, GLuint, GLuint, void *, GLuint);
interp_func interp;
- copy_pv_func copy_pv;
+ copy_pv_func copyPv;
GLboolean (*check_tex_sizes)(GLcontext *ctx);
- GLuint vertex_size;
- GLuint vertex_stride_shift;
- GLuint vertex_format;
+ GLuint vertexSize;
+ GLuint vertexStrideShift;
+ GLuint vertexFormat;
} setup_tab[VIA_MAX_SETUP];
#define TINY_VERTEX_FORMAT 1
#define VERTEX_COLOR via_color_t
#define GET_VIEWPORT_MAT() VIA_CONTEXT(ctx)->ViewportMatrix.m
#define GET_TEXSOURCE(n) n
-#define GET_VERTEX_FORMAT() VIA_CONTEXT(ctx)->vertex_size
-#define GET_VERTEX_SIZE() VIA_CONTEXT(ctx)->vertex_size
+#define GET_VERTEX_FORMAT() VIA_CONTEXT(ctx)->vertexSize
+#define GET_VERTEX_SIZE() VIA_CONTEXT(ctx)->vertexSize
#define GET_VERTEX_STORE() VIA_CONTEXT(ctx)->verts
-#define GET_VERTEX_STRIDE_SHIFT() VIA_CONTEXT(ctx)->vertex_stride_shift
+#define GET_VERTEX_STRIDE_SHIFT() VIA_CONTEXT(ctx)->vertexStrideShift
#define GET_UBYTE_COLOR_STORE() &VIA_CONTEXT(ctx)->UbyteColor
#define GET_UBYTE_SPEC_COLOR_STORE() &VIA_CONTEXT(ctx)->UbyteSecondaryColor
#define INVALIDATE_STORED_VERTICES()
#define IMPORT_FLOAT_SPEC_COLORS via_import_float_spec_colors
#define INTERP_VERTEX setup_tab[VIA_CONTEXT(ctx)->setupIndex].interp
-#define COPY_PV_VERTEX setup_tab[VIA_CONTEXT(ctx)->setupIndex].copy_pv
+#define COPY_PV_VERTEX setup_tab[VIA_CONTEXT(ctx)->setupIndex].copyPv
/***********************************************************************
if (!vmesa->Fallback &&
!(ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED))) {
tnl->Driver.Render.Interp = setup_tab[vmesa->setupIndex].interp;
- tnl->Driver.Render.CopyPV = setup_tab[vmesa->setupIndex].copy_pv;
+ tnl->Driver.Render.CopyPV = setup_tab[vmesa->setupIndex].copyPv;
}
}
#ifdef DEBUG
GLuint newinputs)
{
viaContextPtr vmesa = VIA_CONTEXT(ctx);
- GLubyte *v = ((GLubyte *)vmesa->verts + (start << vmesa->vertex_stride_shift));
- GLuint stride = 1 << vmesa->vertex_stride_shift;
+ GLubyte *v = ((GLubyte *)vmesa->verts + (start << vmesa->vertexStrideShift));
+ GLuint stride = 1 << vmesa->vertexStrideShift;
#ifdef DEBUG
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
#endif
vmesa->setupNewInputs = 0;
if (!newinputs)
return;
- if (newinputs & VERT_CLIP) {
+ if (newinputs & VERT_BIT_CLIP) {
setup_tab[vmesa->setupIndex].emit(ctx, start, count, v, stride);
}
else {
GLuint ind = 0;
- if (newinputs & VERT_RGBA)
+ if (newinputs & VERT_BIT_COLOR0)
ind |= VIA_RGBA_BIT;
if (newinputs & VERT_BIT_COLOR1)
ind |= VIA_SPEC_BIT;
- if (newinputs & VERT_TEX(0))
+ if (newinputs & VERT_BIT_TEX0)
ind |= VIA_TEX0_BIT;
- if (newinputs & VERT_TEX(1))
+ if (newinputs & VERT_BIT_TEX1)
ind |= VIA_TEX1_BIT;
if (newinputs & VERT_BIT_FOG)
if (ctx->Fog.Enabled)
ind |= VIA_FOG_BIT;
- if (ctx->Texture.Unit[1]._ReallyEnabled)
+ if (ctx->Texture._EnabledUnits > 1)
ind |= VIA_TEX1_BIT | VIA_TEX0_BIT;
- else if (ctx->Texture.Unit[0]._ReallyEnabled)
+ else if (ctx->Texture._EnabledUnits == 1)
ind |= VIA_TEX0_BIT;
vmesa->setupIndex = ind;
}
else {
tnl->Driver.Render.Interp = setup_tab[ind].interp;
- tnl->Driver.Render.CopyPV = setup_tab[ind].copy_pv;
+ tnl->Driver.Render.CopyPV = setup_tab[ind].copyPv;
}
- vmesa->vertex_size = setup_tab[ind].vertex_size;
- vmesa->vertex_stride_shift = setup_tab[ind].vertex_stride_shift;
+ vmesa->vertexSize = setup_tab[ind].vertexSize;
+ vmesa->vertexStrideShift = setup_tab[ind].vertexStrideShift;
#ifdef DEBUG
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__);
#endif
GLuint start,
GLuint count) {
viaContextPtr vmesa = VIA_CONTEXT(ctx);
- GLuint vertex_size = vmesa->vertex_size * 4;
- GLuint *dest = viaCheckDma(vmesa, (count - start) * vertex_size);
+ GLuint vertexSize = vmesa->vertexSize * 4;
+ GLuint *dest = viaCheckDma(vmesa, (count - start) * vertexSize);
#ifdef DEBUG
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
if (VIA_DEBUG) fprintf(stderr, "choose setup_tab[0x%x]\n", vmesa->setupIndex);
#endif
- setup_tab[vmesa->setupIndex].emit(ctx, start, count, dest, vertex_size);
- vmesa->dmaLow += (count - start) * vertex_size;
+ setup_tab[vmesa->setupIndex].emit(ctx, start, count, dest, vertexSize);
+ vmesa->dmaLow += (count - start) * vertexSize;
#ifdef DEBUG
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__);
#endif
--- /dev/null
+/*
+ * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
+ * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+
+#define CLIP_DOTPROD(K, A, B, C, D) X(K) * A + Y(K) * B + Z(K) * C + W(K) * D
+
+#define POLY_CLIP(PLANE, A, B, C, D) \
+do { \
+ if (mask & PLANE) { \
+ GLuint idxPrev = inlist[0]; \
+ GLfloat dpPrev = CLIP_DOTPROD(idxPrev, A, B, C, D); \
+ GLuint outcount = 0; \
+ GLuint i; \
+ \
+ inlist[n] = inlist[0]; /* prevent rotation of vertices */ \
+ for (i = 1; i <= n; i++) { \
+ GLuint idx = inlist[i]; \
+ GLfloat dp = CLIP_DOTPROD(idx, A, B, C, D); \
+ \
+ clipmask[idxPrev] |= PLANE; \
+ if (!NEGATIVE(dpPrev)) { \
+ outlist[outcount++] = idxPrev; \
+ clipmask[idxPrev] &= ~PLANE; \
+ } \
+ \
+ if (DIFFERENT_SIGNS(dp, dpPrev)) { \
+ GLuint newvert = VB->LastClipped++; \
+ VB->ClipMask[newvert] = 0; \
+ outlist[outcount++] = newvert; \
+ if (NEGATIVE(dp)) { \
+ /* Going out of bounds. Avoid division by zero as we \
+ * know dp != dpPrev from DIFFERENT_SIGNS, above. \
+ */ \
+ GLfloat t = dp / (dp - dpPrev); \
+ INTERP_4F(t, coord[newvert], coord[idx], coord[idxPrev]); \
+ interp(ctx, t, newvert, idx, idxPrev, GL_TRUE); \
+ } \
+ else { \
+ /* Coming back in. \
+ */ \
+ GLfloat t = dpPrev / (dpPrev - dp); \
+ INTERP_4F(t, coord[newvert], coord[idxPrev], coord[idx]); \
+ interp(ctx, t, newvert, idxPrev, idx, GL_FALSE); \
+ } \
+ } \
+ \
+ idxPrev = idx; \
+ dpPrev = dp; \
+ } \
+ \
+ if (outcount < 3) \
+ return; \
+ \
+ { \
+ GLuint *tmp = inlist; \
+ inlist = outlist; \
+ outlist = tmp; \
+ n = outcount; \
+ } \
+ } \
+} while (0)
+
+
+#define LINE_CLIP(PLANE, A, B, C, D) \
+do { \
+ if (mask & PLANE) { \
+ GLfloat dpI = CLIP_DOTPROD(ii, A, B, C, D); \
+ GLfloat dpJ = CLIP_DOTPROD(jj, A, B, C, D); \
+ \
+ if (DIFFERENT_SIGNS(dpI, dpJ)) { \
+ GLuint newvert = VB->LastClipped++; \
+ VB->ClipMask[newvert] = 0; \
+ if (NEGATIVE(dpJ)) { \
+ GLfloat t = dpI / (dpI - dpJ); \
+ VB->ClipMask[jj] |= PLANE; \
+ INTERP_4F(t, coord[newvert], coord[ii], coord[jj]); \
+ interp(ctx, t, newvert, ii, jj, GL_FALSE); \
+ jj = newvert; \
+ } \
+ else { \
+ GLfloat t = dpJ / (dpJ - dpI); \
+ VB->ClipMask[ii] |= PLANE; \
+ INTERP_4F(t, coord[newvert], coord[jj], coord[ii]); \
+ interp(ctx, t, newvert, jj, ii, GL_FALSE); \
+ ii = newvert; \
+ } \
+ } \
+ else if (NEGATIVE(dpI)) \
+ return; \
+ } \
+} while (0)
+
+
+/* Clip a line against the viewport and user clip planes.
+ */
+static INLINE void
+TAG(clip_line)(GLcontext *ctx, GLuint i, GLuint j, GLubyte mask)
+{
+ TNLcontext *tnl = TNL_CONTEXT(ctx);
+ struct vertex_buffer *VB = &tnl->vb;
+ interp_func interp = tnl->Driver.Render.Interp;
+ GLfloat (*coord)[4] = VB->ClipPtr->data;
+ GLuint ii = i, jj = j, p;
+#ifdef DEBUG
+ if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
+#endif
+#ifdef PERFORMANCE_MEASURE
+ if (VIA_PERFORMANCE) P_M;
+#endif
+ VB->LastClipped = VB->Count;
+
+ if (mask & 0x3f) {
+ LINE_CLIP(CLIP_RIGHT_BIT, -1, 0, 0, 1);
+ LINE_CLIP(CLIP_LEFT_BIT, 1, 0, 0, 1);
+ LINE_CLIP(CLIP_TOP_BIT, 0, -1, 0, 1);
+ LINE_CLIP(CLIP_BOTTOM_BIT, 0, 1, 0, 1);
+ LINE_CLIP(CLIP_FAR_BIT, 0, 0, -1, 1);
+ LINE_CLIP(CLIP_NEAR_BIT, 0, 0, 1, 1);
+ }
+
+ if (mask & CLIP_USER_BIT) {
+ for (p = 0; p < MAX_CLIP_PLANES; p++) {
+ if (ctx->Transform.ClipPlanesEnabled & (1 << p)) {
+ GLfloat a = ctx->Transform._ClipUserPlane[p][0];
+ GLfloat b = ctx->Transform._ClipUserPlane[p][1];
+ GLfloat c = ctx->Transform._ClipUserPlane[p][2];
+ GLfloat d = ctx->Transform._ClipUserPlane[p][3];
+ LINE_CLIP(CLIP_USER_BIT, a, b, c, d);
+ }
+ }
+ }
+
+ if ((ctx->_TriangleCaps & DD_FLATSHADE) && j != jj)
+ tnl->Driver.Render.CopyPV(ctx, jj, j);
+
+ tnl->Driver.Render.ClippedLine(ctx, ii, jj);
+#ifdef DEBUG
+ if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__);
+#endif
+}
+
+
+/* Clip a triangle against the viewport and user clip planes.
+ */
+static INLINE void
+TAG(clip_tri)(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLubyte mask)
+{
+ TNLcontext *tnl = TNL_CONTEXT(ctx);
+ struct vertex_buffer *VB = &tnl->vb;
+ interp_func interp = tnl->Driver.Render.Interp;
+ GLfloat (*coord)[4] = VB->ClipPtr->data;
+ GLuint pv = v2;
+ GLuint vlist[2][MAX_CLIPPED_VERTICES];
+ GLuint *inlist = vlist[0], *outlist = vlist[1];
+ GLuint p;
+ GLubyte *clipmask = VB->ClipMask;
+ GLuint n = 3;
+
+#ifdef PERFORMANCE_MEASURE
+ if (VIA_PERFORMANCE) P_M;
+#endif
+ ASSIGN_3V(inlist, v2, v0, v1); /* pv rotated to slot zero */
+
+ VB->LastClipped = VB->Count;
+
+ if (mask & 0x3f) {
+ POLY_CLIP(CLIP_RIGHT_BIT, -1, 0, 0, 1);
+ POLY_CLIP(CLIP_LEFT_BIT, 1, 0, 0, 1);
+ POLY_CLIP(CLIP_TOP_BIT, 0, -1, 0, 1);
+ POLY_CLIP(CLIP_BOTTOM_BIT, 0, 1, 0, 1);
+ POLY_CLIP(CLIP_FAR_BIT, 0, 0, -1, 1);
+ POLY_CLIP(CLIP_NEAR_BIT, 0, 0, 1, 1);
+ }
+
+ if (mask & CLIP_USER_BIT) {
+ for (p = 0; p < MAX_CLIP_PLANES; p++) {
+ if (ctx->Transform.ClipPlanesEnabled & (1 << p)) {
+ GLfloat a = ctx->Transform._ClipUserPlane[p][0];
+ GLfloat b = ctx->Transform._ClipUserPlane[p][1];
+ GLfloat c = ctx->Transform._ClipUserPlane[p][2];
+ GLfloat d = ctx->Transform._ClipUserPlane[p][3];
+ POLY_CLIP(CLIP_USER_BIT, a, b, c, d);
+ }
+ }
+ }
+
+ if (ctx->_TriangleCaps & DD_FLATSHADE) {
+ if (pv != inlist[0]) {
+ ASSERT(inlist[0] >= VB->Count);
+ tnl->Driver.Render.CopyPV(ctx, inlist[0], pv);
+ }
+ }
+
+ tnl->Driver.Render.ClippedPolygon(ctx, inlist, n);
+}
+
+
+/* Clip a quad against the viewport and user clip planes.
+ */
+static INLINE void
+TAG(clip_quad)(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3,
+ GLubyte mask)
+{
+ TNLcontext *tnl = TNL_CONTEXT(ctx);
+ struct vertex_buffer *VB = &tnl->vb;
+ interp_func interp = tnl->Driver.Render.Interp;
+ GLfloat (*coord)[4] = VB->ClipPtr->data;
+ GLuint pv = v3;
+ GLuint vlist[2][MAX_CLIPPED_VERTICES];
+ GLuint *inlist = vlist[0], *outlist = vlist[1];
+ GLuint p;
+ GLubyte *clipmask = VB->ClipMask;
+ GLuint n = 4;
+#ifdef DEBUG
+ if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
+#endif
+#ifdef PERFORMANCE_MEASURE
+ if (VIA_PERFORMANCE) P_M;
+#endif
+ ASSIGN_4V(inlist, v3, v0, v1, v2); /* pv rotated to slot zero */
+
+ VB->LastClipped = VB->Count;
+
+ if (mask & 0x3f) {
+ POLY_CLIP(CLIP_RIGHT_BIT, -1, 0, 0, 1);
+ POLY_CLIP(CLIP_LEFT_BIT, 1, 0, 0, 1);
+ POLY_CLIP(CLIP_TOP_BIT, 0, -1, 0, 1);
+ POLY_CLIP(CLIP_BOTTOM_BIT, 0, 1, 0, 1);
+ POLY_CLIP(CLIP_FAR_BIT, 0, 0, -1, 1);
+ POLY_CLIP(CLIP_NEAR_BIT, 0, 0, 1, 1);
+ }
+
+ if (mask & CLIP_USER_BIT) {
+ for (p = 0; p < MAX_CLIP_PLANES; p++) {
+ if (ctx->Transform.ClipPlanesEnabled & (1 << p)) {
+ GLfloat a = ctx->Transform._ClipUserPlane[p][0];
+ GLfloat b = ctx->Transform._ClipUserPlane[p][1];
+ GLfloat c = ctx->Transform._ClipUserPlane[p][2];
+ GLfloat d = ctx->Transform._ClipUserPlane[p][3];
+ POLY_CLIP(CLIP_USER_BIT, a, b, c, d);
+ }
+ }
+ }
+
+ if (ctx->_TriangleCaps & DD_FLATSHADE) {
+ if (pv != inlist[0]) {
+ ASSERT(inlist[0] >= VB->Count);
+ tnl->Driver.Render.CopyPV(ctx, inlist[0], pv);
+ }
+ }
+
+ tnl->Driver.Render.ClippedPolygon(ctx, inlist, n);
+#ifdef DEBUG
+ if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__);
+#endif
+}
+
+#undef W
+#undef Z
+#undef Y
+#undef X
+#undef SIZE
+#undef TAG
+#undef POLY_CLIP
+#undef LINE_CLIP
#ifdef PERFORMANCE_MEASURE
if (VIA_PERFORMANCE) P_M;
#endif
- if (TEST_PRIM_PARITY(flags))
- parity = 1;
-
INIT(GL_TRIANGLES);
if (NEED_EDGEFLAG_SETUP) {