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>
This commit is contained in:
@@ -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;
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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;
|
||||
|
@@ -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);
|
||||
|
@@ -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);
|
||||
|
||||
|
@@ -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])
|
||||
|
Reference in New Issue
Block a user