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