| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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_DRM_THREAD_H_ | 5 #ifndef UI_OZONE_PLATFORM_DRM_GPU_DRM_THREAD_H_ |
| 6 #define UI_OZONE_PLATFORM_DRM_GPU_DRM_THREAD_H_ | 6 #define UI_OZONE_PLATFORM_DRM_GPU_DRM_THREAD_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 | 11 |
| 12 #include "base/files/scoped_file.h" | 12 #include "base/files/scoped_file.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "base/threading/thread.h" | 15 #include "base/threading/thread.h" |
| 16 #include "mojo/public/cpp/bindings/binding_set.h" | 16 #include "mojo/public/cpp/bindings/binding_set.h" |
| 17 #include "services/service_manager/public/cpp/connection.h" | 17 #include "services/service_manager/public/cpp/connection.h" |
| 18 #include "ui/gfx/native_pixmap_handle.h" | 18 #include "ui/gfx/native_pixmap_handle.h" |
| 19 #include "ui/gfx/native_widget_types.h" | 19 #include "ui/gfx/native_widget_types.h" |
| 20 #include "ui/gfx/vsync_provider.h" | 20 #include "ui/gfx/vsync_provider.h" |
| 21 #include "ui/ozone/common/gpu/ozone_gpu_message_params.h" | 21 #include "ui/ozone/common/gpu/ozone_gpu_message_params.h" |
| 22 #include "ui/ozone/public/interfaces/device_cursor.mojom.h" | 22 #include "ui/ozone/public/interfaces/device_cursor.mojom.h" |
| 23 #include "ui/ozone/public/swap_completion_callback.h" | 23 #include "ui/ozone/public/swap_completion_callback.h" |
| 24 | 24 |
| 25 namespace base { | 25 namespace base { |
| 26 struct FileDescriptor; | 26 struct FileDescriptor; |
| 27 } | 27 } |
| 28 | 28 |
| 29 namespace display { |
| 30 struct GammaRampRGBEntry; |
| 31 } |
| 32 |
| 29 namespace gfx { | 33 namespace gfx { |
| 30 class Point; | 34 class Point; |
| 31 class Rect; | 35 class Rect; |
| 32 } | 36 } |
| 33 | 37 |
| 34 namespace ui { | 38 namespace ui { |
| 35 | 39 |
| 36 class DrmDeviceManager; | 40 class DrmDeviceManager; |
| 37 class DrmGpuDisplayManager; | 41 class DrmGpuDisplayManager; |
| 38 class GbmBuffer; | 42 class GbmBuffer; |
| 39 class ScanoutBufferGenerator; | 43 class ScanoutBufferGenerator; |
| 40 class ScreenManager; | 44 class ScreenManager; |
| 41 | 45 |
| 42 struct GammaRampRGBEntry; | |
| 43 struct OverlayPlane; | 46 struct OverlayPlane; |
| 44 | 47 |
| 45 // Holds all the DRM related state and performs all DRM related operations. | 48 // Holds all the DRM related state and performs all DRM related operations. |
| 46 // | 49 // |
| 47 // The DRM thread is used to insulate DRM operations from potential blocking | 50 // The DRM thread is used to insulate DRM operations from potential blocking |
| 48 // behaviour on the GPU main thread in order to reduce the potential for jank | 51 // behaviour on the GPU main thread in order to reduce the potential for jank |
| 49 // (for example jank in the cursor if the GPU main thread is performing heavy | 52 // (for example jank in the cursor if the GPU main thread is performing heavy |
| 50 // operations). The inverse is also true as blocking operations on the DRM | 53 // operations). The inverse is also true as blocking operations on the DRM |
| 51 // thread (such as modesetting) no longer block the GPU main thread. | 54 // thread (such as modesetting) no longer block the GPU main thread. |
| 52 class DrmThread : public base::Thread, public ozone::mojom::DeviceCursor { | 55 class DrmThread : public base::Thread, public ozone::mojom::DeviceCursor { |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 void DisableNativeDisplay( | 107 void DisableNativeDisplay( |
| 105 int64_t id, | 108 int64_t id, |
| 106 const base::Callback<void(int64_t, bool)>& callback); | 109 const base::Callback<void(int64_t, bool)>& callback); |
| 107 void TakeDisplayControl(const base::Callback<void(bool)>& callback); | 110 void TakeDisplayControl(const base::Callback<void(bool)>& callback); |
| 108 void RelinquishDisplayControl(const base::Callback<void(bool)>& callback); | 111 void RelinquishDisplayControl(const base::Callback<void(bool)>& callback); |
| 109 void AddGraphicsDevice(const base::FilePath& path, | 112 void AddGraphicsDevice(const base::FilePath& path, |
| 110 const base::FileDescriptor& fd); | 113 const base::FileDescriptor& fd); |
| 111 void RemoveGraphicsDevice(const base::FilePath& path); | 114 void RemoveGraphicsDevice(const base::FilePath& path); |
| 112 void GetHDCPState( | 115 void GetHDCPState( |
| 113 int64_t display_id, | 116 int64_t display_id, |
| 114 const base::Callback<void(int64_t, bool, HDCPState)>& callback); | 117 const base::Callback<void(int64_t, bool, display::HDCPState)>& callback); |
| 115 void SetHDCPState(int64_t display_id, | 118 void SetHDCPState(int64_t display_id, |
| 116 HDCPState state, | 119 display::HDCPState state, |
| 117 const base::Callback<void(int64_t, bool)>& callback); | 120 const base::Callback<void(int64_t, bool)>& callback); |
| 118 void SetColorCorrection(int64_t display_id, | 121 void SetColorCorrection( |
| 119 const std::vector<GammaRampRGBEntry>& degamma_lut, | 122 int64_t display_id, |
| 120 const std::vector<GammaRampRGBEntry>& gamma_lut, | 123 const std::vector<display::GammaRampRGBEntry>& degamma_lut, |
| 121 const std::vector<float>& correction_matrix); | 124 const std::vector<display::GammaRampRGBEntry>& gamma_lut, |
| 125 const std::vector<float>& correction_matrix); |
| 122 | 126 |
| 123 // base::Thread: | 127 // base::Thread: |
| 124 void Init() override; | 128 void Init() override; |
| 125 | 129 |
| 126 // Mojo support for DeviceCursorRequest. | 130 // Mojo support for DeviceCursorRequest. |
| 127 void AddBinding(ozone::mojom::DeviceCursorRequest request); | 131 void AddBinding(ozone::mojom::DeviceCursorRequest request); |
| 128 | 132 |
| 129 private: | 133 private: |
| 130 std::unique_ptr<DrmDeviceManager> device_manager_; | 134 std::unique_ptr<DrmDeviceManager> device_manager_; |
| 131 std::unique_ptr<ScanoutBufferGenerator> buffer_generator_; | 135 std::unique_ptr<ScanoutBufferGenerator> buffer_generator_; |
| 132 std::unique_ptr<ScreenManager> screen_manager_; | 136 std::unique_ptr<ScreenManager> screen_manager_; |
| 133 std::unique_ptr<DrmGpuDisplayManager> display_manager_; | 137 std::unique_ptr<DrmGpuDisplayManager> display_manager_; |
| 134 | 138 |
| 135 // The mojo implementation requires a BindingSet because the DrmThread serves | 139 // The mojo implementation requires a BindingSet because the DrmThread serves |
| 136 // requests from two different client threads. | 140 // requests from two different client threads. |
| 137 mojo::BindingSet<ozone::mojom::DeviceCursor> bindings_; | 141 mojo::BindingSet<ozone::mojom::DeviceCursor> bindings_; |
| 138 | 142 |
| 139 DISALLOW_COPY_AND_ASSIGN(DrmThread); | 143 DISALLOW_COPY_AND_ASSIGN(DrmThread); |
| 140 }; | 144 }; |
| 141 | 145 |
| 142 } // namespace ui | 146 } // namespace ui |
| 143 | 147 |
| 144 #endif // UI_OZONE_PLATFORM_DRM_GPU_DRM_THREAD_H_ | 148 #endif // UI_OZONE_PLATFORM_DRM_GPU_DRM_THREAD_H_ |
| OLD | NEW |