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_BUFFERED_SURFACELESS_H_ |
| 6 #define UI_OZONE_PLATFORM_DRM_GPU_GL_SURFACE_GBM_BUFFERED_SURFACELESS_H_ |
| 7 |
| 8 #include <memory> |
| 9 |
| 10 #include "base/macros.h" |
| 11 #include "base/memory/ref_counted.h" |
| 12 #include "ui/gl/gl_context.h" |
| 13 #include "ui/gl/gl_image.h" |
| 14 #include "ui/ozone/platform/drm/gpu/gl_surface_gbm_surfaceless.h" |
| 15 |
| 16 namespace ui { |
| 17 |
| 18 class GbmSurfaceFactory; |
| 19 |
| 20 // This provides surface-like semantics implemented through surfaceless. |
| 21 // A framebuffer is bound automatically. |
| 22 class GLSurfaceGbmBufferedSurfaceless : public GLSurfaceGbmSurfaceless { |
| 23 public: |
| 24 GLSurfaceGbmBufferedSurfaceless(std::unique_ptr<DrmWindowProxy> window, |
| 25 GbmSurfaceFactory* surface_manager, |
| 26 gfx::AcceleratedWidget widget); |
| 27 |
| 28 // GLSurface: |
| 29 unsigned int GetBackingFrameBufferObject() override; |
| 30 bool OnMakeCurrent(gl::GLContext* context) override; |
| 31 bool Resize(const gfx::Size& size, |
| 32 float scale_factor, |
| 33 bool has_alpha) override; |
| 34 bool SupportsPostSubBuffer() override; |
| 35 void SwapBuffersAsync(const SwapCompletionCallback& callback) override; |
| 36 void Destroy() override; |
| 37 bool IsSurfaceless() const override; |
| 38 |
| 39 private: |
| 40 ~GLSurfaceGbmBufferedSurfaceless() override; |
| 41 |
| 42 void BindFramebuffer(); |
| 43 bool CreatePixmaps(); |
| 44 |
| 45 scoped_refptr<gl::GLContext> context_; |
| 46 GLuint fbo_; |
| 47 GLuint textures_[2]; |
| 48 scoped_refptr<gl::GLImage> images_[2]; |
| 49 int current_surface_; |
| 50 |
| 51 DISALLOW_COPY_AND_ASSIGN(GLSurfaceGbmBufferedSurfaceless); |
| 52 }; |
| 53 |
| 54 } // namespace ui |
| 55 |
| 56 #endif // UI_OZONE_PLATFORM_DRM_GPU_GL_SURFACE_GBM_BUFFERED_SURFACELESS_H_ |
OLD | NEW |