Mesa (master): intel: Push flushing for cliprects changes down into the cliprects changes.

Eric Anholt anholt at kemper.freedesktop.org
Wed Oct 8 02:03:33 UTC 2008


Module: Mesa
Branch: master
Commit: fc19536aa989ad61e95c281883d32860d767f8ef
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=fc19536aa989ad61e95c281883d32860d767f8ef

Author: Eric Anholt <eric at anholt.net>
Date:   Fri Oct  3 16:20:00 2008 -0700

intel: Push flushing for cliprects changes down into the cliprects changes.

This lets us short-circuit when we're leaving the same cliprects in place,
which becomes quite common with metaops clears, and may be useful for some of
our FBO paths.

---

 src/mesa/drivers/dri/intel/intel_buffers.c |   28 ++++++++++++++++++++++------
 1 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_buffers.c b/src/mesa/drivers/dri/intel/intel_buffers.c
index defa5b1..f5eaf76 100644
--- a/src/mesa/drivers/dri/intel/intel_buffers.c
+++ b/src/mesa/drivers/dri/intel/intel_buffers.c
@@ -135,6 +135,14 @@ intel_readbuf_region(struct intel_context *intel)
 static void
 intelSetRenderbufferClipRects(struct intel_context *intel)
 {
+   /* If the batch contents require looping over cliprects, flush them before
+    * we go changing which cliprects get referenced when that happens.
+    */
+   if (intel->batch->cliprect_mode == LOOP_CLIPRECTS &&
+       (intel->fboRect.x2 != intel->ctx.DrawBuffer->Width ||
+	intel->fboRect.x2 != intel->ctx.DrawBuffer->Height))
+      intel_batchbuffer_flush(intel->batch);
+
    assert(intel->ctx.DrawBuffer->Width > 0);
    assert(intel->ctx.DrawBuffer->Height > 0);
    intel->fboRect.x1 = 0;
@@ -160,6 +168,12 @@ intelSetFrontClipRects(struct intel_context *intel)
    if (!dPriv)
       return;
 
+   /* If the batch contents require looping over cliprects, flush them before
+    * we go changing which cliprects get referenced when that happens.
+    */
+   if (intel->batch->cliprect_mode == LOOP_CLIPRECTS &&
+       intel->pClipRects != dPriv->pClipRects)
+      intel_batchbuffer_flush(intel->batch);
    intel->numClipRects = dPriv->numClipRects;
    intel->pClipRects = dPriv->pClipRects;
    intel->drawX = dPriv->x;
@@ -183,6 +197,10 @@ intelSetBackClipRects(struct intel_context *intel)
 
    if (intel_fb->pf_active || dPriv->numBackClipRects == 0) {
       /* use the front clip rects */
+      if (intel->batch->cliprect_mode == LOOP_CLIPRECTS &&
+	  intel->pClipRects != dPriv->pClipRects)
+	 intel_batchbuffer_flush(intel->batch);
+
       intel->numClipRects = dPriv->numClipRects;
       intel->pClipRects = dPriv->pClipRects;
       intel->drawX = dPriv->x;
@@ -190,6 +208,10 @@ intelSetBackClipRects(struct intel_context *intel)
    }
    else {
       /* use the back clip rects */
+      if (intel->batch->cliprect_mode == LOOP_CLIPRECTS &&
+	  intel->pClipRects != dPriv->pBackClipRects)
+	 intel_batchbuffer_flush(intel->batch);
+
       intel->numClipRects = dPriv->numBackClipRects;
       intel->pClipRects = dPriv->pBackClipRects;
       intel->drawX = dPriv->backX;
@@ -900,12 +922,6 @@ intel_draw_buffer(GLcontext * ctx, struct gl_framebuffer *fb)
    if (fb->Name)
       intel_validate_paired_depth_stencil(ctx, fb);
 
-   /* If the batch contents require looping over cliprects, flush them before
-    * we go changing which cliprects get referenced when that happens.
-    */
-   if (intel->batch->cliprect_mode == LOOP_CLIPRECTS)
-      intel_batchbuffer_flush(intel->batch);
-
    /*
     * How many color buffers are we drawing into?
     */




More information about the mesa-commit mailing list