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

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, 3 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
13 namespace ui {
14
15 class DrmDeviceManager;
16 class DrmGpuPlatformSupport;
17 class DrmGpuPlatformSupportProxy;
18 class DrmWindow;
19 class ScanoutBufferGenerator;
20 class ScreenManager;
21
22 // Holds all the DRM related state and performs all DRM related operations with
23 // the exception of buffer allocations which happen on the threads requiring the
24 // allocations.
25 //
26 // The DRM thread is used to insulate DRM operations from potential blocking
27 // behaviour on the GPU main thread in order to reduce the potential for jank
28 // (for example jank in the cursor if the GPU main thread is performing heavy
29 // operations). The inverse is also true as blocking operations on the DRM
30 // thread (such as modesetting) no longer block the GPU main thread.
31 class DrmThread : public base::Thread {
32 public:
33 DrmThread();
34 ~DrmThread() override;
35
36 void Start();
37
38 // Safe to use from any thread. Access to the device manager is direct since
39 // the device manager performs its own locking since buffer allocations need
40 // to happen on the main GPU thread and on the IO GPU thread without waiting.
41 DrmDeviceManager* device_manager() const { return device_manager_.get(); }
42
43 // Safe to use from any thread.
44 base::WeakPtr<DrmGpuPlatformSupport> GetGpuPlatformSupport() const;
45
46 // Safe to use from any thread.
47 base::WeakPtr<DrmWindow> GetWindow(gfx::AcceleratedWidget widget) const;
48
49 // base::Thread:
50 void Init() override;
51
52 protected:
53 scoped_ptr<DrmDeviceManager> device_manager_;
54 scoped_ptr<ScanoutBufferGenerator> buffer_generator_;
55 scoped_ptr<ScreenManager> screen_manager_;
56 scoped_ptr<DrmGpuPlatformSupport> gpu_platform_support_;
57
58 private:
59 void GetGpuPlatformSupportOnThread(
60 base::WeakPtr<DrmGpuPlatformSupport>* support) const;
61
62 void GetWindowOnThread(gfx::AcceleratedWidget widget,
63 base::WeakPtr<DrmWindow>* weak_window) const;
64
65 DISALLOW_COPY_AND_ASSIGN(DrmThread);
66 };
67
68 } // namespace ui
69
70 #endif // UI_OZONE_PLATFORM_DRM_GPU_DRM_THREAD_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698