We had vendored duplicates from pre-Mesa days; clean that up.
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
panfrost_afbc_header_size(unsigned width, unsigned height)
{
/* Align to tile */
- unsigned aligned_width = ALIGN(width, AFBC_TILE_WIDTH);
- unsigned aligned_height = ALIGN(height, AFBC_TILE_HEIGHT);
+ unsigned aligned_width = ALIGN_POT(width, AFBC_TILE_WIDTH);
+ unsigned aligned_height = ALIGN_POT(height, AFBC_TILE_HEIGHT);
/* Compute size in tiles, rather than pixels */
unsigned tile_count_x = aligned_width / AFBC_TILE_WIDTH;
unsigned header_bytes = tile_count * AFBC_HEADER_BYTES_PER_TILE;
/* Align and go */
- return ALIGN(header_bytes, AFBC_CACHE_ALIGN);
+ return ALIGN_POT(header_bytes, AFBC_CACHE_ALIGN);
}
struct panfrost_transfer
panfrost_allocate_chunk(struct panfrost_context *ctx, size_t size, unsigned heap_id)
{
- size = ALIGN(size, ALIGNMENT);
+ size = ALIGN_POT(size, ALIGNMENT);
struct pipe_context *gallium = (struct pipe_context *) ctx;
struct panfrost_screen *screen = pan_screen(gallium->screen);
panfrost_allocate_transient(struct panfrost_context *ctx, size_t sz)
{
/* Pad the size */
- sz = ALIGN(sz, ALIGNMENT);
+ sz = ALIGN_POT(sz, ALIGNMENT);
/* Check if there is room in the current entry */
struct panfrost_transient_pool *pool = &ctx->transient_pools[ctx->cmdstream_i];
struct panfrost_transfer
panfrost_allocate_chunk(struct panfrost_context *ctx, size_t size, unsigned heap_id);
-#include <math.h>
-#define inff INFINITY
-
-#define R(...) #__VA_ARGS__
-#define ALIGN(x, y) (((x) + ((y) - 1)) & ~((y) - 1))
-
#endif /* __PAN_ALLOCATE_H__ */
slot->stride = stride;
slot->size = stride * count;
- ctx->varying_height += ALIGN(slot->size, 64);
+ ctx->varying_height += ALIGN_POT(slot->size, 64);
assert(ctx->varying_height < ctx->varying_mem.bo->size);
return varying_address;
mali_ptr gpu = panfrost_map_constant_buffer_gpu(ctx, buf, ubo);
unsigned bytes_per_field = 16;
- unsigned aligned = ALIGN(sz, bytes_per_field);
+ unsigned aligned = ALIGN_POT(sz, bytes_per_field);
unsigned fields = aligned / bytes_per_field;
ubos[ubo].size = MALI_POSITIVE(fields);
* should work, but in practice causes issues when we're not
* explicitly trying to scissor */
- .clip_minx = -inff,
- .clip_miny = -inff,
- .clip_maxx = inff,
- .clip_maxy = inff,
+ .clip_minx = -INFINITY,
+ .clip_miny = -INFINITY,
+ .clip_maxx = INFINITY,
+ .clip_maxy = INFINITY,
.clip_minz = 0.0,
.clip_maxz = 1.0,
unsigned width,
unsigned height)
{
- unsigned aligned_width = ALIGN(width, CHECKSUM_TILE_WIDTH);
- unsigned aligned_height = ALIGN(height, CHECKSUM_TILE_HEIGHT);
+ unsigned aligned_width = ALIGN_POT(width, CHECKSUM_TILE_WIDTH);
+ unsigned aligned_height = ALIGN_POT(height, CHECKSUM_TILE_HEIGHT);
unsigned tile_count_x = aligned_width / CHECKSUM_TILE_WIDTH;
unsigned tile_count_y = aligned_height / CHECKSUM_TILE_HEIGHT;
unsigned effective_depth = depth;
if (should_align) {
- effective_width = ALIGN(effective_width, 16);
- effective_height = ALIGN(effective_height, 16);
+ effective_width = ALIGN_POT(effective_width, 16);
+ effective_height = ALIGN_POT(effective_height, 16);
/* We don't need to align depth */
}
/* ..but cache-line align it for performance */
if (can_align_stride && pres->layout == PAN_LINEAR)
- stride = ALIGN(stride, 64);
+ stride = ALIGN_POT(stride, 64);
slice->stride = stride;
if (res->target != PIPE_TEXTURE_3D) {
/* Arrays and cubemaps have the entire miptree duplicated */
- pres->cubemap_stride = ALIGN(offset, 64);
- *bo_size = ALIGN(pres->cubemap_stride * res->array_size, 4096);
+ pres->cubemap_stride = ALIGN_POT(offset, 64);
+ *bo_size = ALIGN_POT(pres->cubemap_stride * res->array_size, 4096);
} else {
/* 3D strides across the 2D layers */
assert(res->array_size == 1);
pres->cubemap_stride = size_2d;
- *bo_size = ALIGN(offset, 4096);
+ *bo_size = ALIGN_POT(offset, 4096);
}
}