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

Side by Side Diff: ui/ozone/platform/drm/host/drm_host_overlay_candidates.h

Issue 1157793004: ozone: Add overlay candidate implementation that queries support via IPC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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_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 "ui/ozone/common/gpu/ozone_gpu_message_params.h"
13 #include "ui/ozone/public/gpu_platform_support_host.h"
14 #include "ui/ozone/public/overlay_candidates_ozone.h"
15
16 namespace ui {
17
18 class DrmGpuPlatformSupportHost;
19
20 // This is an implementation of OverlayCandidatesOzone where the driver is asked
21 // about overlay capabilities via IPC. We have no way of querying abstract
22 // capabilities, only if a particular configuration is supported or not.
23 // Each time we we are asked if a particular configuration is supported, if we
24 // have not seen that configuration before, it is IPCed to the GPU via
25 // OzoneGpuMsg_CheckOverlayCapabilities; a test commit is then performed and
26 // the result is returned in OzoneHostMsg_OverlayCapabilitiesReceived. Testing
27 // is asynchronous, until the reply arrives that configuration will be failed.
28 //
29 // There is a many:1 relationship between this class and
30 // DrmGpuPlatformSupportHost, each compositor will own one of these objects.
31 // Each request has a unique request ID, which is assigned from a shared
32 // sequence number so that replies can be routed to the correct object.
33 class DrmHostOverlayCandidates : public OverlayCandidatesOzone,
34 public GpuPlatformSupportHost {
35 struct PendingCheck {
36 PendingCheck(uint32_t id, const OverlayCheck_Params& overlay);
37 ~PendingCheck();
38
39 uint32_t request_id;
40 OverlayCheck_Params overlay;
41 };
42
43 struct OverlayCompare {
44 bool operator()(const OverlayCheck_Params& l, const OverlayCheck_Params& r);
45 };
46
47 public:
48 DrmHostOverlayCandidates(gfx::AcceleratedWidget widget,
49 DrmGpuPlatformSupportHost* platform_support);
50 ~DrmHostOverlayCandidates() override;
51
52 // OverlayCandidatesOzone:
53 void CheckOverlaySupport(OverlaySurfaceCandidateList* candidates) override;
54
55 // GpuPlatformSupportHost:
56 void OnChannelEstablished(
57 int host_id,
58 scoped_refptr<base::SingleThreadTaskRunner> send_runner,
59 const base::Callback<void(IPC::Message*)>& sender) override;
60 void OnChannelDestroyed(int host_id) override;
61 bool OnMessageReceived(const IPC::Message& message) override;
62
63 private:
64 void SendRequest(const OverlaySurfaceCandidateList& candidates,
65 const PendingCheck& check);
66 void OnOverlayResult(bool* handled,
67 gfx::AcceleratedWidget widget,
68 uint32_t id,
69 bool result);
70 void ProcessResult(const PendingCheck& check, bool result);
71
72 void CheckSingleOverlay(OverlaySurfaceCandidateList* candidates);
73
74 bool channel_established_;
75 uint32_t next_request_id_;
76 base::Callback<void(IPC::Message*)> send_callback_;
77 gfx::AcceleratedWidget widget_;
78 DrmGpuPlatformSupportHost* platform_support_; // Not owned.
79
80 std::deque<PendingCheck> pending_checks_;
81 std::map<OverlayCheck_Params, bool, OverlayCompare> cache_;
82
83 DISALLOW_COPY_AND_ASSIGN(DrmHostOverlayCandidates);
84 };
85
86 } // namespace ui
87
88 #endif // UI_OZONE_PLATFORM_DRM_HOST_OVERLAY_CANDIDATES_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698