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 IsInterlacedHwcDisplayConfig35 bool IsInterlaced() const { 36 return (mode.GetRawMode().flags & DRM_MODE_FLAG_INTERLACE) != 0; 37 } 38 }; 39 40 struct HwcDisplayConfigs { 41 HWC2::Error Update(DrmConnector &conn); 42 void GenFakeMode(uint16_t width, uint16_t height); 43 44 std::map<uint32_t /*config_id*/, struct HwcDisplayConfig> hwc_configs; 45 46 uint32_t active_config_id = 0; 47 uint32_t preferred_config_id = 0; 48 49 // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) 50 static uint32_t last_config_id; 51 52 uint32_t mm_width = 0; 53 uint32_t mm_height = 0; 54 }; 55 56 } // namespace android 57