1 /* 2 * Copyright (C) 2021–2022 Beijing OSWare Technology Co., Ltd 3 * This file contains confidential and proprietary information of 4 * OSWare Technology Co., Ltd 5 * 6 * Licensed under the Apache License, Version 2.0 (the "License"); 7 * you may not use this file except in compliance with the License. 8 * You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, software 13 * distributed under the License is distributed on an "AS IS" BASIS, 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 * See the License for the specific language governing permissions and 16 * limitations under the License. 17 */ 18 19 #ifndef FB_DISPLAY_H 20 #define FB_DISPLAY_H 21 #include <unordered_map> 22 #include <memory> 23 #include <vector> 24 #include "hdi_display.h" 25 #include "hdi_composer.h" 26 #include "fb_composition.h" 27 28 namespace OHOS { 29 namespace HDI { 30 namespace DISPLAY { 31 class FbDisplay : public HdiDisplay { 32 public: 33 explicit FbDisplay(std::vector<int> &fds); 34 virtual ~FbDisplay(); 35 int32_t Init() override; 36 int32_t GetDisplayCapability(DisplayCapability *info) override; 37 int32_t GetDisplaySupportedModes(uint32_t *num, DisplayModeInfo *modes) override; 38 int32_t GetDisplayMode(uint32_t *modeId) override; 39 int32_t SetDisplayMode(uint32_t modeId) override; 40 int32_t GetDisplayPowerStatus(DispPowerStatus *status) override; 41 int32_t SetDisplayPowerStatus(DispPowerStatus status) override; 42 int32_t GetDisplayBacklight(uint32_t *value) override; 43 int32_t SetDisplayBacklight(uint32_t value) override; 44 virtual int32_t RegDisplayVBlankCallback(VBlankCallback cb, void *data) override; 45 virtual bool IsConnected() override; 46 virtual int32_t SetDisplayVsyncEnabled(bool enabled) override; 47 protected: 48 std::unique_ptr<HdiLayer> CreateHdiLayer(LayerType type) override; 49 private: 50 // the first fd is the master device fd 51 std::vector<int> deviceFds_; 52 std::vector<DisplayModeInfo> modes_; 53 uint32_t mActiveModeId = INVALID_MODE_ID; 54 DisplayCapability displayCapability_; 55 DispPowerStatus mPowerstatus = POWER_STATUS_ON; 56 }; 57 } // namespace OHOS 58 } // namespace HDI 59 } // namespace DISPLAY 60 61 #endif // HDI_DISPLAY_H