mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-04 11:58:10 +02:00
freedreno/decode: Move enum lookup out of snapshot
Some of these enums change between gens, which will be easier to deal with if we move them out of the snapshot serialization helpers. Signed-off-by: Rob Clark <rob.clark@oss.qualcomm.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37727>
This commit is contained in:
parent
d7db333b0e
commit
6959bd9f54
2 changed files with 53 additions and 12 deletions
|
|
@ -221,6 +221,42 @@ parseline_nowhitespace(const char *line, const char *fmt, ...)
|
|||
break; \
|
||||
} else
|
||||
|
||||
/*
|
||||
* Helpers to decode pipe-id, etc
|
||||
*/
|
||||
|
||||
static uint32_t
|
||||
statetype_id(const char *name)
|
||||
{
|
||||
if (!is_a7xx())
|
||||
return 0;
|
||||
return enumval("a7xx_statetype_id", name);
|
||||
}
|
||||
|
||||
static uint32_t
|
||||
pipe_id(const char *name)
|
||||
{
|
||||
if (!is_a7xx())
|
||||
return 0;
|
||||
return enumval("a7xx_pipe", name);
|
||||
}
|
||||
|
||||
static uint32_t
|
||||
debugbus_id(const char *name)
|
||||
{
|
||||
if (!is_a7xx())
|
||||
return 0;
|
||||
return enumval("a7xx_debugbus_id", name);
|
||||
}
|
||||
|
||||
static uint32_t
|
||||
cluster_id(const char *name)
|
||||
{
|
||||
if (!is_a7xx())
|
||||
return 0;
|
||||
return enumval("a7xx_cluster", name);
|
||||
}
|
||||
|
||||
/*
|
||||
* Decode ringbuffer section:
|
||||
*/
|
||||
|
|
@ -652,7 +688,8 @@ decode_clusters(void)
|
|||
} else if (startswith_nowhitespace(line, "- location:")) {
|
||||
parseline_nowhitespace(line, "- location: %u", &location);
|
||||
} else if (startswith_nowhitespace(line, "- pipe:")) {
|
||||
snapshot_cluster_regs(pipe_name, cluster_name, context, location);
|
||||
snapshot_cluster_regs(pipe_id(pipe_name), cluster_id(cluster_name),
|
||||
context, location);
|
||||
|
||||
free(pipe_name);
|
||||
parseline_nowhitespace(line, "- pipe: %ms", &pipe_name);
|
||||
|
|
@ -676,7 +713,10 @@ decode_clusters(void)
|
|||
printf("%s", line);
|
||||
}
|
||||
|
||||
snapshot_cluster_regs(pipe_name, cluster_name, context, location);
|
||||
if (reg_buf.count) {
|
||||
snapshot_cluster_regs(pipe_id(pipe_name), cluster_id(cluster_name),
|
||||
context, location);
|
||||
}
|
||||
|
||||
free(cluster_name);
|
||||
free(pipe_name);
|
||||
|
|
@ -937,7 +977,8 @@ decode_shader_blocks(void)
|
|||
if (dump)
|
||||
dump_hex_ascii(buf, 4 * sizedwords, 1);
|
||||
|
||||
snapshot_shader_block(type, pipe, sp, usptp, location, buf, sizedwords);
|
||||
snapshot_shader_block(statetype_id(type), pipe_id(pipe),
|
||||
sp, usptp, location, buf, sizedwords);
|
||||
|
||||
free(buf);
|
||||
|
||||
|
|
@ -977,7 +1018,7 @@ decode_debugbus(void)
|
|||
|
||||
if (dump)
|
||||
dump_hex_ascii(buf, 4 * sizedwords, 1);
|
||||
snapshot_debugbus(block, buf, sizedwords);
|
||||
snapshot_debugbus(debugbus_id(block), buf, sizedwords);
|
||||
|
||||
free(buf);
|
||||
|
||||
|
|
|
|||
|
|
@ -462,7 +462,7 @@ snapshot_indexed_regs(const char *name, uint32_t *regs, uint32_t sizedwords)
|
|||
}
|
||||
|
||||
static inline void
|
||||
snapshot_cluster_regs(const char *pipe_name, const char *cluster_name, int context,
|
||||
snapshot_cluster_regs(uint32_t pipe_id, uint32_t cluster_id, int context,
|
||||
uint32_t location)
|
||||
{
|
||||
uint32_t count = reg_buf.count;
|
||||
|
|
@ -478,8 +478,8 @@ snapshot_cluster_regs(const char *pipe_name, const char *cluster_name, int conte
|
|||
/* TODO, 8xx should use snapshot_mvc_regs_v3: */
|
||||
struct snapshot_mvc_regs_v2 cluster_regs = {
|
||||
.ctxt_id = context,
|
||||
.cluster_id = enumval("a7xx_cluster", cluster_name),
|
||||
.pipe_id = enumval("a7xx_pipe", pipe_name),
|
||||
.cluster_id = cluster_id,
|
||||
.pipe_id = pipe_id,
|
||||
.location_id = location,
|
||||
};
|
||||
|
||||
|
|
@ -492,13 +492,13 @@ snapshot_cluster_regs(const char *pipe_name, const char *cluster_name, int conte
|
|||
}
|
||||
|
||||
static inline void
|
||||
snapshot_debugbus(const char *block, uint32_t *buf, uint32_t sizedwords)
|
||||
snapshot_debugbus(uint32_t block, uint32_t *buf, uint32_t sizedwords)
|
||||
{
|
||||
if (!snapshot)
|
||||
return;
|
||||
|
||||
struct snapshot_debugbus debugbus = {
|
||||
.id = enumval("a7xx_debugbus_id", block),
|
||||
.id = block,
|
||||
.count = sizedwords,
|
||||
};
|
||||
|
||||
|
|
@ -511,7 +511,7 @@ snapshot_debugbus(const char *block, uint32_t *buf, uint32_t sizedwords)
|
|||
}
|
||||
|
||||
static inline void
|
||||
snapshot_shader_block(const char *type, const char *pipe, int sp, int usptp,
|
||||
snapshot_shader_block(uint32_t type, uint32_t pipe, int sp, int usptp,
|
||||
int location, uint32_t *buf, uint32_t sizedwords)
|
||||
{
|
||||
if (!snapshot)
|
||||
|
|
@ -519,10 +519,10 @@ snapshot_shader_block(const char *type, const char *pipe, int sp, int usptp,
|
|||
|
||||
/* TODO, 8xx should use snapshot_shader_v3: */
|
||||
struct snapshot_shader_v2 shader_block = {
|
||||
.type = enumval("a7xx_statetype_id", type),
|
||||
.type = type,
|
||||
.index = sp,
|
||||
.usptp = usptp,
|
||||
.pipe_id = enumval("a7xx_pipe", pipe),
|
||||
.pipe_id = pipe,
|
||||
.location = location,
|
||||
.size = sizedwords,
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue