xref: /aosp_15_r20/external/drm_hwcomposer/drm/DrmCrtc.h (revision 0a9764fe0a15e71ebbeb85e87e10990c23aab47f)
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 #pragma once
18 
19 #include <xf86drmMode.h>
20 
21 #include <cstdint>
22 
23 #include "DrmDisplayPipeline.h"
24 #include "DrmMode.h"
25 #include "DrmProperty.h"
26 #include "DrmUnique.h"
27 
28 namespace android {
29 
30 class DrmDevice;
31 
32 class DrmCrtc : public PipelineBindable<DrmCrtc> {
33  public:
34   static auto CreateInstance(DrmDevice &dev, uint32_t crtc_id, uint32_t index)
35       -> std::unique_ptr<DrmCrtc>;
36 
37   DrmCrtc() = delete;
38   DrmCrtc(const DrmCrtc &) = delete;
39   DrmCrtc &operator=(const DrmCrtc &) = delete;
40 
GetId()41   auto GetId() const {
42     return crtc_->crtc_id;
43   }
44 
GetIndexInResArray()45   auto GetIndexInResArray() const {
46     return index_in_res_array_;
47   }
48 
GetActiveProperty()49   auto &GetActiveProperty() const {
50     return active_property_;
51   }
52 
GetModeProperty()53   auto &GetModeProperty() const {
54     return mode_property_;
55   }
56 
GetOutFencePtrProperty()57   auto &GetOutFencePtrProperty() const {
58     return out_fence_ptr_property_;
59   }
60 
GetCtmProperty()61   auto &GetCtmProperty() const {
62     return ctm_property_;
63   }
64 
65  private:
DrmCrtc(DrmModeCrtcUnique crtc,uint32_t index)66   DrmCrtc(DrmModeCrtcUnique crtc, uint32_t index)
67       : crtc_(std::move(crtc)), index_in_res_array_(index){};
68 
69   DrmModeCrtcUnique crtc_;
70 
71   const uint32_t index_in_res_array_;
72 
73   DrmProperty ctm_property_;
74 
75   DrmProperty active_property_;
76   DrmProperty mode_property_;
77   DrmProperty out_fence_ptr_property_;
78 };
79 }  // namespace android
80