diff options
author | Brian Paul <[email protected]> | 2009-11-02 12:40:04 -0700 |
---|---|---|
committer | Brian Paul <[email protected]> | 2009-11-03 09:52:25 -0700 |
commit | bcbfda71b03303d3f008a6f3cf8cb7d9667bf8d2 (patch) | |
tree | bdbdb244d65ece593811a25c861087d7a526ffc2 /src/mesa/drivers/dri/intel | |
parent | 644d8fd363ca7d8f40f4fa319919985cc002df9e (diff) |
intel: avoid unnecessary front buffer flushing/updating
Before, if we just called glXMakeCurrent() and didn't render anything we'd
still trigger a flushFrontBuffer() call.
Now only set the intel->front_buffer_dirty field at state validation time
just before we draw something.
NOTE: additional calls to intel_check_front_buffer_rendering() might be
needed if I missed some rendering paths.
Diffstat (limited to 'src/mesa/drivers/dri/intel')
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_buffers.c | 21 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_buffers.h | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_span.c | 2 |
3 files changed, 23 insertions, 2 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_buffers.c b/src/mesa/drivers/dri/intel/intel_buffers.c index 639ffa64376..6b12d484d85 100644 --- a/src/mesa/drivers/dri/intel/intel_buffers.c +++ b/src/mesa/drivers/dri/intel/intel_buffers.c @@ -133,6 +133,25 @@ intel_get_cliprects(struct intel_context *intel, /** + * Check if we're about to draw into the front color buffer. + * If so, set the intel->front_buffer_dirty field to true. + */ +void +intel_check_front_buffer_rendering(struct intel_context *intel) +{ + const struct gl_framebuffer *fb = intel->ctx.DrawBuffer; + if (fb->Name == 0) { + /* drawing to window system buffer */ + if (fb->_NumColorDrawBuffers > 0) { + if (fb->_ColorDrawBufferIndexes[0] == BUFFER_FRONT_LEFT) { + intel->front_buffer_dirty = GL_TRUE; + } + } + } +} + + +/** * Update the hardware state for drawing into a window or framebuffer object. * * Called by glDrawBuffer, glBindFramebufferEXT, MakeCurrent, and other @@ -202,8 +221,6 @@ intel_draw_buffer(GLcontext * ctx, struct gl_framebuffer *fb) intel_batchbuffer_flush(intel->batch); intel->front_cliprects = GL_TRUE; colorRegions[0] = intel_get_rb_region(fb, BUFFER_FRONT_LEFT); - - intel->front_buffer_dirty = GL_TRUE; } else { if (!intel->constant_cliprect && intel->front_cliprects) diff --git a/src/mesa/drivers/dri/intel/intel_buffers.h b/src/mesa/drivers/dri/intel/intel_buffers.h index 6069d38e9eb..d7800f2ca2f 100644 --- a/src/mesa/drivers/dri/intel/intel_buffers.h +++ b/src/mesa/drivers/dri/intel/intel_buffers.h @@ -45,6 +45,8 @@ extern struct intel_region *intel_readbuf_region(struct intel_context *intel); extern struct intel_region *intel_drawbuf_region(struct intel_context *intel); +extern void intel_check_front_buffer_rendering(struct intel_context *intel); + extern void intel_draw_buffer(GLcontext * ctx, struct gl_framebuffer *fb); extern void intelInitBufferFuncs(struct dd_function_table *functions); diff --git a/src/mesa/drivers/dri/intel/intel_span.c b/src/mesa/drivers/dri/intel/intel_span.c index 638e05f2add..bab13e3665b 100644 --- a/src/mesa/drivers/dri/intel/intel_span.c +++ b/src/mesa/drivers/dri/intel/intel_span.c @@ -501,6 +501,8 @@ intel_map_unmap_framebuffer(struct intel_context *intel, else intel_renderbuffer_unmap(intel, fb->_StencilBuffer->Wrapped); } + + intel_check_front_buffer_rendering(intel); } /** |