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

Side by Side Diff: content/renderer/android/synchronous_compositor_proxy.cc

Issue 1769913003: sync compositor: Add output_surface_id (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comment Created 4 years, 9 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/android/synchronous_compositor_proxy.h" 5 #include "content/renderer/android/synchronous_compositor_proxy.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/memory/shared_memory.h" 9 #include "base/memory/shared_memory.h"
10 #include "content/common/android/sync_compositor_messages.h" 10 #include "content/common/android/sync_compositor_messages.h"
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 &hardware_draw_reply_, reply_message); 211 &hardware_draw_reply_, reply_message);
212 output_surface_->DemandDrawHw(params.surface_size, params.transform, 212 output_surface_->DemandDrawHw(params.surface_size, params.transform,
213 params.viewport, params.clip, 213 params.viewport, params.clip,
214 params.viewport_rect_for_tile_priority, 214 params.viewport_rect_for_tile_priority,
215 params.transform_for_tile_priority); 215 params.transform_for_tile_priority);
216 } 216 }
217 217
218 if (inside_receive_) { 218 if (inside_receive_) {
219 // Did not swap. 219 // Did not swap.
220 cc::CompositorFrame empty_frame; 220 cc::CompositorFrame empty_frame;
221 SendDemandDrawHwReply(&empty_frame, reply_message); 221 SendDemandDrawHwReply(&empty_frame, 0u, reply_message);
222 inside_receive_ = false; 222 inside_receive_ = false;
223 } else { 223 } else {
224 DeliverMessages(); 224 DeliverMessages();
225 } 225 }
226 } 226 }
227 227
228 void SynchronousCompositorProxy::SwapBuffersHw(cc::CompositorFrame* frame) { 228 void SynchronousCompositorProxy::SwapBuffersHw(uint32_t output_surface_id,
229 cc::CompositorFrame* frame) {
229 DCHECK(inside_receive_); 230 DCHECK(inside_receive_);
230 DCHECK(hardware_draw_reply_); 231 DCHECK(hardware_draw_reply_);
231 DCHECK(frame); 232 DCHECK(frame);
232 SendDemandDrawHwReply(frame, hardware_draw_reply_); 233 SendDemandDrawHwReply(frame, output_surface_id, hardware_draw_reply_);
233 inside_receive_ = false; 234 inside_receive_ = false;
234 } 235 }
235 236
236 void SynchronousCompositorProxy::SendDemandDrawHwReply( 237 void SynchronousCompositorProxy::SendDemandDrawHwReply(
237 cc::CompositorFrame* frame, 238 cc::CompositorFrame* frame,
239 uint32_t output_surface_id,
238 IPC::Message* reply_message) { 240 IPC::Message* reply_message) {
239 SyncCompositorCommonRendererParams common_renderer_params; 241 SyncCompositorCommonRendererParams common_renderer_params;
240 PopulateCommonParams(&common_renderer_params); 242 PopulateCommonParams(&common_renderer_params);
241 // Not using WriteParams because cc::CompositorFrame is not copy-able. 243 // Not using WriteParams because cc::CompositorFrame is not copy-able.
dcheng 2016/03/22 07:22:37 I don't think WriteParams requires that the input
boliu 2016/03/22 15:25:50 Switched to WriteReplyParams. Honestly don't reme
242 IPC::ParamTraits<SyncCompositorCommonRendererParams>::Write( 244 IPC::ParamTraits<SyncCompositorCommonRendererParams>::Write(
243 reply_message, common_renderer_params); 245 reply_message, common_renderer_params);
246 IPC::ParamTraits<uint32_t>::Write(reply_message, output_surface_id);
244 IPC::ParamTraits<cc::CompositorFrame>::Write(reply_message, *frame); 247 IPC::ParamTraits<cc::CompositorFrame>::Write(reply_message, *frame);
245 Send(reply_message); 248 Send(reply_message);
246 } 249 }
247 250
248 struct SynchronousCompositorProxy::SharedMemoryWithSize { 251 struct SynchronousCompositorProxy::SharedMemoryWithSize {
249 base::SharedMemory shm; 252 base::SharedMemory shm;
250 const size_t buffer_size; 253 const size_t buffer_size;
251 bool zeroed; 254 bool zeroed;
252 255
253 SharedMemoryWithSize(base::SharedMemoryHandle shm_handle, size_t buffer_size) 256 SharedMemoryWithSize(base::SharedMemoryHandle shm_handle, size_t buffer_size)
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 SyncCompositorCommonRendererParams common_renderer_params; 362 SyncCompositorCommonRendererParams common_renderer_params;
360 PopulateCommonParams(&common_renderer_params); 363 PopulateCommonParams(&common_renderer_params);
361 // Not using WriteParams because cc::CompositorFrame is not copy-able. 364 // Not using WriteParams because cc::CompositorFrame is not copy-able.
362 IPC::ParamTraits<bool>::Write(reply_message, success); 365 IPC::ParamTraits<bool>::Write(reply_message, success);
363 IPC::ParamTraits<SyncCompositorCommonRendererParams>::Write( 366 IPC::ParamTraits<SyncCompositorCommonRendererParams>::Write(
364 reply_message, common_renderer_params); 367 reply_message, common_renderer_params);
365 IPC::ParamTraits<cc::CompositorFrame>::Write(reply_message, *frame); 368 IPC::ParamTraits<cc::CompositorFrame>::Write(reply_message, *frame);
366 Send(reply_message); 369 Send(reply_message);
367 } 370 }
368 371
369 void SynchronousCompositorProxy::SwapBuffers(cc::CompositorFrame* frame) { 372 void SynchronousCompositorProxy::SwapBuffers(uint32_t output_surface_id,
373 cc::CompositorFrame* frame) {
370 DCHECK(hardware_draw_reply_ || software_draw_reply_); 374 DCHECK(hardware_draw_reply_ || software_draw_reply_);
371 DCHECK(!(hardware_draw_reply_ && software_draw_reply_)); 375 DCHECK(!(hardware_draw_reply_ && software_draw_reply_));
372 if (hardware_draw_reply_) { 376 if (hardware_draw_reply_) {
373 SwapBuffersHw(frame); 377 SwapBuffersHw(output_surface_id, frame);
374 } else if (software_draw_reply_) { 378 } else if (software_draw_reply_) {
375 SwapBuffersSw(frame); 379 SwapBuffersSw(frame);
376 } 380 }
377 } 381 }
378 382
379 void SynchronousCompositorProxy::OnComputeScroll( 383 void SynchronousCompositorProxy::OnComputeScroll(
380 const SyncCompositorCommonBrowserParams& common_params, 384 const SyncCompositorCommonBrowserParams& common_params,
381 base::TimeTicks animation_time) { 385 base::TimeTicks animation_time) {
382 ProcessCommonParams(common_params); 386 ProcessCommonParams(common_params);
383 if (need_animate_scroll_) { 387 if (need_animate_scroll_) {
(...skipping 18 matching lines...) Expand all
402 } 406 }
403 if (common_params.update_root_scroll_offset && 407 if (common_params.update_root_scroll_offset &&
404 total_scroll_offset_ != common_params.root_scroll_offset) { 408 total_scroll_offset_ != common_params.root_scroll_offset) {
405 total_scroll_offset_ = common_params.root_scroll_offset; 409 total_scroll_offset_ = common_params.root_scroll_offset;
406 input_handler_proxy_->SynchronouslySetRootScrollOffset( 410 input_handler_proxy_->SynchronouslySetRootScrollOffset(
407 total_scroll_offset_); 411 total_scroll_offset_);
408 } 412 }
409 begin_frame_source_->SetBeginFrameSourcePaused( 413 begin_frame_source_->SetBeginFrameSourcePaused(
410 common_params.begin_frame_source_paused); 414 common_params.begin_frame_source_paused);
411 if (!common_params.ack.resources.empty()) { 415 if (!common_params.ack.resources.empty()) {
412 output_surface_->ReturnResources(common_params.ack); 416 output_surface_->ReturnResources(
417 common_params.output_surface_id_for_returned_resources,
418 common_params.ack);
413 } 419 }
414 } 420 }
415 421
416 } // namespace content 422 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698