[Mesa-dev] [PATCH 7/7] i965: Drop the update_texture_surface vtbl hook.

Francisco Jerez currojerez at riseup.net
Thu May 7 07:15:41 PDT 2015


At this point the update_texture_surface and
emit_texture_surface_state hooks are almost equivalent, the only
significant difference is that emit_texture_surface_state supports
binding read-write surfaces.  The name of the latter is more
consistent with the other emit_something_surface_state hooks, so let's
keep it.
---
 src/mesa/drivers/dri/i965/brw_context.h           | 10 ------
 src/mesa/drivers/dri/i965/brw_wm_surface_state.c  | 37 ++++++++++++-----------
 src/mesa/drivers/dri/i965/gen7_wm_surface_state.c | 24 ++-------------
 src/mesa/drivers/dri/i965/gen8_surface_state.c    | 18 -----------
 4 files changed, 23 insertions(+), 66 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index 2eb4251..780edba 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -983,16 +983,6 @@ struct brw_context
 
    struct
    {
-      void (*update_texture_surface)(struct brw_context *brw,
-                                     struct intel_mipmap_tree *mt,
-                                     GLenum target,
-                                     unsigned min_layer,
-                                     unsigned max_layer,
-                                     unsigned min_level,
-                                     unsigned max_level,
-                                     uint32_t tex_format, unsigned swizzle,
-                                     uint32_t *surf_offset,
-                                     bool for_gather);
       uint32_t (*update_renderbuffer_surface)(struct brw_context *brw,
                                               struct gl_renderbuffer *rb,
                                               bool layered, unsigned unit,
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 de4bdc5..870d699 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -308,16 +308,17 @@ update_buffer_texture_surface(struct gl_context *ctx,
 }
 
 static void
-brw_update_texture_surface(struct brw_context *brw,
-                           struct intel_mipmap_tree *mt,
-                           GLenum target,
-                           unsigned min_layer /* unused */,
-                           unsigned max_layer /* unused */,
-                           unsigned min_level,
-                           unsigned max_level,
-                           uint32_t tex_format, unsigned swizzle /* unused */,
-                           uint32_t *surf_offset,
-                           bool for_gather)
+gen4_emit_texture_surface_state(struct brw_context *brw,
+                                struct intel_mipmap_tree *mt,
+                                GLenum target,
+                                unsigned min_layer /* unused */,
+                                unsigned max_layer /* unused */,
+                                unsigned min_level,
+                                unsigned max_level,
+                                unsigned tex_format,
+                                unsigned swizzle /* unused */,
+                                uint32_t *surf_offset,
+                                bool rw, bool for_gather)
 {
    uint32_t *surf;
 
@@ -378,7 +379,8 @@ brw_update_texture_surface(struct brw_context *brw,
                            *surf_offset + 4,
                            mt->bo,
                            surf[1] - mt->bo->offset64,
-                           I915_GEM_DOMAIN_SAMPLER, 0);
+                           I915_GEM_DOMAIN_SAMPLER,
+                           (rw ? I915_GEM_DOMAIN_SAMPLER : 0));
 }
 
 /**
@@ -834,11 +836,12 @@ update_texture_surface(struct gl_context *ctx,
        */
       assert(brw->gen >= 7 || obj->MinLevel == 0 || brw->meta_in_progress);
 
-      brw->vtbl.update_texture_surface(brw, mt, obj->Target,
-                                       obj->MinLayer, obj->MinLayer + depth,
-                                       obj->MinLevel + obj->BaseLevel,
-                                       obj->MinLevel + intel_obj->_MaxLevel + 1,
-                                       format, swizzle, surf_offset, for_gather);
+      brw->vtbl.emit_texture_surface_state(
+         brw, mt, obj->Target,
+         obj->MinLayer, obj->MinLayer + depth,
+         obj->MinLevel + obj->BaseLevel,
+         obj->MinLevel + intel_obj->_MaxLevel + 1,
+         format, swizzle, surf_offset, false, for_gather);
    }
 }
 
