Chromium Code Reviews| 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" | |
| 17 #include "services/shell/public/cpp/connection.h" | |
| 16 #include "ui/gfx/native_pixmap_handle_ozone.h" | 18 #include "ui/gfx/native_pixmap_handle_ozone.h" |
| 17 #include "ui/gfx/native_widget_types.h" | 19 #include "ui/gfx/native_widget_types.h" |
| 18 #include "ui/gfx/vsync_provider.h" | 20 #include "ui/gfx/vsync_provider.h" |
| 19 #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" | |
| 20 #include "ui/ozone/public/surface_ozone_egl.h" | 23 #include "ui/ozone/public/surface_ozone_egl.h" |
| 21 | 24 |
| 22 namespace base { | 25 namespace base { |
| 23 struct FileDescriptor; | 26 struct FileDescriptor; |
| 24 } | 27 } |
| 25 | 28 |
| 26 namespace gfx { | 29 namespace gfx { |
| 27 class Point; | 30 class Point; |
| 28 class Rect; | 31 class Rect; |
| 29 } | 32 } |
| 30 | 33 |
| 34 namespace shell { | |
| 35 class Connection; | |
| 36 } | |
| 37 | |
| 31 namespace ui { | 38 namespace ui { |
| 32 | 39 |
| 33 class DrmDeviceManager; | 40 class DrmDeviceManager; |
| 34 class DrmGpuDisplayManager; | 41 class DrmGpuDisplayManager; |
| 35 class DrmWindow; | 42 class DrmWindow; |
| 36 class DrmWindowProxy; | 43 class DrmWindowProxy; |
| 37 class GbmBuffer; | 44 class GbmBuffer; |
| 38 class ScanoutBufferGenerator; | 45 class ScanoutBufferGenerator; |
| 39 class ScreenManager; | 46 class ScreenManager; |
| 40 | 47 |
| 41 struct GammaRampRGBEntry; | 48 struct GammaRampRGBEntry; |
| 42 struct OverlayPlane; | 49 struct OverlayPlane; |
| 43 | 50 |
| 44 // Holds all the DRM related state and performs all DRM related operations. | 51 // Holds all the DRM related state and performs all DRM related operations. |
| 45 // | 52 // |
| 46 // The DRM thread is used to insulate DRM operations from potential blocking | 53 // The DRM thread is used to insulate DRM operations from potential blocking |
| 47 // behaviour on the GPU main thread in order to reduce the potential for jank | 54 // behaviour on the GPU main thread in order to reduce the potential for jank |
| 48 // (for example jank in the cursor if the GPU main thread is performing heavy | 55 // (for example jank in the cursor if the GPU main thread is performing heavy |
| 49 // operations). The inverse is also true as blocking operations on the DRM | 56 // operations). The inverse is also true as blocking operations on the DRM |
| 50 // thread (such as modesetting) no longer block the GPU main thread. | 57 // thread (such as modesetting) no longer block the GPU main thread. |
| 51 class DrmThread : public base::Thread { | 58 class DrmThread : public base::Thread, public ozone::mojom::DeviceCursor { |
| 52 public: | 59 public: |
| 53 DrmThread(); | 60 DrmThread(); |
| 54 ~DrmThread() override; | 61 ~DrmThread() override; |
| 55 | 62 |
| 56 void Start(); | 63 void Start(); |
| 57 | 64 |
| 58 // Must be called on the DRM thread. | 65 // Must be called on the DRM thread. |
| 59 void CreateBuffer(gfx::AcceleratedWidget widget, | 66 void CreateBuffer(gfx::AcceleratedWidget widget, |
| 60 const gfx::Size& size, | 67 const gfx::Size& size, |
| 61 gfx::BufferFormat format, | 68 gfx::BufferFormat format, |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 73 void SchedulePageFlip(gfx::AcceleratedWidget widget, | 80 void SchedulePageFlip(gfx::AcceleratedWidget widget, |
| 74 const std::vector<OverlayPlane>& planes, | 81 const std::vector<OverlayPlane>& planes, |
| 75 const SwapCompletionCallback& callback); | 82 const SwapCompletionCallback& callback); |
| 76 void GetVSyncParameters( | 83 void GetVSyncParameters( |
| 77 gfx::AcceleratedWidget widget, | 84 gfx::AcceleratedWidget widget, |
| 78 const gfx::VSyncProvider::UpdateVSyncCallback& callback); | 85 const gfx::VSyncProvider::UpdateVSyncCallback& callback); |
| 79 | 86 |
| 80 void CreateWindow(gfx::AcceleratedWidget widget); | 87 void CreateWindow(gfx::AcceleratedWidget widget); |
| 81 void DestroyWindow(gfx::AcceleratedWidget widget); | 88 void DestroyWindow(gfx::AcceleratedWidget widget); |
| 82 void SetWindowBounds(gfx::AcceleratedWidget widget, const gfx::Rect& bounds); | 89 void SetWindowBounds(gfx::AcceleratedWidget widget, const gfx::Rect& bounds); |
| 83 void SetCursor(gfx::AcceleratedWidget widget, | 90 void SetCursor(const gfx::AcceleratedWidget& widget, |
| 84 const std::vector<SkBitmap>& bitmaps, | 91 const std::vector<SkBitmap>& bitmaps, |
| 85 const gfx::Point& location, | 92 const gfx::Point& location, |
| 86 int frame_delay_ms); | 93 uint32_t frame_delay_ms); |
|
spang
2016/07/27 17:00:59
Should it really be unsigned? I'd say int is the c
rjkroege
2016/07/27 20:55:13
But negative time into the future? That makes me s
| |
| 87 void MoveCursor(const gfx::AcceleratedWidget& widget, | 94 void MoveCursor(const gfx::AcceleratedWidget& widget, |
| 88 const gfx::Point& location); | 95 const gfx::Point& location); |
| 89 void CheckOverlayCapabilities( | 96 void CheckOverlayCapabilities( |
| 90 gfx::AcceleratedWidget widget, | 97 gfx::AcceleratedWidget widget, |
| 91 const std::vector<OverlayCheck_Params>& overlays, | 98 const std::vector<OverlayCheck_Params>& overlays, |
| 92 const base::Callback<void(gfx::AcceleratedWidget, | 99 const base::Callback<void(gfx::AcceleratedWidget, |
| 93 const std::vector<OverlayCheck_Params>&)>& | 100 const std::vector<OverlayCheck_Params>&)>& |
| 94 callback); | 101 callback); |
| 95 void RefreshNativeDisplays( | 102 void RefreshNativeDisplays( |
| 96 const base::Callback<void(const std::vector<DisplaySnapshot_Params>&)>& | 103 const base::Callback<void(const std::vector<DisplaySnapshot_Params>&)>& |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 115 HDCPState state, | 122 HDCPState state, |
| 116 const base::Callback<void(int64_t, bool)>& callback); | 123 const base::Callback<void(int64_t, bool)>& callback); |
| 117 void SetColorCorrection(int64_t display_id, | 124 void SetColorCorrection(int64_t display_id, |
| 118 const std::vector<GammaRampRGBEntry>& degamma_lut, | 125 const std::vector<GammaRampRGBEntry>& degamma_lut, |
| 119 const std::vector<GammaRampRGBEntry>& gamma_lut, | 126 const std::vector<GammaRampRGBEntry>& gamma_lut, |
| 120 const std::vector<float>& correction_matrix); | 127 const std::vector<float>& correction_matrix); |
| 121 | 128 |
| 122 // base::Thread: | 129 // base::Thread: |
| 123 void Init() override; | 130 void Init() override; |
| 124 | 131 |
| 132 // Mojo support for DeviceCursorRequest. | |
| 133 void AddBinding(ozone::mojom::DeviceCursorRequest request); | |
| 134 | |
| 125 private: | 135 private: |
| 126 std::unique_ptr<DrmDeviceManager> device_manager_; | 136 std::unique_ptr<DrmDeviceManager> device_manager_; |
| 127 std::unique_ptr<ScanoutBufferGenerator> buffer_generator_; | 137 std::unique_ptr<ScanoutBufferGenerator> buffer_generator_; |
| 128 std::unique_ptr<ScreenManager> screen_manager_; | 138 std::unique_ptr<ScreenManager> screen_manager_; |
| 129 std::unique_ptr<DrmGpuDisplayManager> display_manager_; | 139 std::unique_ptr<DrmGpuDisplayManager> display_manager_; |
| 130 | 140 |
| 141 // The mojo implementation requires a BindingSet because the DrmThread serves | |
| 142 // requests from two different client threads. | |
| 143 mojo::BindingSet<ozone::mojom::DeviceCursor> bindings_; | |
| 144 | |
| 131 DISALLOW_COPY_AND_ASSIGN(DrmThread); | 145 DISALLOW_COPY_AND_ASSIGN(DrmThread); |
| 132 }; | 146 }; |
| 133 | 147 |
| 134 } // namespace ui | 148 } // namespace ui |
| 135 | 149 |
| 136 #endif // UI_OZONE_PLATFORM_DRM_GPU_DRM_THREAD_H_ | 150 #endif // UI_OZONE_PLATFORM_DRM_GPU_DRM_THREAD_H_ |
| OLD | NEW |