1 /* 2 * Copyright (c) 2021-2022 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 DISPLAY_TEST_UTILS_H 17 #define DISPLAY_TEST_UTILS_H 18 #include <vector> 19 #include "display_test.h" 20 namespace OHOS { 21 namespace HDI { 22 namespace DISPLAY { 23 namespace TEST { 24 void SaveFile(const char *fileName, uint8_t *data, int size); 25 void SetUint32(uint32_t &dst, uint32_t value); 26 void SetPixel(const BufferHandle &handle, int x, int y, uint32_t color); 27 void ClearColor(const BufferHandle &handle, uint32_t color); 28 uint32_t GetPixelValue(const BufferHandle &handle, int x, int y); 29 uint32_t CheckPixel(const BufferHandle &handle, int x, int y, uint32_t color); 30 std::vector<IRect> SplitBuffer(const BufferHandle &handle, std::vector<uint32_t> &colors); 31 32 class HdiDisplay { 33 public: SetDisplayBacklight(uint32_t devId,uint32_t & level)34 static int32_t SetDisplayBacklight(uint32_t devId, uint32_t &level) { 35 return DISPLAY_NOT_SUPPORT; 36 }; SetDisplayClientCrop(uint32_t devId,IRect * rect)37 static int32_t SetDisplayClientCrop(uint32_t devId, IRect *rect) { 38 return DISPLAY_NOT_SUPPORT; 39 }; SetDisplayClientDestRect(uint32_t devId,IRect * rect)40 static int32_t SetDisplayClientDestRect(uint32_t devId, IRect *rect) { 41 return DISPLAY_NOT_SUPPORT; 42 }; SetDisplayMode(uint32_t devId,uint32_t modeId)43 static int32_t SetDisplayMode(uint32_t devId, uint32_t modeId) { 44 return DISPLAY_NOT_SUPPORT; 45 }; SetDisplayPowerStatus(uint32_t devId,DispPowerStatus status)46 static int32_t SetDisplayPowerStatus(uint32_t devId, DispPowerStatus status) { 47 return DISPLAY_NOT_SUPPORT; 48 }; GetDisplayBacklight(uint32_t devId,uint32_t & level)49 static int32_t GetDisplayBacklight(uint32_t devId, uint32_t &level) { 50 return DISPLAY_NOT_SUPPORT; 51 }; SetDisplayProperty(uint32_t devId,uint32_t id,uint64_t value)52 static int32_t SetDisplayProperty(uint32_t devId, uint32_t id, uint64_t value) { 53 return DISPLAY_NOT_SUPPORT; 54 }; DestroyVirtualDisplay(uint32_t devId)55 static int32_t DestroyVirtualDisplay(uint32_t devId) { 56 return DISPLAY_NOT_SUPPORT; 57 }; GetDisplayPowerStatus(uint32_t devId,DispPowerStatus status)58 static int32_t GetDisplayPowerStatus(uint32_t devId, DispPowerStatus status) { 59 return DISPLAY_NOT_SUPPORT; 60 }; GetDisplayProperty(uint32_t devId,uint32_t id,uint64_t value)61 static int32_t GetDisplayProperty(uint32_t devId, uint32_t id, uint64_t value) { 62 return DISPLAY_NOT_SUPPORT; 63 }; SetVirtualDisplayBuffer(uint32_t devId,BufferHandle * buffer,int32_t fence)64 static int32_t SetVirtualDisplayBuffer(uint32_t devId, BufferHandle *buffer, int32_t fence) { 65 return DISPLAY_NOT_SUPPORT; 66 }; DestroyLayer(uint32_t devId,uint32_t layerId)67 static int32_t DestroyLayer(uint32_t devId, uint32_t layerId) { 68 return DISPLAY_NOT_SUPPORT; 69 }; InitCmdRequest(uint32_t & request)70 static int32_t InitCmdRequest(uint32_t &request) { 71 return DISPLAY_NOT_SUPPORT; 72 }; CreateVirtualDisplay(uint32_t width,uint32_t height,int32_t format,uint32_t devId)73 static int32_t CreateVirtualDisplay(uint32_t width, uint32_t height, int32_t format, uint32_t devId) { 74 return DISPLAY_NOT_SUPPORT; 75 }; CmdRequest(uint32_t inEleCnt,uint32_t & inFds,uint32_t & outEleCnt)76 static int32_t CmdRequest(uint32_t inEleCnt, uint32_t &inFds, uint32_t &outEleCnt) { 77 return DISPLAY_NOT_SUPPORT; 78 }; GetCmdReply(int32_t reply)79 static int32_t GetCmdReply(int32_t reply) { 80 return DISPLAY_NOT_SUPPORT; 81 }; 82 }; 83 84 class DisplayRegisterCallbackBase { 85 public: OnHotplugIn(uint32_t outputId,bool connected)86 static int32_t OnHotplugIn(uint32_t outputId, bool connected) { 87 return DISPLAY_NOT_SUPPORT; 88 }; OnVBlankCallback(unsigned int sequence,uint64_t ns)89 static int32_t OnVBlankCallback(unsigned int sequence, uint64_t ns) { 90 return DISPLAY_NOT_SUPPORT; 91 }; OnRefreshCallback(uint32_t devId)92 static int32_t OnRefreshCallback(uint32_t devId) { 93 return DISPLAY_NOT_SUPPORT; 94 }; 95 }; 96 } // OHOS 97 } // HDI 98 } // DISPLAY 99 } // TEST 100 101 102 #endif // HDI_TEST_RENDER_UTILS_H 103