summaryrefslogtreecommitdiffstats
path: root/src/intel
diff options
context:
space:
mode:
authorChad Versace <[email protected]>2017-07-10 11:11:40 -0700
committerChad Versace <[email protected]>2017-10-17 11:08:26 -0700
commita9ca8f370d6cce0569f15cbbf0986f5d2e0c1384 (patch)
tree56fa9323a77ad944e92687849280b37f0e456dcc /src/intel
parentaa716db0f64ddb60da17ed64cfcf1248b9ddf907 (diff)
anv: Better support for Android logging (v2)
In src/intel/vulkan/*, redirect all instances of printf, vk_error, anv_loge, anv_debug, anv_finishme, anv_perf_warn, anv_assert, and their many variants to the new intel_log functions. I believe I caught them all. The other subdirs of src/intel are left for a future exercise. v2: - Rebase onto Tapani's VK_EXT_debug_report changes. - Drop unused #include <cutils/log.h>. Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/intel')
-rw-r--r--src/intel/vulkan/anv_device.c11
-rw-r--r--src/intel/vulkan/anv_private.h12
-rw-r--r--src/intel/vulkan/anv_util.c21
-rw-r--r--src/intel/vulkan/genX_cmd_buffer.c4
4 files changed, 15 insertions, 33 deletions
diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index 9a74efcbad3..2c10a2fe7f4 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -50,7 +50,7 @@ compiler_perf_log(void *data, const char *fmt, ...)
va_start(args, fmt);
if (unlikely(INTEL_DEBUG & DEBUG_PERF))
- vfprintf(stderr, fmt, args);
+ intel_logd_v(fmt, args);
va_end(args);
}
@@ -294,11 +294,11 @@ anv_physical_device_init(struct anv_physical_device *device,
}
if (device->info.is_haswell) {
- fprintf(stderr, "WARNING: Haswell Vulkan support is incomplete\n");
+ intel_logw("Haswell Vulkan support is incomplete");
} else if (device->info.gen == 7 && !device->info.is_baytrail) {
- fprintf(stderr, "WARNING: Ivy Bridge Vulkan support is incomplete\n");
+ intel_logw("Ivy Bridge Vulkan support is incomplete");
} else if (device->info.gen == 7 && device->info.is_baytrail) {
- fprintf(stderr, "WARNING: Bay Trail Vulkan support is incomplete\n");
+ intel_logw("Bay Trail Vulkan support is incomplete");
} else if (device->info.gen >= 8 && device->info.gen <= 9) {
/* Broadwell, Cherryview, Skylake, Broxton, Kabylake is as fully
* supported as anything */
@@ -365,8 +365,7 @@ anv_physical_device_init(struct anv_physical_device *device,
* many platforms, but otherwise, things will just work.
*/
if (device->subslice_total < 1 || device->eu_total < 1) {
- fprintf(stderr, "WARNING: Kernel 4.1 required to properly"
- " query GPU properties.\n");
+ intel_logw("Kernel 4.1 required to properly query GPU properties");
}
} else if (device->info.gen == 7) {
device->subslice_total = 1 << (device->info.gt - 1);
diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h
index abc278b40b7..a80e8519257 100644
--- a/src/intel/vulkan/anv_private.h
+++ b/src/intel/vulkan/anv_private.h
@@ -74,6 +74,7 @@ struct gen_l3_config;
#include "isl/isl.h"
#include "common/gen_debug.h"
+#include "common/intel_log.h"
#include "wsi_common.h"
/* Allowing different clear colors requires us to perform a depth resolve at
@@ -314,11 +315,9 @@ VkResult __vk_errorf(struct anv_instance *instance, const void *object,
#define vk_errorf(instance, obj, error, format, ...)\
__vk_errorf(instance, obj, REPORT_OBJECT_TYPE(obj), error,\
__FILE__, __LINE__, format, ## __VA_ARGS__);
-#define anv_debug(format, ...) fprintf(stderr, "debug: " format, ##__VA_ARGS__)
#else
#define vk_error(error) error
#define vk_errorf(instance, obj, error, format, ...) error
-#define anv_debug(format, ...)
#endif
/**
@@ -337,10 +336,8 @@ VkResult __vk_errorf(struct anv_instance *instance, const void *object,
* defined by extensions supported by that component.
*/
#define anv_debug_ignored_stype(sType) \
- anv_debug("%s: ignored VkStructureType %u\n", __func__, (sType))
+ intel_logd("%s: ignored VkStructureType %u\n", __func__, (sType))
-void __anv_finishme(const char *file, int line, const char *format, ...)
- anv_printflike(3, 4);
void __anv_perf_warn(struct anv_instance *instance, const void *object,
VkDebugReportObjectTypeEXT type, const char *file,
int line, const char *format, ...)
@@ -364,7 +361,8 @@ void anv_debug_report(struct anv_instance *instance,
do { \
static bool reported = false; \
if (!reported) { \
- __anv_finishme(__FILE__, __LINE__, format, ##__VA_ARGS__); \
+ intel_logw("%s:%d: FINISHME: " format, __FILE__, __LINE__, \
+ ##__VA_ARGS__); \
reported = true; \
} \
} while (0)
@@ -386,7 +384,7 @@ void anv_debug_report(struct anv_instance *instance,
#ifdef DEBUG
#define anv_assert(x) ({ \
if (unlikely(!(x))) \
- fprintf(stderr, "%s:%d ASSERT: %s\n", __FILE__, __LINE__, #x); \
+ intel_loge("%s:%d ASSERT: %s", __FILE__, __LINE__, #x); \
})
#else
#define anv_assert(x)
diff --git a/src/intel/vulkan/anv_util.c b/src/intel/vulkan/anv_util.c
index ec61f7355ef..59f893492b7 100644
--- a/src/intel/vulkan/anv_util.c
+++ b/src/intel/vulkan/anv_util.c
@@ -47,22 +47,7 @@ anv_loge(const char *format, ...)
void
anv_loge_v(const char *format, va_list va)
{
- fprintf(stderr, "vk: error: ");
- vfprintf(stderr, format, va);
- fprintf(stderr, "\n");
-}
-
-void anv_printflike(3, 4)
-__anv_finishme(const char *file, int line, const char *format, ...)
-{
- va_list ap;
- char buffer[256];
-
- va_start(ap, format);
- vsnprintf(buffer, sizeof(buffer), format, ap);
- va_end(ap);
-
- fprintf(stderr, "%s:%d: FINISHME: %s\n", file, line, buffer);
+ intel_loge_v(format, va);
}
void anv_printflike(6, 7)
@@ -89,7 +74,7 @@ __anv_perf_warn(struct anv_instance *instance, const void *object,
"anv",
report);
- fprintf(stderr, "%s:%d: PERF: %s\n", file, line, buffer);
+ intel_logw("%s:%d: PERF: %s", file, line, buffer);
}
VkResult
@@ -123,7 +108,7 @@ __vk_errorf(struct anv_instance *instance, const void *object,
"anv",
report);
- fprintf(stderr, "%s\n", report);
+ intel_loge("%s", report);
if (error == VK_ERROR_DEVICE_LOST &&
env_var_as_boolean("ANV_ABORT_ON_DEVICE_LOSS", false))
diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c
index 43437c8eb0f..20a885c4381 100644
--- a/src/intel/vulkan/genX_cmd_buffer.c
+++ b/src/intel/vulkan/genX_cmd_buffer.c
@@ -1174,7 +1174,7 @@ genX(cmd_buffer_config_l3)(struct anv_cmd_buffer *cmd_buffer,
return;
if (unlikely(INTEL_DEBUG & DEBUG_L3)) {
- fprintf(stderr, "L3 config transition: ");
+ intel_logd("L3 config transition: ");
gen_dump_l3_config(cfg, stderr);
}
@@ -2329,7 +2329,7 @@ load_indirect_parameters(struct anv_cmd_buffer *cmd_buffer,
emit_mul_gpr0(batch, view_count);
emit_lrr(batch, GEN7_3DPRIM_INSTANCE_COUNT, CS_GPR(0));
#else
- anv_finishme("Multiview + indirect draw requires MI_MATH\n"
+ anv_finishme("Multiview + indirect draw requires MI_MATH; "
"MI_MATH is not supported on Ivy Bridge");
emit_lrm(batch, GEN7_3DPRIM_INSTANCE_COUNT, bo, bo_offset + 4);
#endif