diff options
author | junov <junov@chromium.org> | 2016-01-07 13:48:51 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-01-07 21:49:40 +0000 |
commit | 0cad1f4cc187083f997c91f117529ba3ff5b191a (patch) | |
tree | 9ea0e41955eeeea14efac9f3c822e8e8951a0ad1 | |
parent | c7246ee039f232e3ff2eb1edb10797b47ef8b9c9 (diff) | |
download | chromium_src-0cad1f4cc187083f997c91f117529ba3ff5b191a.zip chromium_src-0cad1f4cc187083f997c91f117529ba3ff5b191a.tar.gz chromium_src-0cad1f4cc187083f997c91f117529ba3ff5b191a.tar.bz2 |
Add GL error usage metrics for glTexImage* APIs
This change adds histograms that track errors that occur in
calls that allocate GPU textures. The motivation is to track
the impact of tweaking GPU resource management parameters.
In particular, there is a desire to increase the limit of the
skia texture cache in order to solve some performance issues.
This histogram will allow us to measure the impact of that
change on GPU resource allocation failure rates.
BUG=464835
Review URL: https://codereview.chromium.org/1563613002
Cr-Commit-Position: refs/heads/master@{#368165}
-rw-r--r-- | gpu/command_buffer/service/BUILD.gn | 1 | ||||
-rw-r--r-- | gpu/command_buffer/service/gl_utils.cc | 26 | ||||
-rw-r--r-- | gpu/command_buffer/service/gl_utils.h | 10 | ||||
-rw-r--r-- | gpu/command_buffer/service/texture_manager.cc | 8 | ||||
-rw-r--r-- | gpu/command_buffer_service.gypi | 1 | ||||
-rw-r--r-- | tools/metrics/histograms/histograms.xml | 21 |
6 files changed, 67 insertions, 0 deletions
diff --git a/gpu/command_buffer/service/BUILD.gn b/gpu/command_buffer/service/BUILD.gn index f22f7e2..497c243 100644 --- a/gpu/command_buffer/service/BUILD.gn +++ b/gpu/command_buffer/service/BUILD.gn @@ -51,6 +51,7 @@ source_set("service_sources") { "gl_context_virtual.h", "gl_state_restorer_impl.cc", "gl_state_restorer_impl.h", + "gl_utils.cc", "gl_utils.h", "gles2_cmd_clear_framebuffer.cc", "gles2_cmd_clear_framebuffer.h", diff --git a/gpu/command_buffer/service/gl_utils.cc b/gpu/command_buffer/service/gl_utils.cc new file mode 100644 index 0000000..bb8ce4b --- /dev/null +++ b/gpu/command_buffer/service/gl_utils.cc @@ -0,0 +1,26 @@ +// Copyright (c) 2016 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "gpu/command_buffer/service/gl_utils.h" + +#include "base/metrics/histogram.h" + +namespace gpu { +namespace gles2 { + +std::vector<int> GetAllGLErrors() { + int gl_errors[] = { + GL_NO_ERROR, + GL_INVALID_ENUM, + GL_INVALID_VALUE, + GL_INVALID_OPERATION, + GL_INVALID_FRAMEBUFFER_OPERATION, + GL_OUT_OF_MEMORY, + }; + return base::CustomHistogram::ArrayToCustomRanges(gl_errors, + arraysize(gl_errors)); +} + +} // namespace gles2 +} // namespace gpu diff --git a/gpu/command_buffer/service/gl_utils.h b/gpu/command_buffer/service/gl_utils.h index ade4a37..9402eca 100644 --- a/gpu/command_buffer/service/gl_utils.h +++ b/gpu/command_buffer/service/gl_utils.h @@ -8,6 +8,8 @@ #ifndef GPU_COMMAND_BUFFER_SERVICE_GL_UTILS_H_ #define GPU_COMMAND_BUFFER_SERVICE_GL_UTILS_H_ +#include <vector> + #include "build/build_config.h" #include "ui/gl/gl_bindings.h" @@ -22,4 +24,12 @@ #define CHECK_GL_ERROR() void(0) #endif // GL_ERROR_DEBUGGING +namespace gpu { +namespace gles2 { + +std::vector<int> GetAllGLErrors(); + +} // gles2 +} // gpu + #endif // GPU_COMMAND_BUFFER_SERVICE_GL_UTILS_H_ diff --git a/gpu/command_buffer/service/texture_manager.cc b/gpu/command_buffer/service/texture_manager.cc index 1bce494..82fab48 100644 --- a/gpu/command_buffer/service/texture_manager.cc +++ b/gpu/command_buffer/service/texture_manager.cc @@ -13,6 +13,7 @@ #include "base/bits.h" #include "base/lazy_instance.h" +#include "base/metrics/histogram_macros.h" #include "base/strings/stringprintf.h" #include "base/thread_task_runner_handle.h" #include "base/trace_event/memory_dump_manager.h" @@ -2262,6 +2263,13 @@ void TextureManager::DoTexImage( } } GLenum error = ERRORSTATE_PEEK_GL_ERROR(error_state, function_name); + if (args.command_type == DoTexImageArguments::kTexImage3D) { + UMA_HISTOGRAM_CUSTOM_ENUMERATION("GPU.Error.TexImage3D", error, + GetAllGLErrors()); + } else { + UMA_HISTOGRAM_CUSTOM_ENUMERATION("GPU.Error.TexImage2D", error, + GetAllGLErrors()); + } if (error == GL_NO_ERROR) { SetLevelInfo( texture_ref, args.target, args.level, args.internal_format, args.width, diff --git a/gpu/command_buffer_service.gypi b/gpu/command_buffer_service.gypi index 7fc7de2..fc9f33f 100644 --- a/gpu/command_buffer_service.gypi +++ b/gpu/command_buffer_service.gypi @@ -53,6 +53,7 @@ 'command_buffer/service/gl_context_virtual.h', 'command_buffer/service/gl_state_restorer_impl.cc', 'command_buffer/service/gl_state_restorer_impl.h', + 'command_buffer/service/gl_utils.cc', 'command_buffer/service/gl_utils.h', 'command_buffer/service/gles2_cmd_clear_framebuffer.cc', 'command_buffer/service/gles2_cmd_clear_framebuffer.h', diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index c07c42f..1a4350f 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml @@ -15092,6 +15092,12 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries. <summary>The display type used to ask for an EGLDisplay.</summary> </histogram> +<histogram name="GPU.Error" enum="GLError"> + <owner>junov@chromium.org</owner> + <owner>piman@chromium.org</owner> + <summary>The error states generated by OpenGL calls.</summary> +</histogram> + <histogram name="GPU.FenceSupport" enum="BooleanAvailable"> <owner>reveman@chromium.org</owner> <summary> @@ -66451,6 +66457,15 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries. <int value="6" label="UNSET"/> </enum> +<enum name="GLError" type="int"> + <int value="0" label="0x0000 - GL_NO_ERROR"/> + <int value="1280" label="0x0500 - GL_INVALID_ENUM"/> + <int value="1281" label="0x0501 - GL_INVALID_VALUE"/> + <int value="1282" label="0x0502 - GL_INVALID_OPERATION"/> + <int value="1285" label="0x0505 - GL_OUT_OF_MEMORY"/> + <int value="1286" label="0x0506 - GL_INVALID_FRAMEBUFFER_OPERATION"/> +</enum> + <enum name="GoogleCaptchaEvent" type="int"> <int value="0" label="Google CAPTCHA shown"/> <int value="1" label="Google CAPTCHA solved"/> @@ -81826,6 +81841,12 @@ To add a new entry, add it with any value and run test to compute valid value. <affected-histogram name="PLT.PT_StartToFinish"/> </histogram_suffixes> +<histogram_suffixes name="GLApisWithErrorReporting"> + <suffix name="TexImage2D" label="All GL APIs that allocate a 2D texture."/> + <suffix name="TexImage3D" label="All GL APIs that allocate a 3D texture."/> + <affected-histogram name="GPU.Error"/> +</histogram_suffixes> + <histogram_suffixes name="GlobalSdch"> <suffix name="global_disable_sdch" label="with SDCH completely disabled"/> <suffix name="global_enable_sdch" |