summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/r128/r128_ioctl.c
diff options
context:
space:
mode:
authorEric Anholt <anholt@FreeBSD.org>2005-10-27 20:26:24 +0000
committerEric Anholt <anholt@FreeBSD.org>2005-10-27 20:26:24 +0000
commit215c4c3a9c989b3d0e7090177ab2fc3eeab0ddaa (patch)
tree4d358e322e350f176e5b0dfbc6c838403f7199fd /src/mesa/drivers/dri/r128/r128_ioctl.c
parent512c994b92126a7575bb3cc327da40710b43f52c (diff)
Bug #1028: Add hardware-accelerated stencil support to r128. Testing with
stencilwrap reported many issues with various modes. Some of these were complicated by the fact that spans are broken (Bug #1615), but some appear to be real bugs. However, while spans remain broken, I found that visual results were better by avoiding fallbacks rather than avoiding just a broken stencil implementation. Note that this required changing the depth spans at 24+8bpp into read-modify-write cycles. It would be nicer as a single write with a mask, but the kernel span blits turn off masking. Reviewed by: ajax
Diffstat (limited to 'src/mesa/drivers/dri/r128/r128_ioctl.c')
-rw-r--r--src/mesa/drivers/dri/r128/r128_ioctl.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/mesa/drivers/dri/r128/r128_ioctl.c b/src/mesa/drivers/dri/r128/r128_ioctl.c
index 8f14854887..3b34d9fbb2 100644
--- a/src/mesa/drivers/dri/r128/r128_ioctl.c
+++ b/src/mesa/drivers/dri/r128/r128_ioctl.c
@@ -408,6 +408,7 @@ static void r128Clear( GLcontext *ctx, GLbitfield mask, GLboolean all,
GLuint flags = 0;
GLint i;
GLint ret;
+ GLuint depthmask = 0;
if ( R128_DEBUG & DEBUG_VERBOSE_API ) {
fprintf( stderr, "%s:\n", __FUNCTION__ );
@@ -438,15 +439,17 @@ static void r128Clear( GLcontext *ctx, GLbitfield mask, GLboolean all,
if ( ( mask & BUFFER_BIT_DEPTH ) && ctx->Depth.Mask ) {
flags |= R128_DEPTH;
+ /* if we're at 16 bits, extra plane mask won't hurt */
+ depthmask |= 0x00ffffff;
mask &= ~BUFFER_BIT_DEPTH;
}
-#if 0
- /* FIXME: Add stencil support */
- if ( mask & BUFFER_BIT_STENCIL ) {
- flags |= DRM_R128_DEPTH_BUFFER;
+
+ if ( mask & BUFFER_BIT_STENCIL &&
+ (ctx->Visual.stencilBits > 0 && ctx->Visual.depthBits == 24) ) {
+ flags |= R128_DEPTH;
+ depthmask |= ctx->Stencil.WriteMask[0] << 24;
mask &= ~BUFFER_BIT_STENCIL;
}
-#endif
if ( flags ) {
@@ -511,7 +514,7 @@ static void r128Clear( GLcontext *ctx, GLbitfield mask, GLboolean all,
clear.clear_color = rmesa->ClearColor;
clear.clear_depth = rmesa->ClearDepth;
clear.color_mask = rmesa->setup.plane_3d_mask_c;
- clear.depth_mask = ~0;
+ clear.depth_mask = depthmask;
ret = drmCommandWrite( rmesa->driFd, DRM_R128_CLEAR,
&clear, sizeof(clear) );