ac/surface: add radeon_surf::u::gfx9::uses_custom_pitch
so that we don't try to guess when the pitch is overridden Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24759>
This commit is contained in:
parent
9eb00f612a
commit
905a00f10a
5 changed files with 22 additions and 17 deletions
|
|
@ -3009,6 +3009,7 @@ bool ac_surface_override_offset_stride(const struct radeon_info *info, struct ra
|
|||
if (pitch != surf->u.gfx9.surf_pitch) {
|
||||
unsigned slices = surf->surf_size / surf->u.gfx9.surf_slice_size;
|
||||
|
||||
surf->u.gfx9.uses_custom_pitch = true;
|
||||
surf->u.gfx9.surf_pitch = pitch;
|
||||
surf->u.gfx9.epitch = pitch - 1;
|
||||
surf->u.gfx9.pitch[0] = pitch;
|
||||
|
|
|
|||
|
|
@ -217,6 +217,7 @@ struct gfx9_meta_equation {
|
|||
struct gfx9_surf_layout {
|
||||
uint16_t epitch; /* gfx9 only, not on gfx10 */
|
||||
uint8_t swizzle_mode; /* color or depth */
|
||||
bool uses_custom_pitch; /* only used by gfx10.3+ */
|
||||
|
||||
enum gfx9_resource_type resource_type:8; /* 1D, 2D or 3D */
|
||||
uint16_t surf_pitch; /* in blocks */
|
||||
|
|
|
|||
|
|
@ -840,15 +840,16 @@ si_set_mutable_tex_desc_fields(struct radv_device *device, struct radv_image *im
|
|||
}
|
||||
|
||||
/* 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.
|
||||
* of 256B.
|
||||
*
|
||||
* If an imported image is used with VK_IMAGE_VIEW_TYPE_2D_ARRAY, it may hang due to VM faults
|
||||
* because DEPTH means pitch with 2D, but it means depth with 2D array.
|
||||
*/
|
||||
if (device->physical_device->rad_info.gfx_level >= GFX10_3 && image->vk.image_type == VK_IMAGE_TYPE_2D &&
|
||||
plane->surface.is_linear && util_is_power_of_two_nonzero(plane->surface.bpe) &&
|
||||
G_00A00C_TYPE(state[3]) == V_008F1C_SQ_RSRC_IMG_2D) {
|
||||
if (device->physical_device->rad_info.gfx_level >= GFX10_3 && plane->surface.u.gfx9.uses_custom_pitch) {
|
||||
assert((plane->surface.u.gfx9.surf_pitch * plane->surface.bpe) % 256 == 0);
|
||||
assert(image->vk.image_type == VK_IMAGE_TYPE_2D);
|
||||
assert(plane->surface.is_linear);
|
||||
assert(G_00A00C_TYPE(state[3]) == V_008F1C_SQ_RSRC_IMG_2D);
|
||||
unsigned pitch = plane->surface.u.gfx9.surf_pitch;
|
||||
|
||||
/* Subsampled images have the pitch in the units of blocks. */
|
||||
|
|
|
|||
|
|
@ -327,13 +327,14 @@ void si_set_mutable_tex_desc_fields(struct si_screen *sscreen, struct si_texture
|
|||
}
|
||||
|
||||
/* 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.
|
||||
* of 256B.
|
||||
*/
|
||||
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);
|
||||
if (sscreen->info.gfx_level >= GFX10_3 && tex->surface.u.gfx9.uses_custom_pitch) {
|
||||
ASSERTED unsigned min_alignment = 256;
|
||||
assert((tex->surface.u.gfx9.surf_pitch * tex->surface.bpe) % min_alignment == 0);
|
||||
assert(tex->buffer.b.b.target == PIPE_TEXTURE_2D ||
|
||||
tex->buffer.b.b.target == PIPE_TEXTURE_RECT);
|
||||
assert(tex->surface.is_linear);
|
||||
unsigned pitch = tex->surface.u.gfx9.surf_pitch;
|
||||
|
||||
/* Subsampled images have the pitch in the units of blocks. */
|
||||
|
|
|
|||
|
|
@ -2505,16 +2505,17 @@ static void si_initialize_color_surface(struct si_context *sctx, struct si_surfa
|
|||
|
||||
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.
|
||||
/* GFX10.3+ can set a custom pitch for 1D and 2D non-array, but it must be a multiple of
|
||||
* 256B.
|
||||
*
|
||||
* 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);
|
||||
if (sctx->gfx_level >= GFX10_3 && tex->surface.u.gfx9.uses_custom_pitch) {
|
||||
ASSERTED unsigned min_alignment = 256;
|
||||
assert((tex->surface.u.gfx9.surf_pitch * tex->surface.bpe) % min_alignment == 0);
|
||||
assert(tex->buffer.b.b.target == PIPE_TEXTURE_2D ||
|
||||
tex->buffer.b.b.target == PIPE_TEXTURE_RECT);
|
||||
assert(tex->surface.is_linear);
|
||||
|
||||
width0 = tex->surface.u.gfx9.surf_pitch;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue