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/surface_display_output_surface.h" | 5 #include "cc/surfaces/surface_display_output_surface.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_ack.h" | 9 #include "cc/output/compositor_frame_ack.h" |
10 #include "cc/surfaces/display.h" | 10 #include "cc/surfaces/display.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 allocator_(allocator) { | 26 allocator_(allocator) { |
27 factory_.set_needs_sync_points(false); | 27 factory_.set_needs_sync_points(false); |
28 capabilities_.delegated_rendering = true; | 28 capabilities_.delegated_rendering = true; |
29 capabilities_.adjust_deadline_for_parent = true; | 29 capabilities_.adjust_deadline_for_parent = true; |
30 capabilities_.can_force_reclaim_resources = true; | 30 capabilities_.can_force_reclaim_resources = true; |
31 // Display and SurfaceDisplayOutputSurface share a GL context, so sync | 31 // Display and SurfaceDisplayOutputSurface share a GL context, so sync |
32 // points aren't needed when passing resources between them. | 32 // points aren't needed when passing resources between them. |
33 capabilities_.delegated_sync_points_required = false; | 33 capabilities_.delegated_sync_points_required = false; |
34 } | 34 } |
35 | 35 |
| 36 #if defined(ENABLE_VULKAN) |
| 37 SurfaceDisplayOutputSurface::SurfaceDisplayOutputSurface( |
| 38 SurfaceManager* surface_manager, |
| 39 SurfaceIdAllocator* allocator, |
| 40 scoped_refptr<VulkanContextProvider> vulkan_context_provider) |
| 41 : OutputSurface(std::move(vulkan_context_provider), true), |
| 42 display_client_(NULL), |
| 43 factory_(surface_manager, this), |
| 44 allocator_(allocator) { |
| 45 capabilities_.delegated_rendering = true; |
| 46 capabilities_.adjust_deadline_for_parent = true; |
| 47 capabilities_.can_force_reclaim_resources = true; |
| 48 } |
| 49 #endif |
| 50 |
36 SurfaceDisplayOutputSurface::~SurfaceDisplayOutputSurface() { | 51 SurfaceDisplayOutputSurface::~SurfaceDisplayOutputSurface() { |
37 if (HasClient()) | 52 if (HasClient()) |
38 DetachFromClient(); | 53 DetachFromClient(); |
39 if (!surface_id_.is_null()) { | 54 if (!surface_id_.is_null()) { |
40 factory_.Destroy(surface_id_); | 55 factory_.Destroy(surface_id_); |
41 } | 56 } |
42 } | 57 } |
43 | 58 |
44 void SurfaceDisplayOutputSurface::SwapBuffers(CompositorFrame* frame) { | 59 void SurfaceDisplayOutputSurface::SwapBuffers(CompositorFrame* frame) { |
45 gfx::Size frame_size = | 60 gfx::Size frame_size = |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 DCHECK(client_); | 121 DCHECK(client_); |
107 client_->SetBeginFrameSource(begin_frame_source); | 122 client_->SetBeginFrameSource(begin_frame_source); |
108 } | 123 } |
109 | 124 |
110 void SurfaceDisplayOutputSurface::SwapBuffersComplete(SurfaceDrawStatus drawn) { | 125 void SurfaceDisplayOutputSurface::SwapBuffersComplete(SurfaceDrawStatus drawn) { |
111 if (client_ && !display_client_->output_surface_lost()) | 126 if (client_ && !display_client_->output_surface_lost()) |
112 client_->DidSwapBuffersComplete(); | 127 client_->DidSwapBuffersComplete(); |
113 } | 128 } |
114 | 129 |
115 } // namespace cc | 130 } // namespace cc |
OLD | NEW |