• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2015 The Android Open Source Project
3  *
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
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16 
17 #ifndef ANDROID_DRM_CRTC_H_
18 #define ANDROID_DRM_CRTC_H_
19 
20 #include <xf86drmMode.h>
21 
22 #include <cstdint>
23 
24 #include "DrmDisplayPipeline.h"
25 #include "DrmMode.h"
26 #include "DrmProperty.h"
27 #include "DrmUnique.h"
28 
29 namespace android {
30 
31 class DrmDevice;
32 
33 class DrmCrtc : public PipelineBindable<DrmCrtc> {
34  public:
35   static auto CreateInstance(DrmDevice &dev, uint32_t crtc_id, uint32_t index)
36       -> std::unique_ptr<DrmCrtc>;
37 
38   DrmCrtc() = delete;
39   DrmCrtc(const DrmCrtc &) = delete;
40   DrmCrtc &operator=(const DrmCrtc &) = delete;
41 
GetId()42   auto GetId() const {
43     return crtc_->crtc_id;
44   }
45 
GetIndexInResArray()46   auto GetIndexInResArray() const {
47     return index_in_res_array_;
48   }
49 
GetActiveProperty()50   auto &GetActiveProperty() const {
51     return active_property_;
52   }
53 
GetModeProperty()54   auto &GetModeProperty() const {
55     return mode_property_;
56   }
57 
GetOutFencePtrProperty()58   auto &GetOutFencePtrProperty() const {
59     return out_fence_ptr_property_;
60   }
61 
62  private:
DrmCrtc(DrmModeCrtcUnique crtc,uint32_t index)63   DrmCrtc(DrmModeCrtcUnique crtc, uint32_t index)
64       : crtc_(std::move(crtc)), index_in_res_array_(index){};
65 
66   DrmModeCrtcUnique crtc_;
67 
68   const uint32_t index_in_res_array_;
69 
70   DrmProperty active_property_;
71   DrmProperty mode_property_;
72   DrmProperty out_fence_ptr_property_;
73 };
74 }  // namespace android
75 
76 #endif  // ANDROID_DRM_CRTC_H_
77