summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/etnaviv/etnaviv_blt.c2
-rw-r--r--src/gallium/drivers/etnaviv/etnaviv_texture_state.c3
-rw-r--r--src/gallium/drivers/freedreno/freedreno_query_hw.c2
-rw-r--r--src/gallium/drivers/i915/i915_state_sampler.c3
-rw-r--r--src/gallium/drivers/llvmpipe/lp_state_fs.c2
-rw-r--r--src/gallium/drivers/llvmpipe/lp_texture.c2
-rw-r--r--src/gallium/drivers/nouveau/codegen/nv50_ir.cpp2
-rw-r--r--src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp4
-rw-r--r--src/gallium/drivers/nouveau/nv30/nv30_miptree.c6
-rw-r--r--src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c2
-rw-r--r--src/gallium/drivers/r300/r300_texture_desc.c6
-rw-r--r--src/gallium/drivers/r600/r600_texture.c2
-rw-r--r--src/gallium/drivers/radeon/r600_texture.c2
-rw-r--r--src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c2
-rw-r--r--src/gallium/drivers/softpipe/sp_texture.c12
-rw-r--r--src/gallium/drivers/swr/swr_screen.cpp4
-rw-r--r--src/gallium/drivers/vc4/vc4_program.c4
17 files changed, 31 insertions, 29 deletions
diff --git a/src/gallium/drivers/etnaviv/etnaviv_blt.c b/src/gallium/drivers/etnaviv/etnaviv_blt.c
index 5d783a4ad9c..c30c11ab61e 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_blt.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_blt.c
@@ -178,7 +178,7 @@ emit_blt_copyimage(struct etna_cmd_stream *stream, const struct blt_imgcopy_op *
static void
emit_blt_inplace(struct etna_cmd_stream *stream, const struct blt_inplace_op *op)
{
- assert(op->bpp > 0 && util_is_power_of_two(op->bpp));
+ assert(op->bpp > 0 && util_is_power_of_two_or_zero(op->bpp));
etna_cmd_stream_reserve(stream, 64*2); /* Never allow BLT sequences to be broken up */
etna_set_state(stream, VIVS_BLT_ENABLE, 0x00000001);
etna_set_state(stream, VIVS_BLT_CONFIG,
diff --git a/src/gallium/drivers/etnaviv/etnaviv_texture_state.c b/src/gallium/drivers/etnaviv/etnaviv_texture_state.c
index faa073a71af..7100865f925 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_texture_state.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_texture_state.c
@@ -158,7 +158,8 @@ etna_create_sampler_view_state(struct pipe_context *pctx, struct pipe_resource *
/* Workaround for npot textures -- it appears that only CLAMP_TO_EDGE is
* supported when the appropriate capability is not set. */
if (!ctx->specs.npot_tex_any_wrap &&
- (!util_is_power_of_two(res->base.width0) || !util_is_power_of_two(res->base.height0))) {
+ (!util_is_power_of_two_or_zero(res->base.width0) ||
+ !util_is_power_of_two_or_zero(res->base.height0))) {
sv->TE_SAMPLER_CONFIG0_MASK = ~(VIVS_TE_SAMPLER_CONFIG0_UWRAP__MASK |
VIVS_TE_SAMPLER_CONFIG0_VWRAP__MASK);
sv->TE_SAMPLER_CONFIG0 |=
diff --git a/src/gallium/drivers/freedreno/freedreno_query_hw.c b/src/gallium/drivers/freedreno/freedreno_query_hw.c
index 8b25e9cbcca..86a46faa730 100644
--- a/src/gallium/drivers/freedreno/freedreno_query_hw.c
+++ b/src/gallium/drivers/freedreno/freedreno_query_hw.c
@@ -301,7 +301,7 @@ fd_hw_sample_init(struct fd_batch *batch, uint32_t size)
struct fd_hw_sample *samp = slab_alloc_st(&batch->ctx->sample_pool);
pipe_reference_init(&samp->reference, 1);
samp->size = size;
- debug_assert(util_is_power_of_two(size));
+ debug_assert(util_is_power_of_two_or_zero(size));
batch->next_sample_offset = align(batch->next_sample_offset, size);
samp->offset = batch->next_sample_offset;
/* NOTE: slab_alloc_st() does not zero out the buffer: */
diff --git a/src/gallium/drivers/i915/i915_state_sampler.c b/src/gallium/drivers/i915/i915_state_sampler.c
index 84ed1514630..66a5778717a 100644
--- a/src/gallium/drivers/i915/i915_state_sampler.c
+++ b/src/gallium/drivers/i915/i915_state_sampler.c
@@ -307,7 +307,8 @@ static void update_map(struct i915_context *i915,
int first_level = view->u.tex.first_level;
const uint num_levels = pt->last_level - first_level;
unsigned max_lod = num_levels * 4;
- bool is_npot = (!util_is_power_of_two(pt->width0) || !util_is_power_of_two(pt->height0));
+ bool is_npot = (!util_is_power_of_two_or_zero(pt->width0) ||
+ !util_is_power_of_two_or_zero(pt->height0));
uint format, pitch;
/*
diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c
index 66645b07ac7..74b8d4dd96e 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_fs.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c
@@ -2240,7 +2240,7 @@ generate_unswizzled_blend(struct gallivm_state *gallivm,
if (dst_count > src_count) {
if ((dst_type.width == 8 || dst_type.width == 16) &&
- util_is_power_of_two(dst_type.length) &&
+ util_is_power_of_two_or_zero(dst_type.length) &&
dst_type.length * dst_type.width < 128) {
/*
* Never try to load values as 4xi8 which we will then
diff --git a/src/gallium/drivers/llvmpipe/lp_texture.c b/src/gallium/drivers/llvmpipe/lp_texture.c
index 162c74ad7dd..89852cc95c3 100644
--- a/src/gallium/drivers/llvmpipe/lp_texture.c
+++ b/src/gallium/drivers/llvmpipe/lp_texture.c
@@ -670,7 +670,7 @@ llvmpipe_get_format_alignment( enum pipe_format format )
bytes = size / 8;
- if (!util_is_power_of_two(bytes)) {
+ if (!util_is_power_of_two_or_zero(bytes)) {
bytes /= desc->nr_channels;
}
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir.cpp
index 6f12df70a11..c987da99085 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir.cpp
@@ -423,7 +423,7 @@ ImmediateValue::isNegative() const
bool
ImmediateValue::isPow2() const
{
- return util_is_power_of_two(reg.data.u32);
+ return util_is_power_of_two_or_zero(reg.data.u32);
}
void
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
index 48cf74950df..39177bd044b 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
@@ -1305,7 +1305,7 @@ ConstantFolding::opnd(Instruction *i, ImmediateValue &imm0, int s)
src->op == OP_SHR &&
src->src(1).getImmediate(imm1) &&
i->src(t).mod == Modifier(0) &&
- util_is_power_of_two(imm0.reg.data.u32 + 1)) {
+ util_is_power_of_two_or_zero(imm0.reg.data.u32 + 1)) {
// low byte = offset, high byte = width
uint32_t ext = (util_last_bit(imm0.reg.data.u32) << 8) | imm1.reg.data.u32;
i->op = OP_EXTBF;
@@ -1314,7 +1314,7 @@ ConstantFolding::opnd(Instruction *i, ImmediateValue &imm0, int s)
} else if (src->op == OP_SHL &&
src->src(1).getImmediate(imm1) &&
i->src(t).mod == Modifier(0) &&
- util_is_power_of_two(~imm0.reg.data.u32 + 1) &&
+ util_is_power_of_two_or_zero(~imm0.reg.data.u32 + 1) &&
util_last_bit(~imm0.reg.data.u32) <= imm1.reg.data.u32) {
i->op = OP_MOV;
i->setSrc(s, NULL);
diff --git a/src/gallium/drivers/nouveau/nv30/nv30_miptree.c b/src/gallium/drivers/nouveau/nv30/nv30_miptree.c
index 165b8f29b4b..4f991776323 100644
--- a/src/gallium/drivers/nouveau/nv30/nv30_miptree.c
+++ b/src/gallium/drivers/nouveau/nv30/nv30_miptree.c
@@ -401,9 +401,9 @@ nv30_miptree_create(struct pipe_screen *pscreen,
if ((pt->target == PIPE_TEXTURE_RECT) ||
(pt->bind & PIPE_BIND_SCANOUT) ||
- !util_is_power_of_two(pt->width0) ||
- !util_is_power_of_two(pt->height0) ||
- !util_is_power_of_two(pt->depth0) ||
+ !util_is_power_of_two_or_zero(pt->width0) ||
+ !util_is_power_of_two_or_zero(pt->height0) ||
+ !util_is_power_of_two_or_zero(pt->depth0) ||
util_format_is_compressed(pt->format) ||
util_format_is_float(pt->format) || mt->ms_mode) {
mt->uniform_pitch = util_format_get_nblocksx(pt->format, w) * blocksz;
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c b/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c
index 37a67619588..8e2192d3de2 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c
@@ -183,7 +183,7 @@ nvc0_validate_fb(struct nvc0_context *nvc0)
}
if (nr_cbufs == 0 && !fb->zsbuf) {
- assert(util_is_power_of_two(fb->samples));
+ assert(util_is_power_of_two_or_zero(fb->samples));
assert(fb->samples <= 8);
nvc0_fb_set_null_rt(push, 0, fb->layers);
diff --git a/src/gallium/drivers/r300/r300_texture_desc.c b/src/gallium/drivers/r300/r300_texture_desc.c
index 2442d726cd1..37e7b5fc4e2 100644
--- a/src/gallium/drivers/r300/r300_texture_desc.c
+++ b/src/gallium/drivers/r300/r300_texture_desc.c
@@ -270,15 +270,15 @@ static void r300_setup_miptree(struct r300_screen *screen,
static void r300_setup_flags(struct r300_resource *tex)
{
tex->tex.uses_stride_addressing =
- !util_is_power_of_two(tex->b.b.width0) ||
+ !util_is_power_of_two_or_zero(tex->b.b.width0) ||
(tex->tex.stride_in_bytes_override &&
r300_stride_to_width(tex->b.b.format,
tex->tex.stride_in_bytes_override) != tex->b.b.width0);
tex->tex.is_npot =
tex->tex.uses_stride_addressing ||
- !util_is_power_of_two(tex->b.b.height0) ||
- !util_is_power_of_two(tex->b.b.depth0);
+ !util_is_power_of_two_or_zero(tex->b.b.height0) ||
+ !util_is_power_of_two_or_zero(tex->b.b.depth0);
}
static void r300_setup_cbzb_flags(struct r300_screen *rscreen,
diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c
index 806bc278b08..c39c00c2e3e 100644
--- a/src/gallium/drivers/r600/r600_texture.c
+++ b/src/gallium/drivers/r600/r600_texture.c
@@ -217,7 +217,7 @@ static int r600_init_surface(struct r600_common_screen *rscreen,
bpe = 4; /* stencil is allocated separately on evergreen */
} else {
bpe = util_format_get_blocksize(ptex->format);
- assert(util_is_power_of_two(bpe));
+ assert(util_is_power_of_two_or_zero(bpe));
}
if (!is_flushed_depth && is_depth) {
diff --git a/src/gallium/drivers/radeon/r600_texture.c b/src/gallium/drivers/radeon/r600_texture.c
index eb6706c9dcd..50c5dbe3e1a 100644
--- a/src/gallium/drivers/radeon/r600_texture.c
+++ b/src/gallium/drivers/radeon/r600_texture.c
@@ -240,7 +240,7 @@ static int r600_init_surface(struct si_screen *sscreen,
bpe = 4; /* stencil is allocated separately on evergreen */
} else {
bpe = util_format_get_blocksize(ptex->format);
- assert(util_is_power_of_two(bpe));
+ assert(util_is_power_of_two_or_zero(bpe));
}
if (!is_flushed_depth && is_depth) {
diff --git a/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c b/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c
index 90cc2e0d981..79fdebe8388 100644
--- a/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c
+++ b/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c
@@ -192,7 +192,7 @@ LLVMValueRef si_llvm_bound_index(struct si_shader_context *ctx,
LLVMValueRef c_max = LLVMConstInt(ctx->i32, num - 1, 0);
LLVMValueRef cc;
- if (util_is_power_of_two(num)) {
+ if (util_is_power_of_two_or_zero(num)) {
index = LLVMBuildAnd(builder, index, c_max, "");
} else {
/* In theory, this MAX pattern should result in code that is
diff --git a/src/gallium/drivers/softpipe/sp_texture.c b/src/gallium/drivers/softpipe/sp_texture.c
index ea5e2c64b84..c49bfcaba55 100644
--- a/src/gallium/drivers/softpipe/sp_texture.c
+++ b/src/gallium/drivers/softpipe/sp_texture.c
@@ -166,9 +166,9 @@ softpipe_resource_create_front(struct pipe_screen *screen,
pipe_reference_init(&spr->base.reference, 1);
spr->base.screen = screen;
- spr->pot = (util_is_power_of_two(templat->width0) &&
- util_is_power_of_two(templat->height0) &&
- util_is_power_of_two(templat->depth0));
+ spr->pot = (util_is_power_of_two_or_zero(templat->width0) &&
+ util_is_power_of_two_or_zero(templat->height0) &&
+ util_is_power_of_two_or_zero(templat->depth0));
if (spr->base.bind & (PIPE_BIND_DISPLAY_TARGET |
PIPE_BIND_SCANOUT |
@@ -231,9 +231,9 @@ softpipe_resource_from_handle(struct pipe_screen *screen,
pipe_reference_init(&spr->base.reference, 1);
spr->base.screen = screen;
- spr->pot = (util_is_power_of_two(templat->width0) &&
- util_is_power_of_two(templat->height0) &&
- util_is_power_of_two(templat->depth0));
+ spr->pot = (util_is_power_of_two_or_zero(templat->width0) &&
+ util_is_power_of_two_or_zero(templat->height0) &&
+ util_is_power_of_two_or_zero(templat->depth0));
spr->dt = winsys->displaytarget_from_handle(winsys,
templat,
diff --git a/src/gallium/drivers/swr/swr_screen.cpp b/src/gallium/drivers/swr/swr_screen.cpp
index dd2d003d15d..880a177c399 100644
--- a/src/gallium/drivers/swr/swr_screen.cpp
+++ b/src/gallium/drivers/swr/swr_screen.cpp
@@ -105,7 +105,7 @@ swr_is_format_supported(struct pipe_screen *_screen,
return FALSE;
if ((sample_count > screen->msaa_max_count)
- || !util_is_power_of_two(sample_count))
+ || !util_is_power_of_two_or_zero(sample_count))
return FALSE;
if (bind & PIPE_BIND_DISPLAY_TARGET) {
@@ -1103,7 +1103,7 @@ swr_validate_env_options(struct swr_screen *screen)
int msaa_max_count = debug_get_num_option("SWR_MSAA_MAX_COUNT", 1);
if (msaa_max_count != 1) {
if ((msaa_max_count < 1) || (msaa_max_count > SWR_MAX_NUM_MULTISAMPLES)
- || !util_is_power_of_two(msaa_max_count)) {
+ || !util_is_power_of_two_or_zero(msaa_max_count)) {
fprintf(stderr, "SWR_MSAA_MAX_COUNT invalid: %d\n", msaa_max_count);
fprintf(stderr, "must be power of 2 between 1 and %d" \
" (or 1 to disable msaa)\n",
diff --git a/src/gallium/drivers/vc4/vc4_program.c b/src/gallium/drivers/vc4/vc4_program.c
index 2ec6aa471d4..367613130bb 100644
--- a/src/gallium/drivers/vc4/vc4_program.c
+++ b/src/gallium/drivers/vc4/vc4_program.c
@@ -313,7 +313,7 @@ static struct qreg
ntq_get_alu_src(struct vc4_compile *c, nir_alu_instr *instr,
unsigned src)
{
- assert(util_is_power_of_two(instr->dest.write_mask));
+ assert(util_is_power_of_two_or_zero(instr->dest.write_mask));
unsigned chan = ffs(instr->dest.write_mask) - 1;
struct qreg r = ntq_get_src(c, instr->src[src].src,
instr->src[src].swizzle[chan]);
@@ -1363,7 +1363,7 @@ ntq_emit_alu(struct vc4_compile *c, nir_alu_instr *instr)
/* We have a scalar result, so the instruction should only have a
* single channel written to.
*/
- assert(util_is_power_of_two(instr->dest.write_mask));
+ assert(util_is_power_of_two_or_zero(instr->dest.write_mask));
ntq_store_dest(c, &instr->dest.dest,
ffs(instr->dest.write_mask) - 1, result);
}