1 /* 2 * Copyright (c) 2021 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 HDI_GFX_COMPOSITION_H 17 #define HDI_GFX_COMPOSITION_H 18 #include "display_gfx.h" 19 #include "hdi_composer.h" 20 namespace OHOS { 21 namespace HDI { 22 namespace DISPLAY { 23 class HdiGfxComposition : public HdiComposition { 24 public: 25 int32_t Init(void) override; 26 int32_t SetLayers(std::vector<HdiLayer *> &layers, HdiLayer &clientLayer) override; 27 int32_t Apply(bool modeSet) override; ~HdiGfxComposition()28 ~HdiGfxComposition() override 29 { 30 (void)GfxModuleDeinit(); 31 } 32 33 private: 34 bool CanHandle(HdiLayer &hdiLayer); 35 void InitGfxSurface(ISurface &surface, HdiLayerBuffer &buffer); 36 int32_t BlitLayer(HdiLayer &src, HdiLayer &dst); 37 int32_t ClearRect(HdiLayer &src, HdiLayer &dst); 38 int32_t GfxModuleInit(void); 39 int32_t GfxModuleDeinit(void); 40 void *mGfxModule = nullptr; 41 GfxFuncs *mGfxFuncs = nullptr; 42 HdiLayer *mClientLayer; 43 static constexpr const char* LIB_HDI_GFX_NAME = "libdisplay_gfx.z.so"; 44 static constexpr const char* LIB_GFX_FUNC_INIT = "GfxInitialize"; 45 static constexpr const char* LIB_GFX_FUNC_DEINIT = "GfxUninitialize"; 46 bool valid_ = false; 47 }; 48 } // namespace OHOS 49 } // namespace HDI 50 } // namespace DISPLAY 51 52 #endif // HDI_GFX_COMPOSITION_H 53