• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2024 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 HARDWARE_CURSOR_POINTER_MANAGER_H
17 #define HARDWARE_CURSOR_POINTER_MANAGER_H
18 
19 #include <mutex>
20 #include <parameters.h>
21 
22 #include "singleton.h"
23 #include "v1_2/include/idisplay_composer_interface.h"
24 
25 namespace OHOS {
26 namespace MMI {
27 class HardwareCursorPointerManager {
28 public:
29 #ifdef OHOS_BUILD_ENABLE_HARDWARE_CURSOR
30     HardwareCursorPointerManager() = default;
31     ~HardwareCursorPointerManager() = default;
32     void SetTargetDevice(uint32_t devId);
33     void SetHdiServiceState(bool hdiServiceState);
34     bool IsSupported();
35     int32_t SetPosition(uint32_t devId, int32_t x, int32_t y, BufferHandle* buffer);
36     int32_t EnableStats(bool enable);
37     int32_t GetCursorStats(uint32_t &frameCount, uint32_t &vsyncCount);
38 private:
39     sptr<OHOS::HDI::Display::Composer::V1_2::IDisplayComposerInterface> GetPowerInterface();
40     bool isEnableState_ { false };
41     bool isEnable_ { false };
42     bool isDeviceChange_ { false };
43     uint32_t devId_ { 0 };
44     sptr<OHOS::HDI::Display::Composer::V1_2::IDisplayComposerInterface> powerInterface_ = nullptr;
45     std::mutex mtx_;
46 #endif // OHOS_BUILD_ENABLE_HARDWARE_CURSOR
47 };
48 } // namespace MMI
49 } // namespace OHOS
50 #endif // HARDWARE_CURSOR_POINTER_MANAGER_H
51