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 bool outerOnly; 44 MultiScreenMode multiScreenMode; 45 MultiScreenPositionOptions mainScreenOption; 46 MultiScreenPositionOptions secondaryScreenOption; 47 }; 48 49 struct BaseEdid { 50 std::string modelName_; 51 std::string manufacturerName_; 52 std::string displayProductName_; 53 std::string asciiText_; 54 std::string displayProductSerialNumber_; 55 uint8_t edidMinor_; 56 uint8_t weekOfManufactureOrModelYearFlag_; 57 uint16_t yearOfManufactureOrModelYear_; 58 uint16_t productCode_; 59 uint32_t serialNumber_; 60 int32_t hScreenSize_; // Horizontal Screen Size in cm. 61 int32_t vScreenSize_; 62 uint8_t bitsPerPrimaryColor_; 63 uint8_t videoInputType_; 64 uint8_t gamma_; 65 uint8_t feature_; 66 uint8_t colorCharacteristics_[10]; 67 uint8_t extensionFlag_; 68 uint8_t checkSum_; 69 }; 70 71 using ParseEdidFunc = int32_t (*)(const uint8_t*, const uint32_t, struct BaseEdid*); 72 73 bool LoadEdidPlugin(void); 74 void UnloadEdidPlugin(void); 75 bool GetEdid(ScreenId screenId, struct BaseEdid &edid); 76 int32_t GetEdidCheckCode(const std::vector<uint8_t>& edidData); 77 } 78 } 79 #endif /* SCREEN_EDID_PARSE_H */