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

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: added drm_thread_proxy 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 // Must be called on the DRM thread.
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 WindowBoundsChanged(gfx::AcceleratedWidget widget,
69 const gfx::Rect& bounds);
70 void CursorSet(gfx::AcceleratedWidget widget,
71 const std::vector<SkBitmap>& bitmaps,
72 const gfx::Point& location,
73 int frame_delay_ms);
74 void CursorMove(gfx::AcceleratedWidget widget, const gfx::Point& location);
75 void CheckOverlayCapabilities(
76 gfx::AcceleratedWidget widget,
77 const std::vector<OverlayCheck_Params>& overlays,
78 const base::Callback<void(gfx::AcceleratedWidget, bool)>& callback);
79 void RefreshNativeDisplays(
80 const base::Callback<void(const std::vector<DisplaySnapshot_Params>&)>&
81 callback);
82 void ConfigureNativeDisplay(
83 int64_t id,
84 const DisplayMode_Params& mode,
85 const gfx::Point& origin,
86 const base::Callback<void(int64_t, bool)>& callback);
87 void DisableNativeDisplay(
88 int64_t id,
89 const base::Callback<void(int64_t, bool)>& callback);
90 void TakeDisplayControl(const base::Callback<void(bool)>& callback);
91 void RelinquishDisplayControl(const base::Callback<void(bool)>& callback);
92 void AddGraphicsDevice(const base::FilePath& path,
93 const base::FileDescriptor& fd);
94 void RemoveGraphicsDevice(const base::FilePath& path);
95 void GetHDCPState(
96 int64_t display_id,
97 const base::Callback<void(int64_t, bool, HDCPState)>& callback);
98 void SetHDCPState(int64_t display_id,
99 HDCPState state,
100 const base::Callback<void(int64_t, bool)>& callback);
101 void SetGammaRamp(int64_t id, const std::vector<GammaRampRGBEntry>& lut);
102
103 // base::Thread:
104 void Init() override;
105
106 private:
107 scoped_ptr<DrmDeviceManager> device_manager_;
108 scoped_ptr<ScanoutBufferGenerator> buffer_generator_;
109 scoped_ptr<ScreenManager> screen_manager_;
110 scoped_ptr<DrmGpuDisplayManager> display_manager_;
111
112 DISALLOW_COPY_AND_ASSIGN(DrmThread);
113 };
114
115 } // namespace ui
116
117 #endif // UI_OZONE_PLATFORM_DRM_GPU_DRM_THREAD_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698