Index: ui/ozone/platform/drm/gpu/gl_surface_gbm_surfaceless.h |
diff --git a/ui/ozone/platform/drm/gpu/gl_surface_gbm_surfaceless.h b/ui/ozone/platform/drm/gpu/gl_surface_gbm_surfaceless.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..73bf68a2ee9238e2c864edf85effdc27c0be8611 |
--- /dev/null |
+++ b/ui/ozone/platform/drm/gpu/gl_surface_gbm_surfaceless.h |
@@ -0,0 +1,99 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef UI_OZONE_PLATFORM_DRM_GPU_GL_SURFACE_GBM_SURFACELESS_H_ |
+#define UI_OZONE_PLATFORM_DRM_GPU_GL_SURFACE_GBM_SURFACELESS_H_ |
+ |
+#include <memory> |
+#include <vector> |
+ |
+#include "base/macros.h" |
+#include "base/memory/scoped_vector.h" |
+#include "base/memory/weak_ptr.h" |
+#include "ui/gl/gl_image.h" |
+#include "ui/gl/gl_surface_egl.h" |
+#include "ui/gl/gl_surface_overlay.h" |
+#include "ui/gl/scoped_binders.h" |
+#include "ui/ozone/platform/drm/gpu/overlay_plane.h" |
+ |
+namespace ui { |
+ |
+class DrmWindowProxy; |
+class GbmSurfaceFactory; |
+ |
+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.
|
+ public: |
+ GLSurfaceGbmSurfaceless(std::unique_ptr<DrmWindowProxy> window, |
+ GbmSurfaceFactory* surface_manager, |
+ gfx::AcceleratedWidget widget); |
+ |
+ void QueueOverlayPlane(const OverlayPlane& plane); |
+ |
+ // GLSurface: |
+ bool Initialize(GLSurface::Format format) override; |
+ gfx::SwapResult SwapBuffers() override; |
+ bool ScheduleOverlayPlane(int z_order, |
+ gfx::OverlayTransform transform, |
+ gl::GLImage* image, |
+ const gfx::Rect& bounds_rect, |
+ const gfx::RectF& crop_rect) override; |
+ bool IsOffscreen() override; |
+ gfx::VSyncProvider* GetVSyncProvider() override; |
+ bool SupportsAsyncSwap() override; |
+ bool SupportsPostSubBuffer() override; |
+ gfx::SwapResult PostSubBuffer(int x, int y, int width, int height) override; |
+ void SwapBuffersAsync(const SwapCompletionCallback& callback) override; |
+ void PostSubBufferAsync(int x, |
+ int y, |
+ int width, |
+ int height, |
+ const SwapCompletionCallback& callback) override; |
+ EGLConfig GetConfig() override; |
+ |
+ protected: |
+ struct PendingFrame { |
+ PendingFrame(); |
+ ~PendingFrame(); |
+ |
+ bool ScheduleOverlayPlanes(gfx::AcceleratedWidget widget); |
+ void Flush(); |
+ |
+ bool ready; |
+ std::vector<gl::GLSurfaceOverlay> overlays; |
+ SwapCompletionCallback callback; |
+ }; |
+ |
+ ~GLSurfaceGbmSurfaceless() override; |
+ |
+ void SubmitFrame(); |
+ |
+ EGLSyncKHR InsertFence(bool implicit); |
+ void FenceRetired(EGLSyncKHR fence, PendingFrame* frame); |
+ |
+ void SwapCompleted(const SwapCompletionCallback& callback, |
+ gfx::SwapResult result); |
+ |
+ bool IsUniversalDisplayLinkDevice(); |
+ |
+ std::unique_ptr<DrmWindowProxy> window_; |
+ GbmSurfaceFactory* surface_manager_; |
+ std::vector<OverlayPlane> planes_; |
+ |
+ // The native surface. Deleting this is allowed to free the EGLNativeWindow. |
+ gfx::AcceleratedWidget widget_; |
+ std::unique_ptr<gfx::VSyncProvider> vsync_provider_; |
+ ScopedVector<PendingFrame> unsubmitted_frames_; |
+ bool has_implicit_external_sync_; |
+ bool has_image_flush_external_; |
+ bool last_swap_buffers_result_; |
+ bool swap_buffers_pending_; |
+ |
+ base::WeakPtrFactory<GLSurfaceGbmSurfaceless> weak_factory_; |
+ |
+ private: |
+ DISALLOW_COPY_AND_ASSIGN(GLSurfaceGbmSurfaceless); |
+}; |
+ |
+} // namespace ui |
+#endif // UI_OZONE_PLATFORM_DRM_GPU_GL_SURFACE_GBM_SURFACELESS_H_ |