nouveau: disable fences when running under drm-shim.

Otherwise, you get a hang at the end of shader-db.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16150>
This commit is contained in:
Emma Anholt 2021-12-08 15:21:42 -08:00 committed by Marge Bot
parent c6aa639ba9
commit e4ca97111f
4 changed files with 12 additions and 0 deletions

View File

@ -131,6 +131,12 @@ nouveau_fence_update(struct nouveau_screen *screen, bool flushed)
struct nouveau_fence *next = NULL;
u32 sequence = screen->fence.update(&screen->base);
/* If running under drm-shim, let all fences be signalled so things run to
* completion (avoids a hang at the end of shader-db).
*/
if (unlikely(screen->disable_fences))
sequence = screen->fence.sequence;
if (screen->fence.sequence_ack == sequence)
return;
screen->fence.sequence_ack = sequence;

View File

@ -208,6 +208,8 @@ nouveau_screen_init(struct nouveau_screen *screen, struct nouveau_device *dev)
if (screen->force_enable_cl)
glsl_type_singleton_init_or_ref();
screen->disable_fences = debug_get_bool_option("NOUVEAU_DISABLE_FENCES", false);
/* These must be set before any failure is possible, as the cleanup
* paths assume they're responsible for deleting them.
*/

View File

@ -74,6 +74,7 @@ struct nouveau_screen {
bool prefer_nir;
bool force_enable_cl;
bool has_svm;
bool disable_fences;
void *svm_cutout;
size_t svm_cutout_size;

View File

@ -218,6 +218,9 @@ drm_shim_driver_init(void)
nouveau_driver_get_device_info();
/* Ask userspace to consider all fences completed. */
setenv("NOUVEAU_DISABLE_FENCES", "true", true);
/* nothing looks at the pci id, so fix it to a GTX 780 */
static const char uevent_content[] =
"DRIVER=nouveau\n"