Chromium Code Reviews

Side by Side Diff: content/browser/gpu/gpu_process_host.cc

Issue 123563002: Remove gpu side LatencyInfo merging (Closed) Base URL: http://git.chromium.org/chromium/src.git@gpu-per-event-latency-6-small
Patch Set: ignore ViewHostMsg_CompositorSurfaceBuffersSwapped msg if the latency_info list if too big Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/gpu/gpu_process_host.h" 5 #include "content/browser/gpu/gpu_process_host.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/base_switches.h" 8 #include "base/base_switches.h"
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 46 matching lines...)
57 #include "ui/ozone/ozone_switches.h" 57 #include "ui/ozone/ozone_switches.h"
58 #endif 58 #endif
59 59
60 namespace content { 60 namespace content {
61 61
62 bool GpuProcessHost::gpu_enabled_ = true; 62 bool GpuProcessHost::gpu_enabled_ = true;
63 bool GpuProcessHost::hardware_gpu_enabled_ = true; 63 bool GpuProcessHost::hardware_gpu_enabled_ = true;
64 64
65 namespace { 65 namespace {
66 66
67 const unsigned int kMaxLatencyInfoNumber = 100;
68
67 enum GPUProcessLifetimeEvent { 69 enum GPUProcessLifetimeEvent {
68 LAUNCHED, 70 LAUNCHED,
69 DIED_FIRST_TIME, 71 DIED_FIRST_TIME,
70 DIED_SECOND_TIME, 72 DIED_SECOND_TIME,
71 DIED_THIRD_TIME, 73 DIED_THIRD_TIME,
72 DIED_FOURTH_TIME, 74 DIED_FOURTH_TIME,
73 GPU_PROCESS_LIFETIME_EVENT_MAX = 100 75 GPU_PROCESS_LIFETIME_EVENT_MAX = 100
74 }; 76 };
75 77
76 // Indexed by GpuProcessKind. There is one of each kind maximum. This array may 78 // Indexed by GpuProcessKind. There is one of each kind maximum. This array may
(...skipping 48 matching lines...)
125 } 127 }
126 } 128 }
127 129
128 #if defined(OS_WIN) 130 #if defined(OS_WIN)
129 // This sends a ViewMsg_SwapBuffers_ACK directly to the renderer process 131 // This sends a ViewMsg_SwapBuffers_ACK directly to the renderer process
130 // (RenderWidget). 132 // (RenderWidget).
131 void AcceleratedSurfaceBuffersSwappedCompletedForRenderer( 133 void AcceleratedSurfaceBuffersSwappedCompletedForRenderer(
132 int surface_id, 134 int surface_id,
133 base::TimeTicks timebase, 135 base::TimeTicks timebase,
134 base::TimeDelta interval, 136 base::TimeDelta interval,
135 const ui::LatencyInfo& latency_info) { 137 const std::vector<ui::LatencyInfo>& latency_info) {
136 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { 138 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
137 BrowserThread::PostTask( 139 BrowserThread::PostTask(
138 BrowserThread::UI, 140 BrowserThread::UI,
139 FROM_HERE, 141 FROM_HERE,
140 base::Bind(&AcceleratedSurfaceBuffersSwappedCompletedForRenderer, 142 base::Bind(&AcceleratedSurfaceBuffersSwappedCompletedForRenderer,
141 surface_id, timebase, interval, latency_info)); 143 surface_id, timebase, interval, latency_info));
142 return; 144 return;
143 } 145 }
144 146
145 int render_process_id = 0; 147 int render_process_id = 0;
(...skipping 14 matching lines...)
160 RenderWidgetHostImpl::From(rwh)->DidReceiveRendererFrame(); 162 RenderWidgetHostImpl::From(rwh)->DidReceiveRendererFrame();
161 } 163 }
162 164
163 void AcceleratedSurfaceBuffersSwappedCompleted( 165 void AcceleratedSurfaceBuffersSwappedCompleted(
164 int host_id, 166 int host_id,
165 int route_id, 167 int route_id,
166 int surface_id, 168 int surface_id,
167 bool alive, 169 bool alive,
168 base::TimeTicks timebase, 170 base::TimeTicks timebase,
169 base::TimeDelta interval, 171 base::TimeDelta interval,
170 const ui::LatencyInfo& latency_info) { 172 const std::vector<ui::LatencyInfo>& latency_info) {
171 AcceleratedSurfaceBuffersSwappedCompletedForGPU( 173 AcceleratedSurfaceBuffersSwappedCompletedForGPU(
172 host_id, route_id, alive, timebase, interval); 174 host_id, route_id, alive, timebase, interval);
173 AcceleratedSurfaceBuffersSwappedCompletedForRenderer( 175 AcceleratedSurfaceBuffersSwappedCompletedForRenderer(
174 surface_id, timebase, interval, latency_info); 176 surface_id, timebase, interval, latency_info);
175 } 177 }
176 178
177 // NOTE: changes to this class need to be reviewed by the security team. 179 // NOTE: changes to this class need to be reviewed by the security team.
178 class GpuSandboxedProcessLauncherDelegate 180 class GpuSandboxedProcessLauncherDelegate
179 : public SandboxedProcessLauncherDelegate { 181 : public SandboxedProcessLauncherDelegate {
180 public: 182 public:
(...skipping 686 matching lines...)
867 869
868 void GpuProcessHost::OnGpuMemoryUmaStatsReceived( 870 void GpuProcessHost::OnGpuMemoryUmaStatsReceived(
869 const GPUMemoryUmaStats& stats) { 871 const GPUMemoryUmaStats& stats) {
870 TRACE_EVENT0("gpu", "GpuProcessHost::OnGpuMemoryUmaStatsReceived"); 872 TRACE_EVENT0("gpu", "GpuProcessHost::OnGpuMemoryUmaStatsReceived");
871 uma_memory_stats_received_ = true; 873 uma_memory_stats_received_ = true;
872 uma_memory_stats_ = stats; 874 uma_memory_stats_ = stats;
873 } 875 }
874 876
875 #if defined(OS_MACOSX) 877 #if defined(OS_MACOSX)
876 void GpuProcessHost::OnAcceleratedSurfaceBuffersSwapped( 878 void GpuProcessHost::OnAcceleratedSurfaceBuffersSwapped(
877 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params) { 879 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params) {
jln (very slow on Chromium) 2014/01/14 01:11:52 Check for vector size here as well.
Yufeng Shen (Slow to review) 2014/01/14 20:02:42 Done.
878 TRACE_EVENT0("gpu", "GpuProcessHost::OnAcceleratedSurfaceBuffersSwapped"); 880 TRACE_EVENT0("gpu", "GpuProcessHost::OnAcceleratedSurfaceBuffersSwapped");
879 881
880 gfx::GLSurfaceHandle surface_handle = 882 gfx::GLSurfaceHandle surface_handle =
881 GpuSurfaceTracker::Get()->GetSurfaceHandle(params.surface_id); 883 GpuSurfaceTracker::Get()->GetSurfaceHandle(params.surface_id);
882 // Compositor window is always gfx::kNullPluginWindow. 884 // Compositor window is always gfx::kNullPluginWindow.
883 // TODO(jbates) http://crbug.com/105344 This will be removed when there are no 885 // TODO(jbates) http://crbug.com/105344 This will be removed when there are no
884 // plugin windows. 886 // plugin windows.
885 if (surface_handle.handle != gfx::kNullPluginWindow || 887 if (surface_handle.handle != gfx::kNullPluginWindow ||
886 surface_handle.transport_type == gfx::TEXTURE_TRANSPORT) { 888 surface_handle.transport_type == gfx::TEXTURE_TRANSPORT) {
887 RouteOnUIThread(GpuHostMsg_AcceleratedSurfaceBuffersSwapped(params)); 889 RouteOnUIThread(GpuHostMsg_AcceleratedSurfaceBuffersSwapped(params));
(...skipping 23 matching lines...)
911 ignore_result(scoped_completion_runner.Release()); 913 ignore_result(scoped_completion_runner.Release());
912 914
913 ViewHostMsg_CompositorSurfaceBuffersSwapped_Params view_params; 915 ViewHostMsg_CompositorSurfaceBuffersSwapped_Params view_params;
914 view_params.surface_id = params.surface_id; 916 view_params.surface_id = params.surface_id;
915 view_params.surface_handle = params.surface_handle; 917 view_params.surface_handle = params.surface_handle;
916 view_params.route_id = params.route_id; 918 view_params.route_id = params.route_id;
917 view_params.size = params.size; 919 view_params.size = params.size;
918 view_params.scale_factor = params.scale_factor; 920 view_params.scale_factor = params.scale_factor;
919 view_params.gpu_process_host_id = host_id_; 921 view_params.gpu_process_host_id = host_id_;
920 view_params.latency_info = params.latency_info; 922 view_params.latency_info = params.latency_info;
923 if (view_params.latency_info.size() > kMaxLatencyInfoNumber) {
924 for (size_t i = 0; i < view_params.latency_info.size(); i++)
925 view_params.latency_info[i].AddLatencyNumber(
926 ui::LATENCY_INFO_LIST_TERMINATED_OVERFLOW_COMPONENT, 0, 0);
927 view_params.latency_info.clear();
928 }
921 helper->DidReceiveBackingStoreMsg(ViewHostMsg_CompositorSurfaceBuffersSwapped( 929 helper->DidReceiveBackingStoreMsg(ViewHostMsg_CompositorSurfaceBuffersSwapped(
922 render_widget_id, 930 render_widget_id,
923 view_params)); 931 view_params));
924 } 932 }
925 #endif // OS_MACOSX 933 #endif // OS_MACOSX
926 934
927 #if defined(OS_WIN) 935 #if defined(OS_WIN)
928 void GpuProcessHost::OnAcceleratedSurfaceBuffersSwapped( 936 void GpuProcessHost::OnAcceleratedSurfaceBuffersSwapped(
929 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params) { 937 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params) {
930 TRACE_EVENT0("gpu", "GpuProcessHost::OnAcceleratedSurfaceBuffersSwapped"); 938 TRACE_EVENT0("gpu", "GpuProcessHost::OnAcceleratedSurfaceBuffersSwapped");
jln (very slow on Chromium) 2014/01/14 01:11:52 Another size check required here.
Yufeng Shen (Slow to review) 2014/01/14 20:02:42 Done.
931 939
932 base::ScopedClosureRunner scoped_completion_runner( 940 base::ScopedClosureRunner scoped_completion_runner(
933 base::Bind(&AcceleratedSurfaceBuffersSwappedCompleted, 941 base::Bind(&AcceleratedSurfaceBuffersSwappedCompleted,
934 host_id_, params.route_id, params.surface_id, 942 host_id_, params.route_id, params.surface_id,
935 true, base::TimeTicks(), base::TimeDelta(), ui::LatencyInfo())); 943 true, base::TimeTicks(), base::TimeDelta(),
944 std::vector<ui::LatencyInfo>()));
936 945
937 gfx::GLSurfaceHandle handle = 946 gfx::GLSurfaceHandle handle =
938 GpuSurfaceTracker::Get()->GetSurfaceHandle(params.surface_id); 947 GpuSurfaceTracker::Get()->GetSurfaceHandle(params.surface_id);
939 948
940 if (handle.is_null()) 949 if (handle.is_null())
941 return; 950 return;
942 951
943 if (handle.transport_type == gfx::TEXTURE_TRANSPORT) { 952 if (handle.transport_type == gfx::TEXTURE_TRANSPORT) {
944 TRACE_EVENT1("gpu", "SurfaceIDNotFound_RoutingToUI", 953 TRACE_EVENT1("gpu", "SurfaceIDNotFound_RoutingToUI",
945 "surface_id", params.surface_id); 954 "surface_id", params.surface_id);
(...skipping 45 matching lines...)
991 presenter->AsyncCopyToVideoFrame( 1000 presenter->AsyncCopyToVideoFrame(
992 gfx::Rect(params.size), target_frame, 1001 gfx::Rect(params.size), target_frame,
993 base::Bind(copy_callback, present_time)); 1002 base::Bind(copy_callback, present_time));
994 } 1003 }
995 } 1004 }
996 } 1005 }
997 1006
998 void GpuProcessHost::OnAcceleratedSurfacePostSubBuffer( 1007 void GpuProcessHost::OnAcceleratedSurfacePostSubBuffer(
999 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params) { 1008 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params) {
1000 TRACE_EVENT0("gpu", "GpuProcessHost::OnAcceleratedSurfacePostSubBuffer"); 1009 TRACE_EVENT0("gpu", "GpuProcessHost::OnAcceleratedSurfacePostSubBuffer");
1001 1010
jln (very slow on Chromium) 2014/01/14 01:11:52 And here as well (or someone will forget to check
Yufeng Shen (Slow to review) 2014/01/14 20:02:42 Done.
1002 NOTIMPLEMENTED(); 1011 NOTIMPLEMENTED();
1003 } 1012 }
1004 1013
1005 void GpuProcessHost::OnAcceleratedSurfaceSuspend(int32 surface_id) { 1014 void GpuProcessHost::OnAcceleratedSurfaceSuspend(int32 surface_id) {
1006 TRACE_EVENT0("gpu", "GpuProcessHost::OnAcceleratedSurfaceSuspend"); 1015 TRACE_EVENT0("gpu", "GpuProcessHost::OnAcceleratedSurfaceSuspend");
1007 1016
1008 gfx::PluginWindowHandle handle = 1017 gfx::PluginWindowHandle handle =
1009 GpuSurfaceTracker::Get()->GetSurfaceHandle(surface_id).handle; 1018 GpuSurfaceTracker::Get()->GetSurfaceHandle(surface_id).handle;
1010 1019
1011 if (!handle) { 1020 if (!handle) {
(...skipping 249 matching lines...)
1261 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); 1270 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader");
1262 ClientIdToShaderCacheMap::iterator iter = 1271 ClientIdToShaderCacheMap::iterator iter =
1263 client_id_to_shader_cache_.find(client_id); 1272 client_id_to_shader_cache_.find(client_id);
1264 // If the cache doesn't exist then this is an off the record profile. 1273 // If the cache doesn't exist then this is an off the record profile.
1265 if (iter == client_id_to_shader_cache_.end()) 1274 if (iter == client_id_to_shader_cache_.end())
1266 return; 1275 return;
1267 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); 1276 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader);
1268 } 1277 }
1269 1278
1270 } // namespace content 1279 } // namespace content
OLDNEW

Powered by Google App Engine