blob: 98067c13465ae0190cfc8bfeaa30dda25d4d4d37 [file] [log] [blame]
Roman Stratiienko0137f862022-01-04 18:27:40 +02001/*
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 Stratiienkobde95662022-12-10 20:27:58 +020017#pragma once
Roman Stratiienko0137f862022-01-04 18:27:40 +020018
19#include <hardware/hwcomposer2.h>
20
21#include <map>
22
23#include "drm/DrmMode.h"
24
25namespace android {
26
27class DrmConnector;
28
29struct HwcDisplayConfig {
Roman Stratiienkod0c035b2022-01-21 15:12:56 +020030 uint32_t id{};
31 uint32_t group_id{};
Roman Stratiienkodf3120f2022-12-07 23:10:55 +020032 DrmMode mode{};
Roman Stratiienko0137f862022-01-04 18:27:40 +020033 bool disabled{};
34
35 bool IsInterlaced() const {
Roman Stratiienkodf3120f2022-12-07 23:10:55 +020036 return (mode.GetRawMode().flags & DRM_MODE_FLAG_INTERLACE) != 0;
Roman Stratiienko0137f862022-01-04 18:27:40 +020037 }
38};
39
40struct HwcDisplayConfigs {
41 HWC2::Error Update(DrmConnector &conn);
Roman Stratiienko3dacd472022-01-11 19:18:34 +020042 void FillHeadless();
Roman Stratiienko0137f862022-01-04 18:27:40 +020043
Roman Stratiienkod0c035b2022-01-21 15:12:56 +020044 std::map<uint32_t /*config_id*/, struct HwcDisplayConfig> hwc_configs;
Roman Stratiienko0137f862022-01-04 18:27:40 +020045
Roman Stratiienkod0c035b2022-01-21 15:12:56 +020046 uint32_t active_config_id = 0;
47 uint32_t preferred_config_id = 0;
Roman Stratiienkoaa8ec522022-01-17 13:17:56 +020048
Roman Stratiienko3dacd472022-01-11 19:18:34 +020049 // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
Roman Stratiienkod0c035b2022-01-21 15:12:56 +020050 static uint32_t last_config_id;
Roman Stratiienkof0c507f2022-01-17 18:29:24 +020051
52 uint32_t mm_width = 0;
53 uint32_t mm_height = 0;
Roman Stratiienko0137f862022-01-04 18:27:40 +020054};
55
56} // namespace android