turnip: Unrecoverable hang in Age of Empires IV on A650/A660
I have a trace of Age of Empires IV (https://cloud.igalia.com/s/o3ZyFEoY66FYDKj) which on frame 653 results in an unrecoverable hang (the board completely locks up and reboots after a few seconds).
I use this changes https://gitlab.freedesktop.org/Danil/mesa/-/commits/TEST/vkd3d to run it. To run the trace do:
gfxrecon-replay --remove-unsupported -m rebind --sfa age_of_empire_iv_full.gfxr --pause-frame 652
(The hang will happen on the 653 frame).
@flto found that the hang could be avoided if we don't use tiling with R8G8 images without UBWC and suggested that "probably R8G8 non-UBWC tiled is buggy, since media formats are always either linear or UBWC".
if (image->vk_format == VK_FORMAT_R8G8_UNORM && tile_mode == TILE6_3 && !ubwc_enabled)
tile_mode = TILE6_LINEAR;
(This in tu_CreateImage
would prevent the hang)
Digging deeper I found the command which hangs (I'm mostly sure of it):
t7 opcode: CP_BLIT (2c) (2 dwords)
{ OP = BLIT_OP_SCALE }
mode: RM6_BYPASS
skip_ib2: g=0, l=0
draw[2354] register values
!+ 10f00f80 GRAS_2D_BLIT_CNTL: { ROTATE = ROTATE_0 | SOLID_COLOR | COLOR_FORMAT = FMT6_8_8_UNORM | MASK = 0xf | IFMT = R2D_UNORM8 | RASTER_MODE = TYPE_TILED }
+ 00000000 GRAS_2D_DST_TL: { X = 0 | Y = 0 }
!+ 04ff04ff GRAS_2D_DST_BR: { X = 1279 | Y = 1279 }
!+ 10f00f80 RB_2D_BLIT_CNTL: { ROTATE = ROTATE_0 | SOLID_COLOR | COLOR_FORMAT = FMT6_8_8_UNORM | MASK = 0xf | IFMT = R2D_UNORM8 | RASTER_MODE = TYPE_TILED }
+ 00000000 RB_2D_UNKNOWN_8C01: 0
!+ 0000030f RB_2D_DST_INFO: { COLOR_FORMAT = FMT6_8_8_UNORM | TILE_MODE = TILE6_3 | COLOR_SWAP = WZYX | SAMPLES = MSAA_ONE }
!+ 2cb30280 RB_2D_DST: 0x2cb30280
+ 00000000 RB_2D_DST_HI: 0
!+ 00000028 RB_2D_DST_PITCH: 2560
!+ 2cb30280 RB_2D_DST_FLAGS: 0x2cb30280
+ 00000000 RB_2D_DST_FLAGS_HI: 0
+ 00000000 RB_2D_DST_FLAGS_PITCH: 0
+ 00000000 RB_2D_SRC_SOLID_C0: 0
+ 00000000 RB_2D_SRC_SOLID_C1: 0
+ 00000000 RB_2D_SRC_SOLID_C2: 0
+ 00000000 RB_2D_SRC_SOLID_C3: 0
!+ 0000f078 SP_2D_DST_FORMAT: { COLOR_FORMAT = FMT6_8_8_UNORM | MASK = 0xf }
Command stream dump: age_of_empire_iv_full_near_hang_a660.tar.gz (commands were instrumented to find the exact place of the hang). The hang happens between CP_WAIT_REG_MEM REF =
with values of 0x4d245
and 0x4d246
.
The blit seem to be caused by the clear of a render target by an empty render pass with VK_ATTACHMENT_LOAD_OP_CLEAR
.
The image is:
"[43888]vkCreateImage": {
"return": "VK_SUCCESS",
"device": "0x0x170",
"pCreateInfo": {
"sType": "VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO",
"pNext": {
"sType": "VK_STRUCTURE_TYPE_IMAGE_FORMAT_LIST_CREATE_INFO",
"pNext": null,
"viewFormatCount": 4,
"pViewFormats": [
"VK_FORMAT_R8G8_UNORM",
"VK_FORMAT_R8G8_UINT",
"VK_FORMAT_R8G8_SINT",
"VK_FORMAT_R8G8_SNORM"
]
},
"flags": 8,
"imageType": "VK_IMAGE_TYPE_2D",
"format": "VK_FORMAT_R8G8_UNORM",
"extent": {
"width": 1280,
"height": 1280,
"depth": 1
},
"mipLevels": 1,
"arrayLayers": 1,
"samples": "VK_SAMPLE_COUNT_1_BIT",
"tiling": "VK_IMAGE_TILING_OPTIMAL",
"usage": 23,
"sharingMode": "VK_SHARING_MODE_EXCLUSIVE",
"queueFamilyIndexCount": 0,
"pQueueFamilyIndices": [],
"initialLayout": "VK_IMAGE_LAYOUT_UNDEFINED"
},
"pAllocator": null,
"[out]pImage": "0x0xd93"
},
Anyway, I tried to reproduce the issue by re-creating renderpass I found by dumping trace's commands, and wasn't able to reproduce anything...
We could just disable the tiling for non-ubwc R8G8 (or all two channel formats?) checking what blob does beforehand and call it a day. But I guess we want to know the exact extents of the issue.