summaryrefslogtreecommitdiffstats
path: root/src/amd
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2017-11-13 11:17:41 -0800
committerIan Romanick <[email protected]>2018-03-29 14:09:23 -0700
commitd76c204d0564701b4b8b6a2bdda50e2939683e66 (patch)
treeedcf51df711640ffd89326079f10b1dcf65f311b /src/amd
parenta3a16d4aa7e5a22816226d8e7417138164b10525 (diff)
util: Move util_is_power_of_two to bitscan.h and rename to util_is_power_of_two_or_zero
The new name make the zero-input behavior more obvious. The next patch adds a new function with different zero-input behavior. Signed-off-by: Ian Romanick <[email protected]> Suggested-by: Matt Turner <[email protected]> Reviewed-by: Alejandro PiƱeiro <[email protected]>
Diffstat (limited to 'src/amd')
-rw-r--r--src/amd/common/ac_gpu_info.c4
-rw-r--r--src/amd/common/ac_surface.c2
-rw-r--r--src/amd/vulkan/radv_formats.c4
3 files changed, 5 insertions, 5 deletions
diff --git a/src/amd/common/ac_gpu_info.c b/src/amd/common/ac_gpu_info.c
index 73fc36203c1..f93ef4cbade 100644
--- a/src/amd/common/ac_gpu_info.c
+++ b/src/amd/common/ac_gpu_info.c
@@ -333,8 +333,8 @@ bool ac_query_gpu_info(int fd, amdgpu_device_handle dev,
}
info->has_virtual_memory = true;
- assert(util_is_power_of_two(dma.available_rings + 1));
- assert(util_is_power_of_two(compute.available_rings + 1));
+ assert(util_is_power_of_two_or_zero(dma.available_rings + 1));
+ assert(util_is_power_of_two_or_zero(compute.available_rings + 1));
info->num_sdma_rings = util_bitcount(dma.available_rings);
info->num_compute_rings = util_bitcount(compute.available_rings);
diff --git a/src/amd/common/ac_surface.c b/src/amd/common/ac_surface.c
index 81882576baf..1e1641daeec 100644
--- a/src/amd/common/ac_surface.c
+++ b/src/amd/common/ac_surface.c
@@ -275,7 +275,7 @@ static int gfx6_compute_level(ADDR_HANDLE addrlib,
AddrSurfInfoIn->bpp) {
unsigned alignment = 256 / (AddrSurfInfoIn->bpp / 8);
- assert(util_is_power_of_two(AddrSurfInfoIn->bpp));
+ assert(util_is_power_of_two_or_zero(AddrSurfInfoIn->bpp));
AddrSurfInfoIn->width = align(AddrSurfInfoIn->width, alignment);
}
diff --git a/src/amd/vulkan/radv_formats.c b/src/amd/vulkan/radv_formats.c
index efb1d78790a..1bafe09e77f 100644
--- a/src/amd/vulkan/radv_formats.c
+++ b/src/amd/vulkan/radv_formats.c
@@ -638,13 +638,13 @@ radv_physical_device_get_format_properties(struct radv_physical_device *physical
tiled |= VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT;
}
}
- if (tiled && util_is_power_of_two(vk_format_get_blocksize(format)) && !scaled) {
+ if (tiled && util_is_power_of_two_or_zero(vk_format_get_blocksize(format)) && !scaled) {
tiled |= VK_FORMAT_FEATURE_TRANSFER_SRC_BIT_KHR |
VK_FORMAT_FEATURE_TRANSFER_DST_BIT_KHR;
}
}
- if (linear && util_is_power_of_two(vk_format_get_blocksize(format)) && !scaled) {
+ if (linear && util_is_power_of_two_or_zero(vk_format_get_blocksize(format)) && !scaled) {
linear |= VK_FORMAT_FEATURE_TRANSFER_SRC_BIT_KHR |
VK_FORMAT_FEATURE_TRANSFER_DST_BIT_KHR;
}