Commit e2ecb2dd by Ian Elliott Committed by Commit Bot

Enable logging API commands to Android logcat

This enables logging API commands to Android logcat. It is enabled via the following GN arg: angle_enable_android_api_logcat = true On desktop, API commands can continue to be logged to the "angle_debug.txt" file via a different mechanism, with the GN arg: angle_enable_trace = true Bug: b/170249632 Change-Id: Id52e75f966a97692ec6d69eb3d254ba295a151c2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2519094 Commit-Queue: Ian Elliott <ianelliott@google.com> Reviewed-by: 's avatarCourtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: 's avatarCharlie Lao <cclao@google.com>
parent 06a9d529
...@@ -106,10 +106,19 @@ config("internal_config") { ...@@ -106,10 +106,19 @@ config("internal_config") {
defines += [ "ANGLE_IS_LINUX" ] defines += [ "ANGLE_IS_LINUX" ]
} }
# Enables debug/trace-related functionality, including logging every GLES/EGL API command to the
# "angle_debug.txt" file on desktop. Enables debug markers for AGI, but must also set
# angle_enable_annotator_run_time_checks to improve performance.
if (angle_enable_trace) { if (angle_enable_trace) {
defines += [ "ANGLE_ENABLE_DEBUG_TRACE=1" ] defines += [ "ANGLE_ENABLE_DEBUG_TRACE=1" ]
} }
# When used with angle_enable_trace, enables logging every GLES/EGL API command to Android logcat
# Enables debug markers for AGI regardless of run-time checks.
if (angle_enable_trace_android_logcat) {
defines += [ "ANGLE_ENABLE_TRACE_ANDROID_LOGCAT=1" ]
}
if (is_chromeos) { if (is_chromeos) {
defines += [ "ANGLE_PLATFORM_CHROMEOS" ] defines += [ "ANGLE_PLATFORM_CHROMEOS" ]
} }
...@@ -254,6 +263,8 @@ config("debug_annotations_config") { ...@@ -254,6 +263,8 @@ config("debug_annotations_config") {
defines = [ "ANGLE_ENABLE_DEBUG_ANNOTATIONS" ] defines = [ "ANGLE_ENABLE_DEBUG_ANNOTATIONS" ]
} }
if (angle_enable_annotator_run_time_checks) { if (angle_enable_annotator_run_time_checks) {
# When used with angle_enable_trace, enables debug markers for AGI with run-time checks to
# filter out EVENT() messages when the debug annotator is disabled.
defines = [ "ANGLE_ENABLE_ANNOTATOR_RUN_TIME_CHECKS" ] defines = [ "ANGLE_ENABLE_ANNOTATOR_RUN_TIME_CHECKS" ]
} }
} }
......
...@@ -131,6 +131,7 @@ declare_args() { ...@@ -131,6 +131,7 @@ declare_args() {
angle_enable_hlsl = angle_enable_d3d9 || angle_enable_d3d11 angle_enable_hlsl = angle_enable_d3d9 || angle_enable_d3d11
angle_enable_trace = false angle_enable_trace = false
angle_enable_trace_android_logcat = false
# Disable the layers in ubsan builds because of really slow builds. # Disable the layers in ubsan builds because of really slow builds.
# TODO(anglebug.com/4082) enable validation layers on mac for swiftshader # TODO(anglebug.com/4082) enable validation layers on mac for swiftshader
......
...@@ -225,6 +225,9 @@ void Trace(LogSeverity severity, const char *message) ...@@ -225,6 +225,9 @@ void Trace(LogSeverity severity, const char *message)
} }
if (severity == LOG_FATAL || severity == LOG_ERR || severity == LOG_WARN || if (severity == LOG_FATAL || severity == LOG_ERR || severity == LOG_WARN ||
#if defined(ANGLE_ENABLE_TRACE_ANDROID_LOGCAT)
severity == LOG_EVENT ||
#endif
severity == LOG_INFO) severity == LOG_INFO)
{ {
#if defined(ANGLE_PLATFORM_ANDROID) #if defined(ANGLE_PLATFORM_ANDROID)
...@@ -232,6 +235,7 @@ void Trace(LogSeverity severity, const char *message) ...@@ -232,6 +235,7 @@ void Trace(LogSeverity severity, const char *message)
switch (severity) switch (severity)
{ {
case LOG_INFO: case LOG_INFO:
case LOG_EVENT:
android_priority = ANDROID_LOG_INFO; android_priority = ANDROID_LOG_INFO;
break; break;
case LOG_WARN: case LOG_WARN:
......
...@@ -25,7 +25,7 @@ void DebugAnnotatorVk::beginEvent(gl::Context *context, ...@@ -25,7 +25,7 @@ void DebugAnnotatorVk::beginEvent(gl::Context *context,
const char *eventMessage) const char *eventMessage)
{ {
angle::LoggingAnnotator::beginEvent(context, entryPoint, eventName, eventMessage); angle::LoggingAnnotator::beginEvent(context, entryPoint, eventName, eventMessage);
if (context) if (vkCmdBeginDebugUtilsLabelEXT && context)
{ {
ContextVk *contextVk = vk::GetImpl(static_cast<gl::Context *>(context)); ContextVk *contextVk = vk::GetImpl(static_cast<gl::Context *>(context));
contextVk->logEvent(eventMessage); contextVk->logEvent(eventMessage);
...@@ -37,7 +37,7 @@ void DebugAnnotatorVk::endEvent(gl::Context *context, ...@@ -37,7 +37,7 @@ void DebugAnnotatorVk::endEvent(gl::Context *context,
gl::EntryPoint entryPoint) gl::EntryPoint entryPoint)
{ {
angle::LoggingAnnotator::endEvent(context, eventName, entryPoint); angle::LoggingAnnotator::endEvent(context, eventName, entryPoint);
if (context && isDrawOrDispatchEntryPoint(entryPoint)) if (vkCmdBeginDebugUtilsLabelEXT && context && isDrawOrDispatchEntryPoint(entryPoint))
{ {
ContextVk *contextVk = vk::GetImpl(static_cast<gl::Context *>(context)); ContextVk *contextVk = vk::GetImpl(static_cast<gl::Context *>(context));
contextVk->endEventLog(entryPoint); contextVk->endEventLog(entryPoint);
......
...@@ -2519,6 +2519,10 @@ void RendererVk::setGlobalDebugAnnotator() ...@@ -2519,6 +2519,10 @@ void RendererVk::setGlobalDebugAnnotator()
enableDebugAnnotatorVk = true; enableDebugAnnotatorVk = true;
} }
} }
#if defined(ANGLE_ENABLE_TRACE_ANDROID_LOGCAT)
// This will log all API commands to Android's logcat as well as create Vulkan debug markers.
enableDebugAnnotatorVk = true;
#endif
if (enableDebugAnnotatorVk) if (enableDebugAnnotatorVk)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment