summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/dri/unichrome/via_context.c4
-rw-r--r--src/mesa/drivers/dri/unichrome/via_context.h15
-rw-r--r--src/mesa/drivers/dri/unichrome/via_state.c43
3 files changed, 55 insertions, 7 deletions
diff --git a/src/mesa/drivers/dri/unichrome/via_context.c b/src/mesa/drivers/dri/unichrome/via_context.c
index dde78c2dc90..ee7f7a079af 100644
--- a/src/mesa/drivers/dri/unichrome/via_context.c
+++ b/src/mesa/drivers/dri/unichrome/via_context.c
@@ -54,7 +54,6 @@
#include "via_tris.h"
#include "via_ioctl.h"
#include "via_fb.h"
-#include "via_regs.h"
#include <stdio.h>
#include "macros.h"
@@ -380,9 +379,8 @@ viaCreateContext(const __GLcontextModes *mesaVis,
assert(!mesaVis->haveStencilBuffer);
vmesa->have_hw_stencil = GL_FALSE;
vmesa->depth_max = (GLfloat)0xffffffff;
- vmesa->depth_clear_mask = 0;
- vmesa->ClearDepth = 0xffffffff;
vmesa->depth_clear_mask = 0xf << 28;
+ vmesa->ClearDepth = 0xffffffff;
vmesa->polygon_offset_scale = 2.0 / vmesa->depth_max;
break;
default:
diff --git a/src/mesa/drivers/dri/unichrome/via_context.h b/src/mesa/drivers/dri/unichrome/via_context.h
index c6b3265b105..4562c9e656d 100644
--- a/src/mesa/drivers/dri/unichrome/via_context.h
+++ b/src/mesa/drivers/dri/unichrome/via_context.h
@@ -41,6 +41,18 @@ typedef struct via_texture_object_t *viaTextureObjectPtr;
#include "via_tex.h"
#include "via_common.h"
+/* Chip tags. These are used to group the adapters into
+ * related families.
+ */
+enum VIACHIPTAGS {
+ VIA_UNKNOWN = 0,
+ VIA_CLE266,
+ VIA_KM400,
+ VIA_K8M800,
+ VIA_PM800,
+ VIA_LAST
+};
+
#define VIA_FALLBACK_TEXTURE 0x1
#define VIA_FALLBACK_DRAW_BUFFER 0x2
#define VIA_FALLBACK_READ_BUFFER 0x4
@@ -53,6 +65,7 @@ typedef struct via_texture_object_t *viaTextureObjectPtr;
#define VIA_FALLBACK_BLEND_FUNC 0x400
#define VIA_FALLBACK_USER_DISABLE 0x800
#define VIA_FALLBACK_PROJ_TEXTURE 0x1000
+#define VIA_FALLBACK_STIPPLE 0x2000
#define VIA_DMA_BUFSIZ 4096
#define VIA_DMA_HIGHWATER (VIA_DMA_BUFSIZ - 128)
@@ -284,6 +297,8 @@ struct via_context_t {
GLuint swap_count;
GLuint swap_missed_count;
+ GLuint stipple[32];
+
PFNGLXGETUSTPROC get_ust;
};
diff --git a/src/mesa/drivers/dri/unichrome/via_state.c b/src/mesa/drivers/dri/unichrome/via_state.c
index 43430210518..94b32011618 100644
--- a/src/mesa/drivers/dri/unichrome/via_state.c
+++ b/src/mesa/drivers/dri/unichrome/via_state.c
@@ -469,9 +469,8 @@ void viaEmitState(viaContextPtr vmesa)
}
}
-
if (ctx->Polygon.StippleFlag) {
- GLuint *stipple = &ctx->PolygonStipple[0];
+ GLuint *stipple = &vmesa->stipple[0];
BEGIN_RING(38);
OUT_RING( HC_HEADER2 );
@@ -675,7 +674,7 @@ static void viaDrawBuffer(GLcontext *ctx, GLenum mode)
viaXMesaWindowMoved(vmesa);
- /* We want to update the s/w rast state too so that r200SetBuffer()
+ /* We want to update the s/w rast state too so that viaSetBuffer()
* gets called.
*/
_swrast_DrawBuffer(ctx, mode);
@@ -758,6 +757,41 @@ static void viaDepthRange(GLcontext *ctx,
viaCalcViewport(ctx);
}
+#if 0
+static void
+flip_bytes( GLubyte *p, GLuint n )
+{
+ register GLuint i, a, b;
+
+ for (i=0;i<n;i++) {
+ b = (GLuint) p[i]; /* words are often faster than bytes */
+ a = ((b & 0x01) << 7) |
+ ((b & 0x02) << 5) |
+ ((b & 0x04) << 3) |
+ ((b & 0x08) << 1) |
+ ((b & 0x10) >> 1) |
+ ((b & 0x20) >> 3) |
+ ((b & 0x40) >> 5) |
+ ((b & 0x80) >> 7);
+ p[i] = (GLubyte) a;
+ }
+}
+#endif
+
+static void viaPolygonStipple( GLcontext *ctx, const GLubyte *mask )
+{
+ viaContextPtr vmesa = VIA_CONTEXT(ctx);
+ GLubyte *s = (GLubyte *)vmesa->stipple;
+ int i;
+
+ /* Fallback for the CLE266 case as it doesn't seem to work */
+ if (vmesa->viaScreen->deviceID == VIA_CLE266) {
+ FALLBACK( vmesa, VIA_FALLBACK_STIPPLE, GL_TRUE);
+ } else {
+ for (i=0;i<128;i++)
+ s[i] = mask[i];
+ }
+}
void viaInitState(GLcontext *ctx)
{
@@ -1557,7 +1591,7 @@ void viaValidateState( GLcontext *ctx )
viaChooseTriangle(ctx);
}
- if (vmesa->newState & _NEW_STENCIL)
+ if ((vmesa->newState & _NEW_STENCIL) && vmesa->have_hw_stencil)
viaChooseStencilState(ctx);
if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR)
@@ -1600,6 +1634,7 @@ void viaInitStateFuncs(GLcontext *ctx)
ctx->Driver.DepthRange = viaDepthRange;
ctx->Driver.Viewport = viaViewport;
ctx->Driver.Enable = viaEnable;
+ ctx->Driver.PolygonStipple = viaPolygonStipple;
/* Pixel path fallbacks.
*/