summaryrefslogtreecommitdiffstats
path: root/gpu
diff options
context:
space:
mode:
authormarkdittmer <markdittmer@chromium.org>2016-03-02 08:08:29 -0800
committerCommit bot <commit-bot@chromium.org>2016-03-02 16:10:02 +0000
commitcbf36ceafceb140cdc5d6f45a9ae2053483795c4 (patch)
tree90b48204a027deed138b35b855859d8afe4a09df /gpu
parent88336cbc14c314ee0b5d6c445ad2dca23ad5892a (diff)
downloadchromium_src-cbf36ceafceb140cdc5d6f45a9ae2053483795c4.zip
chromium_src-cbf36ceafceb140cdc5d6f45a9ae2053483795c4.tar.gz
chromium_src-cbf36ceafceb140cdc5d6f45a9ae2053483795c4.tar.bz2
Move content:GPUVideo...Stats to gpu::Video...Stats. HolyJavaStyleNamingBatman!
As a part of the GPU refactor for Mus, we are trying to eliminate spots where content/common/gpu depends on content/. One such dependency is content::GPUVideoMemoryUsageStats. BUG=586367 CQ_INCLUDE_TRYBOTS=tryserver.chromium.win:win_optional_gpu_tests_rel Committed: https://crrev.com/6c1a70a5d0436c7c647c995202fbfa307f28983a Cr-Commit-Position: refs/heads/master@{#377036} Review URL: https://codereview.chromium.org/1708783002 Cr-Commit-Position: refs/heads/master@{#378757}
Diffstat (limited to 'gpu')
-rw-r--r--gpu/BUILD.gn1
-rw-r--r--gpu/gpu.gyp42
-rw-r--r--gpu/gpu_ipc_common.gypi27
-rw-r--r--gpu/ipc/common/BUILD.gn31
-rw-r--r--gpu/ipc/common/memory_stats.cc19
-rw-r--r--gpu/ipc/common/memory_stats.h52
6 files changed, 172 insertions, 0 deletions
diff --git a/gpu/BUILD.gn b/gpu/BUILD.gn
index c3f82eb..bf1d6b0 100644
--- a/gpu/BUILD.gn
+++ b/gpu/BUILD.gn
@@ -46,6 +46,7 @@ component("gpu") {
"//gpu/command_buffer/service:service_sources",
"//gpu/config:config_sources",
"//gpu/ipc:ipc_sources",
+ "//gpu/ipc/common:ipc_common_sources",
]
}
diff --git a/gpu/gpu.gyp b/gpu/gpu.gyp
index 4eebf73..643de3d 100644
--- a/gpu/gpu.gyp
+++ b/gpu/gpu.gyp
@@ -597,6 +597,7 @@
'gles2_cmd_helper',
'gpu_config',
'gpu_ipc',
+ 'gpu_ipc_common',
],
'sources': [
'gpu_export.h',
@@ -677,6 +678,14 @@
],
},
{
+ # GN version: //gpu/ipc/common
+ 'target_name': 'gpu_ipc_common',
+ 'type': 'static_library',
+ 'includes': [
+ 'gpu_ipc_common.gypi',
+ ],
+ },
+ {
'target_name': 'gpu_config',
'type': 'static_library',
'includes': [
@@ -709,6 +718,7 @@
'gles2_cmd_helper.gypi',
'gpu_config.gypi',
'gpu_ipc.gypi',
+ 'gpu_ipc_common.gypi',
'../build/android/increase_size_for_speed.gypi',
],
'defines': [
@@ -768,6 +778,14 @@
'gpu',
],
},
+ {
+ # GN version: //gpu/ipc/common
+ 'target_name': 'gpu_ipc_common',
+ 'type': 'none',
+ 'dependencies': [
+ 'gpu',
+ ],
+ },
],
}],
['disable_nacl!=1 and OS=="win" and target_arch=="ia32"', {
@@ -818,6 +836,30 @@
},
},
},
+ {
+ 'target_name': 'gpu_ipc_common_win64',
+ 'type': 'static_library',
+ 'variables': {
+ 'nacl_win64_target': 1,
+ },
+ 'includes': [
+ 'gpu_ipc_common.gypi',
+ ],
+ 'dependencies': [
+ '../base/base.gyp:base_win64',
+ '../ipc/ipc.gyp:ipc_win64',
+ 'command_buffer_common_win64',
+ ],
+ 'defines': [
+ '<@(nacl_win64_defines)',
+ 'GPU_IMPLEMENTATION',
+ ],
+ 'configurations': {
+ 'Common_Base': {
+ 'msvs_target_platform': 'x64',
+ },
+ },
+ },
],
}],
['OS == "android"', {
diff --git a/gpu/gpu_ipc_common.gypi b/gpu/gpu_ipc_common.gypi
new file mode 100644
index 0000000..48f404a
--- /dev/null
+++ b/gpu/gpu_ipc_common.gypi
@@ -0,0 +1,27 @@
+# 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.
+
+{
+ 'dependencies': [
+ '../base/base.gyp:base',
+ '../ipc/ipc.gyp:ipc',
+ ],
+ 'include_dirs': [
+ '..',
+ ],
+ 'sources': [
+ 'ipc/common/memory_stats.cc',
+ 'ipc/common/memory_stats.h',
+ ],
+ 'conditions': [
+ # This section applies to gpu_ipc_win64, used by the NaCl Win64 helper
+ # (nacl64.exe).
+ ['nacl_win64_target==1', {
+ # gpu_ipc_win64 must only link against the 64-bit ipc target.
+ 'dependencies!': [
+ '../ipc/ipc.gyp:ipc',
+ ],
+ }],
+ ],
+}
diff --git a/gpu/ipc/common/BUILD.gn b/gpu/ipc/common/BUILD.gn
new file mode 100644
index 0000000..d99f577
--- /dev/null
+++ b/gpu/ipc/common/BUILD.gn
@@ -0,0 +1,31 @@
+# Copyright 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.
+
+group("ipc") {
+ if (is_component_build) {
+ public_deps = [
+ "//gpu",
+ ]
+ } else {
+ public_deps = [
+ ":ipc_common_sources",
+ ]
+ }
+}
+
+source_set("ipc_common_sources") {
+ visibility = [ "//gpu/*" ]
+
+ sources = [
+ "memory_stats.cc",
+ "memory_stats.h",
+ ]
+
+ configs += [ "//gpu:gpu_implementation" ]
+
+ deps = [
+ "//base",
+ "//ipc",
+ ]
+}
diff --git a/gpu/ipc/common/memory_stats.cc b/gpu/ipc/common/memory_stats.cc
new file mode 100644
index 0000000..af55e48
--- /dev/null
+++ b/gpu/ipc/common/memory_stats.cc
@@ -0,0 +1,19 @@
+// Copyright (c) 2012 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/ipc/common/memory_stats.h"
+
+namespace gpu {
+
+VideoMemoryUsageStats::VideoMemoryUsageStats()
+ : bytes_allocated(0), bytes_allocated_historical_max(0) {}
+
+VideoMemoryUsageStats::~VideoMemoryUsageStats() {}
+
+VideoMemoryUsageStats::ProcessStats::ProcessStats()
+ : video_memory(0), has_duplicates(false) {}
+
+VideoMemoryUsageStats::ProcessStats::~ProcessStats() {}
+
+} // namespace gpu
diff --git a/gpu/ipc/common/memory_stats.h b/gpu/ipc/common/memory_stats.h
new file mode 100644
index 0000000..ecc3944
--- /dev/null
+++ b/gpu/ipc/common/memory_stats.h
@@ -0,0 +1,52 @@
+// Copyright (c) 2012 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.
+
+#ifndef GPU_IPC_COMMON_MEMORY_STATS_H_
+#define GPU_IPC_COMMON_MEMORY_STATS_H_
+
+// Provides access to the GPU information for the system
+// on which chrome is currently running.
+
+#include <stddef.h>
+
+#include <map>
+
+#include "base/process/process.h"
+#include "gpu/gpu_export.h"
+
+namespace gpu {
+
+// Note: we use uint64_t instead of size_t for byte count because this struct
+// is sent over IPC which could span 32 & 64 bit processes.
+struct GPU_EXPORT VideoMemoryUsageStats {
+ VideoMemoryUsageStats();
+ ~VideoMemoryUsageStats();
+
+ struct GPU_EXPORT ProcessStats {
+ ProcessStats();
+ ~ProcessStats();
+
+ // The bytes of GPU resources accessible by this process
+ uint64_t video_memory;
+
+ // Set to true if this process' GPU resource count is inflated because
+ // it is counting other processes' resources (e.g, the GPU process has
+ // duplicate set to true because it is the aggregate of all processes)
+ bool has_duplicates;
+ };
+ typedef std::map<base::ProcessId, ProcessStats> ProcessMap;
+
+ // A map of processes to their GPU resource consumption
+ ProcessMap process_map;
+
+ // The total amount of GPU memory allocated at the time of the request.
+ uint64_t bytes_allocated;
+
+ // The maximum amount of GPU memory ever allocated at once.
+ uint64_t bytes_allocated_historical_max;
+};
+
+} // namespace gpu
+
+#endif // GPU_IPC_COMMON_MEMORY_STATS_H_