From 0392e4bf5cf171c1b872ac2bb5ee84149c24b939 Mon Sep 17 00:00:00 2001 From: Friedrich Vock Date: Thu, 4 Jan 2024 14:41:18 +0100 Subject: [PATCH] radv: Fix shader replay allocation condition Cc: mesa-stable Part-of: (cherry picked from commit 43bdfebbff2c5557355df88816e737ef19618ed2) --- .pick_status.json | 2 +- src/amd/vulkan/radv_shader.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 707e7f966a2..c5b9dba8260 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -924,7 +924,7 @@ "description": "radv: Fix shader replay allocation condition", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c index a0ce999f8d5..7303685e5a6 100644 --- a/src/amd/vulkan/radv_shader.c +++ b/src/amd/vulkan/radv_shader.c @@ -1344,14 +1344,14 @@ radv_replay_shader_arena_block(struct radv_device *device, const struct radv_ser if (!hole->freelist.prev) continue; - if (hole->offset + hole->size < src->offset) - continue; - uint32_t hole_begin = hole->offset; uint32_t hole_end = hole->offset + hole->size; + if (hole_end < block_end) + continue; + /* If another allocated block overlaps the current replay block, allocation is impossible */ - if (block_begin > hole_begin || (hole_end < block_end && hole_end >= block_begin)) + if (hole_begin > block_begin) return NULL; union radv_shader_arena_block *block = insert_block(device, hole, block_begin - hole_begin, src->size, NULL);