[Mesa-dev] [PATCH 21/22] anv: Get rid of the ANV_CALL macro

Jason Ekstrand jason at jlekstrand.net
Sat Oct 8 04:41:19 UTC 2016


This macro was needed by meta in order to make gen-specific calls from
gen-agnostic code.  Now that we don't have meta, the remaining two uses are
fairly trivial to get rid of.

Signed-off-by: Jason Ekstrand <jason at jlekstrand.net>
---
 src/intel/vulkan/anv_device.c           |  2 +-
 src/intel/vulkan/anv_dump.c             |  8 ++++++--
 src/intel/vulkan/anv_entrypoints_gen.py |  2 +-
 src/intel/vulkan/anv_private.h          | 10 ----------
 4 files changed, 8 insertions(+), 14 deletions(-)

diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index 0af11e9..f00c2de 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -1115,7 +1115,7 @@ VkResult anv_QueueWaitIdle(
 {
    ANV_FROM_HANDLE(anv_queue, queue, _queue);
 
-   return ANV_CALL(DeviceWaitIdle)(anv_device_to_handle(queue->device));
+   return anv_DeviceWaitIdle(anv_device_to_handle(queue->device));
 }
 
 VkResult anv_DeviceWaitIdle(
diff --git a/src/intel/vulkan/anv_dump.c b/src/intel/vulkan/anv_dump.c
index ed1b575..0a359a0 100644
--- a/src/intel/vulkan/anv_dump.c
+++ b/src/intel/vulkan/anv_dump.c
@@ -112,7 +112,11 @@ dump_image_do_blit(struct anv_device *device, struct dump_image *image,
                    VkImageAspectFlagBits aspect,
                    unsigned miplevel, unsigned array_layer)
 {
-   ANV_CALL(CmdPipelineBarrier)(anv_cmd_buffer_to_handle(cmd_buffer),
+   PFN_vkCmdPipelineBarrier CmdPipelineBarrier =
+      (void *)anv_GetDeviceProcAddr(anv_device_to_handle(device),
+                                    "vkCmdPipelineBarrier");
+
+   CmdPipelineBarrier(anv_cmd_buffer_to_handle(cmd_buffer),
       VK_PIPELINE_STAGE_TRANSFER_BIT,
       VK_PIPELINE_STAGE_TRANSFER_BIT,
       0, 0, NULL, 0, NULL, 1,
@@ -169,7 +173,7 @@ dump_image_do_blit(struct anv_device *device, struct dump_image *image,
 
    src->usage = old_usage;
 
-   ANV_CALL(CmdPipelineBarrier)(anv_cmd_buffer_to_handle(cmd_buffer),
+   CmdPipelineBarrier(anv_cmd_buffer_to_handle(cmd_buffer),
       VK_PIPELINE_STAGE_TRANSFER_BIT,
       VK_PIPELINE_STAGE_TRANSFER_BIT,
       0, 0, NULL, 0, NULL, 1,
diff --git a/src/intel/vulkan/anv_entrypoints_gen.py b/src/intel/vulkan/anv_entrypoints_gen.py
index aeaeb1d..ebabce6 100644
--- a/src/intel/vulkan/anv_entrypoints_gen.py
+++ b/src/intel/vulkan/anv_entrypoints_gen.py
@@ -222,7 +222,7 @@ anv_set_dispatch_devinfo(const struct gen_device_info *devinfo)
    dispatch_devinfo = *devinfo;
 }
 
-void * __attribute__ ((noinline))
+static void * __attribute__ ((noinline))
 anv_resolve_entrypoint(uint32_t index)
 {
    if (dispatch_devinfo.gen == 0) {
diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h
index 3ddf0ba..72d9127 100644
--- a/src/intel/vulkan/anv_private.h
+++ b/src/intel/vulkan/anv_private.h
@@ -496,18 +496,8 @@ struct anv_bo *anv_scratch_pool_alloc(struct anv_device *device,
                                       gl_shader_stage stage,
                                       unsigned per_thread_scratch);
 
-void *anv_resolve_entrypoint(uint32_t index);
-
 extern struct anv_dispatch_table dtable;
 
-#define ANV_CALL(func) ({ \
-   if (dtable.func == NULL) { \
-      size_t idx = offsetof(struct anv_dispatch_table, func) / sizeof(void *); \
-      dtable.entrypoints[idx] = anv_resolve_entrypoint(idx); \
-   } \
-   dtable.func; \
-})
-
 static inline void *
 anv_alloc(const VkAllocationCallbacks *alloc,
           size_t size, size_t align,
-- 
2.5.0.400.gff86faf



More information about the mesa-dev mailing list