• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021–2022 Beijing OSWare Technology Co., Ltd
3  * This file contains confidential and proprietary information of
4  * OSWare Technology Co., Ltd
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  *     http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 
19 #ifndef DRM_PLANE_H
20 #define DRM_PLANE_H
21 #include <cinttypes>
22 #include <string>
23 #include <vector>
24 #include <xf86drm.h>
25 #include <xf86drmMode.h>
26 
27 namespace OHOS {
28 namespace HDI {
29 namespace DISPLAY {
30 const std::string PROP_FBID = "FB_ID";
31 const std::string PROP_IN_FENCE_FD = "IN_FENCE_FD";
32 const std::string PROP_CRTC_ID = "CRTC_ID";
33 const std::string PROP_TYPE = "type";
34 class DrmDevice;
35 
36 class DrmPlane {
37 public:
38     explicit DrmPlane(drmModePlane &p);
39     virtual ~DrmPlane();
40     int32_t Init(DrmDevice &drmDevice);
GetId()41     uint32_t GetId() const
42     {
43         return mId;
44     }
GetPropFbId()45     uint32_t GetPropFbId() const
46     {
47         return mPropFbId;
48     }
GetPropFenceInId()49     uint32_t GetPropFenceInId() const
50     {
51         return mPropFenceInId;
52     }
GetPropCrtcId()53     uint32_t GetPropCrtcId() const
54     {
55         return mPropCrtcId;
56     }
GetPossibleCrtcs()57     uint32_t GetPossibleCrtcs() const
58     {
59         return mPossibleCrtcs;
60     }
GetType()61     uint32_t GetType() const
62     {
63         return mType;
64     }
BindToPipe(uint32_t pipe)65     void BindToPipe(uint32_t pipe)
66     {
67         mPipe = pipe;
68     }
UnBindPipe()69     void UnBindPipe()
70     {
71         mPipe = 0;
72     }
IsIdle()73     bool IsIdle() const
74     {
75         return (mPipe == 0);
76     }
77 
78 private:
79     uint32_t mId = 0;
80     uint32_t mPossibleCrtcs = 0;
81     uint32_t mPropFbId = 0;
82     uint32_t mPropFenceInId = 0;
83     uint32_t mPropCrtcId = 0;
84     uint32_t mPipe = 0;
85     uint32_t mType = 0;
86     std::vector<uint32_t> mFormats;
87 };
88 } // namespace OHOS
89 } // namespace HDI
90 } // namespace DISPLAY
91 
92 #endif // DRM_PLANE_H