Commit dca586f6 authored by Kenneth Russell's avatar Kenneth Russell Committed by Commit Bot

Add and document enable_gpu_client_logging GN argument.

This can be used in Release builds without dcheck_always_on=true, and
allows the --enable-gpu-client-logging command line argument to work.

Bug: 910783
Change-Id: I0720b7eb0c735de4d08ba50d69b41060eb387d63
Reviewed-on: https://chromium-review.googlesource.com/c/1357623Reviewed-by: default avatarVictor Miura <vmiura@chromium.org>
Commit-Queue: Kenneth Russell <kbr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#612900}
parent 35e50b5d
......@@ -19,6 +19,20 @@ WebGL, Skia/Ganesh, Aura), then in a debug build you can use the
GPU service process. (From the point of view of a GPU client, it's calling
OpenGL ES functions - but the real driver calls are made in the GPU process.)
You can also use this flag in a release build by specifying the GN argument:
```
enable_gpu_client_logging=true
```
It's typically necessary to specify the `--enable-logging=stderr` flag as well:
```
--enable-gpu-client-logging --enable-logging=stderr
```
The output looks like this:
```
[4782:4782:1219/141706:INFO:gles2_implementation.cc(1026)] [.WebGLRenderingContext] glUseProgram(3)
[4782:4782:1219/141706:INFO:gles2_implementation_impl_autogen.h(401)] [.WebGLRenderingContext] glGenBuffers(1, 0x7fffc9e1269c)
......
......@@ -4,6 +4,11 @@
import("//build/config/jumbo.gni")
declare_args() {
# Enable GPU client logging without DCHECK being on.
enable_gpu_client_logging = false
}
# The files here go into the "gpu" component in a component build (with
# "command_buffer_client" and "gles2_cmd_helper" just forwarding) and goes into
# separate static libraries in non-component build.
......@@ -205,6 +210,9 @@ jumbo_component("gles2_implementation") {
sources = gles2_implementation_source_files
defines = [ "GLES2_IMPL_IMPLEMENTATION" ]
if (enable_gpu_client_logging) {
defines += [ "GPU_ENABLE_CLIENT_LOGGING" ]
}
all_dependent_configs = [ "//third_party/khronos:khronos_headers" ]
deps = [
......@@ -295,6 +303,9 @@ jumbo_component("gles2_implementation_no_check") {
"GLES2_IMPL_IMPLEMENTATION",
"GLES2_CONFORMANCE_TESTS=1",
]
if (enable_gpu_client_logging) {
defines += [ "GPU_ENABLE_CLIENT_LOGGING" ]
}
deps = [
":client",
......
......@@ -9,9 +9,15 @@
#include "base/macros.h"
#include "gpu/command_buffer/client/gles2_impl_export.h"
// Macros to log information if DCHECK_IS_ON() and --enable-gpu-client-logging
// flag is set. Code is optimized out if DCHECK is disabled. Requires that a
// LogSettings named log_settings_ is in scope whenever a macro is used.
// Macros to log information if --enable-gpu-client-logging is set and either:
// DCHECK_IS_ON(), or
// enable_gpu_client_logging=true is set in GN args.
// Code is optimized out if DCHECK is disabled or the other GN arg is not set.
// Requires that a LogSettings named log_settings_ is in scope whenever a macro
// is used.
//
// Note that it's typically necessary to also specify --enable-logging=stderr to
// see this logging output on Linux or macOS.
//
// Example usage:
//
......@@ -32,13 +38,14 @@
// LogSettings log_settings_;
// };
#if DCHECK_IS_ON() && !defined(__native_client__) && \
!defined(GLES2_CONFORMANCE_TESTS) && !defined(GLES2_INLINE_OPTIMIZATION)
#if (DCHECK_IS_ON() || defined(GPU_ENABLE_CLIENT_LOGGING)) && \
!defined(__native_client__) && !defined(GLES2_CONFORMANCE_TESTS) && \
!defined(GLES2_INLINE_OPTIMIZATION)
#define GPU_CLIENT_DEBUG
#endif
#if defined(GPU_CLIENT_DEBUG)
#define GPU_CLIENT_LOG(args) DLOG_IF(INFO, log_settings_.enabled()) << args;
#define GPU_CLIENT_LOG(args) LOG_IF(INFO, log_settings_.enabled()) << args;
#define GPU_CLIENT_LOG_CODE_BLOCK(code) code
#define GPU_CLIENT_DCHECK_CODE_BLOCK(code) code
#else // !defined(GPU_CLIENT_DEBUG)
......
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