radeonsi: implement setting a custom pitch to any multiple of 256B on gfx10.3+

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23015>
This commit is contained in:
Marek Olšák
2023-05-15 01:28:15 -04:00
committed by Marge Bot
parent 10c45fcc3f
commit 4ffa45689f
2 changed files with 39 additions and 1 deletions
@@ -328,6 +328,24 @@ void si_set_mutable_tex_desc_fields(struct si_screen *sscreen, struct si_texture
state[3] |= S_00A00C_SW_MODE(tex->surface.u.gfx9.swizzle_mode);
}
/* GFX10.3+ can set a custom pitch for 1D and 2D non-array, but it must be a multiple
* of 256B. Only set it for 2D linear for multi-GPU interop.
*/
if (sscreen->info.gfx_level >= GFX10_3 &&
(tex->buffer.b.b.target == PIPE_TEXTURE_2D ||
tex->buffer.b.b.target == PIPE_TEXTURE_RECT) &&
tex->surface.is_linear) {
assert((tex->surface.u.gfx9.surf_pitch * tex->surface.bpe) % 256 == 0);
unsigned pitch = tex->surface.u.gfx9.surf_pitch;
/* Subsampled images have the pitch in the units of blocks. */
if (tex->surface.blk_w == 2)
pitch *= 2;
state[4] |= S_00A010_DEPTH(pitch - 1) | /* DEPTH contains low bits of PITCH. */
S_00A010_PITCH_MSB((pitch - 1) >> 13);
}
if (meta_va) {
struct gfx9_surf_meta_flags meta = {
.rb_aligned = 1,
+21 -1
View File
@@ -2468,13 +2468,33 @@ static void si_initialize_color_surface(struct si_context *sctx, struct si_surfa
S_028C70_ROUND_MODE(round_mode) |
S_028C70_NUMBER_TYPE(ntype);
unsigned width0 = surf->width0;
/* GFX10.3+ can set a custom pitch for 1D and 2D non-array, but it must be a multiple
* of 256B. Only set it for 2D linear for multi-GPU interop.
*
* We set the pitch in MIP0_WIDTH.
*/
if (sctx->gfx_level >= GFX10_3 &&
(tex->buffer.b.b.target == PIPE_TEXTURE_2D ||
tex->buffer.b.b.target == PIPE_TEXTURE_RECT) &&
tex->surface.is_linear) {
assert((tex->surface.u.gfx9.surf_pitch * tex->surface.bpe) % 256 == 0);
width0 = tex->surface.u.gfx9.surf_pitch;
/* Subsampled images have the pitch in the units of blocks. */
if (tex->surface.blk_w == 2)
width0 *= 2;
}
if (sctx->gfx_level >= GFX10) {
/* Gfx10-11. */
surf->cb_color_view = S_028C6C_SLICE_START(surf->base.u.tex.first_layer) |
S_028C6C_SLICE_MAX_GFX10(surf->base.u.tex.last_layer) |
S_028C6C_MIP_LEVEL_GFX10(surf->base.u.tex.level);
surf->cb_color_attrib = 0;
surf->cb_color_attrib2 = S_028C68_MIP0_WIDTH(surf->width0 - 1) |
surf->cb_color_attrib2 = S_028C68_MIP0_WIDTH(width0 - 1) |
S_028C68_MIP0_HEIGHT(surf->height0 - 1) |
S_028C68_MAX_MIP(tex->buffer.b.b.last_level);
surf->cb_color_attrib3 = S_028EE0_MIP0_DEPTH(util_max_layer(&tex->buffer.b.b, 0)) |