Mesa (master): i965: Disable clipper statistics when meta operations are in progress.

Kenneth Graunke kwg at kemper.freedesktop.org
Mon May 20 20:03:43 UTC 2013


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

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Thu May 16 10:27:53 2013 -0700

i965: Disable clipper statistics when meta operations are in progress.

We don't currently use the clipper statistics, but we'll soon use
CL_INVOCATIONS_COUNT to implement the GL_PRIMITIVES_GENERATED query.
The number of primitives generated is not supposed to be altered during
operations such as glGenerateMipmap.

Prevents spec/EXT_transform_feedback/generatemipmap prims_generated
from breaking when we start using pipeline statistics registers to
implement the GL_PRIMITIVES_GENERATED query in a few commits.

v2: Use the BRW_NEW_META_IN_PROGRESS flag for correct state handling.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Eric Anholt <eric at anholt.net> [v1]
Reviewed-by: Paul Berry <stereotype441 at gmail.com>

---

 src/mesa/drivers/dri/i965/gen6_clip_state.c |    5 +++--
 src/mesa/drivers/dri/i965/gen7_clip_state.c |    8 ++++++--
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/gen6_clip_state.c b/src/mesa/drivers/dri/i965/gen6_clip_state.c
index 51ffbae..cd2a8bf 100644
--- a/src/mesa/drivers/dri/i965/gen6_clip_state.c
+++ b/src/mesa/drivers/dri/i965/gen6_clip_state.c
@@ -37,6 +37,7 @@ upload_clip_state(struct brw_context *brw)
 {
    struct intel_context *intel = &brw->intel;
    struct gl_context *ctx = &intel->ctx;
+   uint32_t dw1 = brw->meta_in_progress ? 0 : GEN6_CLIP_STATISTICS_ENABLE;
    uint32_t dw2 = 0;
 
    /* _NEW_BUFFERS */
@@ -77,7 +78,7 @@ upload_clip_state(struct brw_context *brw)
 
    BEGIN_BATCH(4);
    OUT_BATCH(_3DSTATE_CLIP << 16 | (4 - 2));
-   OUT_BATCH(GEN6_CLIP_STATISTICS_ENABLE);
+   OUT_BATCH(dw1);
    OUT_BATCH(GEN6_CLIP_ENABLE |
 	     GEN6_CLIP_API_OGL |
 	     GEN6_CLIP_MODE_NORMAL |
@@ -92,7 +93,7 @@ upload_clip_state(struct brw_context *brw)
 const struct brw_tracked_state gen6_clip_state = {
    .dirty = {
       .mesa  = _NEW_TRANSFORM | _NEW_LIGHT | _NEW_BUFFERS,
-      .brw   = (BRW_NEW_CONTEXT),
+      .brw   = BRW_NEW_CONTEXT | BRW_NEW_META_IN_PROGRESS,
       .cache = CACHE_NEW_WM_PROG
    },
    .emit = upload_clip_state,
diff --git a/src/mesa/drivers/dri/i965/gen7_clip_state.c b/src/mesa/drivers/dri/i965/gen7_clip_state.c
index 29a5ed5..7c9f6c1 100644
--- a/src/mesa/drivers/dri/i965/gen7_clip_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_clip_state.c
@@ -33,12 +33,16 @@ upload_clip_state(struct brw_context *brw)
 {
    struct intel_context *intel = &brw->intel;
    struct gl_context *ctx = &intel->ctx;
-   uint32_t dw1 = GEN6_CLIP_STATISTICS_ENABLE, dw2 = 0;
+   uint32_t dw1 = 0, dw2 = 0;
 
    /* _NEW_BUFFERS */
    struct gl_framebuffer *fb = ctx->DrawBuffer;
    bool render_to_fbo = _mesa_is_user_fbo(fb);
 
+   /* BRW_NEW_META_IN_PROGRESS */
+   if (!brw->meta_in_progress)
+      dw1 |= GEN6_CLIP_STATISTICS_ENABLE;
+
    /* CACHE_NEW_WM_PROG */
    if (brw->wm.prog_data->barycentric_interp_modes &
        BRW_WM_NONPERSPECTIVE_BARYCENTRIC_BITS) {
@@ -118,7 +122,7 @@ const struct brw_tracked_state gen7_clip_state = {
                 _NEW_POLYGON |
                 _NEW_LIGHT |
                 _NEW_TRANSFORM),
-      .brw   = BRW_NEW_CONTEXT,
+      .brw   = BRW_NEW_CONTEXT | BRW_NEW_META_IN_PROGRESS,
       .cache = CACHE_NEW_WM_PROG
    },
    .emit = upload_clip_state,




More information about the mesa-commit mailing list