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 #ifndef SERVICES_UI_SURFACES_DIRECT_OUTPUT_SURFACE_OZONE_H_ | 5 #ifndef SERVICES_UI_SURFACES_DIRECT_OUTPUT_SURFACE_OZONE_H_ |
6 #define SERVICES_UI_SURFACES_DIRECT_OUTPUT_SURFACE_OZONE_H_ | 6 #define SERVICES_UI_SURFACES_DIRECT_OUTPUT_SURFACE_OZONE_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
11 #include "cc/output/context_provider.h" | 11 #include "cc/output/context_provider.h" |
| 12 #include "cc/output/in_process_context_provider.h" |
12 #include "cc/output/output_surface.h" | 13 #include "cc/output/output_surface.h" |
13 #include "components/display_compositor/gl_helper.h" | 14 #include "components/display_compositor/gl_helper.h" |
14 #include "services/ui/surfaces/surfaces_context_provider.h" | |
15 #include "ui/gfx/geometry/size.h" | 15 #include "ui/gfx/geometry/size.h" |
16 #include "ui/gfx/native_widget_types.h" | 16 #include "ui/gfx/native_widget_types.h" |
17 #include "ui/gfx/swap_result.h" | 17 #include "ui/gfx/swap_result.h" |
18 #include "ui/gl/gl_surface.h" | 18 #include "ui/gl/gl_surface.h" |
19 | 19 |
20 namespace cc { | 20 namespace cc { |
21 class CompositorFrame; | 21 class CompositorFrame; |
22 class SyntheticBeginFrameSource; | 22 class SyntheticBeginFrameSource; |
23 } | 23 } |
24 | 24 |
25 namespace display_compositor { | 25 namespace display_compositor { |
26 class BufferQueue; | 26 class BufferQueue; |
27 } | 27 } |
28 | 28 |
29 namespace gpu { | 29 namespace gpu { |
30 class GpuMemoryBufferManager; | 30 class GpuMemoryBufferManager; |
31 } | 31 } |
32 | 32 |
33 namespace ui { | 33 namespace ui { |
34 | 34 |
35 // An OutputSurface implementation that directly draws and swap to a GL | 35 // An OutputSurface implementation that directly draws and swap to a GL |
36 // "surfaceless" surface (aka one backed by a buffer managed explicitly in | 36 // "surfaceless" surface (aka one backed by a buffer managed explicitly in |
37 // mus/ozone. This class is adapted from | 37 // mus/ozone. This class is adapted from |
38 // GpuSurfacelessBrowserCompositorOutputSurface. | 38 // GpuSurfacelessBrowserCompositorOutputSurface. |
39 class DirectOutputSurfaceOzone : public cc::OutputSurface { | 39 class DirectOutputSurfaceOzone : public cc::OutputSurface { |
40 public: | 40 public: |
41 DirectOutputSurfaceOzone( | 41 DirectOutputSurfaceOzone( |
42 scoped_refptr<SurfacesContextProvider> context_provider, | 42 scoped_refptr<cc::InProcessContextProvider> context_provider, |
43 gfx::AcceleratedWidget widget, | 43 gfx::AcceleratedWidget widget, |
44 cc::SyntheticBeginFrameSource* synthetic_begin_frame_source, | 44 cc::SyntheticBeginFrameSource* synthetic_begin_frame_source, |
45 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | 45 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
46 uint32_t target, | 46 uint32_t target, |
47 uint32_t internalformat); | 47 uint32_t internalformat); |
48 | 48 |
49 ~DirectOutputSurfaceOzone() override; | 49 ~DirectOutputSurfaceOzone() override; |
50 | 50 |
51 // TODO(rjkroege): Implement the equivalent of Reflector. | 51 // TODO(rjkroege): Implement the equivalent of Reflector. |
52 | 52 |
(...skipping 14 matching lines...) Expand all Loading... |
67 unsigned GetOverlayTextureId() const override; | 67 unsigned GetOverlayTextureId() const override; |
68 bool SurfaceIsSuspendForRecycle() const override; | 68 bool SurfaceIsSuspendForRecycle() const override; |
69 bool HasExternalStencilTest() const override; | 69 bool HasExternalStencilTest() const override; |
70 void ApplyExternalStencil() override; | 70 void ApplyExternalStencil() override; |
71 | 71 |
72 // Taken from BrowserCompositor specific API. | 72 // Taken from BrowserCompositor specific API. |
73 void OnUpdateVSyncParametersFromGpu(base::TimeTicks timebase, | 73 void OnUpdateVSyncParametersFromGpu(base::TimeTicks timebase, |
74 base::TimeDelta interval); | 74 base::TimeDelta interval); |
75 | 75 |
76 // Called when a swap completion is sent from the GPU process. | 76 // Called when a swap completion is sent from the GPU process. |
77 void OnGpuSwapBuffersCompleted(gfx::SwapResult result); | 77 void OnGpuSwapBuffersCompleted( |
| 78 const std::vector<ui::LatencyInfo>& latency_info, |
| 79 gfx::SwapResult result, |
| 80 const gpu::GpuProcessHostedCALayerTreeParamsMac* params_mac); |
78 | 81 |
79 cc::OutputSurfaceClient* client_ = nullptr; | 82 cc::OutputSurfaceClient* client_ = nullptr; |
80 | 83 |
81 display_compositor::GLHelper gl_helper_; | 84 display_compositor::GLHelper gl_helper_; |
82 std::unique_ptr<display_compositor::BufferQueue> buffer_queue_; | 85 std::unique_ptr<display_compositor::BufferQueue> buffer_queue_; |
83 cc::SyntheticBeginFrameSource* const synthetic_begin_frame_source_; | 86 cc::SyntheticBeginFrameSource* const synthetic_begin_frame_source_; |
84 | 87 |
85 gfx::Size reshape_size_; | 88 gfx::Size reshape_size_; |
86 gfx::Size swap_size_; | 89 gfx::Size swap_size_; |
87 | 90 |
88 base::WeakPtrFactory<DirectOutputSurfaceOzone> weak_ptr_factory_; | 91 base::WeakPtrFactory<DirectOutputSurfaceOzone> weak_ptr_factory_; |
89 }; | 92 }; |
90 | 93 |
91 } // namespace ui | 94 } // namespace ui |
92 | 95 |
93 #endif // SERVICES_UI_SURFACES_DIRECT_OUTPUT_SURFACE_OZONE_H_ | 96 #endif // SERVICES_UI_SURFACES_DIRECT_OUTPUT_SURFACE_OZONE_H_ |
OLD | NEW |