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_GBM_SURFACE_H_ |
| 6 #define UI_OZONE_PLATFORM_DRM_GPU_GBM_SURFACE_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/gbm_surfaceless.h" |
| 15 |
| 16 namespace ui { |
| 17 |
| 18 class DrmWindowProxy; |
| 19 class GbmSurfaceFactory; |
| 20 |
| 21 // A GLSurface for GBM Ozone platform provides surface-like semantics |
| 22 // implemented through surfaceless. A framebuffer is bound automatically. |
| 23 class GbmSurface : public GbmSurfaceless { |
| 24 public: |
| 25 GbmSurface(GbmSurfaceFactory* surface_factory, |
| 26 std::unique_ptr<DrmWindowProxy> window, |
| 27 gfx::AcceleratedWidget widget); |
| 28 |
| 29 // gl::GLSurface: |
| 30 unsigned int GetBackingFrameBufferObject() override; |
| 31 bool OnMakeCurrent(gl::GLContext* context) override; |
| 32 bool Resize(const gfx::Size& size, |
| 33 float scale_factor, |
| 34 bool has_alpha) override; |
| 35 bool SupportsPostSubBuffer() override; |
| 36 void SwapBuffersAsync(const SwapCompletionCallback& callback) override; |
| 37 void Destroy() override; |
| 38 bool IsSurfaceless() const override; |
| 39 |
| 40 private: |
| 41 ~GbmSurface() override; |
| 42 |
| 43 void BindFramebuffer(); |
| 44 bool CreatePixmaps(); |
| 45 |
| 46 scoped_refptr<gl::GLContext> context_; |
| 47 GLuint fbo_ = 0; |
| 48 GLuint textures_[2]; |
| 49 scoped_refptr<gl::GLImage> images_[2]; |
| 50 int current_surface_ = 0; |
| 51 |
| 52 DISALLOW_COPY_AND_ASSIGN(GbmSurface); |
| 53 }; |
| 54 |
| 55 } // namespace ui |
| 56 |
| 57 #endif // UI_OZONE_PLATFORM_DRM_GPU_GBM_SURFACE_H_ |
OLD | NEW |