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/memory/weak_ptr.h" |
| 10 #include "base/threading/thread.h" |
| 11 #include "ui/gfx/native_widget_types.h" |
| 12 #include "ui/gfx/vsync_provider.h" |
| 13 #include "ui/ozone/common/gpu/ozone_gpu_message_params.h" |
| 14 #include "ui/ozone/public/surface_ozone_egl.h" |
| 15 |
| 16 namespace base { |
| 17 struct FileDescriptor; |
| 18 } |
| 19 |
| 20 namespace gfx { |
| 21 class Point; |
| 22 class Rect; |
| 23 } |
| 24 |
| 25 namespace ui { |
| 26 |
| 27 class DrmDeviceManager; |
| 28 class DrmGpuDisplayManager; |
| 29 class DrmWindow; |
| 30 class DrmWindowProxy; |
| 31 class GbmBuffer; |
| 32 class ScanoutBufferGenerator; |
| 33 class ScreenManager; |
| 34 |
| 35 struct GammaRampRGBEntry; |
| 36 struct OverlayPlane; |
| 37 |
| 38 // Holds all the DRM related state and performs all DRM related operations. |
| 39 // |
| 40 // The DRM thread is used to insulate DRM operations from potential blocking |
| 41 // behaviour on the GPU main thread in order to reduce the potential for jank |
| 42 // (for example jank in the cursor if the GPU main thread is performing heavy |
| 43 // operations). The inverse is also true as blocking operations on the DRM |
| 44 // thread (such as modesetting) no longer block the GPU main thread. |
| 45 class DrmThread : public base::Thread { |
| 46 public: |
| 47 DrmThread(); |
| 48 ~DrmThread() override; |
| 49 |
| 50 void Start(); |
| 51 |
| 52 // Must be called on the DRM thread. |
| 53 void CreateBuffer(gfx::AcceleratedWidget widget, |
| 54 const gfx::Size& size, |
| 55 gfx::BufferFormat format, |
| 56 gfx::BufferUsage usage, |
| 57 scoped_refptr<GbmBuffer>* buffer); |
| 58 |
| 59 void SchedulePageFlip(gfx::AcceleratedWidget widget, |
| 60 const std::vector<OverlayPlane>& planes, |
| 61 const SwapCompletionCallback& callback); |
| 62 void GetVSyncParameters( |
| 63 gfx::AcceleratedWidget widget, |
| 64 const gfx::VSyncProvider::UpdateVSyncCallback& callback); |
| 65 |
| 66 void CreateWindow(gfx::AcceleratedWidget widget); |
| 67 void DestroyWindow(gfx::AcceleratedWidget widget); |
| 68 void SetWindowBounds(gfx::AcceleratedWidget widget, const gfx::Rect& bounds); |
| 69 void SetCursor(gfx::AcceleratedWidget widget, |
| 70 const std::vector<SkBitmap>& bitmaps, |
| 71 const gfx::Point& location, |
| 72 int frame_delay_ms); |
| 73 void MoveCursor(gfx::AcceleratedWidget widget, const gfx::Point& location); |
| 74 void CheckOverlayCapabilities( |
| 75 gfx::AcceleratedWidget widget, |
| 76 const std::vector<OverlayCheck_Params>& overlays, |
| 77 const base::Callback<void(gfx::AcceleratedWidget, |
| 78 const std::vector<OverlayCheck_Params>&)>& |
| 79 callback); |
| 80 void RefreshNativeDisplays( |
| 81 const base::Callback<void(const std::vector<DisplaySnapshot_Params>&)>& |
| 82 callback); |
| 83 void ConfigureNativeDisplay( |
| 84 int64_t id, |
| 85 const DisplayMode_Params& mode, |
| 86 const gfx::Point& origin, |
| 87 const base::Callback<void(int64_t, bool)>& callback); |
| 88 void DisableNativeDisplay( |
| 89 int64_t id, |
| 90 const base::Callback<void(int64_t, bool)>& callback); |
| 91 void TakeDisplayControl(const base::Callback<void(bool)>& callback); |
| 92 void RelinquishDisplayControl(const base::Callback<void(bool)>& callback); |
| 93 void AddGraphicsDevice(const base::FilePath& path, |
| 94 const base::FileDescriptor& fd); |
| 95 void RemoveGraphicsDevice(const base::FilePath& path); |
| 96 void GetHDCPState( |
| 97 int64_t display_id, |
| 98 const base::Callback<void(int64_t, bool, HDCPState)>& callback); |
| 99 void SetHDCPState(int64_t display_id, |
| 100 HDCPState state, |
| 101 const base::Callback<void(int64_t, bool)>& callback); |
| 102 void SetGammaRamp(int64_t id, const std::vector<GammaRampRGBEntry>& lut); |
| 103 |
| 104 // base::Thread: |
| 105 void Init() override; |
| 106 |
| 107 private: |
| 108 scoped_ptr<DrmDeviceManager> device_manager_; |
| 109 scoped_ptr<ScanoutBufferGenerator> buffer_generator_; |
| 110 scoped_ptr<ScreenManager> screen_manager_; |
| 111 scoped_ptr<DrmGpuDisplayManager> display_manager_; |
| 112 |
| 113 DISALLOW_COPY_AND_ASSIGN(DrmThread); |
| 114 }; |
| 115 |
| 116 } // namespace ui |
| 117 |
| 118 #endif // UI_OZONE_PLATFORM_DRM_GPU_DRM_THREAD_H_ |
OLD | NEW |