blob: 75852a6f2c6383c75d3a465806ed77c5e6786ecc [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
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
26namespace android {
27
28class DrmConnector;
29
30struct HwcDisplayConfig {
31 int id{};
32 int group_id{};
33 DrmMode mode;
34 bool disabled{};
35
36 bool IsInterlaced() const {
37 return (mode.flags() & DRM_MODE_FLAG_INTERLACE) != 0;
38 }
39};
40
41struct HwcDisplayConfigs {
42 HWC2::Error Update(DrmConnector &conn);
Roman Stratiienko3dacd472022-01-11 19:18:34 +020043 void FillHeadless();
Roman Stratiienko0137f862022-01-04 18:27:40 +020044
45 std::map<int /*config_id*/, struct HwcDisplayConfig> hwc_configs;
46
47 int active_config_id = 0;
48 int preferred_config_id = 0;
Roman Stratiienkoaa8ec522022-01-17 13:17:56 +020049
Roman Stratiienko3dacd472022-01-11 19:18:34 +020050 // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
51 static int last_config_id;
Roman Stratiienkof0c507f2022-01-17 18:29:24 +020052
53 uint32_t mm_width = 0;
54 uint32_t mm_height = 0;
Roman Stratiienko0137f862022-01-04 18:27:40 +020055};
56
57} // namespace android
58
59#endif