mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-20 05:10:11 +01:00
hasvk: restore anv_is_aligned()
On Broadwell, using the debug mode, you can't create even a single
VkImage:
createimage: ../../src/util/u_math.h:829: util_is_aligned: Assertion `(a != 0) && ((a & (a - 1)) == 0)' failed.
Thread 1 "createimage" received signal SIGABRT, Aborted.
Download failed: Invalid argument. Continuing without source file ./nptl/./nptl/pthread_kill.c.
__pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44
warning: 44 ./nptl/pthread_kill.c: No such file or directory
(gdb) bt
#0 __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44
#1 0x00007ffff789573f in __pthread_kill_internal (threadid=<optimized out>, signo=6) at ./nptl/pthread_kill.c:89
#2 0x00007ffff7840462 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#3 0x00007ffff78284ac in __GI_abort () at ./stdlib/abort.c:77
#4 0x00007ffff7828420 in __assert_fail_base (fmt=<optimized out>, assertion=<optimized out>, file=<optimized out>, line=829, function=<optimized out>) at ./assert/assert.c:118
#5 0x00007ffff5a5fb0c in util_is_aligned (n=0, a=0) at ../../src/util/u_math.h:829
#6 0x00007ffff5a6060d in memory_range_end (memory_range=...) at ../../src/intel/vulkan_hasvk/anv_image.c:51
#7 0x00007ffff5a61c52 in check_memory_range_s (p=0x7fffffffd800) at ../../src/intel/vulkan_hasvk/anv_image.c:779
#8 0x00007ffff5a61ef3 in check_memory_bindings (device=0x555555654d50, image=0x55555566e050) at ../../src/intel/vulkan_hasvk/anv_image.c:830
#9 0x00007ffff5a62ea3 in anv_image_init (device=0x555555654d50, image=0x55555566e050, create_info=0x7fffffffd9d0) at ../../src/intel/vulkan_hasvk/anv_image.c:1263
#10 0x00007ffff5a63147 in anv_image_init_from_create_info (device=0x555555654d50, image=0x55555566e050, pCreateInfo=0x7fffffffda80) at ../../src/intel/vulkan_hasvk/anv_image.c:1333
#11 0x00007ffff5a63211 in anv_CreateImage (_device=0x555555654d50, pCreateInfo=0x7fffffffda80, pAllocator=0x0, pImage=0x7fffffffdd20) at ../../src/intel/vulkan_hasvk/anv_image.c:1356
#12 0x00007ffff44ff376 in vvl::dispatch::Device::CreateImage (this=0x55555562c480, device=0x555555654d50, pCreateInfo=0x7fffffffdcb8, pAllocator=0x0, pImage=0x7fffffffdd20)
at ./layers/vulkan/generated/dispatch_object.cpp:1160
#13 0x00007ffff43e8214 in vulkan_layer_chassis::CreateImage (device=0x555555654d50, pCreateInfo=0x7fffffffdcb8, pAllocator=0x0, pImage=0x7fffffffdd20) at ./layers/vulkan/generated/chassis.cpp:2181
#14 0x0000555555560af4 in vks::Image::init (this=0x7fffffffdcb0) at /home/przanoni/git/random-stuff/vk/vks/libvulkanscript.hpp:1298
#15 0x000055555556557d in main () at createimage.cpp:36
Since we haven't noticed this issue as quickly as I imagined we would,
let's opt for what's mostly a revert of the behavior change in the
original commit.
Fixes: 7be63ef956 ("intel: do not NIH util_is_aligned")
Acked-by: Caio Oliveira <caio.oliveira@intel.com>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
This commit is contained in:
parent
a49c5c07e9
commit
dd9ff33aff
2 changed files with 11 additions and 4 deletions
|
|
@ -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(util_is_aligned(memory_range.offset, memory_range.alignment));
|
||||
assert(anv_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(!util_is_aligned(offset, alignment))) {
|
||||
if (unlikely(!anv_is_aligned(offset, alignment))) {
|
||||
return vk_errorf(device,
|
||||
VK_ERROR_INVALID_DRM_FORMAT_MODIFIER_PLANE_LAYOUT_EXT,
|
||||
"VkImageDrmFormatModifierExplicitCreateInfoEXT::"
|
||||
|
|
@ -192,7 +192,7 @@ memory_range_merge(struct anv_image_memory_range *a,
|
|||
return;
|
||||
|
||||
assert(a->offset == 0);
|
||||
assert(util_is_aligned(b.offset, b.alignment));
|
||||
assert(anv_is_aligned(b.offset, b.alignment));
|
||||
|
||||
a->alignment = MAX2(a->alignment, b.alignment);
|
||||
a->size = MAX2(a->size, b.offset + b.size);
|
||||
|
|
@ -740,7 +740,7 @@ add_primary_surface(struct anv_device *device,
|
|||
static bool MUST_CHECK
|
||||
memory_range_is_aligned(struct anv_image_memory_range memory_range)
|
||||
{
|
||||
return util_is_aligned(memory_range.offset, memory_range.alignment);
|
||||
return anv_is_aligned(memory_range.offset, memory_range.alignment);
|
||||
}
|
||||
|
||||
static bool MUST_CHECK
|
||||
|
|
|
|||
|
|
@ -286,6 +286,13 @@ 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)
|
||||
{
|
||||
return a == 0 || util_is_aligned(n, a);
|
||||
}
|
||||
|
||||
static inline union isl_color_value
|
||||
vk_to_isl_color(VkClearColorValue color)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue