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;
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 */
}
/* 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. */
}
/* 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. */
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;