mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-20 11:40:10 +01:00
intel: do not NIH util_is_aligned
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com> Reviewed-by: Caio Oliveira <caio.oliveira@intel.com> Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com> Acked-by: Yonggang Luo <luoyonggang@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38169>
This commit is contained in:
parent
a014daea8f
commit
7be63ef956
6 changed files with 12 additions and 38 deletions
|
|
@ -109,16 +109,6 @@ isl_is_pow2(uintmax_t n)
|
|||
return !(n & (n - 1));
|
||||
}
|
||||
|
||||
/**
|
||||
* Alignment must be a power of 2.
|
||||
*/
|
||||
static inline bool
|
||||
isl_is_aligned(uintmax_t n, uintmax_t a)
|
||||
{
|
||||
assert(isl_is_pow2(a));
|
||||
return (n & (a - 1)) == 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Alignment must be a power of 2.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -360,8 +360,8 @@ anv_block_pool_init(struct anv_block_pool *pool,
|
|||
VkResult result;
|
||||
|
||||
/* Make sure VMA addresses are aligned for the block pool */
|
||||
assert(anv_is_aligned(start_address, device->info->mem_alignment));
|
||||
assert(anv_is_aligned(initial_size, device->info->mem_alignment));
|
||||
assert(util_is_aligned(start_address, device->info->mem_alignment));
|
||||
assert(util_is_aligned(initial_size, device->info->mem_alignment));
|
||||
assert(max_size > 0);
|
||||
assert(max_size > initial_size);
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ vk_to_isl_surf_dim[] = {
|
|||
static uint64_t MUST_CHECK UNUSED
|
||||
memory_range_end(struct anv_image_memory_range memory_range)
|
||||
{
|
||||
assert(anv_is_aligned(memory_range.offset, memory_range.alignment));
|
||||
assert(util_is_aligned(memory_range.offset, memory_range.alignment));
|
||||
return memory_range.offset + memory_range.size;
|
||||
}
|
||||
|
||||
|
|
@ -141,7 +141,7 @@ image_binding_grow(const struct anv_device *device,
|
|||
/* Offset must be validated because it comes from
|
||||
* VkImageDrmFormatModifierExplicitCreateInfoEXT.
|
||||
*/
|
||||
if (unlikely(!anv_is_aligned(offset, alignment))) {
|
||||
if (unlikely(!util_is_aligned(offset, alignment))) {
|
||||
return vk_errorf(device,
|
||||
VK_ERROR_INVALID_DRM_FORMAT_MODIFIER_PLANE_LAYOUT_EXT,
|
||||
"VkImageDrmFormatModifierExplicitCreateInfoEXT::"
|
||||
|
|
@ -196,8 +196,8 @@ memory_range_merge(struct anv_image_memory_range *a,
|
|||
return;
|
||||
|
||||
assert(a->offset == 0);
|
||||
assert(anv_is_aligned(a->offset, a->alignment));
|
||||
assert(anv_is_aligned(b.offset, b.alignment));
|
||||
assert(util_is_aligned(a->offset, a->alignment));
|
||||
assert(util_is_aligned(b.offset, b.alignment));
|
||||
|
||||
a->alignment = MAX2(a->alignment, b.alignment);
|
||||
a->size = MAX2(a->size, b.offset + b.size);
|
||||
|
|
@ -1007,7 +1007,7 @@ add_primary_surface(struct anv_device *device,
|
|||
static bool MUST_CHECK
|
||||
memory_range_is_aligned(struct anv_image_memory_range memory_range)
|
||||
{
|
||||
return anv_is_aligned(memory_range.offset, memory_range.alignment);
|
||||
return util_is_aligned(memory_range.offset, memory_range.alignment);
|
||||
}
|
||||
|
||||
static bool MUST_CHECK
|
||||
|
|
|
|||
|
|
@ -313,14 +313,6 @@ align_down_npot_u32(uint32_t v, uint32_t a)
|
|||
return v - (v % a);
|
||||
}
|
||||
|
||||
/** Alignment must be a power of 2. */
|
||||
static inline bool
|
||||
anv_is_aligned(uintmax_t n, uintmax_t a)
|
||||
{
|
||||
assert(a == (a & -a));
|
||||
return (n & (a - 1)) == 0;
|
||||
}
|
||||
|
||||
static inline union isl_color_value
|
||||
vk_to_isl_color(VkClearColorValue color)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ vk_to_isl_surf_dim[] = {
|
|||
static uint64_t MUST_CHECK UNUSED
|
||||
memory_range_end(struct anv_image_memory_range memory_range)
|
||||
{
|
||||
assert(anv_is_aligned(memory_range.offset, memory_range.alignment));
|
||||
assert(util_is_aligned(memory_range.offset, memory_range.alignment));
|
||||
return memory_range.offset + memory_range.size;
|
||||
}
|
||||
|
||||
|
|
@ -131,7 +131,7 @@ image_binding_grow(const struct anv_device *device,
|
|||
/* Offset must be validated because it comes from
|
||||
* VkImageDrmFormatModifierExplicitCreateInfoEXT.
|
||||
*/
|
||||
if (unlikely(!anv_is_aligned(offset, alignment))) {
|
||||
if (unlikely(!util_is_aligned(offset, alignment))) {
|
||||
return vk_errorf(device,
|
||||
VK_ERROR_INVALID_DRM_FORMAT_MODIFIER_PLANE_LAYOUT_EXT,
|
||||
"VkImageDrmFormatModifierExplicitCreateInfoEXT::"
|
||||
|
|
@ -192,8 +192,8 @@ memory_range_merge(struct anv_image_memory_range *a,
|
|||
return;
|
||||
|
||||
assert(a->offset == 0);
|
||||
assert(anv_is_aligned(a->offset, a->alignment));
|
||||
assert(anv_is_aligned(b.offset, b.alignment));
|
||||
assert(util_is_aligned(a->offset, a->alignment));
|
||||
assert(util_is_aligned(b.offset, b.alignment));
|
||||
|
||||
a->alignment = MAX2(a->alignment, b.alignment);
|
||||
a->size = MAX2(a->size, b.offset + b.size);
|
||||
|
|
@ -741,7 +741,7 @@ add_primary_surface(struct anv_device *device,
|
|||
static bool MUST_CHECK
|
||||
memory_range_is_aligned(struct anv_image_memory_range memory_range)
|
||||
{
|
||||
return anv_is_aligned(memory_range.offset, memory_range.alignment);
|
||||
return util_is_aligned(memory_range.offset, memory_range.alignment);
|
||||
}
|
||||
|
||||
static bool MUST_CHECK
|
||||
|
|
|
|||
|
|
@ -286,14 +286,6 @@ align_down_npot_u32(uint32_t v, uint32_t a)
|
|||
return v - (v % a);
|
||||
}
|
||||
|
||||
/** Alignment must be a power of 2. */
|
||||
static inline bool
|
||||
anv_is_aligned(uintmax_t n, uintmax_t a)
|
||||
{
|
||||
assert(a == (a & -a));
|
||||
return (n & (a - 1)) == 0;
|
||||
}
|
||||
|
||||
static inline union isl_color_value
|
||||
vk_to_isl_color(VkClearColorValue color)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue