asahi: Fix disk cache disable with AGX_MESA_DEBUG

We go to initialize the disk cache before we've compiled any shaders so
agx_compiler_debug is 0 at this point. Don't try to read it, instead go through
sa safe getter that will do the right thing.

Fixes: 5e9538c12e ("agx: isolate compiler debug flags")
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22891>
This commit is contained in:
Alyssa Rosenzweig
2023-04-23 22:10:34 -04:00
parent fdec9f9c6b
commit e9b471d1b3
4 changed files with 11 additions and 3 deletions

View File

@@ -39,6 +39,12 @@ DEBUG_GET_ONCE_FLAGS_OPTION(agx_compiler_debug, "AGX_MESA_DEBUG",
int agx_compiler_debug = 0;
uint64_t
agx_get_compiler_debug(void)
{
return debug_get_option_agx_compiler_debug();
}
#define DBG(fmt, ...) \
do { \
if (agx_compiler_debug & AGX_DBG_MSGS) \
@@ -2360,7 +2366,7 @@ agx_compile_shader_nir(nir_shader *nir, struct agx_shader_key *key,
struct util_dynarray *binary,
struct agx_shader_info *out)
{
agx_compiler_debug = debug_get_option_agx_compiler_debug();
agx_compiler_debug = agx_get_compiler_debug();
memset(out, 0, sizeof *out);

View File

@@ -809,6 +809,8 @@ struct agx_occupancy {
struct agx_occupancy agx_occupancy_for_register_count(unsigned halfregs);
extern int agx_compiler_debug;
#ifdef __cplusplus
} /* extern C */
#endif

View File

@@ -27,7 +27,7 @@ enum agx_compiler_dbg {
};
/* clang-format on */
extern int agx_compiler_debug;
uint64_t agx_get_compiler_debug(void);
#ifdef __cplusplus
} /* extern C */

View File

@@ -134,7 +134,7 @@ void
agx_disk_cache_init(struct agx_screen *screen)
{
#ifdef ENABLE_SHADER_CACHE
if (agx_compiler_debug || screen->dev.debug)
if (agx_get_compiler_debug() || screen->dev.debug)
return;
const char *renderer = screen->pscreen.get_name(&screen->pscreen);