| 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 <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/threading/thread_checker.h" | 10 #include "base/threading/thread_checker.h" |
| 11 #include "ui/ozone/public/surface_factory_ozone.h" | 11 #include "ui/ozone/public/surface_factory_ozone.h" |
| 12 | 12 |
| 13 namespace ui { | 13 namespace ui { |
| 14 | 14 |
| 15 class DrmDeviceManager; | 15 class DrmThreadProxy; |
| 16 class DrmWindow; | |
| 17 class GbmDevice; | 16 class GbmDevice; |
| 18 class GbmSurfaceless; | 17 class GbmSurfaceless; |
| 19 class ScreenManager; | |
| 20 | 18 |
| 21 class GbmSurfaceFactory : public SurfaceFactoryOzone { | 19 class GbmSurfaceFactory : public SurfaceFactoryOzone { |
| 22 public: | 20 public: |
| 23 GbmSurfaceFactory(); | 21 GbmSurfaceFactory(DrmThreadProxy* drm_thread); |
| 24 ~GbmSurfaceFactory() override; | 22 ~GbmSurfaceFactory() override; |
| 25 | 23 |
| 26 void InitializeGpu(DrmDeviceManager* drm_device_manager, | |
| 27 ScreenManager* screen_manager); | |
| 28 | |
| 29 void RegisterSurface(gfx::AcceleratedWidget widget, GbmSurfaceless* surface); | 24 void RegisterSurface(gfx::AcceleratedWidget widget, GbmSurfaceless* surface); |
| 30 void UnregisterSurface(gfx::AcceleratedWidget widget); | 25 void UnregisterSurface(gfx::AcceleratedWidget widget); |
| 31 GbmSurfaceless* GetSurface(gfx::AcceleratedWidget widget) const; | 26 GbmSurfaceless* GetSurface(gfx::AcceleratedWidget widget) const; |
| 32 | 27 |
| 33 // DrmSurfaceFactory: | 28 // SurfaceFactoryOzone: |
| 34 intptr_t GetNativeDisplay() override; | 29 intptr_t GetNativeDisplay() override; |
| 35 const int32_t* GetEGLSurfaceProperties(const int32_t* desired_list) override; | 30 const int32_t* GetEGLSurfaceProperties(const int32_t* desired_list) override; |
| 36 bool LoadEGLGLES2Bindings( | 31 bool LoadEGLGLES2Bindings( |
| 37 AddGLLibraryCallback add_gl_library, | 32 AddGLLibraryCallback add_gl_library, |
| 38 SetGLGetProcAddressProcCallback set_gl_get_proc_address) override; | 33 SetGLGetProcAddressProcCallback set_gl_get_proc_address) override; |
| 39 scoped_ptr<SurfaceOzoneCanvas> CreateCanvasForWidget( | 34 scoped_ptr<SurfaceOzoneCanvas> CreateCanvasForWidget( |
| 40 gfx::AcceleratedWidget widget) override; | 35 gfx::AcceleratedWidget widget) override; |
| 41 scoped_ptr<ui::SurfaceOzoneEGL> CreateEGLSurfaceForWidget( | 36 scoped_ptr<ui::SurfaceOzoneEGL> CreateEGLSurfaceForWidget( |
| 42 gfx::AcceleratedWidget w) override; | 37 gfx::AcceleratedWidget w) override; |
| 43 scoped_ptr<SurfaceOzoneEGL> CreateSurfacelessEGLSurfaceForWidget( | 38 scoped_ptr<SurfaceOzoneEGL> CreateSurfacelessEGLSurfaceForWidget( |
| 44 gfx::AcceleratedWidget widget) override; | 39 gfx::AcceleratedWidget widget) override; |
| 45 scoped_refptr<ui::NativePixmap> CreateNativePixmap( | 40 scoped_refptr<ui::NativePixmap> CreateNativePixmap( |
| 46 gfx::AcceleratedWidget widget, | 41 gfx::AcceleratedWidget widget, |
| 47 gfx::Size size, | 42 gfx::Size size, |
| 48 gfx::BufferFormat format, | 43 gfx::BufferFormat format, |
| 49 gfx::BufferUsage usage) override; | 44 gfx::BufferUsage usage) override; |
| 50 | 45 |
| 51 private: | 46 private: |
| 52 scoped_refptr<GbmDevice> GetGbmDevice(gfx::AcceleratedWidget widget); | 47 scoped_refptr<GbmDevice> GetGbmDevice(gfx::AcceleratedWidget widget); |
| 53 | 48 |
| 54 DrmDeviceManager* drm_device_manager_; // Not owned. | 49 base::ThreadChecker thread_checker_; |
| 55 ScreenManager* screen_manager_; // Not owned. | |
| 56 | 50 |
| 57 base::ThreadChecker thread_checker_; | 51 DrmThreadProxy* drm_thread_; |
| 58 | 52 |
| 59 std::map<gfx::AcceleratedWidget, GbmSurfaceless*> widget_to_surface_map_; | 53 std::map<gfx::AcceleratedWidget, GbmSurfaceless*> widget_to_surface_map_; |
| 60 | 54 |
| 61 DISALLOW_COPY_AND_ASSIGN(GbmSurfaceFactory); | 55 DISALLOW_COPY_AND_ASSIGN(GbmSurfaceFactory); |
| 62 }; | 56 }; |
| 63 | 57 |
| 64 } // namespace ui | 58 } // namespace ui |
| 65 | 59 |
| 66 #endif // UI_OZONE_PLATFORM_DRM_GPU_GBM_SURFACE_FACTORY_H_ | 60 #endif // UI_OZONE_PLATFORM_DRM_GPU_GBM_SURFACE_FACTORY_H_ |
| OLD | NEW |