Index: ui/ozone/platform/drm/gpu/gl_surface_gbm_buffered_surfaceless.h |
diff --git a/ui/ozone/platform/drm/gpu/gl_surface_gbm_buffered_surfaceless.h b/ui/ozone/platform/drm/gpu/gl_surface_gbm_buffered_surfaceless.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..4876d58856adcc6c55581c34a31da83e090d6e04 |
--- /dev/null |
+++ b/ui/ozone/platform/drm/gpu/gl_surface_gbm_buffered_surfaceless.h |
@@ -0,0 +1,56 @@ |
+// 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_BUFFERED_SURFACELESS_H_ |
+#define UI_OZONE_PLATFORM_DRM_GPU_GL_SURFACE_GBM_BUFFERED_SURFACELESS_H_ |
+ |
+#include <memory> |
+ |
+#include "base/macros.h" |
+#include "base/memory/ref_counted.h" |
+#include "ui/gl/gl_context.h" |
+#include "ui/gl/gl_image.h" |
+#include "ui/ozone/platform/drm/gpu/gl_surface_gbm_surfaceless.h" |
+ |
+namespace ui { |
+ |
+class GbmSurfaceFactory; |
+ |
+// This provides surface-like semantics implemented through surfaceless. |
+// A framebuffer is bound automatically. |
+class GLSurfaceGbmBufferedSurfaceless : public GLSurfaceGbmSurfaceless { |
+ public: |
+ GLSurfaceGbmBufferedSurfaceless(std::unique_ptr<DrmWindowProxy> window, |
+ GbmSurfaceFactory* surface_manager, |
+ gfx::AcceleratedWidget widget); |
+ |
+ // GLSurface: |
+ unsigned int GetBackingFrameBufferObject() override; |
+ bool OnMakeCurrent(gl::GLContext* context) override; |
+ bool Resize(const gfx::Size& size, |
+ float scale_factor, |
+ bool has_alpha) override; |
+ bool SupportsPostSubBuffer() override; |
+ void SwapBuffersAsync(const SwapCompletionCallback& callback) override; |
+ void Destroy() override; |
+ bool IsSurfaceless() const override; |
+ |
+ private: |
+ ~GLSurfaceGbmBufferedSurfaceless() override; |
+ |
+ void BindFramebuffer(); |
+ bool CreatePixmaps(); |
+ |
+ scoped_refptr<gl::GLContext> context_; |
+ GLuint fbo_; |
+ GLuint textures_[2]; |
+ scoped_refptr<gl::GLImage> images_[2]; |
+ int current_surface_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(GLSurfaceGbmBufferedSurfaceless); |
+}; |
+ |
+} // namespace ui |
+ |
+#endif // UI_OZONE_PLATFORM_DRM_GPU_GL_SURFACE_GBM_BUFFERED_SURFACELESS_H_ |