OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "services/ui/surfaces/direct_output_surface_ozone.h" | 5 #include "services/ui/surfaces/direct_output_surface_ozone.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
11 #include "cc/output/compositor_frame.h" | |
12 #include "cc/output/context_provider.h" | 11 #include "cc/output/context_provider.h" |
13 #include "cc/output/output_surface_client.h" | 12 #include "cc/output/output_surface_client.h" |
| 13 #include "cc/output/output_surface_frame.h" |
14 #include "cc/scheduler/begin_frame_source.h" | 14 #include "cc/scheduler/begin_frame_source.h" |
15 #include "components/display_compositor/buffer_queue.h" | 15 #include "components/display_compositor/buffer_queue.h" |
16 #include "gpu/command_buffer/client/context_support.h" | 16 #include "gpu/command_buffer/client/context_support.h" |
17 #include "gpu/command_buffer/client/gles2_interface.h" | 17 #include "gpu/command_buffer/client/gles2_interface.h" |
18 #include "services/ui/surfaces/surfaces_context_provider.h" | 18 #include "services/ui/surfaces/surfaces_context_provider.h" |
19 #include "ui/display/types/display_snapshot.h" | 19 #include "ui/display/types/display_snapshot.h" |
20 | 20 |
21 using display_compositor::BufferQueue; | 21 using display_compositor::BufferQueue; |
22 | 22 |
23 namespace ui { | 23 namespace ui { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 | 76 |
77 void DirectOutputSurfaceOzone::DiscardBackbuffer() { | 77 void DirectOutputSurfaceOzone::DiscardBackbuffer() { |
78 context_provider()->ContextGL()->DiscardBackbufferCHROMIUM(); | 78 context_provider()->ContextGL()->DiscardBackbufferCHROMIUM(); |
79 } | 79 } |
80 | 80 |
81 void DirectOutputSurfaceOzone::BindFramebuffer() { | 81 void DirectOutputSurfaceOzone::BindFramebuffer() { |
82 DCHECK(buffer_queue_); | 82 DCHECK(buffer_queue_); |
83 buffer_queue_->BindFramebuffer(); | 83 buffer_queue_->BindFramebuffer(); |
84 } | 84 } |
85 | 85 |
86 void DirectOutputSurfaceOzone::SwapBuffers(cc::CompositorFrame frame) { | 86 void DirectOutputSurfaceOzone::SwapBuffers(cc::OutputSurfaceFrame frame) { |
87 DCHECK(buffer_queue_); | 87 DCHECK(buffer_queue_); |
88 DCHECK(frame.gl_frame_data); | |
89 | 88 |
90 buffer_queue_->SwapBuffers(frame.gl_frame_data->sub_buffer_rect); | 89 buffer_queue_->SwapBuffers(frame.sub_buffer_rect); |
91 | 90 |
92 // Code combining GpuBrowserCompositorOutputSurface + DirectOutputSurface | 91 // Code combining GpuBrowserCompositorOutputSurface + DirectOutputSurface |
93 if (frame.gl_frame_data->sub_buffer_rect == | 92 if (frame.sub_buffer_rect == gfx::Rect(frame.size)) { |
94 gfx::Rect(frame.gl_frame_data->size)) { | |
95 context_provider_->ContextSupport()->Swap(); | 93 context_provider_->ContextSupport()->Swap(); |
96 } else { | 94 } else { |
97 context_provider_->ContextSupport()->PartialSwapBuffers( | 95 context_provider_->ContextSupport()->PartialSwapBuffers( |
98 frame.gl_frame_data->sub_buffer_rect); | 96 frame.sub_buffer_rect); |
99 } | 97 } |
100 | 98 |
101 gpu::gles2::GLES2Interface* gl = context_provider_->ContextGL(); | 99 gpu::gles2::GLES2Interface* gl = context_provider_->ContextGL(); |
102 const GLuint64 fence_sync = gl->InsertFenceSyncCHROMIUM(); | 100 const GLuint64 fence_sync = gl->InsertFenceSyncCHROMIUM(); |
103 gl->ShallowFlushCHROMIUM(); | 101 gl->ShallowFlushCHROMIUM(); |
104 | 102 |
105 gpu::SyncToken sync_token; | 103 gpu::SyncToken sync_token; |
106 gl->GenUnverifiedSyncTokenCHROMIUM(fence_sync, sync_token.GetData()); | 104 gl->GenUnverifiedSyncTokenCHROMIUM(fence_sync, sync_token.GetData()); |
107 } | 105 } |
108 | 106 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 } | 167 } |
170 | 168 |
171 buffer_queue_->PageFlipComplete(); | 169 buffer_queue_->PageFlipComplete(); |
172 client_->DidSwapBuffersComplete(); | 170 client_->DidSwapBuffersComplete(); |
173 | 171 |
174 if (force_swap) | 172 if (force_swap) |
175 client_->SetNeedsRedrawRect(gfx::Rect(SurfaceSize())); | 173 client_->SetNeedsRedrawRect(gfx::Rect(SurfaceSize())); |
176 } | 174 } |
177 | 175 |
178 } // namespace ui | 176 } // namespace ui |
OLD | NEW |