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 UI_OZONE_PLATFORM_DRM_GPU_GL_SURFACE_GBM_SURFACELESS_H_ | |
6 #define UI_OZONE_PLATFORM_DRM_GPU_GL_SURFACE_GBM_SURFACELESS_H_ | |
7 | |
8 #include <memory> | |
9 #include <vector> | |
10 | |
11 #include "base/macros.h" | |
12 #include "base/memory/scoped_vector.h" | |
13 #include "base/memory/weak_ptr.h" | |
14 #include "ui/gl/gl_image.h" | |
15 #include "ui/gl/gl_surface_egl.h" | |
16 #include "ui/gl/gl_surface_overlay.h" | |
17 #include "ui/gl/scoped_binders.h" | |
18 #include "ui/ozone/platform/drm/gpu/overlay_plane.h" | |
19 | |
20 namespace ui { | |
21 | |
22 class DrmWindowProxy; | |
23 class GbmSurfaceFactory; | |
24 | |
25 class GLSurfaceGbmSurfaceless : public gl::SurfacelessEGL { | |
dnicoara
2016/07/21 17:41:38
nit: I'm thinking we could simplify the naming a b
kylechar
2016/07/21 18:34:08
Done.
| |
26 public: | |
27 GLSurfaceGbmSurfaceless(std::unique_ptr<DrmWindowProxy> window, | |
28 GbmSurfaceFactory* surface_manager, | |
29 gfx::AcceleratedWidget widget); | |
30 | |
31 void QueueOverlayPlane(const OverlayPlane& plane); | |
32 | |
33 // GLSurface: | |
34 bool Initialize(GLSurface::Format format) override; | |
35 gfx::SwapResult SwapBuffers() override; | |
36 bool ScheduleOverlayPlane(int z_order, | |
37 gfx::OverlayTransform transform, | |
38 gl::GLImage* image, | |
39 const gfx::Rect& bounds_rect, | |
40 const gfx::RectF& crop_rect) override; | |
41 bool IsOffscreen() override; | |
42 gfx::VSyncProvider* GetVSyncProvider() override; | |
43 bool SupportsAsyncSwap() override; | |
44 bool SupportsPostSubBuffer() override; | |
45 gfx::SwapResult PostSubBuffer(int x, int y, int width, int height) override; | |
46 void SwapBuffersAsync(const SwapCompletionCallback& callback) override; | |
47 void PostSubBufferAsync(int x, | |
48 int y, | |
49 int width, | |
50 int height, | |
51 const SwapCompletionCallback& callback) override; | |
52 EGLConfig GetConfig() override; | |
53 | |
54 protected: | |
55 struct PendingFrame { | |
56 PendingFrame(); | |
57 ~PendingFrame(); | |
58 | |
59 bool ScheduleOverlayPlanes(gfx::AcceleratedWidget widget); | |
60 void Flush(); | |
61 | |
62 bool ready; | |
63 std::vector<gl::GLSurfaceOverlay> overlays; | |
64 SwapCompletionCallback callback; | |
65 }; | |
66 | |
67 ~GLSurfaceGbmSurfaceless() override; | |
68 | |
69 void SubmitFrame(); | |
70 | |
71 EGLSyncKHR InsertFence(bool implicit); | |
72 void FenceRetired(EGLSyncKHR fence, PendingFrame* frame); | |
73 | |
74 void SwapCompleted(const SwapCompletionCallback& callback, | |
75 gfx::SwapResult result); | |
76 | |
77 bool IsUniversalDisplayLinkDevice(); | |
78 | |
79 std::unique_ptr<DrmWindowProxy> window_; | |
80 GbmSurfaceFactory* surface_manager_; | |
81 std::vector<OverlayPlane> planes_; | |
82 | |
83 // The native surface. Deleting this is allowed to free the EGLNativeWindow. | |
84 gfx::AcceleratedWidget widget_; | |
85 std::unique_ptr<gfx::VSyncProvider> vsync_provider_; | |
86 ScopedVector<PendingFrame> unsubmitted_frames_; | |
87 bool has_implicit_external_sync_; | |
88 bool has_image_flush_external_; | |
89 bool last_swap_buffers_result_; | |
90 bool swap_buffers_pending_; | |
91 | |
92 base::WeakPtrFactory<GLSurfaceGbmSurfaceless> weak_factory_; | |
93 | |
94 private: | |
95 DISALLOW_COPY_AND_ASSIGN(GLSurfaceGbmSurfaceless); | |
96 }; | |
97 | |
98 } // namespace ui | |
99 #endif // UI_OZONE_PLATFORM_DRM_GPU_GL_SURFACE_GBM_SURFACELESS_H_ | |
OLD | NEW |