Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(740)

Side by Side Diff: ui/ozone/platform/drm/gpu/drm_thread.h

Issue 1311043016: Switch DRM platform to using a separate thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mv-drm-calls-on-thread2
Patch Set: . Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 class 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 ScanoutBufferGenerator;
32 class ScreenManager;
33
34 struct GammaRampRGBEntry;
35 struct OverlayPlane;
36
37 // Holds all the DRM related state and performs all DRM related operations with
38 // the exception of buffer allocations which happen on the threads requiring the
39 // allocations.
40 //
41 // The DRM thread is used to insulate DRM operations from potential blocking
42 // behaviour on the GPU main thread in order to reduce the potential for jank
43 // (for example jank in the cursor if the GPU main thread is performing heavy
44 // operations). The inverse is also true as blocking operations on the DRM
45 // thread (such as modesetting) no longer block the GPU main thread.
46 class DrmThread : public base::Thread {
47 public:
48 DrmThread();
49 ~DrmThread() override;
50
51 void Start();
52
53 // Safe to use from any thread. Access to the device manager is direct since
54 // the device manager performs its own locking since buffer allocations need
55 // to happen on the main GPU thread and on the IO GPU thread without waiting.
56 DrmDeviceManager* device_manager() const { return device_manager_.get(); }
57
58 // Safe to call on any thread.
59 scoped_ptr<DrmWindowProxy> CreateWindowProxy(gfx::AcceleratedWidget widget);
60
61 // Must be called on the DRM thread.
62 void SchedulePageFlip(gfx::AcceleratedWidget widget,
63 const std::vector<OverlayPlane>& planes,
64 const SwapCompletionCallback& callback);
65 void GetVSyncParameters(
66 gfx::AcceleratedWidget widget,
67 const gfx::VSyncProvider::UpdateVSyncCallback& callback);
68
69 void OnCreateWindow(gfx::AcceleratedWidget widget);
70 void OnDestroyWindow(gfx::AcceleratedWidget widget);
71 void OnWindowBoundsChanged(gfx::AcceleratedWidget widget,
72 const gfx::Rect& bounds);
73 void OnCursorSet(gfx::AcceleratedWidget widget,
74 const std::vector<SkBitmap>& bitmaps,
75 const gfx::Point& location,
76 int frame_delay_ms);
77 void OnCursorMove(gfx::AcceleratedWidget widget, const gfx::Point& location);
78 void OnCheckOverlayCapabilities(
79 gfx::AcceleratedWidget widget,
80 const std::vector<OverlayCheck_Params>& overlays,
81 const base::Callback<void(gfx::AcceleratedWidget, bool)>& callback);
82 void OnRefreshNativeDisplays(
83 const base::Callback<void(const std::vector<DisplaySnapshot_Params>&)>&
84 callback);
85 void OnConfigureNativeDisplay(
86 int64_t id,
87 const DisplayMode_Params& mode,
88 const gfx::Point& origin,
89 const base::Callback<void(int64_t, bool)>& callback);
90 void OnDisableNativeDisplay(
91 int64_t id,
92 const base::Callback<void(int64_t, bool)>& callback);
93 void OnTakeDisplayControl(const base::Callback<void(bool)>& callback);
94 void OnRelinquishDisplayControl(const base::Callback<void(bool)>& callback);
95 void OnAddGraphicsDevice(const base::FilePath& path,
96 const base::FileDescriptor& fd);
97 void OnRemoveGraphicsDevice(const base::FilePath& path);
98 void OnGetHDCPState(
99 int64_t display_id,
100 const base::Callback<void(int64_t, bool, HDCPState)>& callback);
101 void OnSetHDCPState(int64_t display_id,
102 HDCPState state,
103 const base::Callback<void(int64_t, bool)>& callback);
104 void OnSetGammaRamp(int64_t id, const std::vector<GammaRampRGBEntry>& lut);
105
106 // base::Thread:
107 void Init() override;
108
109 private:
110 void CreateWindowProxyOnThread(gfx::AcceleratedWidget widget,
111 scoped_ptr<DrmWindowProxy>* window);
112
113 scoped_ptr<DrmDeviceManager> device_manager_;
114 scoped_ptr<ScanoutBufferGenerator> buffer_generator_;
115 scoped_ptr<ScreenManager> screen_manager_;
116 scoped_ptr<DrmGpuDisplayManager> display_manager_;
117
118 void GetWindowOnThread(gfx::AcceleratedWidget widget,
119 base::WeakPtr<DrmWindow>* weak_window) const;
120
121 DISALLOW_COPY_AND_ASSIGN(DrmThread);
122 };
123
124 } // namespace ui
125
126 #endif // UI_OZONE_PLATFORM_DRM_GPU_DRM_THREAD_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698