struct anv_state state;
uint32_t block;
- state.offset = ALIGN_U32(stream->next, alignment);
+ state.offset = align_u32(stream->next, alignment);
if (state.offset + size > stream->end) {
block = anv_block_pool_alloc(stream->block_pool);
void *current_map = stream->block_pool->map;
stream->current_block = block;
stream->next = block + sizeof(*sb);
stream->end = block + stream->block_pool->block_size;
- state.offset = ALIGN_U32(stream->next, alignment);
+ state.offset = align_u32(stream->next, alignment);
assert(state.offset + size <= stream->end);
}
type | AUB_TRACE_OP_DATA_WRITE);
aub_out(writer, subtype);
aub_out(writer, gtt_offset + offset);
- aub_out(writer, ALIGN_U32(block_size, 4));
+ aub_out(writer, align_u32(block_size, 4));
if (writer->gen >= 8)
aub_out(writer, 0);
aub_bos[i].map = anv_gem_mmap(device, bo->gem_handle, 0, bo->size);
aub_bos[i].relocated = aub_bos[i].map;
aub_bos[i].offset = offset;
- offset = ALIGN_U32(offset + bo->size + 4095, 4096);
+ offset = align_u32(offset + bo->size + 4095, 4096);
}
struct anv_batch_bo *first_bbo;
pipeline->active_stages |= 1 << stage;
pipeline->scratch_start[stage] = pipeline->total_scratch;
pipeline->total_scratch =
- ALIGN_U32(pipeline->total_scratch, 1024) +
+ align_u32(pipeline->total_scratch, 1024) +
prog_data->total_scratch * max_threads[stage];
}
{
struct anv_state state;
- state.offset = ALIGN_U32(cmd_buffer->surface_next, alignment);
+ state.offset = align_u32(cmd_buffer->surface_next, alignment);
if (state.offset + size > cmd_buffer->surface_batch_bo->bo.size)
return (struct anv_state) { 0 };
/* The format has a color or depth component. Calculate space for it. */
uint32_t aligned_height;
- image_stride = ALIGN_I32(extent->width * format_info->cpp,
+ image_stride = align_i32(extent->width * format_info->cpp,
tile_info->width);
- aligned_height = ALIGN_I32(extent->height, tile_info->height);
+ aligned_height = align_i32(extent->height, tile_info->height);
image_size = image_stride * aligned_height;
}
uint32_t aligned_height;
uint32_t stencil_size;
- stencil_offset = ALIGN_U32(image_size, w_info->surface_alignment);
- stencil_stride = ALIGN_I32(extent->width, w_info->width);
- aligned_height = ALIGN_I32(extent->height, w_info->height);
+ stencil_offset = align_u32(image_size, w_info->surface_alignment);
+ stencil_stride = align_i32(extent->width, w_info->width);
+ aligned_height = align_i32(extent->height, w_info->height);
stencil_size = stencil_stride * aligned_height;
image_size = stencil_offset + stencil_size;
}
#define MAX(a, b) ((a) > (b) ? (a) : (b))
static inline uint32_t
-ALIGN_U32(uint32_t v, uint32_t a)
+align_u32(uint32_t v, uint32_t a)
{
return (v + a - 1) & ~(a - 1);
}
static inline int32_t
-ALIGN_I32(int32_t v, int32_t a)
+align_i32(int32_t v, int32_t a)
{
return (v + a - 1) & ~(a - 1);
}
data = malloc(size);
if (data == NULL)
return NULL;
- split = ALIGN_U32(vector->tail, vector->size);
+ split = align_u32(vector->tail, vector->size);
tail = vector->tail & (vector->size - 1);
if (vector->head - split < vector->size) {
memcpy(data + tail,