intel: use per-instance logging
authorCourtney Goeltzenleuchter <courtney@LunarG.com>
Mon, 13 Apr 2015 20:59:19 +0000 (14:59 -0600)
committerChia-I Wu <olv@lunarg.com>
Thu, 16 Apr 2015 09:33:25 +0000 (17:33 +0800)
icd/intel/compiler/pipeline/pipeline_compiler_interface.cpp
icd/intel/dev.c
icd/intel/gpu.c
icd/intel/instance.c
icd/intel/intel.h

index ed246b1..ed718cb 100644 (file)
@@ -478,7 +478,7 @@ XGL_RESULT intel_pipeline_shader_compile(struct intel_pipeline_shader *pipe_shad
             if (bt.ubo_count != sh_prog->_LinkedShaders[MESA_SHADER_VERTEX]->NumUniformBlocks) {
                 // If there is no UBO data to pull from, the shader is using a default uniform, which
                 // will not work in XGL.  We need a binding slot to pull from.
-                icd_log(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, XGL_NULL_HANDLE, 0, 0,
+                intel_log(gpu, XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, XGL_NULL_HANDLE, 0, 0,
                         "compile error: VS reads from global, non-block uniform");
 
                 assert(0);
@@ -612,7 +612,7 @@ XGL_RESULT intel_pipeline_shader_compile(struct intel_pipeline_shader *pipe_shad
             if (bt.ubo_count != sh_prog->_LinkedShaders[MESA_SHADER_FRAGMENT]->NumUniformBlocks) {
                 // If there is no UBO data to pull from, the shader is using a default uniform, which
                 // will not work in XGL.  We need a binding slot to pull from.
-                icd_log(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, XGL_NULL_HANDLE, 0, 0,
+                intel_log(gpu, XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, XGL_NULL_HANDLE, 0, 0,
                         "compile error: FS reads from global, non-block uniform");
 
                 assert(0);
index 732ed38..888b9e9 100644 (file)
@@ -316,7 +316,7 @@ void intel_dev_log(struct intel_dev *dev,
         return;
 
     va_start(ap, format);
-    icd_logv(msg_type, validation_level, (XGL_BASE_OBJECT) src_object,
+    intel_logv(dev, msg_type, validation_level, (XGL_BASE_OBJECT) src_object,
             location, msg_code, format, ap);
     va_end(ap);
 }
index 645de1c..f2fcdca 100644 (file)
@@ -63,7 +63,7 @@ static int gpu_open_render_node(struct intel_gpu *gpu)
     if (gpu->render_fd_internal < 0 && gpu->render_node) {
         gpu->render_fd_internal = open(gpu->render_node, O_RDWR);
         if (gpu->render_fd_internal < 0) {
-            icd_log(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, NULL, 0,
+            intel_log(gpu, XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, NULL, 0,
                     0, "failed to open %s", gpu->render_node);
         }
     }
@@ -154,8 +154,8 @@ XGL_RESULT intel_gpu_create(const struct intel_instance *instance, int devid,
     struct intel_gpu *gpu;
 
     if (gen < 0) {
-        icd_log(XGL_DBG_MSG_WARNING, XGL_VALIDATION_LEVEL_0, XGL_NULL_HANDLE,
-                0, 0, "unsupported device id 0x%04x", devid);
+        intel_log(instance, XGL_DBG_MSG_WARNING, XGL_VALIDATION_LEVEL_0,
+                XGL_NULL_HANDLE, 0, 0, "unsupported device id 0x%04x", devid);
         return XGL_ERROR_INITIALIZATION_FAILED;
     }
 
@@ -325,7 +325,7 @@ int intel_gpu_get_max_threads(const struct intel_gpu *gpu,
         break;
     }
 
-    icd_log(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, XGL_NULL_HANDLE,
+    intel_log(gpu, XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, XGL_NULL_HANDLE,
             0, 0, "unknown Gen or shader stage");
 
     switch (stage) {
@@ -355,8 +355,8 @@ XGL_RESULT intel_gpu_init_winsys(struct intel_gpu *gpu)
 
     gpu->winsys = intel_winsys_create_for_fd(gpu->handle.icd, fd);
     if (!gpu->winsys) {
-        icd_log(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, XGL_NULL_HANDLE,
-                0, 0, "failed to create GPU winsys");
+        intel_log(gpu, XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0,
+                XGL_NULL_HANDLE, 0, 0, "failed to create GPU winsys");
         gpu_close_render_node(gpu);
         return XGL_ERROR_UNKNOWN;
     }
index 294bd9a..e451171 100644 (file)
@@ -216,26 +216,31 @@ ICD_EXPORT XGL_RESULT XGLAPI xglEnumerateGpus(
 }
 
 ICD_EXPORT XGL_RESULT XGLAPI xglDbgRegisterMsgCallback(
-    XGL_INSTANCE                                instance,
+    XGL_INSTANCE                                instance_,
     XGL_DBG_MSG_CALLBACK_FUNCTION               pfnMsgCallback,
     void*                                       pUserData)
 {
-    return icd_logger_add_callback(pfnMsgCallback, pUserData);
+    struct intel_instance *instance = intel_instance(instance_);
+
+    return icd_instance_add_logger(instance->icd, pfnMsgCallback, pUserData);
 }
 
 ICD_EXPORT XGL_RESULT XGLAPI xglDbgUnregisterMsgCallback(
-    XGL_INSTANCE                                instance,
+    XGL_INSTANCE                                instance_,
     XGL_DBG_MSG_CALLBACK_FUNCTION               pfnMsgCallback)
 {
-    return icd_logger_remove_callback(pfnMsgCallback);
+    struct intel_instance *instance = intel_instance(instance_);
+
+    return icd_instance_remove_logger(instance->icd, pfnMsgCallback);
 }
 
 ICD_EXPORT XGL_RESULT XGLAPI xglDbgSetGlobalOption(
-    XGL_INSTANCE                                instance,
+    XGL_INSTANCE                                instance_,
     XGL_DBG_GLOBAL_OPTION                       dbgOption,
     size_t                                      dataSize,
     const void*                                 pData)
 {
+    struct intel_instance *instance = intel_instance(instance_);
     XGL_RESULT res = XGL_SUCCESS;
 
     if (dataSize == 0)
@@ -245,7 +250,8 @@ ICD_EXPORT XGL_RESULT XGLAPI xglDbgSetGlobalOption(
     case XGL_DBG_OPTION_DEBUG_ECHO_ENABLE:
     case XGL_DBG_OPTION_BREAK_ON_ERROR:
     case XGL_DBG_OPTION_BREAK_ON_WARNING:
-        res = icd_logger_set_bool(dbgOption, *((const bool *) pData));
+        res = icd_instance_set_bool(instance->icd, dbgOption,
+                *((const bool *) pData));
         break;
     default:
         res = XGL_ERROR_INVALID_VALUE;
index 869cece..5d0bb72 100644 (file)
@@ -45,7 +45,6 @@
 #include "icd-spv.h"
 #include "icd-format.h"
 #include "icd-instance.h"
-#include "icd-log.h"
 #include "icd-utils.h"
 
 #define INTEL_API_VERSION XGL_API_VERSION