| 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 #include "ui/ozone/platform/dri/ozone_platform_gbm.h" | 5 #include "ui/ozone/platform/dri/ozone_platform_gbm.h" |
| 6 | 6 |
| 7 #include <dlfcn.h> | 7 #include <dlfcn.h> |
| 8 #include <gbm.h> | 8 #include <gbm.h> |
| 9 #include <stdlib.h> | 9 #include <stdlib.h> |
| 10 | 10 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 virtual GpuPlatformSupport* GetGpuPlatformSupport() override { | 91 virtual GpuPlatformSupport* GetGpuPlatformSupport() override { |
| 92 return gpu_platform_support_.get(); | 92 return gpu_platform_support_.get(); |
| 93 } | 93 } |
| 94 virtual GpuPlatformSupportHost* GetGpuPlatformSupportHost() override { | 94 virtual GpuPlatformSupportHost* GetGpuPlatformSupportHost() override { |
| 95 return gpu_platform_support_host_.get(); | 95 return gpu_platform_support_host_.get(); |
| 96 } | 96 } |
| 97 virtual scoped_ptr<PlatformWindow> CreatePlatformWindow( | 97 virtual scoped_ptr<PlatformWindow> CreatePlatformWindow( |
| 98 PlatformWindowDelegate* delegate, | 98 PlatformWindowDelegate* delegate, |
| 99 const gfx::Rect& bounds) override { | 99 const gfx::Rect& bounds) override { |
| 100 scoped_ptr<DriWindow> platform_window( | 100 scoped_ptr<DriWindow> platform_window( |
| 101 new DriWindow(delegate, | 101 new DriWindow(delegate, bounds, gpu_platform_support_host_.get(), |
| 102 bounds, | 102 event_factory_ozone_.get(), window_manager_.get())); |
| 103 gpu_platform_support_host_.get(), | |
| 104 event_factory_ozone_.get(), | |
| 105 window_manager_.get())); | |
| 106 platform_window->Initialize(); | 103 platform_window->Initialize(); |
| 107 return platform_window.Pass(); | 104 return platform_window.Pass(); |
| 108 } | 105 } |
| 109 virtual scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() | 106 virtual scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() |
| 110 override { | 107 override { |
| 111 return scoped_ptr<NativeDisplayDelegate>(new NativeDisplayDelegateProxy( | 108 return scoped_ptr<NativeDisplayDelegate>(new NativeDisplayDelegateProxy( |
| 112 gpu_platform_support_host_.get(), device_manager_.get())); | 109 gpu_platform_support_host_.get(), device_manager_.get())); |
| 113 } | 110 } |
| 114 virtual void InitializeUI() override { | 111 virtual void InitializeUI() override { |
| 115 vt_manager_.reset(new VirtualTerminalManager()); | 112 vt_manager_.reset(new VirtualTerminalManager()); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 128 virtual void InitializeGPU() override { | 125 virtual void InitializeGPU() override { |
| 129 dri_.reset(new DriWrapper(kDefaultGraphicsCardPath)); | 126 dri_.reset(new DriWrapper(kDefaultGraphicsCardPath)); |
| 130 dri_->Initialize(); | 127 dri_->Initialize(); |
| 131 buffer_generator_.reset(new GbmBufferGenerator(dri_.get())); | 128 buffer_generator_.reset(new GbmBufferGenerator(dri_.get())); |
| 132 screen_manager_.reset(new ScreenManager(dri_.get(), | 129 screen_manager_.reset(new ScreenManager(dri_.get(), |
| 133 buffer_generator_.get())); | 130 buffer_generator_.get())); |
| 134 window_delegate_manager_.reset(new DriWindowDelegateManager()); | 131 window_delegate_manager_.reset(new DriWindowDelegateManager()); |
| 135 if (!surface_factory_ozone_) | 132 if (!surface_factory_ozone_) |
| 136 surface_factory_ozone_.reset(new GbmSurfaceFactory(use_surfaceless_)); | 133 surface_factory_ozone_.reset(new GbmSurfaceFactory(use_surfaceless_)); |
| 137 | 134 |
| 138 surface_factory_ozone_->InitializeGpu(dri_.get(), | 135 surface_factory_ozone_->InitializeGpu( |
| 139 buffer_generator_->device(), | 136 dri_.get(), buffer_generator_->device(), screen_manager_.get(), |
| 140 screen_manager_.get(), | 137 window_delegate_manager_.get()); |
| 141 window_delegate_manager_.get()); | |
| 142 gpu_platform_support_.reset(new DriGpuPlatformSupport( | 138 gpu_platform_support_.reset(new DriGpuPlatformSupport( |
| 143 surface_factory_ozone_.get(), | 139 surface_factory_ozone_.get(), window_delegate_manager_.get(), |
| 144 window_delegate_manager_.get(), | |
| 145 screen_manager_.get(), | 140 screen_manager_.get(), |
| 146 scoped_ptr<NativeDisplayDelegateDri>(new NativeDisplayDelegateDri( | 141 scoped_ptr<NativeDisplayDelegateDri>(new NativeDisplayDelegateDri( |
| 147 dri_.get(), screen_manager_.get(), NULL)))); | 142 dri_.get(), screen_manager_.get(), NULL)))); |
| 148 if (surface_factory_ozone_->InitializeHardware() != | 143 if (surface_factory_ozone_->InitializeHardware() != |
| 149 DriSurfaceFactory::INITIALIZED) | 144 DriSurfaceFactory::INITIALIZED) |
| 150 LOG(FATAL) << "failed to initialize display hardware"; | 145 LOG(FATAL) << "failed to initialize display hardware"; |
| 151 } | 146 } |
| 152 | 147 |
| 153 private: | 148 private: |
| 154 bool use_surfaceless_; | 149 bool use_surfaceless_; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 173 }; | 168 }; |
| 174 | 169 |
| 175 } // namespace | 170 } // namespace |
| 176 | 171 |
| 177 OzonePlatform* CreateOzonePlatformGbm() { | 172 OzonePlatform* CreateOzonePlatformGbm() { |
| 178 CommandLine* cmd = CommandLine::ForCurrentProcess(); | 173 CommandLine* cmd = CommandLine::ForCurrentProcess(); |
| 179 return new OzonePlatformGbm(cmd->HasSwitch(switches::kOzoneUseSurfaceless)); | 174 return new OzonePlatformGbm(cmd->HasSwitch(switches::kOzoneUseSurfaceless)); |
| 180 } | 175 } |
| 181 | 176 |
| 182 } // namespace ui | 177 } // namespace ui |
| OLD | NEW |