[Mesa-dev] [PATCH 06/18] i965: Move texture buffer dispatch into single location

Topi Pohjolainen topi.pohjolainen at intel.com
Wed Apr 22 13:47:26 PDT 2015


All generations do the same exacr dispatch and it could be
therefore done in the hardware independent stage.

Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
---
 src/mesa/drivers/dri/i965/brw_context.h           |  3 ---
 src/mesa/drivers/dri/i965/brw_wm_surface_state.c  | 32 +++++++++++++++--------
 src/mesa/drivers/dri/i965/gen7_wm_surface_state.c |  5 ----
 src/mesa/drivers/dri/i965/gen8_surface_state.c    |  5 ----
 4 files changed, 21 insertions(+), 24 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index 9f4eddd..76d4630 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -1662,9 +1662,6 @@ void brw_create_constant_surface(struct brw_context *brw,
                                  uint32_t size,
                                  uint32_t *out_offset,
                                  bool dword_pitch);
-void brw_update_buffer_texture_surface(struct gl_context *ctx,
-                                       unsigned unit,
-                                       uint32_t *surf_offset);
 void
 brw_update_sol_surface(struct brw_context *brw,
                        struct gl_buffer_object *buffer_obj,
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 82dd92b..0f739bb 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -274,10 +274,10 @@ gen4_emit_buffer_surface_state(struct brw_context *brw,
    }
 }
 
-void
-brw_update_buffer_texture_surface(struct gl_context *ctx,
-                                  unsigned unit,
-                                  uint32_t *surf_offset)
+static void
+update_buffer_texture_surface(struct gl_context *ctx,
+                              unsigned unit,
+                              uint32_t *surf_offset)
 {
    struct brw_context *brw = brw_context(ctx);
    struct gl_texture_object *tObj = ctx->Texture.Unit[unit]._Current;
@@ -320,12 +320,6 @@ brw_update_texture_surface(struct gl_context *ctx,
    struct gl_sampler_object *sampler = _mesa_get_samplerobj(ctx, unit);
    uint32_t *surf;
 
-   /* BRW_NEW_TEXTURE_BUFFER */
-   if (tObj->Target == GL_TEXTURE_BUFFER) {
-      brw_update_buffer_texture_surface(ctx, unit, surf_offset);
-      return;
-   }
-
    surf = brw_state_batch(brw, AUB_TRACE_SURFACE_STATE,
 			  6 * 4, 32, surf_offset);
 
@@ -795,6 +789,22 @@ const struct brw_tracked_state gen6_renderbuffer_surfaces = {
    .emit = update_renderbuffer_surfaces,
 };
 
+static void
+update_texture_surface(struct gl_context *ctx,
+                       unsigned unit,
+                       uint32_t *surf_offset,
+                       bool for_gather)
+{
+   struct brw_context *brw = brw_context(ctx);
+   const struct gl_texture_object *tObj = ctx->Texture.Unit[unit]._Current;
+
+   if (tObj->Target == GL_TEXTURE_BUFFER) {
+      update_buffer_texture_surface(ctx, unit, surf_offset);
+      return;
+   }
+
+   brw->vtbl.update_texture_surface(ctx, unit, surf_offset, for_gather);
+}
 
 static void
 update_stage_texture_surfaces(struct brw_context *brw,
@@ -824,7 +834,7 @@ update_stage_texture_surfaces(struct brw_context *brw,
 
          /* _NEW_TEXTURE */
          if (ctx->Texture.Unit[unit]._Current) {
-            brw->vtbl.update_texture_surface(ctx, unit, surf_offset + s, for_gather);
+            update_texture_surface(ctx, unit, surf_offset + s, for_gather);
          }
       }
    }
diff --git a/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c b/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c
index 9605019..8a7ff25 100644
--- a/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c
@@ -276,11 +276,6 @@ gen7_update_texture_surface(struct gl_context *ctx,
    struct gl_texture_image *firstImage = tObj->Image[0][tObj->BaseLevel];
    struct gl_sampler_object *sampler = _mesa_get_samplerobj(ctx, unit);
 
-   if (tObj->Target == GL_TEXTURE_BUFFER) {
-      brw_update_buffer_texture_surface(ctx, unit, surf_offset);
-      return;
-   }
-
    uint32_t *surf = brw_state_batch(brw, AUB_TRACE_SURFACE_STATE,
                                     8 * 4, 32, surf_offset);
    memset(surf, 0, 8 * 4);
diff --git a/src/mesa/drivers/dri/i965/gen8_surface_state.c b/src/mesa/drivers/dri/i965/gen8_surface_state.c
index 941dfc0..304e5fe 100644
--- a/src/mesa/drivers/dri/i965/gen8_surface_state.c
+++ b/src/mesa/drivers/dri/i965/gen8_surface_state.c
@@ -166,11 +166,6 @@ gen8_update_texture_surface(struct gl_context *ctx,
    mesa_format format = intelObj->_Format;
    uint32_t mocs_wb = brw->gen >= 9 ? SKL_MOCS_WB : BDW_MOCS_WB;
 
-   if (tObj->Target == GL_TEXTURE_BUFFER) {
-      brw_update_buffer_texture_surface(ctx, unit, surf_offset);
-      return;
-   }
-
    if (tObj->StencilSampling && firstImage->_BaseFormat == GL_DEPTH_STENCIL) {
       mt = mt->stencil_mt;
       format = MESA_FORMAT_S_UINT8;
-- 
1.9.3



More information about the mesa-dev mailing list