Roman Stratiienko | 0137f86 | 2022-01-04 18:27:40 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2022 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_HWC2_DEVICE_HWC_DISPLAY_CONFIGS_H |
| 18 | #define ANDROID_HWC2_DEVICE_HWC_DISPLAY_CONFIGS_H |
| 19 | |
| 20 | #include <hardware/hwcomposer2.h> |
| 21 | |
| 22 | #include <map> |
| 23 | |
| 24 | #include "drm/DrmMode.h" |
| 25 | |
| 26 | namespace android { |
| 27 | |
| 28 | class DrmConnector; |
| 29 | |
| 30 | struct HwcDisplayConfig { |
Roman Stratiienko | d0c035b | 2022-01-21 15:12:56 +0200 | [diff] [blame^] | 31 | uint32_t id{}; |
| 32 | uint32_t group_id{}; |
Roman Stratiienko | 0137f86 | 2022-01-04 18:27:40 +0200 | [diff] [blame] | 33 | DrmMode mode; |
| 34 | bool disabled{}; |
| 35 | |
| 36 | bool IsInterlaced() const { |
| 37 | return (mode.flags() & DRM_MODE_FLAG_INTERLACE) != 0; |
| 38 | } |
| 39 | }; |
| 40 | |
| 41 | struct HwcDisplayConfigs { |
| 42 | HWC2::Error Update(DrmConnector &conn); |
Roman Stratiienko | 3dacd47 | 2022-01-11 19:18:34 +0200 | [diff] [blame] | 43 | void FillHeadless(); |
Roman Stratiienko | 0137f86 | 2022-01-04 18:27:40 +0200 | [diff] [blame] | 44 | |
Roman Stratiienko | d0c035b | 2022-01-21 15:12:56 +0200 | [diff] [blame^] | 45 | std::map<uint32_t /*config_id*/, struct HwcDisplayConfig> hwc_configs; |
Roman Stratiienko | 0137f86 | 2022-01-04 18:27:40 +0200 | [diff] [blame] | 46 | |
Roman Stratiienko | d0c035b | 2022-01-21 15:12:56 +0200 | [diff] [blame^] | 47 | uint32_t active_config_id = 0; |
| 48 | uint32_t preferred_config_id = 0; |
Roman Stratiienko | aa8ec52 | 2022-01-17 13:17:56 +0200 | [diff] [blame] | 49 | |
Roman Stratiienko | 3dacd47 | 2022-01-11 19:18:34 +0200 | [diff] [blame] | 50 | // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) |
Roman Stratiienko | d0c035b | 2022-01-21 15:12:56 +0200 | [diff] [blame^] | 51 | static uint32_t last_config_id; |
Roman Stratiienko | f0c507f | 2022-01-17 18:29:24 +0200 | [diff] [blame] | 52 | |
| 53 | uint32_t mm_width = 0; |
| 54 | uint32_t mm_height = 0; |
Roman Stratiienko | 0137f86 | 2022-01-04 18:27:40 +0200 | [diff] [blame] | 55 | }; |
| 56 | |
| 57 | } // namespace android |
| 58 | |
| 59 | #endif |