• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include <mutex>
21 namespace OHOS {
22 namespace HDI {
23 namespace DISPLAY {
24 class HdiGfxComposition : public HdiComposition {
25 public:
26     int32_t Init(void) override;
27     int32_t SetLayers(std::vector<HdiLayer *> &layers, HdiLayer &clientLayer) override;
28     int32_t Apply(bool modeSet) override;
~HdiGfxComposition()29     ~HdiGfxComposition() override
30     {
31         (void)GfxModuleDeinit();
32     }
33 
34 private:
35     bool CanHandle(HdiLayer &hdiLayer);
36     bool UseCompositionClient(std::vector<HdiLayer *> &layers);
37     void InitGfxSurface(ISurface &iSurface, HdiLayerBuffer &buffer);
38     int32_t BlitLayer(HdiLayer &src, HdiLayer &dst);
39     int32_t ClearRect(HdiLayer &src, HdiLayer &dst);
40     int32_t GfxModuleInit(void);
41     int32_t GfxModuleDeinit(void);
42     void *mGfxModule = nullptr;
43     GfxFuncs *mGfxFuncs = nullptr;
44     HdiLayer *mClientLayer;
45     std::mutex mCompLayersMutex;
46 };
47 } // namespace OHOS
48 } // namespace HDI
49 } // namespace DISPLAY
50 
51 #endif // HDI_GFX_COMPOSITION_H
52