| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef UI_OZONE_PLATFORM_DRM_GPU_GBM_SURFACE_FACTORY_H_ | 5 #ifndef UI_OZONE_PLATFORM_DRM_GPU_GBM_SURFACE_FACTORY_H_ |
| 6 #define UI_OZONE_PLATFORM_DRM_GPU_GBM_SURFACE_FACTORY_H_ | 6 #define UI_OZONE_PLATFORM_DRM_GPU_GBM_SURFACE_FACTORY_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 #include <memory> |
| 11 #include <vector> | 12 #include <vector> |
| 12 | 13 |
| 13 #include "base/macros.h" | 14 #include "base/macros.h" |
| 14 #include "base/threading/thread_checker.h" | 15 #include "base/threading/thread_checker.h" |
| 16 #include "ui/gl/gl_implementation.h" |
| 17 #include "ui/gl/gl_surface.h" |
| 15 #include "ui/ozone/public/surface_factory_ozone.h" | 18 #include "ui/ozone/public/surface_factory_ozone.h" |
| 16 | 19 |
| 17 namespace ui { | 20 namespace ui { |
| 18 | 21 |
| 19 class DrmThreadProxy; | 22 class DrmThreadProxy; |
| 20 class GbmDevice; | 23 class GbmDevice; |
| 21 class GbmSurfaceless; | 24 class GbmSurfaceless; |
| 22 | 25 |
| 23 class GbmSurfaceFactory : public SurfaceFactoryOzone { | 26 class GbmSurfaceFactory : public SurfaceFactoryOzone { |
| 24 public: | 27 public: |
| 25 explicit GbmSurfaceFactory(DrmThreadProxy* drm_thread); | 28 explicit GbmSurfaceFactory(DrmThreadProxy* drm_thread); |
| 26 ~GbmSurfaceFactory() override; | 29 ~GbmSurfaceFactory() override; |
| 27 | 30 |
| 28 void RegisterSurface(gfx::AcceleratedWidget widget, GbmSurfaceless* surface); | 31 void RegisterSurface(gfx::AcceleratedWidget widget, GbmSurfaceless* surface); |
| 29 void UnregisterSurface(gfx::AcceleratedWidget widget); | 32 void UnregisterSurface(gfx::AcceleratedWidget widget); |
| 30 GbmSurfaceless* GetSurface(gfx::AcceleratedWidget widget) const; | 33 GbmSurfaceless* GetSurface(gfx::AcceleratedWidget widget) const; |
| 31 | 34 |
| 32 // SurfaceFactoryOzone: | 35 // SurfaceFactoryOzone: |
| 36 bool UseNewSurfaceAPI() override; |
| 37 scoped_refptr<gl::GLSurface> CreateViewGLSurface( |
| 38 gl::GLImplementation implementation, |
| 39 gfx::AcceleratedWidget widget) override; |
| 40 scoped_refptr<gl::GLSurface> CreateSurfacelessViewGLSurface( |
| 41 gl::GLImplementation implementation, |
| 42 gfx::AcceleratedWidget widget) override; |
| 43 scoped_refptr<gl::GLSurface> CreateOffscreenGLSurface( |
| 44 gl::GLImplementation implementation, |
| 45 const gfx::Size& size) override; |
| 46 |
| 33 intptr_t GetNativeDisplay() override; | 47 intptr_t GetNativeDisplay() override; |
| 34 std::vector<gfx::BufferFormat> GetScanoutFormats( | 48 std::vector<gfx::BufferFormat> GetScanoutFormats( |
| 35 gfx::AcceleratedWidget widget) override; | 49 gfx::AcceleratedWidget widget) override; |
| 36 bool LoadEGLGLES2Bindings( | 50 bool LoadEGLGLES2Bindings( |
| 37 AddGLLibraryCallback add_gl_library, | 51 AddGLLibraryCallback add_gl_library, |
| 38 SetGLGetProcAddressProcCallback set_gl_get_proc_address) override; | 52 SetGLGetProcAddressProcCallback set_gl_get_proc_address) override; |
| 39 std::unique_ptr<SurfaceOzoneCanvas> CreateCanvasForWidget( | 53 std::unique_ptr<SurfaceOzoneCanvas> CreateCanvasForWidget( |
| 40 gfx::AcceleratedWidget widget) override; | 54 gfx::AcceleratedWidget widget) override; |
| 41 std::unique_ptr<ui::SurfaceOzoneEGL> CreateEGLSurfaceForWidget( | |
| 42 gfx::AcceleratedWidget w) override; | |
| 43 std::unique_ptr<SurfaceOzoneEGL> CreateSurfacelessEGLSurfaceForWidget( | |
| 44 gfx::AcceleratedWidget widget) override; | |
| 45 scoped_refptr<ui::NativePixmap> CreateNativePixmap( | 55 scoped_refptr<ui::NativePixmap> CreateNativePixmap( |
| 46 gfx::AcceleratedWidget widget, | 56 gfx::AcceleratedWidget widget, |
| 47 gfx::Size size, | 57 gfx::Size size, |
| 48 gfx::BufferFormat format, | 58 gfx::BufferFormat format, |
| 49 gfx::BufferUsage usage) override; | 59 gfx::BufferUsage usage) override; |
| 50 scoped_refptr<NativePixmap> CreateNativePixmapFromHandle( | 60 scoped_refptr<NativePixmap> CreateNativePixmapFromHandle( |
| 51 gfx::AcceleratedWidget widget, | 61 gfx::AcceleratedWidget widget, |
| 52 gfx::Size size, | 62 gfx::Size size, |
| 53 gfx::BufferFormat format, | 63 gfx::BufferFormat format, |
| 54 const gfx::NativePixmapHandle& handle) override; | 64 const gfx::NativePixmapHandle& handle) override; |
| 55 | 65 |
| 56 private: | 66 private: |
| 57 base::ThreadChecker thread_checker_; | 67 base::ThreadChecker thread_checker_; |
| 58 | 68 |
| 59 DrmThreadProxy* drm_thread_; | 69 DrmThreadProxy* drm_thread_; |
| 60 | 70 |
| 61 std::map<gfx::AcceleratedWidget, GbmSurfaceless*> widget_to_surface_map_; | 71 std::map<gfx::AcceleratedWidget, GbmSurfaceless*> widget_to_surface_map_; |
| 62 | 72 |
| 63 DISALLOW_COPY_AND_ASSIGN(GbmSurfaceFactory); | 73 DISALLOW_COPY_AND_ASSIGN(GbmSurfaceFactory); |
| 64 }; | 74 }; |
| 65 | 75 |
| 66 } // namespace ui | 76 } // namespace ui |
| 67 | 77 |
| 68 #endif // UI_OZONE_PLATFORM_DRM_GPU_GBM_SURFACE_FACTORY_H_ | 78 #endif // UI_OZONE_PLATFORM_DRM_GPU_GBM_SURFACE_FACTORY_H_ |
| OLD | NEW |