gallium/radeon: change the BO priority definitions to bits

This is for the next microoptimization.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13478>
This commit is contained in:
Marek Olšák
2021-10-21 22:57:43 -04:00
committed by Marge Bot
parent a0f05a5b20
commit f815009036
9 changed files with 83 additions and 87 deletions

View File

@@ -498,42 +498,39 @@ void si_log_hw_flush(struct si_context *sctx)
}
}
static const char *priority_to_string(enum radeon_bo_priority priority)
static const char *priority_to_string(unsigned priority)
{
#define ITEM(x) [RADEON_PRIO_##x] = #x
static const char *table[64] = {
ITEM(FENCE),
ITEM(TRACE),
ITEM(SO_FILLED_SIZE),
ITEM(QUERY),
ITEM(IB1),
ITEM(IB2),
ITEM(DRAW_INDIRECT),
ITEM(INDEX_BUFFER),
ITEM(CP_DMA),
ITEM(CONST_BUFFER),
ITEM(DESCRIPTORS),
ITEM(BORDER_COLORS),
ITEM(SAMPLER_BUFFER),
ITEM(VERTEX_BUFFER),
ITEM(SHADER_RW_BUFFER),
ITEM(COMPUTE_GLOBAL),
ITEM(SAMPLER_TEXTURE),
ITEM(SHADER_RW_IMAGE),
ITEM(SAMPLER_TEXTURE_MSAA),
ITEM(COLOR_BUFFER),
ITEM(DEPTH_BUFFER),
ITEM(COLOR_BUFFER_MSAA),
ITEM(DEPTH_BUFFER_MSAA),
ITEM(SEPARATE_META),
ITEM(SHADER_BINARY),
ITEM(SHADER_RINGS),
ITEM(SCRATCH_BUFFER),
};
#define ITEM(x) if (priority == RADEON_PRIO_##x) return #x
ITEM(FENCE);
ITEM(TRACE);
ITEM(SO_FILLED_SIZE);
ITEM(QUERY);
ITEM(IB1);
ITEM(IB2);
ITEM(DRAW_INDIRECT);
ITEM(INDEX_BUFFER);
ITEM(CP_DMA);
ITEM(CONST_BUFFER);
ITEM(DESCRIPTORS);
ITEM(BORDER_COLORS);
ITEM(SAMPLER_BUFFER);
ITEM(VERTEX_BUFFER);
ITEM(SHADER_RW_BUFFER);
ITEM(COMPUTE_GLOBAL);
ITEM(SAMPLER_TEXTURE);
ITEM(SHADER_RW_IMAGE);
ITEM(SAMPLER_TEXTURE_MSAA);
ITEM(COLOR_BUFFER);
ITEM(DEPTH_BUFFER);
ITEM(COLOR_BUFFER_MSAA);
ITEM(DEPTH_BUFFER_MSAA);
ITEM(SEPARATE_META);
ITEM(SHADER_BINARY);
ITEM(SHADER_RINGS);
ITEM(SCRATCH_BUFFER);
#undef ITEM
assert(priority < ARRAY_SIZE(table));
return table[priority];
return "";
}
static int bo_list_compare_va(const struct radeon_bo_list_item *a,
@@ -582,7 +579,7 @@ static void si_dump_bo_list(struct si_context *sctx, const struct radeon_saved_c
if (!(saved->bo_list[i].priority_usage & (1u << j)))
continue;
fprintf(f, "%s%s", !hit ? "" : ", ", priority_to_string(j));
fprintf(f, "%s%s", !hit ? "" : ", ", priority_to_string(1u << j));
hit = true;
}
fprintf(f, "\n");