We were invalidating si_screen:tm by calling
r600_destroy_common_screen() which frees the si_screen object. This
caused the driver to crash in LLVMDisposeTargetMachine() since we
were passing it an invalid pointer.
https://bugs.freedesktop.org/show_bug.cgi?id=88170
if (!sscreen->b.ws->unref(sscreen->b.ws))
return;
- r600_destroy_common_screen(&sscreen->b);
-
#if HAVE_LLVM >= 0x0306
+ // r600_destroy_common_screen() frees sscreen, so we need to make
+ // sure to dispose the TargetMachine before we call it.
LLVMDisposeTargetMachine(sscreen->tm);
#endif
+
+ r600_destroy_common_screen(&sscreen->b);
}
#define SI_TILE_MODE_COLOR_2D_8BPP 14