[Mesa-dev] [PATCH 05/25] anv/cmd_buffer: Expose add_surface_state_reloc as an inline helper

Jason Ekstrand jason at jlekstrand.net
Sat Oct 22 17:50:36 UTC 2016


---
 src/intel/vulkan/anv_private.h     | 11 +++++++++++
 src/intel/vulkan/genX_cmd_buffer.c | 21 ++++++---------------
 2 files changed, 17 insertions(+), 15 deletions(-)

diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h
index 3fe9d7d..a6611f1 100644
--- a/src/intel/vulkan/anv_private.h
+++ b/src/intel/vulkan/anv_private.h
@@ -1218,6 +1218,17 @@ struct anv_state
 anv_cmd_buffer_alloc_dynamic_state(struct anv_cmd_buffer *cmd_buffer,
                                    uint32_t size, uint32_t alignment);
 
+static inline void
+anv_cmd_buffer_add_surface_state_reloc(struct anv_cmd_buffer *cmd_buffer,
+                                       struct anv_state state,
+                                       struct anv_bo *bo, uint32_t offset)
+{
+   const struct isl_device *isl_dev = &cmd_buffer->device->isl_dev;
+
+   anv_reloc_list_add(&cmd_buffer->surface_relocs, &cmd_buffer->pool->alloc,
+                      state.offset + isl_dev->ss.addr_offset, bo, offset);
+}
+
 VkResult
 anv_cmd_buffer_new_binding_table_block(struct anv_cmd_buffer *cmd_buffer);
 
diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c
index e9cfcc9..8734389 100644
--- a/src/intel/vulkan/genX_cmd_buffer.c
+++ b/src/intel/vulkan/genX_cmd_buffer.c
@@ -628,17 +628,6 @@ cmd_buffer_alloc_push_constants(struct anv_cmd_buffer *cmd_buffer)
    cmd_buffer->state.push_constants_dirty |= VK_SHADER_STAGE_ALL_GRAPHICS;
 }
 
-static void
-add_surface_state_reloc(struct anv_cmd_buffer *cmd_buffer,
-                        struct anv_state state, struct anv_bo *bo,
-                        uint32_t offset)
-{
-   const struct isl_device *isl_dev = &cmd_buffer->device->isl_dev;
-
-   anv_reloc_list_add(&cmd_buffer->surface_relocs, &cmd_buffer->pool->alloc,
-                      state.offset + isl_dev->ss.addr_offset, bo, offset);
-}
-
 static struct anv_state
 alloc_null_surface_state(struct anv_cmd_buffer *cmd_buffer,
                          struct anv_framebuffer *fb)
@@ -725,7 +714,8 @@ emit_binding_table(struct anv_cmd_buffer *cmd_buffer,
                                     format, bo_offset, 12, 1);
 
       bt_map[0] = surface_state.offset + state_offset;
-      add_surface_state_reloc(cmd_buffer, surface_state, bo, bo_offset);
+      anv_cmd_buffer_add_surface_state_reloc(cmd_buffer, surface_state,
+                                             bo, bo_offset);
    }
 
    if (map->surface_count == 0)
@@ -758,8 +748,8 @@ emit_binding_table(struct anv_cmd_buffer *cmd_buffer,
 
             assert(iview->color_rt_surface_state.alloc_size);
             surface_state = iview->color_rt_surface_state;
-            add_surface_state_reloc(cmd_buffer, iview->color_rt_surface_state,
-                                    iview->bo, iview->offset);
+            anv_cmd_buffer_add_surface_state_reloc(cmd_buffer, surface_state,
+                                                   iview->bo, iview->offset);
          } else {
             /* Null render target */
             struct anv_framebuffer *fb = cmd_buffer->state.framebuffer;
@@ -833,7 +823,8 @@ emit_binding_table(struct anv_cmd_buffer *cmd_buffer,
       }
 
       bt_map[bias + s] = surface_state.offset + state_offset;
-      add_surface_state_reloc(cmd_buffer, surface_state, bo, bo_offset);
+      anv_cmd_buffer_add_surface_state_reloc(cmd_buffer, surface_state,
+                                             bo, bo_offset);
    }
    assert(image == map->image_count);
 
-- 
2.5.0.400.gff86faf



More information about the mesa-dev mailing list