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_MODE_H_ |
| 18 | #define ANDROID_DRM_MODE_H_ |
| 19 | |
Sean Paul | 6a55e9f | 2015-04-30 15:31:06 -0400 | [diff] [blame] | 20 | #include <xf86drmMode.h> |
Roman Stratiienko | aa3cd54 | 2020-08-29 11:26:16 +0300 | [diff] [blame] | 21 | |
Roman Stratiienko | a148f21 | 2021-11-16 18:23:18 +0200 | [diff] [blame] | 22 | #include <cstdint> |
Roman Stratiienko | e78235c | 2021-12-23 17:36:12 +0200 | [diff] [blame^] | 23 | #include <cstdio> |
Sean Paul | f72cccd | 2018-08-27 13:59:08 -0400 | [diff] [blame] | 24 | #include <string> |
Sean Paul | 6a55e9f | 2015-04-30 15:31:06 -0400 | [diff] [blame] | 25 | |
Roman Stratiienko | 40b374b | 2021-10-22 18:13:09 +0300 | [diff] [blame] | 26 | #include "DrmUnique.h" |
| 27 | |
Sean Paul | 6a55e9f | 2015-04-30 15:31:06 -0400 | [diff] [blame] | 28 | namespace android { |
| 29 | |
Roman Stratiienko | 40b374b | 2021-10-22 18:13:09 +0300 | [diff] [blame] | 30 | class DrmDevice; |
| 31 | |
Sean Paul | 6a55e9f | 2015-04-30 15:31:06 -0400 | [diff] [blame] | 32 | class DrmMode { |
| 33 | public: |
Zach Reizner | ff30b52 | 2015-10-28 19:08:45 -0700 | [diff] [blame] | 34 | DrmMode() = default; |
Roman Stratiienko | e78235c | 2021-12-23 17:36:12 +0200 | [diff] [blame^] | 35 | explicit DrmMode(drmModeModeInfoPtr m); |
Sean Paul | 6a55e9f | 2015-04-30 15:31:06 -0400 | [diff] [blame] | 36 | |
| 37 | bool operator==(const drmModeModeInfo &m) const; |
Sean Paul | 6a55e9f | 2015-04-30 15:31:06 -0400 | [diff] [blame] | 38 | |
Sean Paul | 6a55e9f | 2015-04-30 15:31:06 -0400 | [diff] [blame] | 39 | uint32_t clock() const; |
| 40 | |
Roman Stratiienko | 40b374b | 2021-10-22 18:13:09 +0300 | [diff] [blame] | 41 | uint16_t h_display() const; |
| 42 | uint16_t h_sync_start() const; |
| 43 | uint16_t h_sync_end() const; |
| 44 | uint16_t h_total() const; |
| 45 | uint16_t h_skew() const; |
Sean Paul | 6a55e9f | 2015-04-30 15:31:06 -0400 | [diff] [blame] | 46 | |
Roman Stratiienko | 40b374b | 2021-10-22 18:13:09 +0300 | [diff] [blame] | 47 | uint16_t v_display() const; |
| 48 | uint16_t v_sync_start() const; |
| 49 | uint16_t v_sync_end() const; |
| 50 | uint16_t v_total() const; |
| 51 | uint16_t v_scan() const; |
Stéphane Marchesin | b74e08c | 2015-07-05 02:00:08 -0700 | [diff] [blame] | 52 | float v_refresh() const; |
Sean Paul | 6a55e9f | 2015-04-30 15:31:06 -0400 | [diff] [blame] | 53 | |
| 54 | uint32_t flags() const; |
| 55 | uint32_t type() const; |
| 56 | |
| 57 | std::string name() const; |
| 58 | |
Roman Stratiienko | 40b374b | 2021-10-22 18:13:09 +0300 | [diff] [blame] | 59 | auto CreateModeBlob(const DrmDevice &drm) -> DrmModeUserPropertyBlobUnique; |
| 60 | |
Sean Paul | 6a55e9f | 2015-04-30 15:31:06 -0400 | [diff] [blame] | 61 | private: |
Zach Reizner | ff30b52 | 2015-10-28 19:08:45 -0700 | [diff] [blame] | 62 | uint32_t clock_ = 0; |
Sean Paul | 6a55e9f | 2015-04-30 15:31:06 -0400 | [diff] [blame] | 63 | |
Roman Stratiienko | 40b374b | 2021-10-22 18:13:09 +0300 | [diff] [blame] | 64 | uint16_t h_display_ = 0; |
| 65 | uint16_t h_sync_start_ = 0; |
| 66 | uint16_t h_sync_end_ = 0; |
| 67 | uint16_t h_total_ = 0; |
| 68 | uint16_t h_skew_ = 0; |
Sean Paul | 6a55e9f | 2015-04-30 15:31:06 -0400 | [diff] [blame] | 69 | |
Roman Stratiienko | 40b374b | 2021-10-22 18:13:09 +0300 | [diff] [blame] | 70 | uint16_t v_display_ = 0; |
| 71 | uint16_t v_sync_start_ = 0; |
| 72 | uint16_t v_sync_end_ = 0; |
| 73 | uint16_t v_total_ = 0; |
| 74 | uint16_t v_scan_ = 0; |
| 75 | uint16_t v_refresh_ = 0; |
Sean Paul | 6a55e9f | 2015-04-30 15:31:06 -0400 | [diff] [blame] | 76 | |
Zach Reizner | ff30b52 | 2015-10-28 19:08:45 -0700 | [diff] [blame] | 77 | uint32_t flags_ = 0; |
| 78 | uint32_t type_ = 0; |
Sean Paul | 6a55e9f | 2015-04-30 15:31:06 -0400 | [diff] [blame] | 79 | |
| 80 | std::string name_; |
| 81 | }; |
Sean Paul | f72cccd | 2018-08-27 13:59:08 -0400 | [diff] [blame] | 82 | } // namespace android |
Sean Paul | 6a55e9f | 2015-04-30 15:31:06 -0400 | [diff] [blame] | 83 | |
| 84 | #endif // ANDROID_DRM_MODE_H_ |