• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #pragma once
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 {
30   uint32_t id{};
31   uint32_t group_id{};
32   DrmMode mode{};
33   bool disabled{};
34   uint32_t output_type{};
35 
IsInterlacedHwcDisplayConfig36   bool IsInterlaced() const {
37     return (mode.GetRawMode().flags & DRM_MODE_FLAG_INTERLACE) != 0;
38   }
39 };
40 
41 struct HwcDisplayConfigs {
42   HWC2::Error Update(DrmConnector &conn);
43   void GenFakeMode(uint16_t width, uint16_t height);
44 
45   std::map<uint32_t /*config_id*/, struct HwcDisplayConfig> hwc_configs;
46 
47   uint32_t active_config_id = 0;
48   uint32_t preferred_config_id = 0;
49 
50   // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
51   static uint32_t last_config_id;
52 
53   uint32_t mm_width = 0;
54   uint32_t mm_height = 0;
55 };
56 
57 }  // namespace android
58