blob: ebf0a97eb915f50e0aa80046470a7e2e3ffa89ef [file] [log] [blame]
Sean Paul6a55e9f2015-04-30 15:31:06 -04001/*
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
Sean Paul6a55e9f2015-04-30 15:31:06 -040020#include <xf86drmMode.h>
21
Roman Stratiienkoe78235c2021-12-23 17:36:12 +020022#include <cstdint>
23
Roman Stratiienkocad8e0c2022-01-31 16:40:16 +020024#include "DrmDisplayPipeline.h"
Roman Stratiienko13cc3662020-08-29 21:35:39 +030025#include "DrmMode.h"
26#include "DrmProperty.h"
Roman Stratiienko10be8752022-01-30 20:28:46 +020027#include "DrmUnique.h"
Roman Stratiienkoaa3cd542020-08-29 11:26:16 +030028
Sean Paul6a55e9f2015-04-30 15:31:06 -040029namespace android {
30
Alexandru Gheorghe0f5abd72018-05-01 14:37:10 +010031class DrmDevice;
Sean Paul877be972015-06-03 14:08:27 -040032
Roman Stratiienkocad8e0c2022-01-31 16:40:16 +020033class DrmCrtc : public PipelineBindable<DrmCrtc> {
Sean Paul6a55e9f2015-04-30 15:31:06 -040034 public:
Roman Stratiienko10be8752022-01-30 20:28:46 +020035 static auto CreateInstance(DrmDevice &dev, uint32_t crtc_id, uint32_t index)
36 -> std::unique_ptr<DrmCrtc>;
37
38 DrmCrtc() = delete;
Zach Reiznerff30b522015-10-28 19:08:45 -070039 DrmCrtc(const DrmCrtc &) = delete;
40 DrmCrtc &operator=(const DrmCrtc &) = delete;
Sean Paul6a55e9f2015-04-30 15:31:06 -040041
Roman Stratiienko10be8752022-01-30 20:28:46 +020042 auto GetId() const {
43 return crtc_->crtc_id;
44 }
Sean Paul877be972015-06-03 14:08:27 -040045
Roman Stratiienko10be8752022-01-30 20:28:46 +020046 auto GetIndexInResArray() const {
47 return index_in_res_array_;
48 }
Sean Paul6a55e9f2015-04-30 15:31:06 -040049
Roman Stratiienko10be8752022-01-30 20:28:46 +020050 auto &GetActiveProperty() const {
51 return active_property_;
52 }
Sean Paul6a55e9f2015-04-30 15:31:06 -040053
Roman Stratiienko10be8752022-01-30 20:28:46 +020054 auto &GetModeProperty() const {
55 return mode_property_;
56 }
Sean Paul6a55e9f2015-04-30 15:31:06 -040057
Roman Stratiienko10be8752022-01-30 20:28:46 +020058 auto &GetOutFencePtrProperty() const {
59 return out_fence_ptr_property_;
60 }
Sean Paul877be972015-06-03 14:08:27 -040061
Sean Paul6a55e9f2015-04-30 15:31:06 -040062 private:
Roman Stratiienko10be8752022-01-30 20:28:46 +020063 DrmCrtc(DrmModeCrtcUnique crtc, uint32_t index)
64 : crtc_(std::move(crtc)), index_in_res_array_(index){};
Sean Paul877be972015-06-03 14:08:27 -040065
Roman Stratiienko10be8752022-01-30 20:28:46 +020066 DrmModeCrtcUnique crtc_;
Sean Paul6a55e9f2015-04-30 15:31:06 -040067
Roman Stratiienko10be8752022-01-30 20:28:46 +020068 const uint32_t index_in_res_array_;
Sean Paul877be972015-06-03 14:08:27 -040069
70 DrmProperty active_property_;
71 DrmProperty mode_property_;
Robert Fossca0fbba2016-10-20 10:14:43 -040072 DrmProperty out_fence_ptr_property_;
Sean Paul6a55e9f2015-04-30 15:31:06 -040073};
Sean Paulf72cccd2018-08-27 13:59:08 -040074} // namespace android
Sean Paul6a55e9f2015-04-30 15:31:06 -040075
76#endif // ANDROID_DRM_CRTC_H_