1 /* 2 * Copyright (c) 2023 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_DRV_H 17 #define DISPLAY_DRV_H 18 19 #include <stdint.h> 20 namespace OHOS { 21 namespace PowerMgr { 22 constexpr const char* FB_DEV_PATH = "/dev/graphics/fb0"; 23 constexpr const char* DRM_DEV_PATH = "/dev/dri/card0"; 24 using DisplayInfo = struct DisplayInfo_ { 25 int width {}; 26 int height {}; 27 unsigned int rowBytes {}; 28 unsigned int pixelBytes {}; 29 }; 30 class DisplayDrv { 31 public: DisplayDrv()32 DisplayDrv() : fd_(-1) {} ~DisplayDrv()33 virtual ~DisplayDrv() {} 34 virtual bool Init() = 0; 35 virtual void Flip(const uint8_t* buf) = 0; 36 virtual void GetDisplayInfo(DisplayInfo& dsInfo) = 0; 37 virtual void Blank(bool blank) = 0; 38 virtual void Exit() = 0; 39 40 protected: 41 int fd_; 42 }; 43 } // namespace PowerMgr 44 } // namespace OHOS 45 #endif 46