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_HOST_OVERLAY_CANDIDATES_H_ | 5 #ifndef UI_OZONE_PLATFORM_DRM_HOST_OVERLAY_CANDIDATES_H_ |
6 #define UI_OZONE_PLATFORM_DRM_HOST_OVERLAY_CANDIDATES_H_ | 6 #define UI_OZONE_PLATFORM_DRM_HOST_OVERLAY_CANDIDATES_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <map> | 9 #include <map> |
10 #include <vector> | 10 #include <vector> |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
47 void OnChannelEstablished( | 47 void OnChannelEstablished( |
48 int host_id, | 48 int host_id, |
49 scoped_refptr<base::SingleThreadTaskRunner> send_runner, | 49 scoped_refptr<base::SingleThreadTaskRunner> send_runner, |
50 const base::Callback<void(IPC::Message*)>& sender) override; | 50 const base::Callback<void(IPC::Message*)>& sender) override; |
51 void OnChannelDestroyed(int host_id) override; | 51 void OnChannelDestroyed(int host_id) override; |
52 bool OnMessageReceived(const IPC::Message& message) override; | 52 bool OnMessageReceived(const IPC::Message& message) override; |
53 | 53 |
54 void ResetCache(); | 54 void ResetCache(); |
55 | 55 |
56 private: | 56 private: |
57 struct HardwareDisplayPlaneProxy { | |
58 HardwareDisplayPlaneProxy(uint32_t id); | |
59 ~HardwareDisplayPlaneProxy(); | |
60 | |
61 bool in_use = false; | |
62 uint32_t plane_id; | |
63 }; | |
64 | |
65 struct OverlayCompare { | 57 struct OverlayCompare { |
66 bool operator()(const OverlayCheck_Params& l, | 58 bool operator()(const OverlayCheck_Params& l, |
67 const OverlayCheck_Params& r) const; | 59 const OverlayCheck_Params& r) const; |
68 }; | 60 }; |
69 | 61 |
70 template <class KeyType, class ValueType> | 62 template <class KeyType, class ValueType> |
71 struct OverlayMap { | 63 struct OverlayMap { |
72 typedef std::map<KeyType, ValueType, OverlayCompare> Type; | 64 typedef std::map<KeyType, ValueType, OverlayCompare> Type; |
73 }; | 65 }; |
74 | 66 |
75 void SendRequest(const std::vector<OverlayCheck_Params>& list); | 67 void SendRequest(const std::vector<OverlayCheck_Params>& current_list, |
68 const std::vector<OverlayCheck_Params>& new_list); | |
76 void OnOverlayResult(bool* handled, | 69 void OnOverlayResult(bool* handled, |
77 gfx::AcceleratedWidget widget, | 70 gfx::AcceleratedWidget widget, |
78 const std::vector<OverlayCheck_Params>& params); | 71 const std::vector<OverlayCheck_Params>& params); |
79 bool CanHandleCandidate(const OverlaySurfaceCandidate& candidate) const; | 72 bool CanHandleCandidate(const OverlaySurfaceCandidate& candidate) const; |
80 uint32_t CalculateCandidateWeight( | 73 uint32_t CalculateCandidateWeight( |
81 const OverlaySurfaceCandidate& candidate) const; | 74 const OverlaySurfaceCandidate& candidate) const; |
82 void ValidateCandidates(OverlaySurfaceCandidateList* candidates); | 75 void ValidateCandidates(const OverlaySurfaceCandidateList& candidates); |
83 | 76 |
84 DrmGpuPlatformSupportHost* platform_support_; // Not owned. | 77 DrmGpuPlatformSupportHost* platform_support_; // Not owned. |
85 DrmWindowHost* window_; // Not owned. | 78 DrmWindowHost* window_; // Not owned. |
86 | 79 |
87 // List of all OverlayCheck_Params which have been validated in GPU side. If | 80 // List of all OverlayCheck_Params which have been validated in GPU side. |
88 // this value is true, it means the particular param is compatible and | |
89 // corresponding candidate can be promoted to use Hardware Overlays. | |
90 base::MRUCacheBase<OverlayCheck_Params, | 81 base::MRUCacheBase<OverlayCheck_Params, |
91 bool, | 82 OverlayCheck_Params::State, |
92 base::MRUCacheNullDeletor<bool>, | 83 base::MRUCacheNullDeletor<OverlayCheck_Params::State>, |
93 OverlayMap> cache_; | 84 OverlayMap> cache_; |
94 // List of all OverlayCheck_Params currently in use by various candidates. If | 85 |
95 // the value is true, it means the correspnding candidate has been promoted to | 86 // List of all compatible OverlayCheck_Params currently in use. |
96 // use overlay. | 87 std::vector<OverlayCheck_Params> in_use_params_; |
dnicoara
2015/11/23 19:22:54
I'm not sure that this is really needed or that it
| |
97 typedef std::map<OverlayCheck_Params, bool, OverlayCompare> CompatibleParams; | |
98 CompatibleParams in_use_compatible_params_; | |
99 // Used to get best possible approximation of plane usage in GPU side. We use | |
100 // this to make sure we don't handle more candidates than what we can support | |
101 // in GPU side. | |
102 ScopedVector<HardwareDisplayPlaneProxy> hardware_plane_proxy_; | |
103 | 88 |
104 DISALLOW_COPY_AND_ASSIGN(DrmOverlayCandidatesHost); | 89 DISALLOW_COPY_AND_ASSIGN(DrmOverlayCandidatesHost); |
105 }; | 90 }; |
106 | 91 |
107 } // namespace ui | 92 } // namespace ui |
108 | 93 |
109 #endif // UI_OZONE_PLATFORM_DRM_HOST_OVERLAY_CANDIDATES_H_ | 94 #endif // UI_OZONE_PLATFORM_DRM_HOST_OVERLAY_CANDIDATES_H_ |
OLD | NEW |