blob: 42fc9f9d79eddfe3912e39212ae81744f7b28dd8 [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 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
Sean Paul6a55e9f2015-04-30 15:31:06 -040032class DrmCrtc {
33 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
Sean Paul6a55e9f2015-04-30 15:31:06 -040061 private:
Roman Stratiienko10be8752022-01-30 20:28:46 +020062 DrmCrtc(DrmModeCrtcUnique crtc, uint32_t index)
63 : crtc_(std::move(crtc)), index_in_res_array_(index){};
Sean Paul877be972015-06-03 14:08:27 -040064
Roman Stratiienko10be8752022-01-30 20:28:46 +020065 DrmModeCrtcUnique crtc_;
Sean Paul6a55e9f2015-04-30 15:31:06 -040066
Roman Stratiienko10be8752022-01-30 20:28:46 +020067 const uint32_t index_in_res_array_;
Sean Paul877be972015-06-03 14:08:27 -040068
69 DrmProperty active_property_;
70 DrmProperty mode_property_;
Robert Fossca0fbba2016-10-20 10:14:43 -040071 DrmProperty out_fence_ptr_property_;
Sean Paul6a55e9f2015-04-30 15:31:06 -040072};
Sean Paulf72cccd2018-08-27 13:59:08 -040073} // namespace android
Sean Paul6a55e9f2015-04-30 15:31:06 -040074
75#endif // ANDROID_DRM_CRTC_H_