summaryrefslogtreecommitdiff
path: root/src/mesa/drivers
diff options
context:
space:
mode:
authorKeith Whitwell <keith@tungstengraphics.com>2007-08-02 13:59:31 +0100
committerKeith Whitwell <keith@tungstengraphics.com>2007-08-02 13:59:31 +0100
commit4f442d9ef5db42867c99a7288b4114a0340f73e6 (patch)
tree10f6dbab05ad7ed5d88b565273263f8f74e23354 /src/mesa/drivers
parent1ecc648398a51f734ef1e3b729595f41cedf29f9 (diff)
Reroute some clear functionality.
Still require the intelClear() call to flush batchbuffers. That will be removed later...
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/dri/i915pipe/intel_buffers.c120
-rw-r--r--src/mesa/drivers/dri/i915pipe/intel_context.c7
2 files changed, 13 insertions, 114 deletions
diff --git a/src/mesa/drivers/dri/i915pipe/intel_buffers.c b/src/mesa/drivers/dri/i915pipe/intel_buffers.c
index e39220fe47..5e68a869bf 100644
--- a/src/mesa/drivers/dri/i915pipe/intel_buffers.c
+++ b/src/mesa/drivers/dri/i915pipe/intel_buffers.c
@@ -295,110 +295,14 @@ intelWindowMoved(struct intel_context *intel)
-/**
- * Called by ctx->Driver.Clear.
- * XXX NO LONGER USED - REMOVE IN NEAR FUTURE
- */
-#if 0
-static void
-intelClear(GLcontext *ctx, GLbitfield mask)
-#else
-static void
-OLD_intelClear(struct pipe_context *pipe,
- GLboolean color, GLboolean depth,
- GLboolean stencil, GLboolean accum)
-#endif
-{
- GLcontext *ctx = (GLcontext *) pipe->glctx;
- const GLuint colorMask = *((GLuint *) & ctx->Color.ColorMask);
- GLbitfield tri_mask = 0;
- GLbitfield blit_mask = 0;
- GLbitfield swrast_mask = 0;
- struct gl_framebuffer *fb = ctx->DrawBuffer;
- GLuint i;
-
- GLbitfield mask;
-
- if (color)
- mask = ctx->DrawBuffer->_ColorDrawBufferMask[0]; /*XXX temporary*/
- else
- mask = 0x0;
-
- if (0)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- /* HW color buffers (front, back, aux, generic FBO, etc) */
- if (colorMask == ~0) {
- /* clear all R,G,B,A */
- /* XXX FBO: need to check if colorbuffers are software RBOs! */
- blit_mask |= (mask & BUFFER_BITS_COLOR);
- }
- else {
- /* glColorMask in effect */
- tri_mask |= (mask & BUFFER_BITS_COLOR);
- }
-
- /* HW stencil */
- if (stencil) {
- const struct pipe_region *stencilRegion
- = intel_get_rb_region(fb, BUFFER_STENCIL);
- if (stencilRegion) {
- /* have hw stencil */
- if ((ctx->Stencil.WriteMask[0] & 0xff) != 0xff) {
- /* not clearing all stencil bits, so use triangle clearing */
- tri_mask |= BUFFER_BIT_STENCIL;
- }
- else {
- /* clearing all stencil bits, use blitting */
- blit_mask |= BUFFER_BIT_STENCIL;
- }
- }
- }
-
- /* HW depth */
- if (depth) {
- /* clear depth with whatever method is used for stencil (see above) */
- if (tri_mask & BUFFER_BIT_STENCIL)
- tri_mask |= BUFFER_BIT_DEPTH;
- else
- blit_mask |= BUFFER_BIT_DEPTH;
- }
-
- /* SW fallback clearing */
- swrast_mask = mask & ~tri_mask & ~blit_mask;
-
- for (i = 0; i < BUFFER_COUNT; i++) {
- GLuint bufBit = 1 << i;
- if ((blit_mask | tri_mask) & bufBit) {
- if (!fb->Attachment[i].Renderbuffer->ClassID) {
- blit_mask &= ~bufBit;
- tri_mask &= ~bufBit;
- swrast_mask |= bufBit;
- }
- }
- }
-
-
- intelFlush(ctx); /* XXX intelClearWithBlit also does this */
-
- if (blit_mask)
- intelClearWithBlit(ctx, blit_mask);
-
-#if 0
- if (swrast_mask | tri_mask)
- _swrast_Clear(ctx, swrast_mask | tri_mask);
-#else
- softpipe_clear(pipe, GL_FALSE,
- (swrast_mask | tri_mask) & BUFFER_BIT_DEPTH,
- (swrast_mask | tri_mask) & BUFFER_BIT_STENCIL,
- (swrast_mask | tri_mask) & BUFFER_BIT_ACCUM);
-#endif
-}
-
-/**
- * Clear buffers. Called via pipe->clear().
- */
+/* XXX - kludge required because softpipe_clear uses
+ * region->fill(), which still calls intelBlit(!), but doesn't
+ * flush the batchbuffer.
+ *
+ * One way or another, that behaviour should stop, and then this
+ * function can go aawy.
+ */
void
intelClear(struct pipe_context *pipe,
GLboolean color, GLboolean depth,
@@ -407,19 +311,9 @@ intelClear(struct pipe_context *pipe,
GLcontext *ctx = (GLcontext *) pipe->glctx;
struct intel_context *intel = intel_context(ctx);
- /* XXX
- * Examine stencil and color writemasks to determine if we can clear
- * with blits.
- */
-
- intelFlush(&intel->ctx);
- LOCK_HARDWARE(intel);
-
softpipe_clear(pipe, color, depth, stencil, accum);
intel_batchbuffer_flush(intel->batch);
-
- UNLOCK_HARDWARE(intel);
}
diff --git a/src/mesa/drivers/dri/i915pipe/intel_context.c b/src/mesa/drivers/dri/i915pipe/intel_context.c
index be8235d7d1..0fc24c3b5a 100644
--- a/src/mesa/drivers/dri/i915pipe/intel_context.c
+++ b/src/mesa/drivers/dri/i915pipe/intel_context.c
@@ -417,7 +417,12 @@ intelCreateContext(const __GLcontextModes * mesaVis,
*/
st_create_context( &intel->ctx,
softpipe_create() );
-
+
+ /* KW: Not sure I like this - we should only be talking to the
+ * state_tracker. The pipe code will need some way of talking to
+ * us, eg for batchbuffer ioctls, and there will need to be a
+ * buffer manager interface. So, this is a temporary hack, right?
+ */
intel->pipe = intel->ctx.st->pipe;
intel->pipe->screen = intelScreen;
intel->pipe->glctx = ctx;