| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "cc/surfaces/direct_compositor_frame_sink.h" | 5 #include "cc/surfaces/direct_compositor_frame_sink.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "cc/output/compositor_frame.h" | 8 #include "cc/output/compositor_frame.h" |
| 9 #include "cc/output/compositor_frame_sink_client.h" | 9 #include "cc/output/compositor_frame_sink_client.h" |
| 10 #include "cc/surfaces/display.h" | 10 #include "cc/surfaces/display.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | 24 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
| 25 SharedBitmapManager* shared_bitmap_manager) | 25 SharedBitmapManager* shared_bitmap_manager) |
| 26 : CompositorFrameSink(std::move(context_provider), | 26 : CompositorFrameSink(std::move(context_provider), |
| 27 std::move(worker_context_provider), | 27 std::move(worker_context_provider), |
| 28 gpu_memory_buffer_manager, | 28 gpu_memory_buffer_manager, |
| 29 shared_bitmap_manager), | 29 shared_bitmap_manager), |
| 30 frame_sink_id_(frame_sink_id), | 30 frame_sink_id_(frame_sink_id), |
| 31 surface_manager_(surface_manager), | 31 surface_manager_(surface_manager), |
| 32 display_(display) { | 32 display_(display) { |
| 33 DCHECK(thread_checker_.CalledOnValidThread()); | 33 DCHECK(thread_checker_.CalledOnValidThread()); |
| 34 capabilities_.can_force_reclaim_resources = true; | 34 capabilities_.must_always_swap = true; |
| 35 // Display and DirectCompositorFrameSink share a GL context, so sync | 35 // Display and DirectCompositorFrameSink share a GL context, so sync |
| 36 // points aren't needed when passing resources between them. | 36 // points aren't needed when passing resources between them. |
| 37 capabilities_.delegated_sync_points_required = false; | 37 capabilities_.delegated_sync_points_required = false; |
| 38 } | 38 } |
| 39 | 39 |
| 40 DirectCompositorFrameSink::DirectCompositorFrameSink( | 40 DirectCompositorFrameSink::DirectCompositorFrameSink( |
| 41 const FrameSinkId& frame_sink_id, | 41 const FrameSinkId& frame_sink_id, |
| 42 SurfaceManager* surface_manager, | 42 SurfaceManager* surface_manager, |
| 43 Display* display, | 43 Display* display, |
| 44 scoped_refptr<VulkanContextProvider> vulkan_context_provider) | 44 scoped_refptr<VulkanContextProvider> vulkan_context_provider) |
| 45 : CompositorFrameSink(std::move(vulkan_context_provider)), | 45 : CompositorFrameSink(std::move(vulkan_context_provider)), |
| 46 frame_sink_id_(frame_sink_id), | 46 frame_sink_id_(frame_sink_id), |
| 47 surface_manager_(surface_manager), | 47 surface_manager_(surface_manager), |
| 48 display_(display) { | 48 display_(display) { |
| 49 DCHECK(thread_checker_.CalledOnValidThread()); | 49 DCHECK(thread_checker_.CalledOnValidThread()); |
| 50 capabilities_.can_force_reclaim_resources = true; | 50 capabilities_.must_always_swap = true; |
| 51 } | 51 } |
| 52 | 52 |
| 53 DirectCompositorFrameSink::~DirectCompositorFrameSink() { | 53 DirectCompositorFrameSink::~DirectCompositorFrameSink() { |
| 54 DCHECK(thread_checker_.CalledOnValidThread()); | 54 DCHECK(thread_checker_.CalledOnValidThread()); |
| 55 } | 55 } |
| 56 | 56 |
| 57 bool DirectCompositorFrameSink::BindToClient( | 57 bool DirectCompositorFrameSink::BindToClient( |
| 58 CompositorFrameSinkClient* client) { | 58 CompositorFrameSinkClient* client) { |
| 59 DCHECK(thread_checker_.CalledOnValidThread()); | 59 DCHECK(thread_checker_.CalledOnValidThread()); |
| 60 | 60 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 delegated_local_surface_id_ = local_surface_id_allocator_.GenerateId(); | 103 delegated_local_surface_id_ = local_surface_id_allocator_.GenerateId(); |
| 104 last_swap_frame_size_ = frame_size; | 104 last_swap_frame_size_ = frame_size; |
| 105 } | 105 } |
| 106 display_->SetLocalSurfaceId(delegated_local_surface_id_, | 106 display_->SetLocalSurfaceId(delegated_local_surface_id_, |
| 107 frame.metadata.device_scale_factor); | 107 frame.metadata.device_scale_factor); |
| 108 | 108 |
| 109 support_->SubmitCompositorFrame(delegated_local_surface_id_, | 109 support_->SubmitCompositorFrame(delegated_local_surface_id_, |
| 110 std::move(frame)); | 110 std::move(frame)); |
| 111 } | 111 } |
| 112 | 112 |
| 113 void DirectCompositorFrameSink::ForceReclaimResources() { | |
| 114 support_->ForceReclaimResources(); | |
| 115 } | |
| 116 | |
| 117 void DirectCompositorFrameSink::DisplayOutputSurfaceLost() { | 113 void DirectCompositorFrameSink::DisplayOutputSurfaceLost() { |
| 118 is_lost_ = true; | 114 is_lost_ = true; |
| 119 client_->DidLoseCompositorFrameSink(); | 115 client_->DidLoseCompositorFrameSink(); |
| 120 } | 116 } |
| 121 | 117 |
| 122 void DirectCompositorFrameSink::DisplayWillDrawAndSwap( | 118 void DirectCompositorFrameSink::DisplayWillDrawAndSwap( |
| 123 bool will_draw_and_swap, | 119 bool will_draw_and_swap, |
| 124 const RenderPassList& render_passes) { | 120 const RenderPassList& render_passes) { |
| 125 // This notification is not relevant to our client outside of tests. | 121 // This notification is not relevant to our client outside of tests. |
| 126 } | 122 } |
| (...skipping 29 matching lines...) Expand all Loading... |
| 156 support_->SetNeedsBeginFrame(needs_begin_frame); | 152 support_->SetNeedsBeginFrame(needs_begin_frame); |
| 157 } | 153 } |
| 158 | 154 |
| 159 void DirectCompositorFrameSink::OnDidFinishFrame(const BeginFrameAck& ack) { | 155 void DirectCompositorFrameSink::OnDidFinishFrame(const BeginFrameAck& ack) { |
| 160 // If there was damage, SubmitCompositorFrame includes the ack. | 156 // If there was damage, SubmitCompositorFrame includes the ack. |
| 161 if (!ack.has_damage) | 157 if (!ack.has_damage) |
| 162 support_->BeginFrameDidNotSwap(ack); | 158 support_->BeginFrameDidNotSwap(ack); |
| 163 } | 159 } |
| 164 | 160 |
| 165 } // namespace cc | 161 } // namespace cc |
| OLD | NEW |