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 <memory> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "base/threading/thread_checker.h" | 15 #include "base/threading/thread_checker.h" |
16 #include "ui/gl/gl_implementation.h" | 16 #include "ui/gl/gl_implementation.h" |
17 #include "ui/gl/gl_surface.h" | 17 #include "ui/gl/gl_surface.h" |
| 18 #include "ui/ozone/common/gl_ozone_egl.h" |
18 #include "ui/ozone/public/surface_factory_ozone.h" | 19 #include "ui/ozone/public/surface_factory_ozone.h" |
19 | 20 |
20 namespace ui { | 21 namespace ui { |
21 | 22 |
22 class DrmThreadProxy; | 23 class DrmThreadProxy; |
23 class GbmDevice; | 24 class GbmDevice; |
24 class GbmSurfaceless; | 25 class GbmSurfaceless; |
25 | 26 |
26 class GbmSurfaceFactory : public SurfaceFactoryOzone { | 27 class GbmSurfaceFactory : public SurfaceFactoryOzone { |
27 public: | 28 public: |
28 explicit GbmSurfaceFactory(DrmThreadProxy* drm_thread); | 29 explicit GbmSurfaceFactory(DrmThreadProxy* drm_thread); |
29 ~GbmSurfaceFactory() override; | 30 ~GbmSurfaceFactory() override; |
30 | 31 |
31 void RegisterSurface(gfx::AcceleratedWidget widget, GbmSurfaceless* surface); | 32 void RegisterSurface(gfx::AcceleratedWidget widget, GbmSurfaceless* surface); |
32 void UnregisterSurface(gfx::AcceleratedWidget widget); | 33 void UnregisterSurface(gfx::AcceleratedWidget widget); |
33 GbmSurfaceless* GetSurface(gfx::AcceleratedWidget widget) const; | 34 GbmSurfaceless* GetSurface(gfx::AcceleratedWidget widget) const; |
34 | 35 |
35 // SurfaceFactoryOzone: | 36 // SurfaceFactoryOzone: |
36 scoped_refptr<gl::GLSurface> CreateViewGLSurface( | 37 std::vector<gl::GLImplementation> GetAllowedGLImplementations() override; |
37 gl::GLImplementation implementation, | 38 GLOzone* GetGLOzone(gl::GLImplementation implementation) override; |
38 gfx::AcceleratedWidget widget) override; | |
39 scoped_refptr<gl::GLSurface> CreateSurfacelessViewGLSurface( | |
40 gl::GLImplementation implementation, | |
41 gfx::AcceleratedWidget widget) override; | |
42 scoped_refptr<gl::GLSurface> CreateOffscreenGLSurface( | |
43 gl::GLImplementation implementation, | |
44 const gfx::Size& size) override; | |
45 | 39 |
46 intptr_t GetNativeDisplay() override; | |
47 std::vector<gfx::BufferFormat> GetScanoutFormats( | 40 std::vector<gfx::BufferFormat> GetScanoutFormats( |
48 gfx::AcceleratedWidget widget) override; | 41 gfx::AcceleratedWidget widget) override; |
49 bool LoadEGLGLES2Bindings() override; | |
50 std::unique_ptr<SurfaceOzoneCanvas> CreateCanvasForWidget( | 42 std::unique_ptr<SurfaceOzoneCanvas> CreateCanvasForWidget( |
51 gfx::AcceleratedWidget widget) override; | 43 gfx::AcceleratedWidget widget) override; |
52 scoped_refptr<ui::NativePixmap> CreateNativePixmap( | 44 scoped_refptr<ui::NativePixmap> CreateNativePixmap( |
53 gfx::AcceleratedWidget widget, | 45 gfx::AcceleratedWidget widget, |
54 gfx::Size size, | 46 gfx::Size size, |
55 gfx::BufferFormat format, | 47 gfx::BufferFormat format, |
56 gfx::BufferUsage usage) override; | 48 gfx::BufferUsage usage) override; |
57 scoped_refptr<NativePixmap> CreateNativePixmapFromHandle( | 49 scoped_refptr<NativePixmap> CreateNativePixmapFromHandle( |
58 gfx::AcceleratedWidget widget, | 50 gfx::AcceleratedWidget widget, |
59 gfx::Size size, | 51 gfx::Size size, |
60 gfx::BufferFormat format, | 52 gfx::BufferFormat format, |
61 const gfx::NativePixmapHandle& handle) override; | 53 const gfx::NativePixmapHandle& handle) override; |
62 | 54 |
63 private: | 55 private: |
| 56 std::unique_ptr<GLOzone> egl_implementation_; |
| 57 |
64 base::ThreadChecker thread_checker_; | 58 base::ThreadChecker thread_checker_; |
65 | 59 |
66 DrmThreadProxy* drm_thread_; | 60 DrmThreadProxy* drm_thread_; |
67 | 61 |
68 std::map<gfx::AcceleratedWidget, GbmSurfaceless*> widget_to_surface_map_; | 62 std::map<gfx::AcceleratedWidget, GbmSurfaceless*> widget_to_surface_map_; |
69 | 63 |
70 DISALLOW_COPY_AND_ASSIGN(GbmSurfaceFactory); | 64 DISALLOW_COPY_AND_ASSIGN(GbmSurfaceFactory); |
71 }; | 65 }; |
72 | 66 |
73 } // namespace ui | 67 } // namespace ui |
74 | 68 |
75 #endif // UI_OZONE_PLATFORM_DRM_GPU_GBM_SURFACE_FACTORY_H_ | 69 #endif // UI_OZONE_PLATFORM_DRM_GPU_GBM_SURFACE_FACTORY_H_ |
OLD | NEW |