Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(455)

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: adding check at more places for GpuHostMsg_AcceleratedSurfaceBuffersSwapped/PostBuffer Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
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...) Expand 10 before | Expand all | Expand 10 after
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...) Expand 10 before | Expand all | Expand 10 after
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...) Expand all
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 689 matching lines...) Expand 10 before | Expand all | Expand 10 after
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) {
878 TRACE_EVENT0("gpu", "GpuProcessHost::OnAcceleratedSurfaceBuffersSwapped"); 880 TRACE_EVENT0("gpu", "GpuProcessHost::OnAcceleratedSurfaceBuffersSwapped");
879 881
882 if (params.latency_info.size() > kMaxLatencyInfoNumber) {
883 LOG(ERROR) << "GpuHostMsg_AcceleratedSurfaceBuffersSwapped LatencyInfo"
884 << " size " << params.latency_info.size() << " is too big.";
Ken Russell (switch to Gerrit) 2014/01/15 06:41:29 Please refactor this duplicated code and constant
Yufeng Shen (Slow to review) 2014/01/15 19:44:31 Done.
885 return;
886 }
887
880 gfx::GLSurfaceHandle surface_handle = 888 gfx::GLSurfaceHandle surface_handle =
881 GpuSurfaceTracker::Get()->GetSurfaceHandle(params.surface_id); 889 GpuSurfaceTracker::Get()->GetSurfaceHandle(params.surface_id);
882 // Compositor window is always gfx::kNullPluginWindow. 890 // Compositor window is always gfx::kNullPluginWindow.
883 // TODO(jbates) http://crbug.com/105344 This will be removed when there are no 891 // TODO(jbates) http://crbug.com/105344 This will be removed when there are no
884 // plugin windows. 892 // plugin windows.
885 if (surface_handle.handle != gfx::kNullPluginWindow || 893 if (surface_handle.handle != gfx::kNullPluginWindow ||
886 surface_handle.transport_type == gfx::TEXTURE_TRANSPORT) { 894 surface_handle.transport_type == gfx::TEXTURE_TRANSPORT) {
887 RouteOnUIThread(GpuHostMsg_AcceleratedSurfaceBuffersSwapped(params)); 895 RouteOnUIThread(GpuHostMsg_AcceleratedSurfaceBuffersSwapped(params));
888 return; 896 return;
889 } 897 }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
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");
931 939
940 if (params.latency_info.size() > kMaxLatencyInfoNumber) {
941 LOG(ERROR) << "GpuHostMsg_AcceleratedSurfaceBuffersSwapped LatencyInfo"
942 << " size " << params.latency_info.size() << " is too big.";
943 return;
944 }
945
932 base::ScopedClosureRunner scoped_completion_runner( 946 base::ScopedClosureRunner scoped_completion_runner(
933 base::Bind(&AcceleratedSurfaceBuffersSwappedCompleted, 947 base::Bind(&AcceleratedSurfaceBuffersSwappedCompleted,
934 host_id_, params.route_id, params.surface_id, 948 host_id_, params.route_id, params.surface_id,
935 true, base::TimeTicks(), base::TimeDelta(), ui::LatencyInfo())); 949 true, base::TimeTicks(), base::TimeDelta(),
950 std::vector<ui::LatencyInfo>()));
936 951
937 gfx::GLSurfaceHandle handle = 952 gfx::GLSurfaceHandle handle =
938 GpuSurfaceTracker::Get()->GetSurfaceHandle(params.surface_id); 953 GpuSurfaceTracker::Get()->GetSurfaceHandle(params.surface_id);
939 954
940 if (handle.is_null()) 955 if (handle.is_null())
941 return; 956 return;
942 957
943 if (handle.transport_type == gfx::TEXTURE_TRANSPORT) { 958 if (handle.transport_type == gfx::TEXTURE_TRANSPORT) {
944 TRACE_EVENT1("gpu", "SurfaceIDNotFound_RoutingToUI", 959 TRACE_EVENT1("gpu", "SurfaceIDNotFound_RoutingToUI",
945 "surface_id", params.surface_id); 960 "surface_id", params.surface_id);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
992 gfx::Rect(params.size), target_frame, 1007 gfx::Rect(params.size), target_frame,
993 base::Bind(copy_callback, present_time)); 1008 base::Bind(copy_callback, present_time));
994 } 1009 }
995 } 1010 }
996 } 1011 }
997 1012
998 void GpuProcessHost::OnAcceleratedSurfacePostSubBuffer( 1013 void GpuProcessHost::OnAcceleratedSurfacePostSubBuffer(
999 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params) { 1014 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params) {
1000 TRACE_EVENT0("gpu", "GpuProcessHost::OnAcceleratedSurfacePostSubBuffer"); 1015 TRACE_EVENT0("gpu", "GpuProcessHost::OnAcceleratedSurfacePostSubBuffer");
1001 1016
1017 if (params.latency_info.size() > kMaxLatencyInfoNumber) {
1018 LOG(ERROR) << "GpuHostMsg_AcceleratedSurfacePostSubBuffer LatencyInfo"
1019 << " size " << params.latency_info.size() << " is too big.";
1020 return;
1021 }
1022
1002 NOTIMPLEMENTED(); 1023 NOTIMPLEMENTED();
1003 } 1024 }
1004 1025
1005 void GpuProcessHost::OnAcceleratedSurfaceSuspend(int32 surface_id) { 1026 void GpuProcessHost::OnAcceleratedSurfaceSuspend(int32 surface_id) {
1006 TRACE_EVENT0("gpu", "GpuProcessHost::OnAcceleratedSurfaceSuspend"); 1027 TRACE_EVENT0("gpu", "GpuProcessHost::OnAcceleratedSurfaceSuspend");
1007 1028
1008 gfx::PluginWindowHandle handle = 1029 gfx::PluginWindowHandle handle =
1009 GpuSurfaceTracker::Get()->GetSurfaceHandle(surface_id).handle; 1030 GpuSurfaceTracker::Get()->GetSurfaceHandle(surface_id).handle;
1010 1031
1011 if (!handle) { 1032 if (!handle) {
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
1261 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); 1282 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader");
1262 ClientIdToShaderCacheMap::iterator iter = 1283 ClientIdToShaderCacheMap::iterator iter =
1263 client_id_to_shader_cache_.find(client_id); 1284 client_id_to_shader_cache_.find(client_id);
1264 // If the cache doesn't exist then this is an off the record profile. 1285 // If the cache doesn't exist then this is an off the record profile.
1265 if (iter == client_id_to_shader_cache_.end()) 1286 if (iter == client_id_to_shader_cache_.end())
1266 return; 1287 return;
1267 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); 1288 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader);
1268 } 1289 }
1269 1290
1270 } // namespace content 1291 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/aura/software_browser_compositor_output_surface.cc ('k') | content/browser/gpu/gpu_process_host_ui_shim.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698