From ad04bd81b96bfd41adcf230b161dda24559e2722 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Mon, 12 Jun 2023 13:04:35 -0400 Subject: [PATCH] zink: force inlining for a bunch of functions Part-of: --- src/gallium/drivers/zink/zink_batch.h | 10 +++---- src/gallium/drivers/zink/zink_bo.h | 34 ++++++++++++------------ src/gallium/drivers/zink/zink_context.h | 4 +-- src/gallium/drivers/zink/zink_resource.h | 4 +-- 4 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/gallium/drivers/zink/zink_batch.h b/src/gallium/drivers/zink/zink_batch.h index 40872ce2551..67ffa9e0b04 100644 --- a/src/gallium/drivers/zink/zink_batch.h +++ b/src/gallium/drivers/zink/zink_batch.h @@ -83,31 +83,31 @@ zink_batch_bind_db(struct zink_context *ctx); void debug_describe_zink_batch_state(char *buf, const struct zink_batch_state *ptr); -static inline bool +static ALWAYS_INLINE bool zink_batch_usage_is_unflushed(const struct zink_batch_usage *u) { return u && u->unflushed; } -static inline void +static ALWAYS_INLINE void zink_batch_usage_unset(struct zink_batch_usage **u, struct zink_batch_state *bs) { (void)p_atomic_cmpxchg((uintptr_t *)u, (uintptr_t)&bs->usage, (uintptr_t)NULL); } -static inline void +static ALWAYS_INLINE void zink_batch_usage_set(struct zink_batch_usage **u, struct zink_batch_state *bs) { *u = &bs->usage; } -static inline bool +static ALWAYS_INLINE bool zink_batch_usage_matches(const struct zink_batch_usage *u, const struct zink_batch_state *bs) { return u == &bs->usage; } -static inline bool +static ALWAYS_INLINE bool zink_batch_usage_exists(const struct zink_batch_usage *u) { return u && (u->usage || u->unflushed); diff --git a/src/gallium/drivers/zink/zink_bo.h b/src/gallium/drivers/zink/zink_bo.h index a9d1e3c6e0c..3ee2ebd7211 100644 --- a/src/gallium/drivers/zink/zink_bo.h +++ b/src/gallium/drivers/zink/zink_bo.h @@ -34,7 +34,7 @@ #define VK_LAZY_VRAM (VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT | VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT) -static inline enum zink_alloc_flag +static ALWAYS_INLINE enum zink_alloc_flag zink_alloc_flags_from_heap(enum zink_heap heap) { switch (heap) { @@ -47,7 +47,7 @@ zink_alloc_flags_from_heap(enum zink_heap heap) return (enum zink_alloc_flag)0; } -static inline VkMemoryPropertyFlags +static ALWAYS_INLINE VkMemoryPropertyFlags vk_domain_from_heap(enum zink_heap heap) { VkMemoryPropertyFlags domains = (VkMemoryPropertyFlags)0; @@ -75,7 +75,7 @@ vk_domain_from_heap(enum zink_heap heap) return domains; } -static inline enum zink_heap +static ALWAYS_INLINE enum zink_heap zink_heap_from_domain_flags(VkMemoryPropertyFlags domains, enum zink_alloc_flag flags) { if (flags & ZINK_ALLOC_SPARSE) @@ -93,7 +93,7 @@ zink_heap_from_domain_flags(VkMemoryPropertyFlags domains, enum zink_alloc_flag return ZINK_HEAP_HOST_VISIBLE_COHERENT; } -static inline unsigned +static ALWAYS_INLINE unsigned zink_mem_type_idx_from_bits(struct zink_screen *screen, enum zink_heap heap, uint32_t bits) { for (unsigned i = 0; i < screen->heap_count[heap]; i++) { @@ -116,19 +116,19 @@ zink_bo_create(struct zink_screen *screen, uint64_t size, unsigned alignment, en bool zink_bo_get_kms_handle(struct zink_screen *screen, struct zink_bo *bo, int fd, uint32_t *handle); -static inline uint64_t +static ALWAYS_INLINE uint64_t zink_bo_get_offset(const struct zink_bo *bo) { return bo->offset; } -static inline VkDeviceMemory +static ALWAYS_INLINE VkDeviceMemory zink_bo_get_mem(const struct zink_bo *bo) { return bo->mem ? bo->mem : bo->u.slab.real->mem; } -static inline VkDeviceSize +static ALWAYS_INLINE VkDeviceSize zink_bo_get_size(const struct zink_bo *bo) { return bo->mem ? bo->base.size : bo->u.slab.real->base.size; @@ -142,28 +142,28 @@ zink_bo_unmap(struct zink_screen *screen, struct zink_bo *bo); bool zink_bo_commit(struct zink_screen *screen, struct zink_resource *res, unsigned level, struct pipe_box *box, bool commit, VkSemaphore *sem); -static inline bool +static ALWAYS_INLINE bool zink_bo_has_unflushed_usage(const struct zink_bo *bo) { return (zink_batch_usage_is_unflushed(bo->reads.u) && bo->reads.submit_count == bo->reads.u->submit_count) || (zink_batch_usage_is_unflushed(bo->writes.u) && bo->writes.submit_count == bo->writes.u->submit_count); } -static inline bool +static ALWAYS_INLINE bool zink_bo_has_usage(const struct zink_bo *bo) { return (zink_batch_usage_exists(bo->reads.u) && bo->reads.submit_count == bo->reads.u->submit_count) || (zink_batch_usage_exists(bo->writes.u) && bo->writes.submit_count == bo->writes.u->submit_count); } -static inline bool +static ALWAYS_INLINE bool zink_bo_usage_matches(const struct zink_bo *bo, const struct zink_batch_state *bs) { return (zink_batch_usage_matches(bo->reads.u, bs) && bo->reads.submit_count == bo->reads.u->submit_count) || (zink_batch_usage_matches(bo->writes.u, bs) && bo->writes.submit_count == bo->writes.u->submit_count); } -static inline bool +static ALWAYS_INLINE bool zink_bo_usage_check_completion(struct zink_screen *screen, struct zink_bo *bo, enum zink_resource_access access) { if (access & ZINK_RESOURCE_ACCESS_READ && !zink_screen_usage_check_completion(screen, bo->reads.u)) @@ -173,7 +173,7 @@ zink_bo_usage_check_completion(struct zink_screen *screen, struct zink_bo *bo, e return true; } -static inline bool +static ALWAYS_INLINE bool zink_bo_usage_check_completion_fast(struct zink_screen *screen, struct zink_bo *bo, enum zink_resource_access access) { if (access & ZINK_RESOURCE_ACCESS_READ && !zink_screen_usage_check_completion_fast(screen, bo->reads.u)) @@ -183,7 +183,7 @@ zink_bo_usage_check_completion_fast(struct zink_screen *screen, struct zink_bo * return true; } -static inline void +static ALWAYS_INLINE void zink_bo_usage_wait(struct zink_context *ctx, struct zink_bo *bo, enum zink_resource_access access) { if (access & ZINK_RESOURCE_ACCESS_READ) @@ -192,7 +192,7 @@ zink_bo_usage_wait(struct zink_context *ctx, struct zink_bo *bo, enum zink_resou zink_batch_usage_wait(ctx, bo->writes.u); } -static inline void +static ALWAYS_INLINE void zink_bo_usage_try_wait(struct zink_context *ctx, struct zink_bo *bo, enum zink_resource_access access) { if (access & ZINK_RESOURCE_ACCESS_READ) @@ -201,7 +201,7 @@ zink_bo_usage_try_wait(struct zink_context *ctx, struct zink_bo *bo, enum zink_r zink_batch_usage_try_wait(ctx, bo->writes.u); } -static inline void +static ALWAYS_INLINE void zink_bo_usage_set(struct zink_bo *bo, struct zink_batch_state *bs, bool write) { if (write) { @@ -213,7 +213,7 @@ zink_bo_usage_set(struct zink_bo *bo, struct zink_batch_state *bs, bool write) } } -static inline bool +static ALWAYS_INLINE bool zink_bo_usage_unset(struct zink_bo *bo, struct zink_batch_state *bs) { zink_batch_usage_unset(&bo->reads.u, bs); @@ -222,7 +222,7 @@ zink_bo_usage_unset(struct zink_bo *bo, struct zink_batch_state *bs) } -static inline void +static ALWAYS_INLINE void zink_bo_unref(struct zink_screen *screen, struct zink_bo *bo) { struct pb_buffer *pbuf = &bo->base; diff --git a/src/gallium/drivers/zink/zink_context.h b/src/gallium/drivers/zink/zink_context.h index 604d4414273..1f0201521a5 100644 --- a/src/gallium/drivers/zink/zink_context.h +++ b/src/gallium/drivers/zink/zink_context.h @@ -79,13 +79,13 @@ zink_program_cache_stages(uint32_t stages_present) (1 << MESA_SHADER_GEOMETRY))) >> 1; } -static inline bool +static ALWAYS_INLINE bool zink_is_zsbuf_used(const struct zink_context *ctx) { return ctx->blitting || tc_renderpass_info_is_zsbuf_used(&ctx->dynamic_fb.tc_info); } -static inline bool +static ALWAYS_INLINE bool zink_is_zsbuf_write(const struct zink_context *ctx) { if (!zink_is_zsbuf_used(ctx)) diff --git a/src/gallium/drivers/zink/zink_resource.h b/src/gallium/drivers/zink/zink_resource.h index 8d79f6d12f6..31a352387e2 100644 --- a/src/gallium/drivers/zink/zink_resource.h +++ b/src/gallium/drivers/zink/zink_resource.h @@ -81,13 +81,13 @@ zink_resource_object_init_mutable(struct zink_context *ctx, struct zink_resource VkDeviceAddress zink_resource_get_address(struct zink_screen *screen, struct zink_resource *res); -static inline bool +static ALWAYS_INLINE bool zink_resource_has_binds(const struct zink_resource *res) { return res->all_binds > 0; } -static inline bool +static ALWAYS_INLINE bool zink_is_swapchain(const struct zink_resource *res) { return res->swapchain;