v3d: Remove padded_height_of_output_image_in_uif_blocks from v3d_surface

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35288>
This commit is contained in:
Jose Maria Casanova Crespo 2025-03-28 12:44:25 +01:00 committed by Marge Bot
parent 1fe0327255
commit 735cf1cb78
3 changed files with 30 additions and 40 deletions

View file

@ -1087,20 +1087,16 @@ v3d_create_surface(struct pipe_context *pctx,
return NULL;
struct pipe_surface *psurf = &surface->base;
unsigned level = surf_tmpl->level;
struct v3d_resource_slice *slice = &rsc->slices[level];
pipe_reference_init(&psurf->reference, 1);
pipe_resource_reference(&psurf->texture, ptex);
psurf->context = pctx;
psurf->format = surf_tmpl->format;
psurf->level = level;
psurf->level = surf_tmpl->level;
psurf->first_layer = surf_tmpl->first_layer;
psurf->last_layer = surf_tmpl->last_layer;
enum v3d_tiling_mode tiling = slice->tiling;
if (util_format_is_depth_or_stencil(psurf->format)) {
switch (psurf->format) {
case PIPE_FORMAT_Z16_UNORM:
@ -1122,13 +1118,6 @@ v3d_create_surface(struct pipe_context *pctx,
surface->internal_bpp = bpp;
}
if (tiling == V3D_TILING_UIF_NO_XOR ||
tiling == V3D_TILING_UIF_XOR) {
surface->padded_height_of_output_image_in_uif_blocks =
(slice->padded_height /
(2 * v3d_utile_height(rsc->cpp)));
}
if (rsc->separate_stencil) {
surface->separate_stencil =
v3d_create_surface(pctx, &rsc->separate_stencil->base,

View file

@ -62,8 +62,6 @@ struct v3d_surface {
*/
uint8_t internal_bpp;
uint32_t padded_height_of_output_image_in_uif_blocks;
/* If the resource being referenced is separate stencil, then this is
* the surface to use when reading/writing stencil.
*/

View file

@ -44,6 +44,23 @@ v3d_surface_get_tiling(struct pipe_surface *psurf)
return rsc->slices[psurf->level].tiling;
}
static uint32_t
v3d_surface_get_height_in_ub_or_stride(struct pipe_surface *psurf)
{
assert(psurf && psurf->texture);
struct v3d_resource *rsc = v3d_resource(psurf->texture);
struct v3d_resource_slice *slice = &rsc->slices[psurf->level];
if (slice->tiling == V3D_TILING_UIF_NO_XOR ||
slice->tiling == V3D_TILING_UIF_XOR) {
return (slice->padded_height /
(2 * v3d_utile_height(rsc->cpp)));
} else if (slice->tiling == V3D_TILING_RASTER) {
return slice->stride;
}
return 0;
}
static void
load_general(struct v3d_cl *cl, struct pipe_surface *psurf, int buffer,
int layer, uint32_t pipe_bit, uint32_t *loads_pending)
@ -60,13 +77,12 @@ load_general(struct v3d_cl *cl, struct pipe_surface *psurf, int buffer,
uint32_t layer_offset =
v3d_layer_offset(&rsc->base, psurf->level,
psurf->first_layer + layer);
enum v3d_tiling_mode tiling = v3d_surface_get_tiling(psurf);
cl_emit(cl, LOAD_TILE_BUFFER_GENERAL, load) {
load.buffer_to_load = buffer;
load.address = cl_address(rsc->bo, layer_offset);
load.memory_format = tiling;
load.memory_format = v3d_surface_get_tiling(psurf);
if (separate_stencil)
load.input_image_format = V3D_OUTPUT_IMAGE_FORMAT_S8;
else
@ -76,15 +92,8 @@ load_general(struct v3d_cl *cl, struct pipe_surface *psurf, int buffer,
psurf->format);
load.r_b_swap = v3d_format_needs_tlb_rb_swap(psurf->format);
load.force_alpha_1 = util_format_has_alpha1(psurf->format);
if (tiling == V3D_TILING_UIF_NO_XOR ||
tiling == V3D_TILING_UIF_XOR) {
load.height_in_ub_or_stride =
surf->padded_height_of_output_image_in_uif_blocks;
} else if (tiling == V3D_TILING_RASTER) {
struct v3d_resource_slice *slice =
&rsc->slices[psurf->level];
load.height_in_ub_or_stride = slice->stride;
}
load.height_in_ub_or_stride =
v3d_surface_get_height_in_ub_or_stride(psurf);
if (psurf->texture->nr_samples > 1)
load.decimate_mode = V3D_DECIMATE_MODE_ALL_SAMPLES;
@ -121,7 +130,6 @@ store_general(struct v3d_job *job,
uint32_t layer_offset =
v3d_layer_offset(&rsc->base, psurf->level,
psurf->first_layer + layer);
enum v3d_tiling_mode tiling = v3d_surface_get_tiling(psurf);
cl_emit(cl, STORE_TILE_BUFFER_GENERAL, store) {
store.buffer_to_store = buffer;
@ -138,17 +146,9 @@ store_general(struct v3d_job *job,
psurf->format);
store.r_b_swap = v3d_format_needs_tlb_rb_swap(psurf->format);
store.memory_format = tiling;
if (tiling == V3D_TILING_UIF_NO_XOR ||
tiling == V3D_TILING_UIF_XOR) {
store.height_in_ub_or_stride =
surf->padded_height_of_output_image_in_uif_blocks;
} else if (tiling == V3D_TILING_RASTER) {
struct v3d_resource_slice *slice =
&rsc->slices[psurf->level];
store.height_in_ub_or_stride = slice->stride;
}
store.memory_format = v3d_surface_get_tiling(psurf);
store.height_in_ub_or_stride =
v3d_surface_get_height_in_ub_or_stride(psurf);
if (psurf->texture->nr_samples > 1) {
store.decimate_mode = V3D_DECIMATE_MODE_ALL_SAMPLES;
@ -755,13 +755,16 @@ v3dX(emit_rcl)(struct v3d_job *job)
int uif_block_height = v3d_utile_height(rsc->cpp) * 2;
uint32_t implicit_padded_height = (align(job->draw_height, uif_block_height) /
uif_block_height);
if (surf->padded_height_of_output_image_in_uif_blocks -
uint32_t padded_height_of_output_image_in_uif_blocks =
v3d_surface_get_height_in_ub_or_stride(psurf);
if (padded_height_of_output_image_in_uif_blocks -
implicit_padded_height < 15) {
config_pad = (surf->padded_height_of_output_image_in_uif_blocks -
config_pad = (padded_height_of_output_image_in_uif_blocks -
implicit_padded_height);
} else {
config_pad = 15;
clear_pad = surf->padded_height_of_output_image_in_uif_blocks;
clear_pad = padded_height_of_output_image_in_uif_blocks;
}
}