1 /* 2 * Copyright (c) 2025 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef SCREEN_EDID_PARSE_H 17 #define SCREEN_EDID_PARSE_H 18 19 #include <string> 20 #include <stdio.h> 21 #include <stdlib.h> 22 #include <vector> 23 24 #include <dlfcn.h> 25 #include <unistd.h> 26 27 #include "window_manager_hilog.h" 28 #include "dm_common.h" 29 #include "transaction/rs_interfaces.h" 30 31 namespace OHOS { 32 namespace Rosen { 33 #if (defined(__aarch64__) || defined(__x86_64__)) 34 const std::string EDID_PARSE_SO_PATH = "/system/lib64/libedid_parse.z.so"; 35 #else 36 const std::string EDID_PARSE_SO_PATH = "/system/lib/libedid_parse.z.so"; 37 #endif 38 39 class RSInterfaces; 40 41 struct MultiScreenInfo { 42 bool isExtendMain; 43 MultiScreenMode multiScreenMode; 44 MultiScreenPositionOptions mainScreenOption; 45 MultiScreenPositionOptions secondaryScreenOption; 46 }; 47 48 struct BaseEdid { 49 std::string modelName_; 50 std::string manufacturerName_; 51 std::string displayProductName_; 52 std::string asciiText_; 53 std::string displayProductSerialNumber_; 54 uint8_t edidMinor_; 55 uint8_t weekOfManufactureOrModelYearFlag_; 56 uint16_t yearOfManufactureOrModelYear_; 57 uint16_t productCode_; 58 uint32_t serialNumber_; 59 int32_t hScreenSize_; // Horizontal Screen Size in cm. 60 int32_t vScreenSize_; 61 uint8_t bitsPerPrimaryColor_; 62 uint8_t videoInputType_; 63 uint8_t gamma_; 64 uint8_t feature_; 65 uint8_t colorCharacteristics_[10]; 66 uint8_t extensionFlag_; 67 uint8_t checkSum_; 68 }; 69 70 using ParseEdidFunc = int32_t (*)(const uint8_t*, const uint32_t, struct BaseEdid*); 71 72 bool LoadEdidPlugin(void); 73 void UnloadEdidPlugin(void); 74 bool GetEdid(ScreenId screenId, struct BaseEdid &edid); 75 int32_t GetEdidCheckCode(const std::vector<uint8_t>& edidData); 76 } 77 } 78 #endif /* SCREEN_EDID_PARSE_H */