summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2004-02-23 21:07:12 +0000
committerBrian Paul <[email protected]>2004-02-23 21:07:12 +0000
commitcf20f8cc3f92fcc6441b55a793bcede0d83a2a69 (patch)
tree4cb5aff95a598c34debe0828d753d53591d66f01
parent537f42e24042292a34048a2e48844fbe4e9267e0 (diff)
updates from Erdi Chen
-rw-r--r--src/mesa/drivers/dri/unichrome/Makefile.solo2
-rw-r--r--src/mesa/drivers/dri/unichrome/server/via_dri.c471
-rw-r--r--src/mesa/drivers/dri/unichrome/server/via_driver.h400
-rw-r--r--src/mesa/drivers/dri/unichrome/server/via_regs.h14
-rw-r--r--src/mesa/drivers/dri/unichrome/via_common.h6
-rw-r--r--src/mesa/drivers/dri/unichrome/via_context.c42
-rw-r--r--src/mesa/drivers/dri/unichrome/via_context.h28
-rw-r--r--src/mesa/drivers/dri/unichrome/via_dd_tritmp.h33
-rw-r--r--src/mesa/drivers/dri/unichrome/via_dd_vbtmp.h78
-rw-r--r--src/mesa/drivers/dri/unichrome/via_dmatmp.h5
-rw-r--r--src/mesa/drivers/dri/unichrome/via_dri.h2
-rw-r--r--src/mesa/drivers/dri/unichrome/via_fb.c21
-rw-r--r--src/mesa/drivers/dri/unichrome/via_ioctl.c107
-rw-r--r--src/mesa/drivers/dri/unichrome/via_render.c39
-rw-r--r--src/mesa/drivers/dri/unichrome/via_screen.c13
-rw-r--r--src/mesa/drivers/dri/unichrome/via_screen.h2
-rw-r--r--src/mesa/drivers/dri/unichrome/via_span.c16
-rw-r--r--src/mesa/drivers/dri/unichrome/via_state.c276
-rw-r--r--src/mesa/drivers/dri/unichrome/via_tex.c1
-rw-r--r--src/mesa/drivers/dri/unichrome/via_tex.h1
-rw-r--r--src/mesa/drivers/dri/unichrome/via_tris.c30
-rw-r--r--src/mesa/drivers/dri/unichrome/via_vb.c50
-rw-r--r--src/mesa/drivers/dri/unichrome/via_vb_cliptmp.h286
-rw-r--r--src/mesa/drivers/dri/unichrome/via_vb_rendertmp.h3
24 files changed, 1125 insertions, 801 deletions
diff --git a/src/mesa/drivers/dri/unichrome/Makefile.solo b/src/mesa/drivers/dri/unichrome/Makefile.solo
index 4cab4992d28..8eb7ba04b29 100644
--- a/src/mesa/drivers/dri/unichrome/Makefile.solo
+++ b/src/mesa/drivers/dri/unichrome/Makefile.solo
@@ -114,7 +114,7 @@ tags:
# 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
diff --git a/src/mesa/drivers/dri/unichrome/server/via_dri.c b/src/mesa/drivers/dri/unichrome/server/via_dri.c
index db661b4056b..d82d7acc733 100644
--- a/src/mesa/drivers/dri/unichrome/server/via_dri.c
+++ b/src/mesa/drivers/dri/unichrome/server/via_dri.c
@@ -44,6 +44,7 @@
#include "driver.h"
#include "drm.h"
+#include "imports.h"
#endif
#include "dri_util.h"
@@ -66,15 +67,11 @@ static int VIADRIScreenInit(DRIDriverContext * ctx);
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
@@ -149,25 +146,18 @@ static int VIADRIAgpInit(const DRIDriverContext *ctx, VIAPtr pVia)
#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)
@@ -177,24 +167,14 @@ 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;
}
}
@@ -275,7 +255,7 @@ static int VIADRIScreenInit(DRIDriverContext * ctx)
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;
@@ -309,8 +289,12 @@ static int VIADRIScreenInit(DRIDriverContext * ctx)
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,
@@ -394,9 +378,8 @@ VIADRIFinishScreenInit(DRIDriverContext * ctx)
/* 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;
@@ -405,9 +388,7 @@ static int VIADRIKernelInit(DRIDriverContext * ctx, VIAPtr pVia)
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;
}
@@ -429,7 +410,7 @@ static int VIADRIMapInit(DRIDriverContext * ctx, VIAPtr pVia)
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,
@@ -437,8 +418,9 @@ const __GLcontextModes __glModes[] =
.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,
@@ -447,7 +429,8 @@ const __GLcontextModes __glModes[] =
.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,
@@ -493,8 +476,8 @@ static void VIAEnableMMIO(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);
@@ -518,6 +501,10 @@ static void VIAEnableMMIO(DRIDriverContext * ctx)
VGAOUT8(0x3c5, val | 0x38);
}
+ /* Unlock CRTC registers */
+ VGAOUT8(0x3d4, 0x47);
+ VGAOUT8(0x3d5, 0x00);
+
return;
}
@@ -536,57 +523,293 @@ static void VIADisableMMIO(DRIDriverContext * ctx)
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)
@@ -614,6 +837,8 @@ static void VIAInitialize2DEngine(DRIDriverContext *ctx)
VIASETREG(0x3c, 0x0);
VIASETREG(0x40, 0x0);
+ VIADisableMMIO(ctx);
+
/* Init AGP and VQ regs */
VIASETREG(0x43c, 0x00100000);
VIASETREG(0x440, 0x00000000);
@@ -706,6 +931,8 @@ static void VIAInitialize2DEngine(DRIDriverContext *ctx)
break;
}
#endif
+
+ VIAEnableMMIO(ctx);
/* Set BPP and Pitch */
VIASETREG(VIA_REG_GEMODE, dwGEMode);
@@ -718,12 +945,14 @@ static void VIAInitialize2DEngine(DRIDriverContext *ctx)
(((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);
@@ -788,7 +1017,7 @@ static void VIAInitialize3DEngine(DRIDriverContext *ctx)
VIASETREG(0x440,0x52000000);
VIASETREG(0x440,0x53000000);
- pVia->sharedData->b3DRegsInitialized = 1;
+ b3DRegsInitialized = 1;
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"3D Engine has been initialized.\n");
}
@@ -806,13 +1035,51 @@ static void VIAInitialize3DEngine(DRIDriverContext *ctx)
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;
@@ -822,22 +1089,26 @@ static int viaInitFBDev(DRIDriverContext *ctx)
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;
}
diff --git a/src/mesa/drivers/dri/unichrome/server/via_driver.h b/src/mesa/drivers/dri/unichrome/server/via_driver.h
index f97704c0768..fe7df163cf7 100644
--- a/src/mesa/drivers/dri/unichrome/server/via_driver.h
+++ b/src/mesa/drivers/dri/unichrome/server/via_driver.h
@@ -23,8 +23,8 @@
* 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 */
@@ -75,7 +75,6 @@
#include "via_dri.h"
#endif
#else
-#include "via_priv.h"
#include "via_regs.h"
#include "sarea.h"
@@ -83,11 +82,25 @@
#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)
@@ -127,145 +140,22 @@ typedef struct {
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;
@@ -289,11 +179,6 @@ typedef struct _VIA {
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;
@@ -311,13 +196,15 @@ typedef struct _VIA {
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 */
@@ -326,8 +213,10 @@ typedef struct _VIA {
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;
@@ -335,39 +224,50 @@ typedef struct _VIA {
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;
@@ -377,7 +277,7 @@ typedef struct _VIA {
VIAConfigPrivPtr pVisualConfigsPriv;
unsigned long agpHandle;
unsigned long registerHandle;
- unsigned long agpAddr;
+ CARD32 agpAddr;
unsigned char *agpBase;
unsigned int agpSize;
Bool IsPCI;
@@ -391,184 +291,24 @@ typedef struct _VIA {
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_ */
diff --git a/src/mesa/drivers/dri/unichrome/server/via_regs.h b/src/mesa/drivers/dri/unichrome/server/via_regs.h
index 3e2fb0a2a06..8205939106f 100644
--- a/src/mesa/drivers/dri/unichrome/server/via_regs.h
+++ b/src/mesa/drivers/dri/unichrome/server/via_regs.h
@@ -1,4 +1,3 @@
-/* $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.
@@ -30,12 +29,12 @@
*
************************************************************************/
-#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
@@ -47,6 +46,7 @@ enum VIACHIPTAGS {
VIA_CLE266,
VIA_KM400,
VIA_K8M800,
+ VIA_PM800,
VIA_LAST
};
@@ -57,8 +57,8 @@ enum VIACHIPTAGS {
#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
@@ -209,4 +209,4 @@ enum VIACHIPTAGS {
#define VIAGETREG(addr) *(volatile unsigned int *)(pVia->MapBase + (addr))
-#endif /* _VIA_REGS_H_ */
+#endif /* _VIA_REGS_H */
diff --git a/src/mesa/drivers/dri/unichrome/via_common.h b/src/mesa/drivers/dri/unichrome/via_common.h
index 214c87224d1..58eafc91032 100644
--- a/src/mesa/drivers/dri/unichrome/via_common.h
+++ b/src/mesa/drivers/dri/unichrome/via_common.h
@@ -60,12 +60,6 @@
#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
diff --git a/src/mesa/drivers/dri/unichrome/via_context.c b/src/mesa/drivers/dri/unichrome/via_context.c
index f38dec03ff8..9dd3230e049 100644
--- a/src/mesa/drivers/dri/unichrome/via_context.c
+++ b/src/mesa/drivers/dri/unichrome/via_context.c
@@ -24,7 +24,6 @@
#include "glheader.h"
#include "context.h"
-/*#include "mem.h"*/
#include "matrix.h"
#include "simple_list.h"
#include "extensions.h"
@@ -585,12 +584,26 @@ void
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) {
@@ -680,11 +693,16 @@ void viaXMesaWindowMoved(viaContextPtr vmesa)
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;
@@ -1073,11 +1091,7 @@ void viaGetLock(viaContextPtr vmesa, GLuint flags)
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);
@@ -1111,14 +1125,10 @@ void viaLock(viaContextPtr vmesa, GLuint flags)
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);
@@ -1161,11 +1171,7 @@ viaSwapBuffers(__DRIdrawablePrivate *drawablePrivate)
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);
}
diff --git a/src/mesa/drivers/dri/unichrome/via_context.h b/src/mesa/drivers/dri/unichrome/via_context.h
index 06e7b8b3e7e..8b5379b8cd0 100644
--- a/src/mesa/drivers/dri/unichrome/via_context.h
+++ b/src/mesa/drivers/dri/unichrome/via_context.h
@@ -242,8 +242,8 @@ struct via_context_t {
/* Hardware state
*/
GLuint dirty;
- int vertex_size;
- int vertex_stride_shift;
+ int vertexSize;
+ int vertexStrideShift;
GLint lastStamp;
GLboolean stippleInHw;
@@ -306,6 +306,8 @@ struct via_context_t {
volatile GLuint* regTranSpace;
GLuint* agpBase;
GLuint drawType;
+ /*=* John Sheng [2003.12.9] Tuxracer & VQ *=*/
+ int VQEnable;
};
/*#define DMA_OFFSET 16*/
#define DMA_OFFSET 32
@@ -460,27 +462,13 @@ extern void viaXMesaWindowMoved(viaContextPtr vmesa);
/* 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
diff --git a/src/mesa/drivers/dri/unichrome/via_dd_tritmp.h b/src/mesa/drivers/dri/unichrome/via_dd_tritmp.h
index e9af5182126..da70ced25ca 100644
--- a/src/mesa/drivers/dri/unichrome/via_dd_tritmp.h
+++ b/src/mesa/drivers/dri/unichrome/via_dd_tritmp.h
@@ -167,12 +167,12 @@ static void TAG(triangle)(GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2)
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]);
}
}
@@ -269,20 +269,11 @@ static void TAG(triangle)(GLcontext *ctx, GLuint e0, GLuint e1, GLuint 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
}
}
@@ -419,14 +410,14 @@ static void TAG(quad)(GLcontext *ctx,
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]);
}
}
@@ -536,22 +527,12 @@ static void TAG(quad)(GLcontext *ctx,
}
}
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
}
}
diff --git a/src/mesa/drivers/dri/unichrome/via_dd_vbtmp.h b/src/mesa/drivers/dri/unichrome/via_dd_vbtmp.h
index f55123297fb..f0144b3e5e1 100644
--- a/src/mesa/drivers/dri/unichrome/via_dd_vbtmp.h
+++ b/src/mesa/drivers/dri/unichrome/via_dd_vbtmp.h
@@ -352,7 +352,7 @@ static void TAG(emit)(GLcontext *ctx, GLuint start, GLuint end,
(void) s;
- //ASSERT(stride == 4);
+ /*ASSERT(stride == 4);*/
#ifdef DEBUG
if (VIA_DEBUG) {
fprintf(stderr, "TAG-emit for DO_XYZW\n");
@@ -649,82 +649,82 @@ static void TAG(init)(void)
#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
diff --git a/src/mesa/drivers/dri/unichrome/via_dmatmp.h b/src/mesa/drivers/dri/unichrome/via_dmatmp.h
index 458ccea213f..5808b505f37 100644
--- a/src/mesa/drivers/dri/unichrome/via_dmatmp.h
+++ b/src/mesa/drivers/dri/unichrome/via_dmatmp.h
@@ -304,11 +304,6 @@ static void TAG(render_tri_strip_verts)(GLcontext *ctx,
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);
diff --git a/src/mesa/drivers/dri/unichrome/via_dri.h b/src/mesa/drivers/dri/unichrome/via_dri.h
index b4293e510b0..aef0ac4ba0f 100644
--- a/src/mesa/drivers/dri/unichrome/via_dri.h
+++ b/src/mesa/drivers/dri/unichrome/via_dri.h
@@ -39,6 +39,8 @@ typedef struct {
int irqEnabled;
unsigned int scrnX, scrnY;
int sarea_priv_offset;
+ /*=* John Sheng [2003.12.9] Tuxracer & VQ *=*/
+ int VQEnable;
} VIADRIRec, *VIADRIPtr;
typedef struct {
diff --git a/src/mesa/drivers/dri/unichrome/via_fb.c b/src/mesa/drivers/dri/unichrome/via_fb.c
index 9d9a5b10350..44503c7288c 100644
--- a/src/mesa/drivers/dri/unichrome/via_fb.c
+++ b/src/mesa/drivers/dri/unichrome/via_fb.c
@@ -53,8 +53,8 @@ via_alloc_back_buffer(viaContextPtr vmesa)
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__);
@@ -86,8 +86,8 @@ via_alloc_front_buffer(viaContextPtr vmesa)
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);
}
@@ -145,8 +145,8 @@ via_alloc_depth_buffer(viaContextPtr vmesa)
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__);
@@ -247,16 +247,21 @@ via_free_dma_buffer(viaContextPtr vmesa)
}
/* 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;
}
diff --git a/src/mesa/drivers/dri/unichrome/via_ioctl.c b/src/mesa/drivers/dri/unichrome/via_ioctl.c
index 04dc130d3f1..9b67b920875 100644
--- a/src/mesa/drivers/dri/unichrome/via_ioctl.c
+++ b/src/mesa/drivers/dri/unichrome/via_ioctl.c
@@ -46,7 +46,7 @@ GLuint nFirstFlip = GL_TRUE;
#define SetReg2DAGP(nReg, nData) { \
*((GLuint *)(vb)) = ((nReg) >> 2) | 0xF0000000; \
*((GLuint *)(vb) + 1) = (nData); \
- vb += 2; \
+ vb = ((GLuint *)vb) + 2; \
vmesa->dmaLow +=8; \
}
@@ -463,20 +463,20 @@ void viaPageFlip(const __DRIdrawablePrivate *dPriv)
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
@@ -1112,7 +1112,7 @@ void viaFillStencilDepthBuffer(viaContextPtr vmesa, GLuint pixel)
}
}
- if (vmesa->glCtx->Color._DrawDestMask & BACK_LEFT_BIT) {
+ if (vmesa->glCtx->Color._DrawDestMask == __GL_BACK_BUFFER_MASK) {
viaFlushPrimsLocked(vmesa);
}
}
@@ -1180,7 +1180,7 @@ void viaFillStencilBuffer(viaContextPtr vmesa, GLuint pixel)
}
}
- if (vmesa->glCtx->Color._DrawDestMask & BACK_LEFT_BIT) {
+ if (vmesa->glCtx->Color._DrawDestMask == __GL_BACK_BUFFER_MASK) {
viaFlushPrimsLocked(vmesa);
}
}
@@ -1265,7 +1265,7 @@ void viaFillDepthBuffer(viaContextPtr vmesa, GLuint pixel)
}
}
- if (vmesa->glCtx->Color._DrawDestMask & BACK_LEFT_BIT) {
+ if (vmesa->glCtx->Color._DrawDestMask == __GL_BACK_BUFFER_MASK) {
viaFlushPrimsLocked(vmesa);
}
}
@@ -1556,9 +1556,9 @@ int flush_agp(viaContextPtr vmesa, drm_via_flush_agp_t* agpCmd)
/*=* [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);
@@ -1712,7 +1712,7 @@ int flush_agp(viaContextPtr vmesa, drm_via_flush_agp_t* agpCmd)
}
#ifdef DEBUG
- if (VIA_DEBUG && 0/*FIXME*/) {
+ if (VIA_DEBUG) {
volatile GLuint *pnEngBase = (volatile GLuint *)((GLuint)pnMMIOBase + 0x400);
int nStatus;
int i = 0;
@@ -1807,9 +1807,9 @@ int flush_agp_saam(viaContextPtr vmesa, drm_via_flush_agp_t* agpCmd)
/*=* [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);
@@ -2035,7 +2035,8 @@ int flush_sys(viaContextPtr vmesa, drm_via_flush_sys_t* buf)
/*=* [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 *=*/
{
@@ -2049,8 +2050,21 @@ int flush_sys(viaContextPtr vmesa, drm_via_flush_sys_t* buf)
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);
@@ -2213,5 +2227,62 @@ int flush_sys(viaContextPtr vmesa, drm_via_flush_sys_t* buf)
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;
}
diff --git a/src/mesa/drivers/dri/unichrome/via_render.c b/src/mesa/drivers/dri/unichrome/via_render.c
index ea3289fdb42..9f87533e3d0 100644
--- a/src/mesa/drivers/dri/unichrome/via_render.c
+++ b/src/mesa/drivers/dri/unichrome/via_render.c
@@ -32,7 +32,6 @@
#include "context.h"
#include "macros.h"
#include "mtypes.h"
-/*#include "mmath.h" _SOLO */
#include "tnl/t_context.h"
@@ -90,7 +89,7 @@ static void VERT_FALLBACK(GLcontext *ctx,
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
@@ -112,9 +111,9 @@ static void VERT_FALLBACK(GLcontext *ctx,
#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) \
@@ -164,7 +163,7 @@ static GLboolean via_run_fastrender(GLcontext *ctx,
#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);
@@ -191,17 +190,17 @@ static GLboolean via_run_fastrender(GLcontext *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;
@@ -249,6 +248,7 @@ const struct tnl_pipeline_stage _via_fastrender_stage =
/**********************************************************************/
/* 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))
@@ -266,7 +266,7 @@ const struct tnl_pipeline_stage _via_fastrender_stage =
#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"
/**********************************************************************/
@@ -293,6 +293,7 @@ const struct tnl_pipeline_stage _via_fastrender_stage =
} 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; \
@@ -335,7 +336,7 @@ const struct tnl_pipeline_stage _via_fastrender_stage =
#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.
@@ -344,7 +345,7 @@ const struct tnl_pipeline_stage _via_fastrender_stage =
#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:
*/
@@ -448,7 +449,7 @@ static GLboolean via_run_render(GLcontext *ctx,
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);
@@ -458,13 +459,13 @@ static GLboolean via_run_render(GLcontext *ctx,
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))
@@ -481,24 +482,24 @@ static GLboolean via_run_render(GLcontext *ctx,
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)
diff --git a/src/mesa/drivers/dri/unichrome/via_screen.c b/src/mesa/drivers/dri/unichrome/via_screen.c
index 1f30e544511..e0f64cf94d6 100644
--- a/src/mesa/drivers/dri/unichrome/via_screen.c
+++ b/src/mesa/drivers/dri/unichrome/via_screen.c
@@ -22,7 +22,6 @@
* DEALINGS IN THE SOFTWARE.
*/
-/*#include <X11/Xlibint.h> _SOLO*/
#include <stdio.h>
#include "utils.h"
@@ -38,6 +37,7 @@
#include "via_tris.h"
#include "via_ioctl.h"
#include "via_screen.h"
+#include "via_fb.h"
#include "via_dri.h"
extern viaContextPtr current_mesa;
@@ -91,6 +91,8 @@ viaInitDriver(__DRIscreenPrivate *sPriv)
#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);
@@ -175,7 +177,6 @@ viaCreateBuffer(__DRIscreenPrivate *driScrnPriv,
#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;
@@ -189,15 +190,10 @@ viaCreateBuffer(__DRIscreenPrivate *driScrnPriv,
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? */
@@ -210,7 +206,6 @@ viaCreateBuffer(__DRIscreenPrivate *driScrnPriv,
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__);
#endif
return (driDrawPriv->driverPrivate != NULL);
-#endif
}
else {
driDrawPriv->driverPrivate = (void *)
diff --git a/src/mesa/drivers/dri/unichrome/via_screen.h b/src/mesa/drivers/dri/unichrome/via_screen.h
index a61a68cfb96..f8d2b9c57a6 100644
--- a/src/mesa/drivers/dri/unichrome/via_screen.h
+++ b/src/mesa/drivers/dri/unichrome/via_screen.h
@@ -66,6 +66,8 @@ typedef struct {
__DRIscreenPrivate *driScrnPriv;
drmBufMapPtr bufs;
unsigned int sareaPrivOffset;
+ /*=* John Sheng [2003.12.9] Tuxracer & VQ *=*/
+ int VQEnable;
} viaScreenPrivate;
extern GLboolean
diff --git a/src/mesa/drivers/dri/unichrome/via_span.c b/src/mesa/drivers/dri/unichrome/via_span.c
index fb5a82a797a..af1bcf5579e 100644
--- a/src/mesa/drivers/dri/unichrome/via_span.c
+++ b/src/mesa/drivers/dri/unichrome/via_span.c
@@ -32,9 +32,7 @@
#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; \
@@ -47,10 +45,8 @@
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; \
@@ -158,7 +154,8 @@
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; \
@@ -166,7 +163,7 @@
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); \
} \
@@ -209,7 +206,6 @@
/*=* [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; \
@@ -222,14 +218,13 @@
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); \
} \
@@ -281,7 +276,6 @@
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; \
@@ -326,7 +320,7 @@
*/
-void viaSetBuffer(GLcontext *ctx, GLframebuffer *colorBuffer,
+static void viaSetBuffer(GLcontext *ctx, GLframebuffer *colorBuffer,
GLuint bufferBit)
{
viaContextPtr vmesa = VIA_CONTEXT(ctx);
diff --git a/src/mesa/drivers/dri/unichrome/via_state.c b/src/mesa/drivers/dri/unichrome/via_state.c
index 61000f228aa..44858bd8e0b 100644
--- a/src/mesa/drivers/dri/unichrome/via_state.c
+++ b/src/mesa/drivers/dri/unichrome/via_state.c
@@ -251,7 +251,7 @@ static void viaDrawBuffer(GLcontext *ctx, GLenum mode)
#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;
@@ -262,7 +262,7 @@ static void viaDrawBuffer(GLcontext *ctx, GLenum mode)
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;
@@ -335,11 +335,11 @@ static void viaBitmap( GLcontext *ctx, GLint px, GLint py,
/*=* 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 *=*/
@@ -496,7 +496,7 @@ void viaInitState(GLcontext *ctx)
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;
}
@@ -1681,11 +1681,11 @@ void viaChooseTextureState(GLcontext *ctx)
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 |
@@ -1729,7 +1729,7 @@ void viaChooseTextureState(GLcontext *ctx)
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 |
@@ -1774,7 +1774,7 @@ void viaChooseTextureState(GLcontext *ctx)
}
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 |
@@ -1814,7 +1814,7 @@ void viaChooseTextureState(GLcontext *ctx)
}
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 |
@@ -1854,7 +1854,7 @@ void viaChooseTextureState(GLcontext *ctx)
}
break;
}
- switch ((GLint)(texUnit0->CombineScaleShiftRGB)) {
+ switch ((GLint)(texUnit0->Combine.ScaleShiftRGB)) {
case 1:
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCshift_No;
break;
@@ -1872,7 +1872,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -1890,7 +1890,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -1908,7 +1908,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -1947,7 +1947,7 @@ void viaChooseTextureState(GLcontext *ctx)
}
break;
}
- switch (texUnit0->CombineSourceRGB[1]) {
+ switch (texUnit0->Combine.SourceRGB[1]) {
case GL_TEXTURE:
if (AlphaCombine[1]==0) {
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_Tex;
@@ -1986,7 +1986,7 @@ void viaChooseTextureState(GLcontext *ctx)
}
break;
}
- switch ((GLint)(texUnit0->CombineScaleShiftRGB)) {
+ switch ((GLint)(texUnit0->Combine.ScaleShiftRGB)) {
case 1:
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCshift_No;
break;
@@ -2000,7 +2000,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
}
@@ -2011,7 +2011,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -2029,7 +2029,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -2047,7 +2047,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -2079,7 +2079,7 @@ void viaChooseTextureState(GLcontext *ctx)
}
break;
}
- switch (texUnit0->CombineSourceRGB[1]) {
+ switch (texUnit0->Combine.SourceRGB[1]) {
case GL_TEXTURE:
if (AlphaCombine[1]==0) {
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCc_Tex;
@@ -2111,7 +2111,7 @@ void viaChooseTextureState(GLcontext *ctx)
}
break;
}
- switch ((GLint)(texUnit0->CombineScaleShiftRGB)) {
+ switch ((GLint)(texUnit0->Combine.ScaleShiftRGB)) {
case 1:
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCshift_No;
break;
@@ -2131,7 +2131,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -2149,7 +2149,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -2167,7 +2167,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -2199,7 +2199,7 @@ void viaChooseTextureState(GLcontext *ctx)
}
break;
}
- switch (texUnit0->CombineSourceRGB[1]) {
+ switch (texUnit0->Combine.SourceRGB[1]) {
case GL_TEXTURE:
if (AlphaCombine[1]==0) {
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCbias_Tex;
@@ -2231,7 +2231,7 @@ void viaChooseTextureState(GLcontext *ctx)
}
break;
}
- switch ((GLint)(texUnit0->CombineScaleShiftRGB)) {
+ switch ((GLint)(texUnit0->Combine.ScaleShiftRGB)) {
case 1:
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCshift_No;
break;
@@ -2246,7 +2246,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -2264,7 +2264,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -2286,7 +2286,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -2304,7 +2304,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -2336,7 +2336,7 @@ void viaChooseTextureState(GLcontext *ctx)
}
break;
}
- switch (texUnit0->CombineSourceRGB[1]) {
+ switch (texUnit0->Combine.SourceRGB[1]) {
case GL_TEXTURE:
if (AlphaCombine[0]==0) {
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCc_Tex;
@@ -2375,7 +2375,7 @@ void viaChooseTextureState(GLcontext *ctx)
}
break;
}
- switch (texUnit0->CombineSourceRGB[2]) {
+ switch (texUnit0->Combine.SourceRGB[2]) {
case GL_TEXTURE:
if (AlphaCombine[0]==0) {
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_Tex;
@@ -2407,7 +2407,7 @@ void viaChooseTextureState(GLcontext *ctx)
}
break;
}
- switch ((GLint)(texUnit0->CombineScaleShiftRGB)) {
+ switch ((GLint)(texUnit0->Combine.ScaleShiftRGB)) {
case 1:
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCshift_No;
break;
@@ -2420,11 +2420,11 @@ void viaChooseTextureState(GLcontext *ctx)
}
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 |
@@ -2447,7 +2447,7 @@ void viaChooseTextureState(GLcontext *ctx)
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 |
@@ -2472,7 +2472,7 @@ void viaChooseTextureState(GLcontext *ctx)
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 |
@@ -2494,7 +2494,7 @@ void viaChooseTextureState(GLcontext *ctx)
}
break;
}
- switch ((GLint)(texUnit0->CombineScaleShiftA)) {
+ switch ((GLint)(texUnit0->Combine.ScaleShiftA)) {
case 1:
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAshift_No;
break;
@@ -2512,7 +2512,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -2520,7 +2520,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -2528,7 +2528,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -2542,7 +2542,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -2556,7 +2556,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -2570,7 +2570,7 @@ void viaChooseTextureState(GLcontext *ctx)
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 {
@@ -2579,7 +2579,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -2587,7 +2587,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -2595,7 +2595,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -2609,7 +2609,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -2623,7 +2623,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -2642,7 +2642,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -2650,14 +2650,14 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -2671,7 +2671,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -2685,7 +2685,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -2701,7 +2701,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -2709,7 +2709,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -2718,7 +2718,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -2726,7 +2726,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -2740,7 +2740,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -2758,7 +2758,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -2772,7 +2772,7 @@ void viaChooseTextureState(GLcontext *ctx)
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAa_Adif;
break;
}
- switch (texUnit0->CombineScaleShiftA) {
+ switch (texUnit0->Combine.ScaleShiftA) {
case 1:
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAshift_No;
break;
@@ -3024,7 +3024,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -3032,7 +3032,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -3040,7 +3040,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -3056,7 +3056,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -4204,11 +4204,11 @@ void viaChooseTextureState(GLcontext *ctx)
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 |
@@ -4252,7 +4252,7 @@ void viaChooseTextureState(GLcontext *ctx)
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 |
@@ -4297,7 +4297,7 @@ void viaChooseTextureState(GLcontext *ctx)
}
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 |
@@ -4337,7 +4337,7 @@ void viaChooseTextureState(GLcontext *ctx)
}
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 |
@@ -4377,7 +4377,7 @@ void viaChooseTextureState(GLcontext *ctx)
}
break;
}
- switch ((GLint)(texUnit1->CombineScaleShiftRGB)) {
+ switch ((GLint)(texUnit1->Combine.ScaleShiftRGB)) {
case 1:
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCshift_No;
break;
@@ -4395,7 +4395,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -4413,7 +4413,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -4431,7 +4431,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -4470,7 +4470,7 @@ void viaChooseTextureState(GLcontext *ctx)
}
break;
}
- switch (texUnit1->CombineSourceRGB[1]) {
+ switch (texUnit1->Combine.SourceRGB[1]) {
case GL_TEXTURE:
if (AlphaCombine[1]==0) {
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCb_Tex;
@@ -4509,7 +4509,7 @@ void viaChooseTextureState(GLcontext *ctx)
}
break;
}
- switch ((GLint)(texUnit1->CombineScaleShiftRGB)) {
+ switch ((GLint)(texUnit1->Combine.ScaleShiftRGB)) {
case 1:
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCshift_No;
break;
@@ -4523,7 +4523,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
}
@@ -4534,7 +4534,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -4552,7 +4552,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -4570,7 +4570,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -4602,7 +4602,7 @@ void viaChooseTextureState(GLcontext *ctx)
}
break;
}
- switch (texUnit1->CombineSourceRGB[1]) {
+ switch (texUnit1->Combine.SourceRGB[1]) {
case GL_TEXTURE:
if (AlphaCombine[1]==0) {
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCc_Tex;
@@ -4634,7 +4634,7 @@ void viaChooseTextureState(GLcontext *ctx)
}
break;
}
- switch ((GLint)(texUnit1->CombineScaleShiftRGB)) {
+ switch ((GLint)(texUnit1->Combine.ScaleShiftRGB)) {
case 1:
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCshift_No;
break;
@@ -4654,7 +4654,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -4672,7 +4672,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -4690,7 +4690,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -4722,7 +4722,7 @@ void viaChooseTextureState(GLcontext *ctx)
}
break;
}
- switch (texUnit1->CombineSourceRGB[1]) {
+ switch (texUnit1->Combine.SourceRGB[1]) {
case GL_TEXTURE:
if (AlphaCombine[1]==0) {
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCbias_Tex;
@@ -4754,7 +4754,7 @@ void viaChooseTextureState(GLcontext *ctx)
}
break;
}
- switch ((GLint)(texUnit1->CombineScaleShiftRGB)) {
+ switch ((GLint)(texUnit1->Combine.ScaleShiftRGB)) {
case 1:
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCshift_No;
break;
@@ -4769,7 +4769,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -4787,7 +4787,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -4809,7 +4809,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -4827,7 +4827,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -4859,7 +4859,7 @@ void viaChooseTextureState(GLcontext *ctx)
}
break;
}
- switch (texUnit1->CombineSourceRGB[1]) {
+ switch (texUnit1->Combine.SourceRGB[1]) {
case GL_TEXTURE:
if (AlphaCombine[0]==0) {
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCc_Tex;
@@ -4898,7 +4898,7 @@ void viaChooseTextureState(GLcontext *ctx)
}
break;
}
- switch (texUnit1->CombineSourceRGB[2]) {
+ switch (texUnit1->Combine.SourceRGB[2]) {
case GL_TEXTURE:
if (AlphaCombine[0]==0) {
vmesa->regHTXnTBLCsat_0 |= HC_HTXnTBLCa_Tex;
@@ -4930,7 +4930,7 @@ void viaChooseTextureState(GLcontext *ctx)
}
break;
}
- switch ((GLint)(texUnit1->CombineScaleShiftRGB)) {
+ switch ((GLint)(texUnit1->Combine.ScaleShiftRGB)) {
case 1:
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLCshift_No;
break;
@@ -4958,7 +4958,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -4966,7 +4966,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -4974,7 +4974,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -4990,7 +4990,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -5009,11 +5009,11 @@ void viaChooseTextureState(GLcontext *ctx)
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 |
@@ -5036,7 +5036,7 @@ void viaChooseTextureState(GLcontext *ctx)
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 |
@@ -5061,7 +5061,7 @@ void viaChooseTextureState(GLcontext *ctx)
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 |
@@ -5083,7 +5083,7 @@ void viaChooseTextureState(GLcontext *ctx)
}
break;
}
- switch ((GLint)(texUnit1->CombineScaleShiftA)) {
+ switch ((GLint)(texUnit1->Combine.ScaleShiftA)) {
case 1:
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAshift_No;
break;
@@ -5101,7 +5101,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -5109,7 +5109,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -5117,7 +5117,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -5131,7 +5131,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -5145,7 +5145,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -5159,7 +5159,7 @@ void viaChooseTextureState(GLcontext *ctx)
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 {
@@ -5168,7 +5168,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -5176,7 +5176,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -5184,7 +5184,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -5198,7 +5198,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -5212,7 +5212,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -5231,7 +5231,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -5239,14 +5239,14 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -5260,7 +5260,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -5274,7 +5274,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -5290,7 +5290,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -5298,7 +5298,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -5307,7 +5307,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -5315,7 +5315,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -5329,7 +5329,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -5347,7 +5347,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -5361,7 +5361,7 @@ void viaChooseTextureState(GLcontext *ctx)
vmesa->regHTXnTBLAsat_0 |= HC_HTXnTBLAa_Adif;
break;
}
- switch (texUnit1->CombineScaleShiftA) {
+ switch (texUnit1->Combine.ScaleShiftA) {
case 1:
vmesa->regHTXnTBLCop_0 |= HC_HTXnTBLAshift_No;
break;
@@ -5614,7 +5614,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -5622,7 +5622,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -5630,7 +5630,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -5646,7 +5646,7 @@ void viaChooseTextureState(GLcontext *ctx)
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;
@@ -6007,8 +6007,7 @@ void viaChooseFogState(GLcontext *ctx)
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;
}
@@ -6339,7 +6338,6 @@ void viaInitStateFuncs(GLcontext *ctx)
*/
ctx->Driver.AlphaFunc = viaAlphaFunc;
ctx->Driver.BlendEquationSeparate = viaBlendEquationSeparate;
- //ctx->Driver.BlendFunc = viaBlendFunc;
ctx->Driver.BlendFuncSeparate = viaBlendFuncSeparate;
ctx->Driver.ClearColor = viaClearColor;
ctx->Driver.ColorMask = viaColorMask;
diff --git a/src/mesa/drivers/dri/unichrome/via_tex.c b/src/mesa/drivers/dri/unichrome/via_tex.c
index 326fa93accf..97a4c8572a6 100644
--- a/src/mesa/drivers/dri/unichrome/via_tex.c
+++ b/src/mesa/drivers/dri/unichrome/via_tex.c
@@ -27,7 +27,6 @@
#include <stdio.h>
#include "glheader.h"
-/*#include "mem.h" _SOLO */
#include "mtypes.h"
#include "simple_list.h"
#include "enums.h"
diff --git a/src/mesa/drivers/dri/unichrome/via_tex.h b/src/mesa/drivers/dri/unichrome/via_tex.h
index e8710b59cef..6a5c959c4cb 100644
--- a/src/mesa/drivers/dri/unichrome/via_tex.h
+++ b/src/mesa/drivers/dri/unichrome/via_tex.h
@@ -27,7 +27,6 @@
#define _VIATEX_H
#include "mtypes.h"
-/*#include "mmath.h"*/
#include "mm.h"
#include "via_context.h"
diff --git a/src/mesa/drivers/dri/unichrome/via_tris.c b/src/mesa/drivers/dri/unichrome/via_tris.c
index 47f081d58a0..61f80ae9704 100644
--- a/src/mesa/drivers/dri/unichrome/via_tris.c
+++ b/src/mesa/drivers/dri/unichrome/via_tris.c
@@ -74,7 +74,7 @@ static void __inline__ via_draw_triangle(viaContextPtr vmesa,
viaVertexPtr v1,
viaVertexPtr v2)
{
- GLuint vertsize = vmesa->vertex_size;
+ GLuint vertsize = vmesa->vertexSize;
GLuint *vb = viaCheckDma(vmesa, 3 * 4 * vertsize);
int j;
@@ -101,7 +101,7 @@ static void __inline__ via_draw_quad(viaContextPtr vmesa,
viaVertexPtr v2,
viaVertexPtr v3)
{
- GLuint vertsize = vmesa->vertex_size;
+ GLuint vertsize = vmesa->vertexSize;
GLuint *vb = viaCheckDma(vmesa, 6 * 4 * vertsize);
int j;
#ifdef DEBUG
@@ -128,7 +128,7 @@ static __inline__ void via_draw_point(viaContextPtr vmesa,
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;
@@ -155,7 +155,7 @@ static __inline__ void via_draw_line(viaContextPtr vmesa,
viaVertexPtr v0,
viaVertexPtr v1)
{
- GLuint vertsize = vmesa->vertex_size;
+ GLuint vertsize = vmesa->vertexSize;
GLuint *vb = viaCheckDma(vmesa, 2 * 4 * vertsize);
int j;
#ifdef DEBUG
@@ -200,7 +200,7 @@ static __inline__ void via_draw_line(viaContextPtr vmesa,
#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 \
@@ -280,7 +280,7 @@ static struct {
#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]
@@ -296,8 +296,8 @@ static struct {
#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;
@@ -502,7 +502,7 @@ via_fallback_point(viaContextPtr vmesa,
#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 \
@@ -627,10 +627,10 @@ static void viaFastRenderClippedPoly(GLcontext *ctx, const GLuint *elts,
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;
@@ -911,7 +911,7 @@ static void emit_all_state(viaContextPtr vmesa)
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];
@@ -923,7 +923,7 @@ static void emit_all_state(viaContextPtr vmesa)
*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
@@ -1612,7 +1612,9 @@ void viaRasterPrimitiveFinish(GLcontext *ctx)
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;
}
diff --git a/src/mesa/drivers/dri/unichrome/via_vb.c b/src/mesa/drivers/dri/unichrome/via_vb.c
index d29e3a0d833..6e8a5371815 100644
--- a/src/mesa/drivers/dri/unichrome/via_vb.c
+++ b/src/mesa/drivers/dri/unichrome/via_vb.c
@@ -27,8 +27,6 @@
#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"
@@ -42,11 +40,11 @@
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
@@ -73,10 +71,10 @@ static struct {
#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()
@@ -103,7 +101,7 @@ static struct {
#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
/***********************************************************************
@@ -263,7 +261,7 @@ void viaCheckTexSizes(GLcontext *ctx) {
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
@@ -277,8 +275,8 @@ void viaBuildVertices(GLcontext *ctx,
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
@@ -286,22 +284,22 @@ void viaBuildVertices(GLcontext *ctx,
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)
@@ -335,9 +333,9 @@ void viaChooseVertexState(GLcontext *ctx) {
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;
@@ -351,11 +349,11 @@ void viaChooseVertexState(GLcontext *ctx) {
}
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
@@ -366,15 +364,15 @@ void via_emit_contiguous_verts(GLcontext *ctx,
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
diff --git a/src/mesa/drivers/dri/unichrome/via_vb_cliptmp.h b/src/mesa/drivers/dri/unichrome/via_vb_cliptmp.h
new file mode 100644
index 00000000000..99f90003e13
--- /dev/null
+++ b/src/mesa/drivers/dri/unichrome/via_vb_cliptmp.h
@@ -0,0 +1,286 @@
+/*
+ * 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
diff --git a/src/mesa/drivers/dri/unichrome/via_vb_rendertmp.h b/src/mesa/drivers/dri/unichrome/via_vb_rendertmp.h
index aa130f96038..067b59e07c1 100644
--- a/src/mesa/drivers/dri/unichrome/via_vb_rendertmp.h
+++ b/src/mesa/drivers/dri/unichrome/via_vb_rendertmp.h
@@ -213,9 +213,6 @@ static void TAG(render_tri_strip)(GLcontext *ctx,
#ifdef PERFORMANCE_MEASURE
if (VIA_PERFORMANCE) P_M;
#endif
- if (TEST_PRIM_PARITY(flags))
- parity = 1;
-
INIT(GL_TRIANGLES);
if (NEED_EDGEFLAG_SETUP) {