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