[Mesa-dev] [PATCH 5/7] i965: Inline brw_update_renderbuffer_surfaces().

Kenneth Graunke kenneth at whitecape.org
Tue Aug 22 20:57:59 UTC 2017


Less baklava layers.
---
 src/mesa/drivers/dri/i965/brw_state.h            |  5 ---
 src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 53 +++++++++---------------
 2 files changed, 20 insertions(+), 38 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_state.h b/src/mesa/drivers/dri/i965/brw_state.h
index c9fd9414826..a07e70341df 100644
--- a/src/mesa/drivers/dri/i965/brw_state.h
+++ b/src/mesa/drivers/dri/i965/brw_state.h
@@ -221,11 +221,6 @@ void brw_update_texture_surface(struct gl_context *ctx,
                                 unsigned unit, uint32_t *surf_offset,
                                 bool for_gather, uint32_t plane);
 
-void brw_update_renderbuffer_surfaces(struct brw_context *brw,
-                                      const struct gl_framebuffer *fb,
-                                      uint32_t render_target_start,
-                                      uint32_t *surf_offset);
-
 /* brw_sampler_state.c */
 void brw_emit_sampler_state(struct brw_context *brw,
                             uint32_t *sampler_state,
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 a0cb566e719..dc1a770a5d3 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -985,52 +985,39 @@ gen4_update_renderbuffer_surface(struct brw_context *brw,
    return offset;
 }
 
-/**
- * Construct SURFACE_STATE objects for renderbuffers/draw buffers.
- */
-void
-brw_update_renderbuffer_surfaces(struct brw_context *brw,
-                                 const struct gl_framebuffer *fb,
-                                 uint32_t render_target_start,
-                                 uint32_t *surf_offset)
+static void
+update_renderbuffer_surfaces(struct brw_context *brw)
 {
-   GLuint i;
+   const struct gl_context *ctx = &brw->ctx;
+
+   /* BRW_NEW_FS_PROG_DATA */
+   const struct brw_wm_prog_data *wm_prog_data =
+      brw_wm_prog_data(brw->wm.base.prog_data);
+
+   /* _NEW_BUFFERS | _NEW_COLOR */
+   const struct gl_framebuffer *fb = ctx->DrawBuffer;
+
+   const unsigned rt_start = wm_prog_data->binding_table.render_target_start;
+
+   uint32_t *surf_offsets = brw->wm.base.surf_offset;
 
    /* Update surfaces for drawing buffers */
    if (fb->_NumColorDrawBuffers >= 1) {
-      for (i = 0; i < fb->_NumColorDrawBuffers; i++) {
-         const uint32_t surf_index = render_target_start + i;
+      for (unsigned i = 0; i < fb->_NumColorDrawBuffers; i++) {
          struct gl_renderbuffer *rb = fb->_ColorDrawBuffers[i];
 
 	 if (intel_renderbuffer(rb)) {
-            surf_offset[surf_index] = brw->gen >= 6 ?
-               gen6_update_renderbuffer_surface(brw, rb, i, surf_index) :
-               gen4_update_renderbuffer_surface(brw, rb, i, surf_index);
+            surf_offsets[rt_start + i] = brw->gen >= 6 ?
+               gen6_update_renderbuffer_surface(brw, rb, i, rt_start + i) :
+               gen4_update_renderbuffer_surface(brw, rb, i, rt_start + i);
 	 } else {
-            emit_null_surface_state(brw, fb, &surf_offset[surf_index]);
+            emit_null_surface_state(brw, fb, &surf_offsets[rt_start + i]);
 	 }
       }
    } else {
-      const uint32_t surf_index = render_target_start;
-      emit_null_surface_state(brw, fb, &surf_offset[surf_index]);
+      emit_null_surface_state(brw, fb, &surf_offsets[rt_start]);
    }
-}
-
-static void
-update_renderbuffer_surfaces(struct brw_context *brw)
-{
-   const struct gl_context *ctx = &brw->ctx;
 
-   /* BRW_NEW_FS_PROG_DATA */
-   const struct brw_wm_prog_data *wm_prog_data =
-      brw_wm_prog_data(brw->wm.base.prog_data);
-
-   /* _NEW_BUFFERS | _NEW_COLOR */
-   const struct gl_framebuffer *fb = ctx->DrawBuffer;
-   brw_update_renderbuffer_surfaces(
-      brw, fb,
-      wm_prog_data->binding_table.render_target_start,
-      brw->wm.base.surf_offset);
    brw->ctx.NewDriverState |= BRW_NEW_SURFACES;
 }
 
-- 
2.14.1



More information about the mesa-dev mailing list