blob: 96443cd6993188cf1cdfef737056e7880035d768 [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
Roman Stratiienkobde95662022-12-10 20:27:58 +020017#pragma once
Sean Paul6a55e9f2015-04-30 15:31:06 -040018
Sean Paul6a55e9f2015-04-30 15:31:06 -040019#include <xf86drmMode.h>
20
Roman Stratiienkoe78235c2021-12-23 17:36:12 +020021#include <cstdint>
22
Roman Stratiienkocad8e0c2022-01-31 16:40:16 +020023#include "DrmDisplayPipeline.h"
Roman Stratiienko13cc3662020-08-29 21:35:39 +030024#include "DrmMode.h"
25#include "DrmProperty.h"
Roman Stratiienko10be8752022-01-30 20:28:46 +020026#include "DrmUnique.h"
Roman Stratiienkoaa3cd542020-08-29 11:26:16 +030027
Sean Paul6a55e9f2015-04-30 15:31:06 -040028namespace android {
29
Alexandru Gheorghe0f5abd72018-05-01 14:37:10 +010030class DrmDevice;
Sean Paul877be972015-06-03 14:08:27 -040031
Roman Stratiienkocad8e0c2022-01-31 16:40:16 +020032class DrmCrtc : public PipelineBindable<DrmCrtc> {
Sean Paul6a55e9f2015-04-30 15:31:06 -040033 public:
Roman Stratiienko10be8752022-01-30 20:28:46 +020034 static auto CreateInstance(DrmDevice &dev, uint32_t crtc_id, uint32_t index)
35 -> std::unique_ptr<DrmCrtc>;
36
37 DrmCrtc() = delete;
Zach Reiznerff30b522015-10-28 19:08:45 -070038 DrmCrtc(const DrmCrtc &) = delete;
39 DrmCrtc &operator=(const DrmCrtc &) = delete;
Sean Paul6a55e9f2015-04-30 15:31:06 -040040
Roman Stratiienko10be8752022-01-30 20:28:46 +020041 auto GetId() const {
42 return crtc_->crtc_id;
43 }
Sean Paul877be972015-06-03 14:08:27 -040044
Roman Stratiienko10be8752022-01-30 20:28:46 +020045 auto GetIndexInResArray() const {
46 return index_in_res_array_;
47 }
Sean Paul6a55e9f2015-04-30 15:31:06 -040048
Roman Stratiienko10be8752022-01-30 20:28:46 +020049 auto &GetActiveProperty() const {
50 return active_property_;
51 }
Sean Paul6a55e9f2015-04-30 15:31:06 -040052
Roman Stratiienko10be8752022-01-30 20:28:46 +020053 auto &GetModeProperty() const {
54 return mode_property_;
55 }
Sean Paul6a55e9f2015-04-30 15:31:06 -040056
Roman Stratiienko10be8752022-01-30 20:28:46 +020057 auto &GetOutFencePtrProperty() const {
58 return out_fence_ptr_property_;
59 }
Sean Paul877be972015-06-03 14:08:27 -040060
Roman Stratiienko0da91bf2023-01-17 18:06:04 +020061 auto &GetCtmProperty() const {
62 return ctm_property_;
63 }
64
Sean Paul6a55e9f2015-04-30 15:31:06 -040065 private:
Roman Stratiienko10be8752022-01-30 20:28:46 +020066 DrmCrtc(DrmModeCrtcUnique crtc, uint32_t index)
67 : crtc_(std::move(crtc)), index_in_res_array_(index){};
Sean Paul877be972015-06-03 14:08:27 -040068
Roman Stratiienko10be8752022-01-30 20:28:46 +020069 DrmModeCrtcUnique crtc_;
Sean Paul6a55e9f2015-04-30 15:31:06 -040070
Roman Stratiienko10be8752022-01-30 20:28:46 +020071 const uint32_t index_in_res_array_;
Sean Paul877be972015-06-03 14:08:27 -040072
Roman Stratiienko0da91bf2023-01-17 18:06:04 +020073 DrmProperty ctm_property_;
74
Sean Paul877be972015-06-03 14:08:27 -040075 DrmProperty active_property_;
76 DrmProperty mode_property_;
Robert Fossca0fbba2016-10-20 10:14:43 -040077 DrmProperty out_fence_ptr_property_;
Sean Paul6a55e9f2015-04-30 15:31:06 -040078};
Sean Paulf72cccd2018-08-27 13:59:08 -040079} // namespace android