Sean Paul | 6a55e9f | 2015-04-30 15:31:06 -0400 | [diff] [blame] | 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 | |
Sean Paul | 6a55e9f | 2015-04-30 15:31:06 -0400 | [diff] [blame] | 20 | #include <xf86drmMode.h> |
| 21 | |
Roman Stratiienko | e78235c | 2021-12-23 17:36:12 +0200 | [diff] [blame] | 22 | #include <cstdint> |
| 23 | |
Roman Stratiienko | cad8e0c | 2022-01-31 16:40:16 +0200 | [diff] [blame] | 24 | #include "DrmDisplayPipeline.h" |
Roman Stratiienko | 13cc366 | 2020-08-29 21:35:39 +0300 | [diff] [blame] | 25 | #include "DrmMode.h" |
| 26 | #include "DrmProperty.h" |
Roman Stratiienko | 10be875 | 2022-01-30 20:28:46 +0200 | [diff] [blame] | 27 | #include "DrmUnique.h" |
Roman Stratiienko | aa3cd54 | 2020-08-29 11:26:16 +0300 | [diff] [blame] | 28 | |
Sean Paul | 6a55e9f | 2015-04-30 15:31:06 -0400 | [diff] [blame] | 29 | namespace android { |
| 30 | |
Alexandru Gheorghe | 0f5abd7 | 2018-05-01 14:37:10 +0100 | [diff] [blame] | 31 | class DrmDevice; |
Sean Paul | 877be97 | 2015-06-03 14:08:27 -0400 | [diff] [blame] | 32 | |
Roman Stratiienko | cad8e0c | 2022-01-31 16:40:16 +0200 | [diff] [blame] | 33 | class DrmCrtc : public PipelineBindable<DrmCrtc> { |
Sean Paul | 6a55e9f | 2015-04-30 15:31:06 -0400 | [diff] [blame] | 34 | public: |
Roman Stratiienko | 10be875 | 2022-01-30 20:28:46 +0200 | [diff] [blame] | 35 | static auto CreateInstance(DrmDevice &dev, uint32_t crtc_id, uint32_t index) |
| 36 | -> std::unique_ptr<DrmCrtc>; |
| 37 | |
| 38 | DrmCrtc() = delete; |
Zach Reizner | ff30b52 | 2015-10-28 19:08:45 -0700 | [diff] [blame] | 39 | DrmCrtc(const DrmCrtc &) = delete; |
| 40 | DrmCrtc &operator=(const DrmCrtc &) = delete; |
Sean Paul | 6a55e9f | 2015-04-30 15:31:06 -0400 | [diff] [blame] | 41 | |
Roman Stratiienko | 10be875 | 2022-01-30 20:28:46 +0200 | [diff] [blame] | 42 | auto GetId() const { |
| 43 | return crtc_->crtc_id; |
| 44 | } |
Sean Paul | 877be97 | 2015-06-03 14:08:27 -0400 | [diff] [blame] | 45 | |
Roman Stratiienko | 10be875 | 2022-01-30 20:28:46 +0200 | [diff] [blame] | 46 | auto GetIndexInResArray() const { |
| 47 | return index_in_res_array_; |
| 48 | } |
Sean Paul | 6a55e9f | 2015-04-30 15:31:06 -0400 | [diff] [blame] | 49 | |
Roman Stratiienko | 10be875 | 2022-01-30 20:28:46 +0200 | [diff] [blame] | 50 | auto &GetActiveProperty() const { |
| 51 | return active_property_; |
| 52 | } |
Sean Paul | 6a55e9f | 2015-04-30 15:31:06 -0400 | [diff] [blame] | 53 | |
Roman Stratiienko | 10be875 | 2022-01-30 20:28:46 +0200 | [diff] [blame] | 54 | auto &GetModeProperty() const { |
| 55 | return mode_property_; |
| 56 | } |
Sean Paul | 6a55e9f | 2015-04-30 15:31:06 -0400 | [diff] [blame] | 57 | |
Roman Stratiienko | 10be875 | 2022-01-30 20:28:46 +0200 | [diff] [blame] | 58 | auto &GetOutFencePtrProperty() const { |
| 59 | return out_fence_ptr_property_; |
| 60 | } |
Sean Paul | 877be97 | 2015-06-03 14:08:27 -0400 | [diff] [blame] | 61 | |
Sean Paul | 6a55e9f | 2015-04-30 15:31:06 -0400 | [diff] [blame] | 62 | private: |
Roman Stratiienko | 10be875 | 2022-01-30 20:28:46 +0200 | [diff] [blame] | 63 | DrmCrtc(DrmModeCrtcUnique crtc, uint32_t index) |
| 64 | : crtc_(std::move(crtc)), index_in_res_array_(index){}; |
Sean Paul | 877be97 | 2015-06-03 14:08:27 -0400 | [diff] [blame] | 65 | |
Roman Stratiienko | 10be875 | 2022-01-30 20:28:46 +0200 | [diff] [blame] | 66 | DrmModeCrtcUnique crtc_; |
Sean Paul | 6a55e9f | 2015-04-30 15:31:06 -0400 | [diff] [blame] | 67 | |
Roman Stratiienko | 10be875 | 2022-01-30 20:28:46 +0200 | [diff] [blame] | 68 | const uint32_t index_in_res_array_; |
Sean Paul | 877be97 | 2015-06-03 14:08:27 -0400 | [diff] [blame] | 69 | |
| 70 | DrmProperty active_property_; |
| 71 | DrmProperty mode_property_; |
Robert Foss | ca0fbba | 2016-10-20 10:14:43 -0400 | [diff] [blame] | 72 | DrmProperty out_fence_ptr_property_; |
Sean Paul | 6a55e9f | 2015-04-30 15:31:06 -0400 | [diff] [blame] | 73 | }; |
Sean Paul | f72cccd | 2018-08-27 13:59:08 -0400 | [diff] [blame] | 74 | } // namespace android |
Sean Paul | 6a55e9f | 2015-04-30 15:31:06 -0400 | [diff] [blame] | 75 | |
| 76 | #endif // ANDROID_DRM_CRTC_H_ |