diff --git a/src/gallium/drivers/iris/iris_batch.c b/src/gallium/drivers/iris/iris_batch.c index c23e281bdce..fee7b0e5147 100644 --- a/src/gallium/drivers/iris/iris_batch.c +++ b/src/gallium/drivers/iris/iris_batch.c @@ -398,6 +398,11 @@ iris_batch_reset(struct iris_batch *batch) iris_cache_sets_clear(batch); + /* Always add the workaround BO, it contains a driver identifier at the + * beginning quite helpful to debug error states. + */ + iris_use_pinned_bo(batch, screen->workaround_bo, false); + iris_batch_maybe_noop(batch); } diff --git a/src/gallium/drivers/iris/iris_screen.c b/src/gallium/drivers/iris/iris_screen.c index 8f28fc3ab9e..6695932bd0b 100644 --- a/src/gallium/drivers/iris/iris_screen.c +++ b/src/gallium/drivers/iris/iris_screen.c @@ -663,6 +663,27 @@ iris_detect_kernel_features(struct iris_screen *screen) screen->kernel_features |= KERNEL_HAS_WAIT_FOR_SUBMIT; } +static bool +iris_init_identifier_bo(struct iris_screen *screen) +{ + void *bo_map; + + bo_map = iris_bo_map(NULL, screen->workaround_bo, MAP_READ | MAP_WRITE); + if (!bo_map) + return false; + + screen->workaround_bo->kflags |= EXEC_OBJECT_CAPTURE; + screen->workaround_address = (struct iris_address) { + .bo = screen->workaround_bo, + .offset = ALIGN( + intel_debug_write_identifiers(bo_map, 4096, "Iris") + 8, 8), + }; + + iris_bo_unmap(screen->workaround_bo); + + return true; +} + struct pipe_screen * iris_screen_create(int fd, const struct pipe_screen_config *config) { @@ -718,10 +739,8 @@ iris_screen_create(int fd, const struct pipe_screen_config *config) if (!screen->workaround_bo) return NULL; - screen->workaround_address = (struct iris_address) { - .bo = screen->workaround_bo, - .offset = 0, - }; + if (!iris_init_identifier_bo(screen)) + return NULL; brw_process_intel_debug_variable(); diff --git a/src/gallium/drivers/iris/iris_screen.h b/src/gallium/drivers/iris/iris_screen.h index 1ce0550a6bf..87d8a5580d7 100644 --- a/src/gallium/drivers/iris/iris_screen.h +++ b/src/gallium/drivers/iris/iris_screen.h @@ -192,8 +192,12 @@ struct iris_screen { const struct gen_l3_config *l3_config_cs; /** - * A buffer containing nothing useful, for hardware workarounds that - * require scratch writes or reads from some unimportant memory. + * A buffer containing a marker + description of the driver. This buffer is + * added to all execbufs syscalls so that we can identify the driver that + * generated a hang by looking at the content of the buffer in the error + * state. It is also used for hardware workarounds that require scratch + * writes or reads from some unimportant memory. To avoid overriding the + * debug data, use the workaround_address field for workarounds. */ struct iris_bo *workaround_bo; struct iris_address workaround_address;