2 // Copyright (c) 2016 Intel Corporation
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://www.apache.org/licenses/LICENSE-2.0
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
17 #ifndef PUBLIC_GPUDEVICE_H_
18 #define PUBLIC_GPUDEVICE_H_
25 #include "displaymanager.h"
26 #include "hwcthread.h"
27 #include "logicaldisplaymanager.h"
28 #include "nativedisplay.h"
30 namespace hwcomposer {
34 class GpuDevice : public HWCThread {
43 uint32_t GetFD() const;
45 NativeDisplay* GetDisplay(uint32_t display);
47 NativeDisplay* CreateVirtualDisplay(uint32_t display_index);
48 void DestroyVirtualDisplay(uint32_t display_index);
50 // This display can be a client preparing
51 // content which will eventually shown by
52 // another parent display.
54 void GetConnectedPhysicalDisplays(std::vector<NativeDisplay*>& displays);
56 const std::vector<NativeDisplay*>& GetAllDisplays();
58 void RegisterHotPlugEventCallback(
59 std::shared_ptr<DisplayHotPlugEventCallback> callback);
61 // Enables the usage of HDCP for all planes supporting this feature
62 // on display. Some displays can support latest HDCP specification and also
63 // have ability to fallback to older specifications i.e. HDCP 2.2 and 1.4
64 // in case latest speicification cannot be supported for some reason.
65 // Content type is defined by content_type.
66 void EnableHDCPSessionForDisplay(uint32_t connector,
67 HWCContentType content_type);
69 // Enables the usage of HDCP for all planes supporting this feature
70 // on all connected displays. Some displays can support latest HDCP
71 // specification and also have ability to fallback to older
72 // specifications i.e. HDCP 2.2 and 1.4 in case latest speicification
73 // cannot be supported for some reason. Content type is defined by
75 void EnableHDCPSessionForAllDisplays(HWCContentType content_type);
77 // The control disables the usage of HDCP for all planes supporting this
78 // feature on display.
79 void DisableHDCPSessionForDisplay(uint32_t connector);
81 // The control disables the usage of HDCP for all planes supporting this
82 // feature on all connected displays.
83 void DisableHDCPSessionForAllDisplays();
85 void SetPAVPSessionStatus(bool enabled, uint32_t pavp_session_id,
86 uint32_t pavp_instance_id);
87 void SetHDCPSRMForAllDisplays(const int8_t* SRM, uint32_t SRMLength);
88 void SetHDCPSRMForDisplay(uint32_t connector, const int8_t* SRM,
90 uint32_t GetDisplayIDFromConnectorID(const uint32_t connector_id);
92 bool IsReservedDrmPlane();
94 std::vector<uint32_t> GetDisplayReservedPlanes(uint32_t display_id);
97 enum InitializationType {
98 kUnInitialized = 0, // Nothing Initialized.
99 kInitialized = 1 << 1 // Everything Initialized
102 void HandleHWCSettings();
104 void HandleRoutine() override;
105 void HandleWait() override;
106 void ParsePlaneReserveSettings(std::string& value);
107 std::unique_ptr<DisplayManager> display_manager_;
108 std::vector<std::unique_ptr<LogicalDisplayManager>> logical_display_manager_;
109 std::vector<std::unique_ptr<NativeDisplay>> mosaic_displays_;
110 std::vector<NativeDisplay*> total_displays_;
112 bool reserve_plane_ = false;
113 std::map<uint8_t, std::vector<uint32_t>> reserved_drm_display_planes_map_;
114 uint32_t initialization_state_ = kUnInitialized;
115 SpinLock initialization_state_lock_;
117 friend class DrmDisplayManager;
120 } // namespace hwcomposer
121 #endif // PUBLIC_GPUDEVICE_H_