blob: 5bcf696c3ce96a8693b305a757b1dc9275768501 [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);
43
44 std::map<int /*config_id*/, struct HwcDisplayConfig> hwc_configs;
45
46 int active_config_id = 0;
47 int preferred_config_id = 0;
Roman Stratiienkoaa8ec522022-01-17 13:17:56 +020048
49 int last_config_id = 1;
Roman Stratiienkof0c507f2022-01-17 18:29:24 +020050
51 uint32_t mm_width = 0;
52 uint32_t mm_height = 0;
Roman Stratiienko0137f862022-01-04 18:27:40 +020053};
54
55} // namespace android
56
57#endif