loader: Make sure msg callbacks get registered if added before initAndEnumGpu
Fix bug where xglDbgRegisterMsgCallback wasn't working if called prior to
xglInitAndEnumerateGpus.
diff --git a/loader/loader.c b/loader/loader.c
index 7229cf0..87730be 100644
--- a/loader/loader.c
+++ b/loader/loader.c
@@ -288,13 +288,6 @@
if (!icd)
return NULL;
- if (loader_icd_set_global_options(icd) != XGL_SUCCESS ||
- loader_icd_register_msg_callbacks(icd) != XGL_SUCCESS) {
- loader_log(XGL_DBG_MSG_WARNING, 0,
- "%s ignored: failed to migrate settings", filename);
- loader_icd_destroy(icd);
- }
-
/* prepend to the list */
icd->next = loader.icds;
loader.icds = icd;
@@ -364,8 +357,6 @@
}
}
- /* we have nothing to log anymore */
- loader_msg_callback_clear();
loader.scanned = true;
}
@@ -1175,6 +1166,12 @@
*disp = icd->loader_dispatch + i;
}
+ if (loader_icd_set_global_options(icd) != XGL_SUCCESS ||
+ loader_icd_register_msg_callbacks(icd) != XGL_SUCCESS) {
+ loader_log(XGL_DBG_MSG_WARNING, 0,
+ "ICD ignored: failed to migrate settings");
+ loader_icd_destroy(icd);
+ }
count += n;
if (count >= maxGpus) {
@@ -1185,6 +1182,9 @@
icd = icd->next;
}
+ /* we have nothing to log anymore */
+ loader_msg_callback_clear();
+
/* get layer libraries */
if (!loader.layer_scanned)
layer_lib_scan(NULL);