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 HardwareCursorPointerManager() = default; 30 ~HardwareCursorPointerManager() = default; 31 void SetTargetDevice(uint32_t devId); 32 void SetHdiServiceState(bool hdiServiceState); 33 bool IsSupported(); 34 int32_t SetPosition(uint32_t devId, int32_t x, int32_t y, BufferHandle* buffer); 35 int32_t EnableStats(bool enable); 36 int32_t GetCursorStats(uint32_t &frameCount, uint32_t &vsyncCount); 37 private: 38 sptr<OHOS::HDI::Display::Composer::V1_2::IDisplayComposerInterface> GetPowerInterface(); 39 bool isEnableState_ { false }; 40 bool isEnable_ { false }; 41 bool isDeviceChange_ { false }; 42 uint32_t devId_ { 0 }; 43 sptr<OHOS::HDI::Display::Composer::V1_2::IDisplayComposerInterface> powerInterface_ = nullptr; 44 std::mutex mtx_; 45 }; 46 } // namespace MMI 47 } // namespace OHOS 48 #endif // HARDWARE_CURSOR_POINTER_MANAGER_H 49