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

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 21 matching lines...) Expand all
43 ViewMsg_SwapCompositorFrameAck::ID 45 ViewMsg_SwapCompositorFrameAck::ID
44 }; 46 };
45 47
46 return new IPC::ForwardingMessageFilter( 48 return new IPC::ForwardingMessageFilter(
47 messages_to_filter, arraysize(messages_to_filter), 49 messages_to_filter, arraysize(messages_to_filter),
48 target_task_runner); 50 target_task_runner);
49 } 51 }
50 52
51 CompositorOutputSurface::CompositorOutputSurface( 53 CompositorOutputSurface::CompositorOutputSurface(
52 int32 routing_id, 54 int32 routing_id,
53 WebGraphicsContext3D* context3D, 55 WebGraphicsContext3DCommandBufferImpl* context3D,
54 cc::SoftwareOutputDevice* software_device) 56 cc::SoftwareOutputDevice* software_device)
55 : OutputSurface(make_scoped_ptr(context3D), 57 : OutputSurface(scoped_ptr<WebKit::WebGraphicsContext3D>(context3D),
56 make_scoped_ptr(software_device)), 58 make_scoped_ptr(software_device)),
57 output_surface_filter_( 59 output_surface_filter_(
58 RenderThreadImpl::current()->compositor_output_surface_filter()), 60 RenderThreadImpl::current()->compositor_output_surface_filter()),
59 routing_id_(routing_id), 61 routing_id_(routing_id),
60 prefers_smoothness_(false), 62 prefers_smoothness_(false),
61 main_thread_id_(base::PlatformThread::CurrentId()) { 63 main_thread_id_(base::PlatformThread::CurrentId()) {
62 DCHECK(output_surface_filter_); 64 DCHECK(output_surface_filter_);
63 CommandLine* command_line = CommandLine::ForCurrentProcess(); 65 CommandLine* command_line = CommandLine::ForCurrentProcess();
64 capabilities_.has_parent_compositor = command_line->HasSwitch( 66 capabilities_.has_parent_compositor = command_line->HasSwitch(
65 switches::kEnableDelegatedRenderer); 67 switches::kEnableDelegatedRenderer);
(...skipping 25 matching lines...) Expand all
91 93
92 return true; 94 return true;
93 } 95 }
94 96
95 void CompositorOutputSurface::SendFrameToParentCompositor( 97 void CompositorOutputSurface::SendFrameToParentCompositor(
96 cc::CompositorFrame* frame) { 98 cc::CompositorFrame* frame) {
97 DCHECK(CalledOnValidThread()); 99 DCHECK(CalledOnValidThread());
98 Send(new ViewHostMsg_SwapCompositorFrame(routing_id_, *frame)); 100 Send(new ViewHostMsg_SwapCompositorFrame(routing_id_, *frame));
99 } 101 }
100 102
103 void CompositorOutputSurface::SwapBuffers(
104 const cc::LatencyInfo& latency_info) {
105 WebGraphicsContext3DCommandBufferImpl* command_buffer =
106 static_cast<WebGraphicsContext3DCommandBufferImpl*>(context3d());
107 CommandBufferProxyImpl* command_buffer_proxy =
108 command_buffer->GetCommandBufferProxy();
109 DCHECK(command_buffer_proxy);
110 context3d()->shallowFlushCHROMIUM();
111 command_buffer_proxy->SetLatencyInfo(latency_info);
112 OutputSurface::SwapBuffers(latency_info);
113 }
114
115 void CompositorOutputSurface::PostSubBuffer(
116 gfx::Rect rect, const cc::LatencyInfo& latency_info) {
117 WebGraphicsContext3DCommandBufferImpl* command_buffer =
118 static_cast<WebGraphicsContext3DCommandBufferImpl*>(context3d());
119 CommandBufferProxyImpl* command_buffer_proxy =
120 command_buffer->GetCommandBufferProxy();
121 DCHECK(command_buffer_proxy);
122 context3d()->shallowFlushCHROMIUM();
123 command_buffer_proxy->SetLatencyInfo(latency_info);
124 OutputSurface::PostSubBuffer(rect, latency_info);
125 }
126
101 void CompositorOutputSurface::OnMessageReceived(const IPC::Message& message) { 127 void CompositorOutputSurface::OnMessageReceived(const IPC::Message& message) {
102 DCHECK(CalledOnValidThread()); 128 DCHECK(CalledOnValidThread());
103 if (!client_) 129 if (!client_)
104 return; 130 return;
105 IPC_BEGIN_MESSAGE_MAP(CompositorOutputSurface, message) 131 IPC_BEGIN_MESSAGE_MAP(CompositorOutputSurface, message)
106 IPC_MESSAGE_HANDLER(ViewMsg_UpdateVSyncParameters, OnUpdateVSyncParameters); 132 IPC_MESSAGE_HANDLER(ViewMsg_UpdateVSyncParameters, OnUpdateVSyncParameters);
107 IPC_MESSAGE_HANDLER(ViewMsg_SwapCompositorFrameAck, OnSwapAck); 133 IPC_MESSAGE_HANDLER(ViewMsg_SwapCompositorFrameAck, OnSwapAck);
108 IPC_END_MESSAGE_MAP() 134 IPC_END_MESSAGE_MAP()
109 } 135 }
110 136
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 // If this is the last surface to stop preferring smoothness, 185 // If this is the last surface to stop preferring smoothness,
160 // Reset the main thread's priority to the default. 186 // Reset the main thread's priority to the default.
161 if (prefers_smoothness_ == true && 187 if (prefers_smoothness_ == true &&
162 --g_prefer_smoothness_count == 0) { 188 --g_prefer_smoothness_count == 0) {
163 SetThreadsPriorityToDefault(main_thread_id_); 189 SetThreadsPriorityToDefault(main_thread_id_);
164 } 190 }
165 prefers_smoothness_ = prefers_smoothness; 191 prefers_smoothness_ = prefers_smoothness;
166 } 192 }
167 193
168 } // namespace content 194 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/gpu/compositor_output_surface.h ('k') | content/renderer/gpu/mailbox_output_surface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698