intel: use util_is_aligned more

Coccinelle + filtering hunks manually.

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:
Alyssa Rosenzweig 2025-10-30 14:45:23 -04:00 committed by Marge Bot
parent 7be63ef956
commit 5f53e6edc0
8 changed files with 11 additions and 11 deletions

View file

@ -5970,7 +5970,7 @@ pin_scratch_space(struct iris_context *ice,
scratch_addr = ref->offset +
iris_resource_bo(ref->res)->address -
IRIS_MEMZONE_SCRATCH_START;
assert((scratch_addr & 0x3f) == 0 && scratch_addr < (1 << 26));
assert(util_is_aligned(scratch_addr, 64) && scratch_addr < (1 << 26));
#else
scratch_addr = scratch_bo->address;
#endif

View file

@ -1265,7 +1265,7 @@ blorp_emit_surface_state(struct blorp_batch *batch,
if (aux_usage != ISL_AUX_USAGE_NONE && surface->clear_color_addr.buffer) {
#if GFX_VER >= 10
assert((surface->clear_color_addr.offset & 0x3f) == 0);
assert(util_is_aligned(surface->clear_color_addr.offset, 64));
uint32_t *clear_addr = state + isl_dev->ss.clear_color_state_offset;
blorp_surface_reloc(batch, state_offset +
isl_dev->ss.clear_color_state_offset,

View file

@ -474,9 +474,9 @@ blorp_get_cs_local_y(struct blorp_params *params)
{
uint32_t height = params->y1 - params->y0;
uint32_t or_ys = params->y0 | params->y1;
if (height > 32 || (or_ys & 3) == 0) {
if (height > 32 || util_is_aligned(or_ys, 4)) {
return 4;
} else if ((or_ys & 1) == 0) {
} else if (util_is_aligned(or_ys, 2)) {
return 2;
} else {
return 1;

View file

@ -1528,7 +1528,7 @@ brw_send_indirect_split_message(struct brw_codegen *p,
brw_eu_inst_set_sends_ex_desc(devinfo, send, ex_desc.ud, gather);
} else {
assert(ex_desc.file == ADDRESS);
assert((ex_desc.subnr & 0x3) == 0);
assert(util_is_aligned(ex_desc.subnr, 4));
brw_eu_inst_set_send_sel_reg32_ex_desc(devinfo, send, 1);
brw_eu_inst_set_send_ex_desc_ia_subreg_nr(devinfo, send, phys_subnr(devinfo, ex_desc) >> 2);

View file

@ -1080,7 +1080,7 @@ brw_uniform_reg(unsigned nr, enum brw_reg_type type)
static inline bool
brw_reg_is_arf(struct brw_reg reg, unsigned arf)
{
assert((arf & 0x0f) == 0 && arf <= BRW_ARF_TIMESTAMP);
assert(util_is_aligned(arf, 16) && arf <= BRW_ARF_TIMESTAMP);
return reg.file == ARF && (reg.nr & 0xF0) == arf;
}

View file

@ -357,7 +357,7 @@ rgba8_copy_16_aligned_src(void *dst, const void *src)
static inline void *
rgba8_copy_aligned_dst(void *dst, const void *src, size_t bytes)
{
assert(bytes == 0 || !(((uintptr_t)dst) & 0xf));
assert(bytes == 0 || util_ptr_is_aligned(dst, 16));
#if defined(__SSSE3__) || defined(__SSE2__)
if (bytes == 64) {
@ -387,7 +387,7 @@ rgba8_copy_aligned_dst(void *dst, const void *src, size_t bytes)
static inline void *
rgba8_copy_aligned_src(void *dst, const void *src, size_t bytes)
{
assert(bytes == 0 || !(((uintptr_t)src) & 0xf));
assert(bytes == 0 || util_ptr_is_aligned(src, 16));
#if defined(__SSSE3__) || defined(__SSE2__)
if (bytes == 64) {

View file

@ -1953,10 +1953,10 @@ anv_surface_state_to_handle(struct anv_physical_device *device,
assert(state.offset >= 0);
uint32_t offset = state.offset;
if (device->uses_ex_bso) {
assert((offset & 0x3f) == 0);
assert(util_is_aligned(offset, 64));
return offset;
} else {
assert((offset & 0x3f) == 0 && offset < (1 << 26));
assert(util_is_aligned(offset, 64) && offset < (1 << 26));
return offset << 6;
}
}

View file

@ -150,7 +150,7 @@ anv_image_fill_surface_state(struct anv_device *device,
if (device->info->ver >= 10 && clear_address.bo) {
uint32_t *clear_addr_dw = surface_state_map +
device->isl_dev.ss.clear_color_state_offset;
assert((clear_address.offset & 0x3f) == 0);
assert(util_is_aligned(clear_address.offset, 64));
state_inout->clear_address.offset |= *clear_addr_dw & 0x3f;
}