diff --git a/src/gallium/drivers/panfrost/pan_screen.c b/src/gallium/drivers/panfrost/pan_screen.c index 7422ca75c93..d8bf73de53d 100644 --- a/src/gallium/drivers/panfrost/pan_screen.c +++ b/src/gallium/drivers/panfrost/pan_screen.c @@ -776,9 +776,10 @@ panfrost_create_screen(int fd, struct renderonly *ro) return NULL; struct panfrost_device *dev = pan_device(&screen->base); - panfrost_open_device(screen, fd, dev); + /* Debug must be set first for pandecode to work correctly */ dev->debug = debug_get_flags_option("PAN_MESA_DEBUG", panfrost_debug_options, 0); + panfrost_open_device(screen, fd, dev); if (dev->debug & PAN_DBG_NO_AFBC) dev->quirks |= MIDGARD_NO_AFBC; @@ -812,9 +813,6 @@ panfrost_create_screen(int fd, struct renderonly *ro) return NULL; } - if (dev->debug & (PAN_DBG_TRACE | PAN_DBG_SYNC)) - pandecode_initialize(!(dev->debug & PAN_DBG_TRACE)); - screen->base.destroy = panfrost_destroy_screen; screen->base.get_name = panfrost_get_name; diff --git a/src/panfrost/lib/pan_props.c b/src/panfrost/lib/pan_props.c index d125aa3e4bf..be13c7d907b 100644 --- a/src/panfrost/lib/pan_props.c +++ b/src/panfrost/lib/pan_props.c @@ -36,6 +36,8 @@ #include "panfrost-quirks.h" #include "pan_bo.h" #include "pan_texture.h" +#include "wrap.h" +#include "pan_util.h" /* Abstraction over the raw drm_panfrost_get_param ioctl for fetching * information about devices */ @@ -247,6 +249,10 @@ panfrost_open_device(void *memctx, int fd, struct panfrost_device *dev) for (unsigned i = 0; i < ARRAY_SIZE(dev->bo_cache.buckets); ++i) list_inithead(&dev->bo_cache.buckets[i]); + /* Initialize pandecode before we start allocating */ + if (dev->debug & (PAN_DBG_TRACE | PAN_DBG_SYNC)) + pandecode_initialize(!(dev->debug & PAN_DBG_TRACE)); + /* Tiler heap is internally required by the tiler, which can only be * active for a single job chain at once, so a single heap can be * shared across batches/contextes */