OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 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_DRM_THREAD_H_ |
| 6 #define UI_OZONE_PLATFORM_DRM_GPU_DRM_THREAD_H_ |
| 7 |
| 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/threading/thread.h" |
| 10 #include "ui/gfx/native_widget_types.h" |
| 11 |
| 12 namespace ui { |
| 13 |
| 14 class DrmDeviceManager; |
| 15 class DrmGpuPlatformSupport; |
| 16 class DrmGpuPlatformSupportProxy; |
| 17 class DrmWindowProxy; |
| 18 class ScanoutBufferGenerator; |
| 19 class ScreenManager; |
| 20 |
| 21 // Holds all the DRM related state and performs all DRM related operations with |
| 22 // the exception of buffer allocations which happen on the threads requiring the |
| 23 // allocations. |
| 24 // |
| 25 // The DRM thread is used to insulate DRM operations from potential blocking |
| 26 // behaviour on the GPU main thread in order to reduce the potential for jank |
| 27 // (for example jank in the cursor if the GPU main thread is performing heavy |
| 28 // operations). The inverse is also true as blocking operations on the DRM |
| 29 // thread (such as modesetting) no longer block the GPU main thread. |
| 30 class DrmThread : public base::Thread { |
| 31 public: |
| 32 DrmThread(); |
| 33 ~DrmThread() override; |
| 34 |
| 35 void Start(); |
| 36 |
| 37 // Safe to use from any thread. Access to the device manager is direct since |
| 38 // the device manager performs its own locking since buffer allocations need |
| 39 // to happen on the main GPU thread and on the IO GPU thread without waiting. |
| 40 DrmDeviceManager* device_manager() const { return device_manager_.get(); } |
| 41 |
| 42 // Safe to use from any thread. |
| 43 scoped_ptr<DrmWindowProxy> CreateWindowProxy( |
| 44 gfx::AcceleratedWidget widget) const; |
| 45 |
| 46 // Safe to use from any thread. |
| 47 scoped_ptr<DrmGpuPlatformSupportProxy> CreateGpuPlatformSupportProxy() const; |
| 48 |
| 49 // base::Thread: |
| 50 void Init() override; |
| 51 |
| 52 protected: |
| 53 scoped_ptr<DrmDeviceManager> device_manager_; |
| 54 scoped_ptr<ScanoutBufferGenerator> buffer_generator_; |
| 55 scoped_ptr<ScreenManager> screen_manager_; |
| 56 scoped_ptr<DrmGpuPlatformSupport> gpu_platform_support_; |
| 57 |
| 58 private: |
| 59 void CreateWindowProxyOnThread(gfx::AcceleratedWidget widget, |
| 60 scoped_ptr<DrmWindowProxy>* proxy) const; |
| 61 |
| 62 void CreateGpuPlatformSupportProxyOnThread( |
| 63 scoped_ptr<DrmGpuPlatformSupportProxy>* proxy) const; |
| 64 |
| 65 DISALLOW_COPY_AND_ASSIGN(DrmThread); |
| 66 }; |
| 67 |
| 68 } // namespace ui |
| 69 |
| 70 #endif // UI_OZONE_PLATFORM_DRM_GPU_DRM_THREAD_H_ |
OLD | NEW |