| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef COMPONENTS_MUS_SURFACES_DIRECT_OUTPUT_SURFACE_OZONE_H_ | |
| 6 #define COMPONENTS_MUS_SURFACES_DIRECT_OUTPUT_SURFACE_OZONE_H_ | |
| 7 | |
| 8 #include <memory> | |
| 9 | |
| 10 #include "base/memory/weak_ptr.h" | |
| 11 #include "cc/output/context_provider.h" | |
| 12 #include "cc/output/output_surface.h" | |
| 13 #include "components/display_compositor/gl_helper.h" | |
| 14 #include "components/mus/surfaces/ozone_gpu_memory_buffer_manager.h" | |
| 15 #include "ui/gfx/geometry/size.h" | |
| 16 #include "ui/gfx/native_widget_types.h" | |
| 17 #include "ui/gfx/swap_result.h" | |
| 18 #include "ui/gl/gl_surface.h" | |
| 19 | |
| 20 namespace display_compositor { | |
| 21 class BufferQueue; | |
| 22 } | |
| 23 | |
| 24 namespace ui { | |
| 25 class LatencyInfo; | |
| 26 } // namespace ui | |
| 27 | |
| 28 namespace cc { | |
| 29 class CompositorFrame; | |
| 30 class SyntheticBeginFrameSource; | |
| 31 } // namespace cc | |
| 32 | |
| 33 namespace mus { | |
| 34 | |
| 35 class SurfacesContextProvider; | |
| 36 | |
| 37 // An OutputSurface implementation that directly draws and swap to a GL | |
| 38 // "surfaceless" surface (aka one backed by a buffer managed explicitly in | |
| 39 // mus/ozone. This class is adapted from | |
| 40 // GpuSurfacelessBrowserCompositorOutputSurface. | |
| 41 class DirectOutputSurfaceOzone : public cc::OutputSurface { | |
| 42 public: | |
| 43 DirectOutputSurfaceOzone( | |
| 44 scoped_refptr<SurfacesContextProvider> context_provider, | |
| 45 gfx::AcceleratedWidget widget, | |
| 46 cc::SyntheticBeginFrameSource* synthetic_begin_frame_source, | |
| 47 uint32_t target, | |
| 48 uint32_t internalformat); | |
| 49 | |
| 50 ~DirectOutputSurfaceOzone() override; | |
| 51 | |
| 52 // TODO(rjkroege): Implement the equivalent of Reflector. | |
| 53 | |
| 54 private: | |
| 55 // cc::OutputSurface implementation. | |
| 56 void SwapBuffers(cc::CompositorFrame frame) override; | |
| 57 void BindFramebuffer() override; | |
| 58 uint32_t GetFramebufferCopyTextureFormat() override; | |
| 59 void Reshape(const gfx::Size& size, | |
| 60 float scale_factor, | |
| 61 const gfx::ColorSpace& color_space, | |
| 62 bool alpha) override; | |
| 63 bool IsDisplayedAsOverlayPlane() const override; | |
| 64 unsigned GetOverlayTextureId() const override; | |
| 65 bool BindToClient(cc::OutputSurfaceClient* client) override; | |
| 66 | |
| 67 // Taken from BrowserCompositor specific API. | |
| 68 void OnUpdateVSyncParametersFromGpu(base::TimeTicks timebase, | |
| 69 base::TimeDelta interval); | |
| 70 | |
| 71 // Called when a swap completion is sent from the GPU process. | |
| 72 void OnGpuSwapBuffersCompleted(gfx::SwapResult result); | |
| 73 | |
| 74 display_compositor::GLHelper gl_helper_; | |
| 75 std::unique_ptr<OzoneGpuMemoryBufferManager> ozone_gpu_memory_buffer_manager_; | |
| 76 std::unique_ptr<display_compositor::BufferQueue> buffer_queue_; | |
| 77 cc::SyntheticBeginFrameSource* const synthetic_begin_frame_source_; | |
| 78 | |
| 79 base::WeakPtrFactory<DirectOutputSurfaceOzone> weak_ptr_factory_; | |
| 80 }; | |
| 81 | |
| 82 } // namespace mus | |
| 83 | |
| 84 #endif // COMPONENTS_MUS_SURFACES_DIRECT_OUTPUT_SURFACE_OZONE_H_ | |
| OLD | NEW |