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_HOST_OVERLAY_CANDIDATES_H_ |
| 6 #define UI_OZONE_PLATFORM_DRM_HOST_OVERLAY_CANDIDATES_H_ |
| 7 |
| 8 #include <deque> |
| 9 #include <map> |
| 10 #include <vector> |
| 11 |
| 12 #include "base/containers/mru_cache.h" |
| 13 #include "base/single_thread_task_runner.h" |
| 14 #include "ui/ozone/common/gpu/ozone_gpu_message_params.h" |
| 15 #include "ui/ozone/public/gpu_platform_support_host.h" |
| 16 #include "ui/ozone/public/overlay_candidates_ozone.h" |
| 17 |
| 18 namespace ui { |
| 19 |
| 20 class DrmGpuPlatformSupportHost; |
| 21 |
| 22 // This is an implementation of OverlayCandidatesOzone where the driver is asked |
| 23 // about overlay capabilities via IPC. We have no way of querying abstract |
| 24 // capabilities, only if a particular configuration is supported or not. |
| 25 // Each time we we are asked if a particular configuration is supported, if we |
| 26 // have not seen that configuration before, it is IPCed to the GPU via |
| 27 // OzoneGpuMsg_CheckOverlayCapabilities; a test commit is then performed and |
| 28 // the result is returned in OzoneHostMsg_OverlayCapabilitiesReceived. Testing |
| 29 // is asynchronous, until the reply arrives that configuration will be failed. |
| 30 // |
| 31 // There is a many:1 relationship between this class and |
| 32 // DrmGpuPlatformSupportHost, each compositor will own one of these objects. |
| 33 // Each request has a unique request ID, which is assigned from a shared |
| 34 // sequence number so that replies can be routed to the correct object. |
| 35 class DrmOverlayCandidatesHost : public OverlayCandidatesOzone { |
| 36 struct OverlayCompare { |
| 37 bool operator()(const OverlayCheck_Params& l, const OverlayCheck_Params& r); |
| 38 }; |
| 39 |
| 40 public: |
| 41 DrmOverlayCandidatesHost(gfx::AcceleratedWidget widget, |
| 42 DrmGpuPlatformSupportHost* platform_support); |
| 43 ~DrmOverlayCandidatesHost() override; |
| 44 |
| 45 // OverlayCandidatesOzone: |
| 46 void CheckOverlaySupport(OverlaySurfaceCandidateList* candidates) override; |
| 47 |
| 48 private: |
| 49 void SendRequest(const OverlaySurfaceCandidateList& candidates, |
| 50 const OverlayCheck_Params& check); |
| 51 void OnOverlayResult(bool* handled, |
| 52 gfx::AcceleratedWidget widget, |
| 53 bool result); |
| 54 void ProcessResult(const OverlayCheck_Params& check, bool result); |
| 55 |
| 56 void CheckSingleOverlay(OverlaySurfaceCandidateList* candidates); |
| 57 |
| 58 gfx::AcceleratedWidget widget_; |
| 59 DrmGpuPlatformSupportHost* platform_support_; // Not owned. |
| 60 |
| 61 std::deque<OverlayCheck_Params> pending_checks_; |
| 62 |
| 63 template <class KeyType, class ValueType> |
| 64 struct OverlayMap { |
| 65 typedef std::map<KeyType, ValueType, OverlayCompare> Type; |
| 66 }; |
| 67 base::MRUCacheBase<OverlayCheck_Params, |
| 68 bool, |
| 69 base::MRUCacheNullDeletor<bool>, |
| 70 OverlayMap> cache_; |
| 71 |
| 72 DISALLOW_COPY_AND_ASSIGN(DrmOverlayCandidatesHost); |
| 73 }; |
| 74 |
| 75 } // namespace ui |
| 76 |
| 77 #endif // UI_OZONE_PLATFORM_DRM_HOST_OVERLAY_CANDIDATES_H_ |
OLD | NEW |