@@ -1071,8 +1074,8 @@ const struct brw_tracked_state brw_cs_abo_surfaces = {
 void
 gen4_init_vtable_surface_functions(struct brw_context *brw)
 {
-   brw->vtbl.update_texture_surface = brw_update_texture_surface;
    brw->vtbl.update_renderbuffer_surface = brw_update_renderbuffer_surface;
    brw->vtbl.emit_null_surface_state = brw_emit_null_surface_state;
+   brw->vtbl.emit_texture_surface_state = gen4_emit_texture_surface_state;
    brw->vtbl.emit_buffer_surface_state = gen4_emit_buffer_surface_state;
 }
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 61e8423..eb9a1e4 100644
--- a/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c
@@ -280,6 +280,9 @@ gen7_emit_texture_surface_state(struct brw_context *brw,
 
    memset(surf, 0, 8 * 4);
 
+   if (for_gather && format == BRW_SURFACEFORMAT_R32G32_FLOAT)
+      format = BRW_SURFACEFORMAT_R32G32_FLOAT_LD;
+
    surf[0] = translate_tex_target(target) << BRW_SURFACE_TYPE_SHIFT |
              format << BRW_SURFACE_FORMAT_SHIFT |
              gen7_surface_tiling_mode(mt->tiling);
@@ -347,26 +350,6 @@ gen7_emit_texture_surface_state(struct brw_context *brw,
    gen7_check_surface_setup(surf, false /* is_render_target */);
 }
 
-static void
-gen7_update_texture_surface(struct brw_context *brw,
-                            struct intel_mipmap_tree *mt,
-                            GLenum target,
-                            unsigned min_layer, unsigned max_layer,
-                            unsigned min_level, unsigned max_level,
-                            uint32_t tex_format, unsigned swizzle,
-                            uint32_t *surf_offset,
-                            bool for_gather)
-{
-   if (for_gather && tex_format == BRW_SURFACEFORMAT_R32G32_FLOAT)
-      tex_format = BRW_SURFACEFORMAT_R32G32_FLOAT_LD;
-
-   gen7_emit_texture_surface_state(brw, mt, target,
-                                   min_layer, max_layer,
-                                   min_level, max_level,
-                                   tex_format, swizzle,
-                                   surf_offset, false, for_gather);
-}
-
 /**
  * Creates a null surface.
  *
@@ -537,7 +520,6 @@ gen7_update_renderbuffer_surface(struct brw_context *brw,
 void
 gen7_init_vtable_surface_functions(struct brw_context *brw)
 {
-   brw->vtbl.update_texture_surface = gen7_update_texture_surface;
    brw->vtbl.update_renderbuffer_surface = gen7_update_renderbuffer_surface;
    brw->vtbl.emit_null_surface_state = gen7_emit_null_surface_state;
    brw->vtbl.emit_texture_surface_state = gen7_emit_texture_surface_state;
diff --git a/src/mesa/drivers/dri/i965/gen8_surface_state.c b/src/mesa/drivers/dri/i965/gen8_surface_state.c
index 129f141..a322f4a 100644
--- a/src/mesa/drivers/dri/i965/gen8_surface_state.c
+++ b/src/mesa/drivers/dri/i965/gen8_surface_state.c
@@ -246,23 +246,6 @@ gen8_emit_texture_surface_state(struct brw_context *brw,
                            (rw ? I915_GEM_DOMAIN_SAMPLER : 0));
 }
 
-static void
-gen8_update_texture_surface(struct brw_context *brw,
-                            struct intel_mipmap_tree *mt,
-                            GLenum target,
-                            unsigned min_layer, unsigned max_layer,
-                            unsigned min_level, unsigned max_level,
-                            uint32_t tex_format, unsigned swizzle,
-                            uint32_t *surf_offset,
-                            bool for_gather)
-{
-   gen8_emit_texture_surface_state(brw, mt, target,
-                                   min_layer, max_layer,
-                                   min_level, max_level,
-                                   tex_format, swizzle, surf_offset,
-                                   false, for_gather);
-}
-
 /**
  * Creates a null surface.
  *
@@ -427,7 +410,6 @@ gen8_update_renderbuffer_surface(struct brw_context *brw,
 void
 gen8_init_vtable_surface_functions(struct brw_context *brw)
 {
-   brw->vtbl.update_texture_surface = gen8_update_texture_surface;
    brw->vtbl.update_renderbuffer_surface = gen8_update_renderbuffer_surface;
    brw->vtbl.emit_null_surface_state = gen8_emit_null_surface_state;
    brw->vtbl.emit_texture_surface_state = gen8_emit_texture_surface_state;
-- 
2.3.5



More information about the mesa-dev mailing list