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 <jason@jlekstrand.net>
This commit is contained in:
@@ -50,7 +50,7 @@ compiler_perf_log(void *data, const char *fmt, ...)
|
|||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
|
|
||||||
if (unlikely(INTEL_DEBUG & DEBUG_PERF))
|
if (unlikely(INTEL_DEBUG & DEBUG_PERF))
|
||||||
vfprintf(stderr, fmt, args);
|
intel_logd_v(fmt, args);
|
||||||
|
|
||||||
va_end(args);
|
va_end(args);
|
||||||
}
|
}
|
||||||
@@ -294,11 +294,11 @@ anv_physical_device_init(struct anv_physical_device *device,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (device->info.is_haswell) {
|
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) {
|
} 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) {
|
} 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) {
|
} else if (device->info.gen >= 8 && device->info.gen <= 9) {
|
||||||
/* Broadwell, Cherryview, Skylake, Broxton, Kabylake is as fully
|
/* Broadwell, Cherryview, Skylake, Broxton, Kabylake is as fully
|
||||||
* supported as anything */
|
* supported as anything */
|
||||||
@@ -365,8 +365,7 @@ anv_physical_device_init(struct anv_physical_device *device,
|
|||||||
* many platforms, but otherwise, things will just work.
|
* many platforms, but otherwise, things will just work.
|
||||||
*/
|
*/
|
||||||
if (device->subslice_total < 1 || device->eu_total < 1) {
|
if (device->subslice_total < 1 || device->eu_total < 1) {
|
||||||
fprintf(stderr, "WARNING: Kernel 4.1 required to properly"
|
intel_logw("Kernel 4.1 required to properly query GPU properties");
|
||||||
" query GPU properties.\n");
|
|
||||||
}
|
}
|
||||||
} else if (device->info.gen == 7) {
|
} else if (device->info.gen == 7) {
|
||||||
device->subslice_total = 1 << (device->info.gt - 1);
|
device->subslice_total = 1 << (device->info.gt - 1);
|
||||||
|
@@ -74,6 +74,7 @@ struct gen_l3_config;
|
|||||||
#include "isl/isl.h"
|
#include "isl/isl.h"
|
||||||
|
|
||||||
#include "common/gen_debug.h"
|
#include "common/gen_debug.h"
|
||||||
|
#include "common/intel_log.h"
|
||||||
#include "wsi_common.h"
|
#include "wsi_common.h"
|
||||||
|
|
||||||
/* Allowing different clear colors requires us to perform a depth resolve at
|
/* 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, ...)\
|
#define vk_errorf(instance, obj, error, format, ...)\
|
||||||
__vk_errorf(instance, obj, REPORT_OBJECT_TYPE(obj), error,\
|
__vk_errorf(instance, obj, REPORT_OBJECT_TYPE(obj), error,\
|
||||||
__FILE__, __LINE__, format, ## __VA_ARGS__);
|
__FILE__, __LINE__, format, ## __VA_ARGS__);
|
||||||
#define anv_debug(format, ...) fprintf(stderr, "debug: " format, ##__VA_ARGS__)
|
|
||||||
#else
|
#else
|
||||||
#define vk_error(error) error
|
#define vk_error(error) error
|
||||||
#define vk_errorf(instance, obj, error, format, ...) error
|
#define vk_errorf(instance, obj, error, format, ...) error
|
||||||
#define anv_debug(format, ...)
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -337,10 +336,8 @@ VkResult __vk_errorf(struct anv_instance *instance, const void *object,
|
|||||||
* defined by extensions supported by that component.
|
* defined by extensions supported by that component.
|
||||||
*/
|
*/
|
||||||
#define anv_debug_ignored_stype(sType) \
|
#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,
|
void __anv_perf_warn(struct anv_instance *instance, const void *object,
|
||||||
VkDebugReportObjectTypeEXT type, const char *file,
|
VkDebugReportObjectTypeEXT type, const char *file,
|
||||||
int line, const char *format, ...)
|
int line, const char *format, ...)
|
||||||
@@ -364,7 +361,8 @@ void anv_debug_report(struct anv_instance *instance,
|
|||||||
do { \
|
do { \
|
||||||
static bool reported = false; \
|
static bool reported = false; \
|
||||||
if (!reported) { \
|
if (!reported) { \
|
||||||
__anv_finishme(__FILE__, __LINE__, format, ##__VA_ARGS__); \
|
intel_logw("%s:%d: FINISHME: " format, __FILE__, __LINE__, \
|
||||||
|
##__VA_ARGS__); \
|
||||||
reported = true; \
|
reported = true; \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
@@ -386,7 +384,7 @@ void anv_debug_report(struct anv_instance *instance,
|
|||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
#define anv_assert(x) ({ \
|
#define anv_assert(x) ({ \
|
||||||
if (unlikely(!(x))) \
|
if (unlikely(!(x))) \
|
||||||
fprintf(stderr, "%s:%d ASSERT: %s\n", __FILE__, __LINE__, #x); \
|
intel_loge("%s:%d ASSERT: %s", __FILE__, __LINE__, #x); \
|
||||||
})
|
})
|
||||||
#else
|
#else
|
||||||
#define anv_assert(x)
|
#define anv_assert(x)
|
||||||
|
@@ -47,22 +47,7 @@ anv_loge(const char *format, ...)
|
|||||||
void
|
void
|
||||||
anv_loge_v(const char *format, va_list va)
|
anv_loge_v(const char *format, va_list va)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "vk: error: ");
|
intel_loge_v(format, va);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void anv_printflike(6, 7)
|
void anv_printflike(6, 7)
|
||||||
@@ -89,7 +74,7 @@ __anv_perf_warn(struct anv_instance *instance, const void *object,
|
|||||||
"anv",
|
"anv",
|
||||||
report);
|
report);
|
||||||
|
|
||||||
fprintf(stderr, "%s:%d: PERF: %s\n", file, line, buffer);
|
intel_logw("%s:%d: PERF: %s", file, line, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
VkResult
|
VkResult
|
||||||
@@ -123,7 +108,7 @@ __vk_errorf(struct anv_instance *instance, const void *object,
|
|||||||
"anv",
|
"anv",
|
||||||
report);
|
report);
|
||||||
|
|
||||||
fprintf(stderr, "%s\n", report);
|
intel_loge("%s", report);
|
||||||
|
|
||||||
if (error == VK_ERROR_DEVICE_LOST &&
|
if (error == VK_ERROR_DEVICE_LOST &&
|
||||||
env_var_as_boolean("ANV_ABORT_ON_DEVICE_LOSS", false))
|
env_var_as_boolean("ANV_ABORT_ON_DEVICE_LOSS", false))
|
||||||
|
@@ -1174,7 +1174,7 @@ genX(cmd_buffer_config_l3)(struct anv_cmd_buffer *cmd_buffer,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (unlikely(INTEL_DEBUG & DEBUG_L3)) {
|
if (unlikely(INTEL_DEBUG & DEBUG_L3)) {
|
||||||
fprintf(stderr, "L3 config transition: ");
|
intel_logd("L3 config transition: ");
|
||||||
gen_dump_l3_config(cfg, stderr);
|
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_mul_gpr0(batch, view_count);
|
||||||
emit_lrr(batch, GEN7_3DPRIM_INSTANCE_COUNT, CS_GPR(0));
|
emit_lrr(batch, GEN7_3DPRIM_INSTANCE_COUNT, CS_GPR(0));
|
||||||
#else
|
#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");
|
"MI_MATH is not supported on Ivy Bridge");
|
||||||
emit_lrm(batch, GEN7_3DPRIM_INSTANCE_COUNT, bo, bo_offset + 4);
|
emit_lrm(batch, GEN7_3DPRIM_INSTANCE_COUNT, bo, bo_offset + 4);
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user