summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2021-12-07 16:05:56 +1000
committerMarge Bot <emma+marge@anholt.net>2021-12-07 19:04:01 +0000
commit55b396e7430f16b3de3999d8f5a191bc1ae44b70 (patch)
tree4a3fac8573d7bb53a9393ba3477af598ad0a1906
parentd9f0991744aa96b354b0912c4b31a995c3b274b0 (diff)
mesa/crocus/iris/blorp: drop minify macro in favour of u_minify
This macro is duplicated, clean it up. Reviewed-by: Dylan Baker <dylan.c.baker@intel.com> Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14103>
-rw-r--r--src/gallium/drivers/crocus/crocus_clear.c8
-rw-r--r--src/gallium/drivers/crocus/crocus_resource.c2
-rw-r--r--src/gallium/drivers/iris/iris_clear.c4
-rw-r--r--src/gallium/drivers/iris/iris_resource.c2
-rw-r--r--src/intel/blorp/blorp.c16
-rw-r--r--src/intel/blorp/blorp_blit.c16
-rw-r--r--src/intel/blorp/blorp_clear.c20
-rw-r--r--src/mesa/main/macros.h7
8 files changed, 34 insertions, 41 deletions
diff --git a/src/gallium/drivers/crocus/crocus_clear.c b/src/gallium/drivers/crocus/crocus_clear.c
index 029131caf5d..9ce65e914c2 100644
--- a/src/gallium/drivers/crocus/crocus_clear.c
+++ b/src/gallium/drivers/crocus/crocus_clear.c
@@ -81,8 +81,8 @@ can_fast_clear_color(struct crocus_context *ice,
/* Check for partial clear */
if (box->x > 0 || box->y > 0 ||
- box->width < minify(p_res->width0, level) ||
- box->height < minify(p_res->height0, level)) {
+ box->width < u_minify(p_res->width0, level) ||
+ box->height < u_minify(p_res->height0, level)) {
return false;
}
@@ -440,8 +440,8 @@ can_fast_clear_depth(struct crocus_context *ice,
* optimization must be disabled.
*/
if (devinfo->ver == 6 &&
- (minify(res->surf.phys_level0_sa.width,
- level) % 16) != 0)
+ (u_minify(res->surf.phys_level0_sa.width,
+ level) % 16) != 0)
return false;
}
return true;
diff --git a/src/gallium/drivers/crocus/crocus_resource.c b/src/gallium/drivers/crocus/crocus_resource.c
index 6acee09494a..4962be3f650 100644
--- a/src/gallium/drivers/crocus/crocus_resource.c
+++ b/src/gallium/drivers/crocus/crocus_resource.c
@@ -368,7 +368,7 @@ unsigned
crocus_get_num_logical_layers(const struct crocus_resource *res, unsigned level)
{
if (res->surf.dim == ISL_SURF_DIM_3D)
- return minify(res->surf.logical_level0_px.depth, level);
+ return u_minify(res->surf.logical_level0_px.depth, level);
else
return res->surf.logical_level0_px.array_len;
}
diff --git a/src/gallium/drivers/iris/iris_clear.c b/src/gallium/drivers/iris/iris_clear.c
index 854b1b8c886..06b8069ad5e 100644
--- a/src/gallium/drivers/iris/iris_clear.c
+++ b/src/gallium/drivers/iris/iris_clear.c
@@ -82,8 +82,8 @@ can_fast_clear_color(struct iris_context *ice,
/* Check for partial clear */
if (box->x > 0 || box->y > 0 ||
- box->width < minify(p_res->width0, level) ||
- box->height < minify(p_res->height0, level)) {
+ box->width < u_minify(p_res->width0, level) ||
+ box->height < u_minify(p_res->height0, level)) {
return false;
}
diff --git a/src/gallium/drivers/iris/iris_resource.c b/src/gallium/drivers/iris/iris_resource.c
index 1e05b9e67df..8f512739ac4 100644
--- a/src/gallium/drivers/iris/iris_resource.c
+++ b/src/gallium/drivers/iris/iris_resource.c
@@ -495,7 +495,7 @@ unsigned
iris_get_num_logical_layers(const struct iris_resource *res, unsigned level)
{
if (res->surf.dim == ISL_SURF_DIM_3D)
- return minify(res->surf.logical_level0_px.depth, level);
+ return u_minify(res->surf.logical_level0_px.depth, level);
else
return res->surf.logical_level0_px.array_len;
}
diff --git a/src/intel/blorp/blorp.c b/src/intel/blorp/blorp.c
index 84756c74715..37b8251c916 100644
--- a/src/intel/blorp/blorp.c
+++ b/src/intel/blorp/blorp.c
@@ -462,10 +462,10 @@ blorp_hiz_op(struct blorp_batch *batch, struct blorp_surf *surf,
* surfaces, not 8. But commit 1f112cc increased the alignment from 4 to
* 8, which prevents the clobbering.
*/
- params.x1 = minify(params.depth.surf.logical_level0_px.width,
- params.depth.view.base_level);
- params.y1 = minify(params.depth.surf.logical_level0_px.height,
- params.depth.view.base_level);
+ params.x1 = u_minify(params.depth.surf.logical_level0_px.width,
+ params.depth.view.base_level);
+ params.y1 = u_minify(params.depth.surf.logical_level0_px.height,
+ params.depth.view.base_level);
params.x1 = ALIGN(params.x1, 8);
params.y1 = ALIGN(params.y1, 4);
@@ -504,10 +504,10 @@ blorp_hiz_op(struct blorp_batch *batch, struct blorp_surf *surf,
* the base LOD extent. Just assert that the caller is accessing an
* LOD that satisfies this requirement.
*/
- assert(minify(params.depth.surf.logical_level0_px.width,
- params.depth.view.base_level) == params.x1);
- assert(minify(params.depth.surf.logical_level0_px.height,
- params.depth.view.base_level) == params.y1);
+ assert(u_minify(params.depth.surf.logical_level0_px.width,
+ params.depth.view.base_level) == params.x1);
+ assert(u_minify(params.depth.surf.logical_level0_px.height,
+ params.depth.view.base_level) == params.y1);
}
params.dst.surf.samples = params.depth.surf.samples;
diff --git a/src/intel/blorp/blorp_blit.c b/src/intel/blorp/blorp_blit.c
index 5f5c4d31f66..6d1d7fc5e51 100644
--- a/src/intel/blorp/blorp_blit.c
+++ b/src/intel/blorp/blorp_blit.c
@@ -2115,11 +2115,11 @@ try_blorp_blit(struct blorp_batch *batch,
/* Gfx4-5 don't support non-normalized texture coordinates */
key->src_coords_normalized = true;
params->wm_inputs.src_inv_size[0] =
- 1.0f / minify(params->src.surf.logical_level0_px.width,
- params->src.view.base_level);
+ 1.0f / u_minify(params->src.surf.logical_level0_px.width,
+ params->src.view.base_level);
params->wm_inputs.src_inv_size[1] =
- 1.0f / minify(params->src.surf.logical_level0_px.height,
- params->src.view.base_level);
+ 1.0f / u_minify(params->src.surf.logical_level0_px.height,
+ params->src.view.base_level);
}
if (isl_format_get_layout(params->dst.view.format)->bpb % 3 == 0) {
@@ -2530,10 +2530,10 @@ blorp_blit(struct blorp_batch *batch,
key.y_scale = params.src.surf.samples / key.x_scale;
params.wm_inputs.rect_grid.x1 =
- minify(params.src.surf.logical_level0_px.width, src_level) *
+ u_minify(params.src.surf.logical_level0_px.width, src_level) *
key.x_scale - 1.0f;
params.wm_inputs.rect_grid.y1 =
- minify(params.src.surf.logical_level0_px.height, src_level) *
+ u_minify(params.src.surf.logical_level0_px.height, src_level) *
key.y_scale - 1.0f;
struct blt_coords coords = {
@@ -2739,9 +2739,9 @@ blorp_surf_convert_to_uncompressed(const struct isl_device *isl_dev,
if (width && height) {
ASSERTED const uint32_t level_width =
- minify(info->surf.logical_level0_px.width, info->view.base_level);
+ u_minify(info->surf.logical_level0_px.width, info->view.base_level);
ASSERTED const uint32_t level_height =
- minify(info->surf.logical_level0_px.height, info->view.base_level);
+ u_minify(info->surf.logical_level0_px.height, info->view.base_level);
assert(*width % fmtl->bw == 0 || *x + *width == level_width);
assert(*height % fmtl->bh == 0 || *y + *height == level_height);
*width = DIV_ROUND_UP(*width, fmtl->bw);
diff --git a/src/intel/blorp/blorp_clear.c b/src/intel/blorp/blorp_clear.c
index df70cfe64f5..4c2f108fd56 100644
--- a/src/intel/blorp/blorp_clear.c
+++ b/src/intel/blorp/blorp_clear.c
@@ -958,8 +958,8 @@ blorp_can_hiz_clear_depth(const struct intel_device_info *devinfo,
&slice_x0, &slice_y0, &slice_z0, &slice_a0);
assert(slice_z0 == 0 && slice_a0 == 0);
const bool max_x1_y1 =
- x1 == minify(surf->logical_level0_px.width, level) &&
- y1 == minify(surf->logical_level0_px.height, level);
+ x1 == u_minify(surf->logical_level0_px.width, level) &&
+ y1 == u_minify(surf->logical_level0_px.height, level);
const uint32_t haligned_x1 = ALIGN(x1, surf->image_alignment_el.w);
const uint32_t valigned_y1 = ALIGN(y1, surf->image_alignment_el.h);
const bool unaligned = (slice_x0 + x0) % 16 || (slice_y0 + y0) % 8 ||
@@ -988,13 +988,13 @@ blorp_can_clear_full_surface(const struct blorp_surf *depth,
{
uint32_t width = 0, height = 0;
if (clear_stencil) {
- width = minify(stencil->surf->logical_level0_px.width, level);
- height = minify(stencil->surf->logical_level0_px.height, level);
+ width = u_minify(stencil->surf->logical_level0_px.width, level);
+ height = u_minify(stencil->surf->logical_level0_px.height, level);
}
if (clear_depth && !(width || height)) {
- width = minify(depth->surf->logical_level0_px.width, level);
- height = minify(depth->surf->logical_level0_px.height, level);
+ width = u_minify(depth->surf->logical_level0_px.width, level);
+ height = u_minify(depth->surf->logical_level0_px.height, level);
}
return x0 == 0 && y0 == 0 && width == x1 && height == y1;
@@ -1225,8 +1225,8 @@ blorp_ccs_resolve(struct blorp_batch *batch,
y_scaledown = aux_fmtl->bh / 2;
}
params.x0 = params.y0 = 0;
- params.x1 = minify(params.dst.surf.logical_level0_px.width, level);
- params.y1 = minify(params.dst.surf.logical_level0_px.height, level);
+ params.x1 = u_minify(params.dst.surf.logical_level0_px.width, level);
+ params.y1 = u_minify(params.dst.surf.logical_level0_px.height, level);
params.x1 = ALIGN(params.x1, x_scaledown) / x_scaledown;
params.y1 = ALIGN(params.y1, y_scaledown) / y_scaledown;
@@ -1439,9 +1439,9 @@ blorp_ccs_ambiguate(struct blorp_batch *batch,
params.dst.addr.offset += offset_B;
const uint32_t width_px =
- minify(surf->aux_surf->logical_level0_px.width, level);
+ u_minify(surf->aux_surf->logical_level0_px.width, level);
const uint32_t height_px =
- minify(surf->aux_surf->logical_level0_px.height, level);
+ u_minify(surf->aux_surf->logical_level0_px.height, level);
const uint32_t width_el = DIV_ROUND_UP(width_px, aux_fmtl->bw);
const uint32_t height_el = DIV_ROUND_UP(height_px, aux_fmtl->bh);
diff --git a/src/mesa/main/macros.h b/src/mesa/main/macros.h
index 920be481ed4..9071379f5a8 100644
--- a/src/mesa/main/macros.h
+++ b/src/mesa/main/macros.h
@@ -689,13 +689,6 @@ INTERP_4F(GLfloat t, GLfloat dst[4], const GLfloat out[4], const GLfloat in[4])
-static inline unsigned
-minify(unsigned value, unsigned levels)
-{
- return MAX2(1, value >> levels);
-}
-
-
/** Cross product of two 3-element vectors */
static inline void
CROSS3(GLfloat n[3], const GLfloat u[3], const GLfloat v[3])