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

Side by Side Diff: content/renderer/gpu/compositor_output_surface.cc

Issue 12614013: Plumb cc::LatencyInfo through command buffer and output surface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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 | Annotate | Revision Log
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/renderer/gpu/compositor_output_surface.h" 5 #include "content/renderer/gpu/compositor_output_surface.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/message_loop_proxy.h" 8 #include "base/message_loop_proxy.h"
9 #include "cc/output/compositor_frame.h" 9 #include "cc/output/compositor_frame.h"
10 #include "cc/output/compositor_frame_ack.h" 10 #include "cc/output/compositor_frame_ack.h"
11 #include "cc/output/output_surface_client.h" 11 #include "cc/output/output_surface_client.h"
12 #include "content/common/gpu/client/command_buffer_proxy_impl.h"
13 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
12 #include "content/common/view_messages.h" 14 #include "content/common/view_messages.h"
13 #include "content/public/common/content_switches.h" 15 #include "content/public/common/content_switches.h"
14 #include "content/renderer/render_thread_impl.h" 16 #include "content/renderer/render_thread_impl.h"
15 #include "ipc/ipc_forwarding_message_filter.h" 17 #include "ipc/ipc_forwarding_message_filter.h"
16 #include "ipc/ipc_sync_channel.h" 18 #include "ipc/ipc_sync_channel.h"
17 #include "ipc/ipc_sync_message_filter.h" 19 #include "ipc/ipc_sync_message_filter.h"
18 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3 D.h" 20 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3 D.h"
19 21
20 #if defined(OS_ANDROID) 22 #if defined(OS_ANDROID)
21 // TODO(epenner): Move thread priorities to base. (crbug.com/170549) 23 // TODO(epenner): Move thread priorities to base. (crbug.com/170549)
(...skipping 23 matching lines...) Expand all
45 ViewMsg_SwapCompositorFrameAck::ID 47 ViewMsg_SwapCompositorFrameAck::ID
46 }; 48 };
47 49
48 return new IPC::ForwardingMessageFilter( 50 return new IPC::ForwardingMessageFilter(
49 messages_to_filter, arraysize(messages_to_filter), 51 messages_to_filter, arraysize(messages_to_filter),
50 target_task_runner); 52 target_task_runner);
51 } 53 }
52 54
53 CompositorOutputSurface::CompositorOutputSurface( 55 CompositorOutputSurface::CompositorOutputSurface(
54 int32 routing_id, 56 int32 routing_id,
55 WebGraphicsContext3D* context3D, 57 WebGraphicsContext3DCommandBufferImpl* context3D,
56 cc::SoftwareOutputDevice* software_device) 58 cc::SoftwareOutputDevice* software_device)
57 : OutputSurface(make_scoped_ptr(context3D), 59 : OutputSurface(scoped_ptr<WebKit::WebGraphicsContext3D>(context3D),
58 make_scoped_ptr(software_device)), 60 make_scoped_ptr(software_device)),
59 output_surface_filter_( 61 output_surface_filter_(
60 RenderThreadImpl::current()->compositor_output_surface_filter()), 62 RenderThreadImpl::current()->compositor_output_surface_filter()),
61 routing_id_(routing_id), 63 routing_id_(routing_id),
62 prefers_smoothness_(false), 64 prefers_smoothness_(false),
63 main_thread_id_(base::PlatformThread::CurrentId()) { 65 main_thread_id_(base::PlatformThread::CurrentId()) {
64 DCHECK(output_surface_filter_); 66 DCHECK(output_surface_filter_);
65 CommandLine* command_line = CommandLine::ForCurrentProcess(); 67 CommandLine* command_line = CommandLine::ForCurrentProcess();
66 capabilities_.has_parent_compositor = command_line->HasSwitch( 68 capabilities_.has_parent_compositor = command_line->HasSwitch(
67 switches::kEnableDelegatedRenderer); 69 switches::kEnableDelegatedRenderer);
(...skipping 25 matching lines...) Expand all
93 95
94 return true; 96 return true;
95 } 97 }
96 98
97 void CompositorOutputSurface::SendFrameToParentCompositor( 99 void CompositorOutputSurface::SendFrameToParentCompositor(
98 cc::CompositorFrame* frame) { 100 cc::CompositorFrame* frame) {
99 DCHECK(CalledOnValidThread()); 101 DCHECK(CalledOnValidThread());
100 Send(new ViewHostMsg_SwapCompositorFrame(routing_id_, *frame)); 102 Send(new ViewHostMsg_SwapCompositorFrame(routing_id_, *frame));
101 } 103 }
102 104
105 void CompositorOutputSurface::SwapBuffers(
106 const cc::LatencyInfo& latency_info) {
107 WebGraphicsContext3DCommandBufferImpl* command_buffer =
108 static_cast<WebGraphicsContext3DCommandBufferImpl*>(context3d());
109 CommandBufferProxyImpl* command_buffer_proxy =
110 command_buffer->GetCommandBufferProxy();
111 if (command_buffer_proxy) {
piman 2013/04/03 18:05:09 I think DCHECK is enough. If we're able to send co
112 context3d()->flush();
piman 2013/04/03 18:05:09 nit: shallowFlush
113 command_buffer_proxy->SetLatencyInfo(latency_info);
114 }
115 OutputSurface::SwapBuffers(latency_info);
116 }
117
118 void CompositorOutputSurface::PostSubBuffer(
119 gfx::Rect rect, const cc::LatencyInfo& latency_info) {
120 WebGraphicsContext3DCommandBufferImpl* command_buffer =
121 static_cast<WebGraphicsContext3DCommandBufferImpl*>(context3d());
122 CommandBufferProxyImpl* command_buffer_proxy =
123 command_buffer->GetCommandBufferProxy();
124 if (command_buffer_proxy) {
piman 2013/04/03 18:05:09 just DCHECK
125 context3d()->flush();
piman 2013/04/03 18:05:09 nit: shallowFlush
126 command_buffer_proxy->SetLatencyInfo(latency_info);
127 }
128 OutputSurface::PostSubBuffer(rect, latency_info);
129 }
130
103 void CompositorOutputSurface::OnMessageReceived(const IPC::Message& message) { 131 void CompositorOutputSurface::OnMessageReceived(const IPC::Message& message) {
104 DCHECK(CalledOnValidThread()); 132 DCHECK(CalledOnValidThread());
105 if (!client_) 133 if (!client_)
106 return; 134 return;
107 IPC_BEGIN_MESSAGE_MAP(CompositorOutputSurface, message) 135 IPC_BEGIN_MESSAGE_MAP(CompositorOutputSurface, message)
108 IPC_MESSAGE_HANDLER(ViewMsg_UpdateVSyncParameters, OnUpdateVSyncParameters); 136 IPC_MESSAGE_HANDLER(ViewMsg_UpdateVSyncParameters, OnUpdateVSyncParameters);
109 IPC_MESSAGE_HANDLER(ViewMsg_SwapCompositorFrameAck, OnSwapAck); 137 IPC_MESSAGE_HANDLER(ViewMsg_SwapCompositorFrameAck, OnSwapAck);
110 IPC_END_MESSAGE_MAP() 138 IPC_END_MESSAGE_MAP()
111 } 139 }
112 140
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 // If this is the last surface to stop preferring smoothness, 189 // If this is the last surface to stop preferring smoothness,
162 // Reset the main thread's priority to the default. 190 // Reset the main thread's priority to the default.
163 if (prefers_smoothness_ == true && 191 if (prefers_smoothness_ == true &&
164 --g_prefer_smoothness_count == 0) { 192 --g_prefer_smoothness_count == 0) {
165 SetThreadsPriorityToDefault(main_thread_id_); 193 SetThreadsPriorityToDefault(main_thread_id_);
166 } 194 }
167 prefers_smoothness_ = prefers_smoothness; 195 prefers_smoothness_ = prefers_smoothness;
168 } 196 }
169 197
170 } // namespace content 198 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698