[Mesa-dev] [PATCH] i965: Make Gen6+ renderbuffer surface updates not depend on NEW_COLOR.

Kenneth Graunke kenneth at whitecape.org
Wed Nov 9 21:39:19 PST 2011


NEW_COLOR is only needed on Gen4-5 as brw_update_renderbuffer_surfaces
only uses ctx->Color when intel->gen < 6.

This should reduce unnecessary state updates.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
 src/mesa/drivers/dri/i965/brw_state.h            |    1 +
 src/mesa/drivers/dri/i965/brw_state_upload.c     |    4 ++--
 src/mesa/drivers/dri/i965/brw_wm_surface_state.c |    9 +++++++++
 3 files changed, 12 insertions(+), 2 deletions(-)

Yeah, you're right...Gen6+ really doesn't need NEW_COLOR.  I suppose I
saw ctx->DrawBuffer->_NumColorBuffers and got confused.

Rather than making atoms non-const and all that, we could just a new
one with less dirty bits but the same function.  Seems simple enough.

diff --git a/src/mesa/drivers/dri/i965/brw_state.h b/src/mesa/drivers/dri/i965/brw_state.h
index f004633..2157ffd 100644
--- a/src/mesa/drivers/dri/i965/brw_state.h
+++ b/src/mesa/drivers/dri/i965/brw_state.h
@@ -89,6 +89,7 @@ extern const struct brw_tracked_state gen6_clip_vp;
 extern const struct brw_tracked_state gen6_color_calc_state;
 extern const struct brw_tracked_state gen6_depth_stencil_state;
 extern const struct brw_tracked_state gen6_gs_state;
+extern const struct brw_tracked_state gen6_renderbuffer_surfaces;
 extern const struct brw_tracked_state gen6_sampler_state;
 extern const struct brw_tracked_state gen6_scissor_state;
 extern const struct brw_tracked_state gen6_sf_state;
diff --git a/src/mesa/drivers/dri/i965/brw_state_upload.c b/src/mesa/drivers/dri/i965/brw_state_upload.c
index a9efc95..730a0e8 100644
--- a/src/mesa/drivers/dri/i965/brw_state_upload.c
+++ b/src/mesa/drivers/dri/i965/brw_state_upload.c
@@ -143,7 +143,7 @@ static const struct brw_tracked_state *gen6_atoms[] =
     */
    &brw_vs_pull_constants,
    &brw_wm_pull_constants,
-   &brw_renderbuffer_surfaces,
+   &gen6_renderbuffer_surfaces,
    &brw_texture_surfaces,
    &brw_binding_table,
 
@@ -210,7 +210,7 @@ const struct brw_tracked_state *gen7_atoms[] =
     */
    &brw_vs_pull_constants,
    &brw_wm_pull_constants,
-   &brw_renderbuffer_surfaces,
+   &gen6_renderbuffer_surfaces,
    &brw_texture_surfaces,
    &brw_binding_table,
 
diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
index 377b19d..0cc6201 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -577,6 +577,15 @@ const struct brw_tracked_state brw_renderbuffer_surfaces = {
    .emit = brw_update_renderbuffer_surfaces,
 };
 
+const struct brw_tracked_state gen6_renderbuffer_surfaces = {
+   .dirty = {
+      .mesa = _NEW_BUFFERS,
+      .brw = BRW_NEW_BATCH,
+      .cache = 0
+   },
+   .emit = brw_update_renderbuffer_surfaces,
+};
+
 /**
  * Construct SURFACE_STATE objects for enabled textures.
  */
-- 
1.7.7.2



More information about the mesa-dev mailing list