| 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 SERVICES_UI_SURFACES_DIRECT_OUTPUT_SURFACE_OZONE_H_ | |
| 6 #define SERVICES_UI_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/in_process_context_provider.h" | |
| 13 #include "cc/output/output_surface.h" | |
| 14 #include "components/display_compositor/gl_helper.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 cc { | |
| 21 class CompositorFrame; | |
| 22 class SyntheticBeginFrameSource; | |
| 23 } | |
| 24 | |
| 25 namespace display_compositor { | |
| 26 class BufferQueue; | |
| 27 } | |
| 28 | |
| 29 namespace gpu { | |
| 30 class GpuMemoryBufferManager; | |
| 31 } | |
| 32 | |
| 33 namespace ui { | |
| 34 | |
| 35 // An OutputSurface implementation that directly draws and swap to a GL | |
| 36 // "surfaceless" surface (aka one backed by a buffer managed explicitly in | |
| 37 // mus/ozone. This class is adapted from | |
| 38 // GpuSurfacelessBrowserCompositorOutputSurface. | |
| 39 class DirectOutputSurfaceOzone : public cc::OutputSurface { | |
| 40 public: | |
| 41 DirectOutputSurfaceOzone( | |
| 42 scoped_refptr<cc::InProcessContextProvider> context_provider, | |
| 43 gfx::AcceleratedWidget widget, | |
| 44 cc::SyntheticBeginFrameSource* synthetic_begin_frame_source, | |
| 45 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | |
| 46 uint32_t target, | |
| 47 uint32_t internalformat); | |
| 48 | |
| 49 ~DirectOutputSurfaceOzone() override; | |
| 50 | |
| 51 // TODO(rjkroege): Implement the equivalent of Reflector. | |
| 52 | |
| 53 private: | |
| 54 // cc::OutputSurface implementation. | |
| 55 void BindToClient(cc::OutputSurfaceClient* client) override; | |
| 56 void EnsureBackbuffer() override; | |
| 57 void DiscardBackbuffer() override; | |
| 58 void BindFramebuffer() override; | |
| 59 void Reshape(const gfx::Size& size, | |
| 60 float device_scale_factor, | |
| 61 const gfx::ColorSpace& color_space, | |
| 62 bool has_alpha) override; | |
| 63 void SwapBuffers(cc::OutputSurfaceFrame frame) override; | |
| 64 uint32_t GetFramebufferCopyTextureFormat() override; | |
| 65 cc::OverlayCandidateValidator* GetOverlayCandidateValidator() const override; | |
| 66 bool IsDisplayedAsOverlayPlane() const override; | |
| 67 unsigned GetOverlayTextureId() const override; | |
| 68 bool SurfaceIsSuspendForRecycle() const override; | |
| 69 bool HasExternalStencilTest() const override; | |
| 70 void ApplyExternalStencil() override; | |
| 71 | |
| 72 // Called when a swap completion is signaled from ImageTransportSurface. | |
| 73 void OnGpuSwapBuffersCompleted( | |
| 74 const std::vector<ui::LatencyInfo>& latency_info, | |
| 75 gfx::SwapResult result, | |
| 76 const gpu::GpuProcessHostedCALayerTreeParamsMac* params_mac); | |
| 77 void OnVSyncParametersUpdated(base::TimeTicks timebase, | |
| 78 base::TimeDelta interval); | |
| 79 | |
| 80 cc::OutputSurfaceClient* client_ = nullptr; | |
| 81 | |
| 82 display_compositor::GLHelper gl_helper_; | |
| 83 std::unique_ptr<display_compositor::BufferQueue> buffer_queue_; | |
| 84 cc::SyntheticBeginFrameSource* const synthetic_begin_frame_source_; | |
| 85 | |
| 86 gfx::Size reshape_size_; | |
| 87 gfx::Size swap_size_; | |
| 88 | |
| 89 base::WeakPtrFactory<DirectOutputSurfaceOzone> weak_ptr_factory_; | |
| 90 }; | |
| 91 | |
| 92 } // namespace ui | |
| 93 | |
| 94 #endif // SERVICES_UI_SURFACES_DIRECT_OUTPUT_SURFACE_OZONE_H_ | |
| OLD | NEW |