1 /* 2 * Copyright (c) 2023 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 OHOS_HDI_DISPLAY_V1_1_DISPLAY_CMD_REQUESTER_H 17 #define OHOS_HDI_DISPLAY_V1_1_DISPLAY_CMD_REQUESTER_H 18 19 #include "v1_0/display_command/display_cmd_responser.h" 20 #include "v1_1/display_composer_type.h" 21 22 #define DISPLAY_TRACE HdfTrace trace(__func__, "HDI:DISP:") 23 24 namespace OHOS { 25 namespace HDI { 26 namespace Display { 27 namespace Composer { 28 namespace V1_1 { 29 using namespace OHOS::HDI::Base; 30 31 template <typename Transfer, typename VdiImpl> 32 class DisplayCmdResponser : public V1_0::DisplayCmdResponser<Transfer, VdiImpl> { 33 public: Create(VdiImpl * impl,std::shared_ptr<DeviceCacheManager> cacheMgr)34 static std::unique_ptr<DisplayCmdResponser> Create(VdiImpl* impl, std::shared_ptr<DeviceCacheManager> cacheMgr) 35 { 36 DISPLAY_CHK_RETURN(impl == nullptr, nullptr, 37 HDF_LOGE("%{public}s: error, VdiImpl is nullptr", __func__)); 38 DISPLAY_CHK_RETURN(cacheMgr == nullptr, nullptr, 39 HDF_LOGE("%{public}s: error, VdiImpl is nullptr", __func__)); 40 return std::make_unique<DisplayCmdResponser>(impl, cacheMgr); 41 } 42 DisplayCmdResponser(VdiImpl * impl,std::shared_ptr<DeviceCacheManager> cacheMgr)43 DisplayCmdResponser(VdiImpl* impl, std::shared_ptr<DeviceCacheManager> cacheMgr) : BaseType1_0(impl, cacheMgr) {} 44 ~DisplayCmdResponser()45 virtual ~DisplayCmdResponser() {} 46 47 private: 48 using BaseType1_0 = V1_0::DisplayCmdResponser<Transfer, VdiImpl>; 49 }; 50 using HdiDisplayCmdResponser = DisplayCmdResponser<SharedMemQueue<int32_t>, IDisplayComposerVdi>; 51 } // namespace V1_1 52 } // namespace Composer 53 } // namespace Display 54 } // namespace HDI 55 } // namespace OHOS 56 #endif // OHOS_HDI_DISPLAY_V1_1_DISPLAY_CMD_REQUESTER_H