diff --git a/display/composer/hdi_service/include/display_composer_service.h b/display/composer/hdi_service/include/display_composer_service.h index c6b736f5799756547c2d66ad18fc0986b5ff767c..040ee6aac5bf8a51b651a59df0c6794017ceca26 100644 --- a/display/composer/hdi_service/include/display_composer_service.h +++ b/display/composer/hdi_service/include/display_composer_service.h @@ -16,13 +16,13 @@ #ifndef OHOS_HDI_DISPLAY_COMPOSER_SERVICE_H #define OHOS_HDI_DISPLAY_COMPOSER_SERVICE_H -#include "idisplay_composer_vdi_v1_1.h" #include "cache_manager/device_cache_manager.h" #include "v1_1/display_command/display_cmd_responser.h" #include "v1_1/idisplay_composer.h" #include "v1_2/display_command/display_cmd_responser.h" #include "v1_2/idisplay_composer.h" #include "v1_2/display_composer_type.h" +#include "common/include/display_vdi_adapter_interface.h" #include namespace OHOS { @@ -84,8 +84,11 @@ public: private: void HidumperInit(); int32_t LoadVdiSo(); - int32_t LoadVdiV1_0(); - int32_t LoadVdiV1_1(); + int32_t LoadVdiAdapter(); + void LoadVdiFuncV1_0(); + void LoadVdiFuncV1_1(); + void ExitService(); + int32_t CreateResponser(); static void OnHotPlug(uint32_t outputId, bool connected, void* data); static void OnVBlank(unsigned int sequence, uint64_t ns, void* data); static void OnMode(uint32_t modeId, uint64_t vBlankPeriod, void* data); @@ -95,6 +98,7 @@ private: private: /* Common */ void* libHandle_; + DisplayComposerVdiAdapter* vdiAdapter_; std::mutex mutex_; std::shared_ptr cacheMgr_; uint32_t currentBacklightLevel_; @@ -102,16 +106,7 @@ private: sptr vBlankCb_; sptr modeCb_; sptr seamlessChangeCb_; - - /* V1_0, which is the version of vdi */ - IDisplayComposerVdi* vdiImpl_; - DestroyComposerVdiFunc destroyVdiFunc_; std::unique_ptr cmdResponser_; - - /* V1_1, which is the version of vdi */ - IDisplayComposerVdiV1_1* vdiImplV1_1_; - DestroyComposerVdiFuncV1_1 destroyVdiFuncV1_1_; - std::unique_ptr cmdResponserV1_1_; sptr refreshCb_; sptr VBlankIdleCb_; }; diff --git a/display/composer/hdi_service/src/display_composer_service.cpp b/display/composer/hdi_service/src/display_composer_service.cpp index 827a752fad5eb1f8d473bcd6b6ab91b32576908a..a8672a40f0447f8ef0c70bf9bc580130d91b7aaf 100644 --- a/display/composer/hdi_service/src/display_composer_service.cpp +++ b/display/composer/hdi_service/src/display_composer_service.cpp @@ -44,36 +44,32 @@ extern "C" V1_2::IDisplayComposer* DisplayComposerImplGetInstance(void) DisplayComposerService::DisplayComposerService() : libHandle_(nullptr), + vdiAdapter_(new(std::nothrow) DisplayComposerVdiAdapter), cacheMgr_(nullptr), currentBacklightLevel_(0), hotPlugCb_(nullptr), vBlankCb_(nullptr), modeCb_(nullptr), seamlessChangeCb_(nullptr), - vdiImpl_(nullptr), - destroyVdiFunc_(nullptr), - cmdResponser_(nullptr), - vdiImplV1_1_(nullptr), - destroyVdiFuncV1_1_(nullptr), - cmdResponserV1_1_(nullptr), refreshCb_(nullptr), VBlankIdleCb_(nullptr) { int32_t ret = LoadVdiSo(); if (ret != HDF_SUCCESS) { - DISPLAY_LOGE("Load composer VDI failed, lib: %{public}s", DISPLAY_COMPOSER_VDI_LIBRARY); + DISPLAY_LOGE("LoadVdiSo failed"); return; } - ret = LoadVdiV1_1(); - if (ret != HDF_SUCCESS) { - ret = LoadVdiV1_0(); + if (LoadVdiAdapter() != HDF_SUCCESS) { + ExitService(); + DISPLAY_LOGE("Create DisplayComposerService failed"); + return; } - if (ret != HDF_SUCCESS) { - dlclose(libHandle_); - libHandle_ = nullptr; - DISPLAY_LOGE("Load composer VDI function failed"); + if (CreateResponser() != HDF_SUCCESS) { + ExitService(); + DISPLAY_LOGE("CreateResponser failed"); + return; } HidumperInit(); @@ -82,19 +78,14 @@ DisplayComposerService::DisplayComposerService() DisplayComposerService::~DisplayComposerService() { std::lock_guard lck(mutex_); - cmdResponser_ = nullptr; - cmdResponserV1_1_ = nullptr; - - if ((destroyVdiFunc_ != nullptr) && (vdiImpl_ != nullptr)) { - destroyVdiFunc_(vdiImpl_); - vdiImpl_ = nullptr; - destroyVdiFunc_ = nullptr; - } + ExitService(); +} - if ((destroyVdiFuncV1_1_ != nullptr) && (vdiImplV1_1_ != nullptr)) { - destroyVdiFuncV1_1_(vdiImplV1_1_); - vdiImplV1_1_ = nullptr; - destroyVdiFuncV1_1_ = nullptr; +void DisplayComposerService::ExitService() +{ + if (vdiAdapter_ != nullptr) { + delete vdiAdapter_; + vdiAdapter_ = nullptr; } if (libHandle_ != nullptr) { @@ -103,6 +94,128 @@ DisplayComposerService::~DisplayComposerService() } } +int32_t DisplayComposerService::LoadVdiAdapter() +{ + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_, HDF_FAILURE); + + LoadVdiFuncV1_0(); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_->RegHotPlugCallback, HDF_FAILURE); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_->GetDisplayCapability, HDF_FAILURE); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_->GetDisplaySupportedModes, HDF_FAILURE); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_->GetDisplayMode, HDF_FAILURE); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_->SetDisplayMode, HDF_FAILURE); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_->GetDisplayPowerStatus, HDF_FAILURE); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_->SetDisplayPowerStatus, HDF_FAILURE); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_->GetDisplayBacklight, HDF_FAILURE); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_->SetDisplayBacklight, HDF_FAILURE); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_->GetDisplayProperty, HDF_FAILURE); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_->GetDisplayCompChange, HDF_FAILURE); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_->SetDisplayClientCrop, HDF_FAILURE); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_->SetDisplayClientBuffer, HDF_FAILURE); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_->SetDisplayClientDamage, HDF_FAILURE); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_->SetDisplayVsyncEnabled, HDF_FAILURE); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_->RegDisplayVBlankCallback, HDF_FAILURE); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_->GetDisplayReleaseFence, HDF_FAILURE); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_->CreateVirtualDisplay, HDF_FAILURE); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_->DestroyVirtualDisplay, HDF_FAILURE); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_->SetVirtualDisplayBuffer, HDF_FAILURE); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_->SetDisplayProperty, HDF_FAILURE); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_->Commit, HDF_FAILURE); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_->CreateLayer, HDF_FAILURE); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_->DestroyLayer, HDF_FAILURE); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_->PrepareDisplayLayers, HDF_FAILURE); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_->SetLayerAlpha, HDF_FAILURE); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_->SetLayerRegion, HDF_FAILURE); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_->SetLayerCrop, HDF_FAILURE); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_->SetLayerZorder, HDF_FAILURE); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_->SetLayerPreMulti, HDF_FAILURE); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_->SetLayerTransformMode, HDF_FAILURE); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_->SetLayerDirtyRegion, HDF_FAILURE); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_->SetLayerVisibleRegion, HDF_FAILURE); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_->SetLayerBuffer, HDF_FAILURE); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_->SetLayerCompositionType, HDF_FAILURE); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_->SetLayerBlendType, HDF_FAILURE); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_->SetLayerMaskInfo, HDF_FAILURE); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_->SetLayerColor, HDF_FAILURE); + LoadVdiFuncV1_1(); + return HDF_SUCCESS; +} + +void DisplayComposerService::LoadVdiFuncV1_0() +{ + vdiAdapter_->LoadVdiImpl = (LoadVdiImplFunc)(dlsym(libHandle_, "LoadVdiImpl")); + vdiAdapter_->DestroyVdiImpl = (DestroyVdiImplFunc)(dlsym(libHandle_, "DestroyVdiImpl")); + vdiAdapter_->RegHotPlugCallback = (RegHotPlugCallbackFunc)(dlsym(libHandle_, "RegHotPlugCallback")); + vdiAdapter_->GetDisplayCapability = (GetDisplayCapabilityFunc)(dlsym(libHandle_, "GetDisplayCapability")); + vdiAdapter_->GetDisplaySupportedModes = + (GetDisplaySupportedModesFunc)(dlsym(libHandle_, "GetDisplaySupportedModes")); + vdiAdapter_->GetDisplayMode = (GetDisplayModeFunc)(dlsym(libHandle_, "GetDisplayMode")); + vdiAdapter_->SetDisplayMode = (SetDisplayModeFunc)(dlsym(libHandle_, "SetDisplayMode")); + vdiAdapter_->GetDisplayPowerStatus = (GetDisplayPowerStatusFunc)(dlsym(libHandle_, "GetDisplayPowerStatus")); + vdiAdapter_->SetDisplayPowerStatus = (SetDisplayPowerStatusFunc)(dlsym(libHandle_, "SetDisplayPowerStatus")); + vdiAdapter_->GetDisplayBacklight = (GetDisplayBacklightFunc)(dlsym(libHandle_, "GetDisplayBacklight")); + vdiAdapter_->SetDisplayBacklight = (SetDisplayBacklightFunc)(dlsym(libHandle_, "SetDisplayBacklight")); + vdiAdapter_->GetDisplayProperty = (GetDisplayPropertyFunc)(dlsym(libHandle_, "GetDisplayProperty")); + vdiAdapter_->GetDisplayCompChange = (GetDisplayCompChangeFunc)(dlsym(libHandle_, "GetDisplayCompChange")); + vdiAdapter_->SetDisplayClientCrop = (SetDisplayClientCropFunc)(dlsym(libHandle_, "SetDisplayClientCrop")); + vdiAdapter_->SetDisplayClientBuffer = (SetDisplayClientBufferFunc)(dlsym(libHandle_, "SetDisplayClientBuffer")); + vdiAdapter_->SetDisplayClientDamage = (SetDisplayClientDamageFunc)(dlsym(libHandle_, "SetDisplayClientDamage")); + vdiAdapter_->SetDisplayVsyncEnabled = (SetDisplayVsyncEnabledFunc)(dlsym(libHandle_, "SetDisplayVsyncEnabled")); + vdiAdapter_->RegDisplayVBlankCallback = + (RegDisplayVBlankCallbackFunc)(dlsym(libHandle_, "RegDisplayVBlankCallback")); + vdiAdapter_->GetDisplayReleaseFence = (GetDisplayReleaseFenceFunc)(dlsym(libHandle_, "GetDisplayReleaseFence")); + vdiAdapter_->CreateVirtualDisplay = (CreateVirtualDisplayFunc)(dlsym(libHandle_, "CreateVirtualDisplay")); + vdiAdapter_->DestroyVirtualDisplay = (DestroyVirtualDisplayFunc)(dlsym(libHandle_, "DestroyVirtualDisplay")); + vdiAdapter_->SetVirtualDisplayBuffer = (SetVirtualDisplayBufferFunc)(dlsym(libHandle_, "SetVirtualDisplayBuffer")); + vdiAdapter_->SetDisplayProperty = (SetDisplayPropertyFunc)(dlsym(libHandle_, "SetDisplayProperty")); + vdiAdapter_->Commit = (CommitFunc)(dlsym(libHandle_, "Commit")); + vdiAdapter_->CreateLayer = (CreateLayerFunc)(dlsym(libHandle_, "CreateLayer")); + vdiAdapter_->DestroyLayer = (DestroyLayerFunc)(dlsym(libHandle_, "DestroyLayer")); + vdiAdapter_->PrepareDisplayLayers = (PrepareDisplayLayersFunc)(dlsym(libHandle_, "PrepareDisplayLayers")); + vdiAdapter_->SetLayerAlpha = (SetLayerAlphaFunc)(dlsym(libHandle_, "SetLayerAlpha")); + vdiAdapter_->SetLayerRegion = (SetLayerRegionFunc)(dlsym(libHandle_, "SetLayerRegion")); + vdiAdapter_->SetLayerCrop = (SetLayerCropFunc)(dlsym(libHandle_, "SetLayerCrop")); + vdiAdapter_->SetLayerZorder = (SetLayerZorderFunc)(dlsym(libHandle_, "SetLayerZorder")); + vdiAdapter_->SetLayerPreMulti = (SetLayerPreMultiFunc)(dlsym(libHandle_, "SetLayerPreMulti")); + vdiAdapter_->SetLayerTransformMode = (SetLayerTransformModeFunc)(dlsym(libHandle_, "SetLayerTransformMode")); + vdiAdapter_->SetLayerDirtyRegion = (SetLayerDirtyRegionFunc)(dlsym(libHandle_, "SetLayerDirtyRegion")); + vdiAdapter_->SetLayerVisibleRegion = (SetLayerVisibleRegionFunc)(dlsym(libHandle_, "SetLayerVisibleRegion")); + vdiAdapter_->SetLayerBuffer = (SetLayerBufferFunc)(dlsym(libHandle_, "SetLayerBuffer")); + vdiAdapter_->SetLayerCompositionType = (SetLayerCompositionTypeFunc)(dlsym(libHandle_, "SetLayerCompositionType")); + vdiAdapter_->SetLayerBlendType = (SetLayerBlendTypeFunc)(dlsym(libHandle_, "SetLayerBlendType")); + vdiAdapter_->SetLayerMaskInfo = (SetLayerMaskInfoFunc)(dlsym(libHandle_, "SetLayerMaskInfo")); + vdiAdapter_->SetLayerColor = (SetLayerColorFunc)(dlsym(libHandle_, "SetLayerColor")); +} + +void DisplayComposerService::LoadVdiFuncV1_1() +{ + vdiAdapter_->RegSeamlessChangeCallback = + (RegSeamlessChangeCallbackFunc)(dlsym(libHandle_, "RegSeamlessChangeCallback")); + vdiAdapter_->GetDisplaySupportedModesExt = + (GetDisplaySupportedModesExtFunc)(dlsym(libHandle_, "GetDisplaySupportedModesExt")); + vdiAdapter_->SetDisplayModeAsync = (SetDisplayModeAsyncFunc)(dlsym(libHandle_, "SetDisplayModeAsync")); + vdiAdapter_->GetDisplayVBlankPeriod = + (GetDisplayVBlankPeriodFunc)(dlsym(libHandle_, "GetDisplayVBlankPeriod")); + vdiAdapter_->SetLayerPerFrameParameter = + (SetLayerPerFrameParameterFunc)(dlsym(libHandle_, "SetLayerPerFrameParameter")); + vdiAdapter_->GetSupportedLayerPerFrameParameterKey = + (GetSupportedLayerPerFrameParameterKeyFunc)(dlsym(libHandle_, "GetSupportedLayerPerFrameParameterKey")); + vdiAdapter_->SetDisplayOverlayResolution = + (SetDisplayOverlayResolutionFunc)(dlsym(libHandle_, "SetDisplayOverlayResolution")); + vdiAdapter_->RegRefreshCallback = (RegRefreshCallbackFunc)(dlsym(libHandle_, "RegRefreshCallback")); + vdiAdapter_->GetDisplaySupportedColorGamuts = + (GetDisplaySupportedColorGamutsFunc)(dlsym(libHandle_, "GetDisplaySupportedColorGamuts")); + vdiAdapter_->GetHDRCapabilityInfos = (GetHDRCapabilityInfosFunc)(dlsym(libHandle_, "GetHDRCapabilityInfos")); + vdiAdapter_->RegDisplayVBlankIdleCallback = + (RegDisplayVBlankIdleCallbackFunc)(dlsym(libHandle_, "RegDisplayVBlankIdleCallback")); + vdiAdapter_->SetDisplayConstraint = (SetDisplayConstraintFunc)(dlsym(libHandle_, "SetDisplayConstraint")); + vdiAdapter_->SetHardwareCursorPosition = + (SetHardwareCursorPositionFunc)(dlsym(libHandle_, "SetHardwareCursorPosition")); + vdiAdapter_->EnableHardwareCursorStats = + (EnableHardwareCursorStatsFunc)(dlsym(libHandle_, "EnableHardwareCursorStats")); + vdiAdapter_->GetHardwareCursorStats = (GetHardwareCursorStatsFunc)(dlsym(libHandle_, "GetHardwareCursorStats")); +} + void DisplayComposerService::HidumperInit() { #ifdef DISPLAY_COMPOSER_SERVICE_HIDUMPER @@ -137,71 +250,18 @@ int32_t DisplayComposerService::LoadVdiSo() return HDF_SUCCESS; } -int32_t DisplayComposerService::LoadVdiV1_0() +int32_t DisplayComposerService::DisplayComposerService::CreateResponser() { - CreateComposerVdiFunc createVdiFunc = nullptr; - const char* errStr = nullptr; - - createVdiFunc = reinterpret_cast(dlsym(libHandle_, "CreateComposerVdi")); - if (createVdiFunc == nullptr) { - errStr = dlerror(); - if (errStr != nullptr) { - DISPLAY_LOGE("CreateVdiFuncV1_0 dlsym error: %{public}s", errStr); - } - return HDF_FAILURE; - } - - destroyVdiFunc_ = reinterpret_cast(dlsym(libHandle_, "DestroyComposerVdi")); - if (destroyVdiFunc_ == nullptr) { - errStr = dlerror(); - if (errStr != nullptr) { - DISPLAY_LOGE("DestroyVdiFuncV1_0 dlsym error: %{public}s", errStr); - } - return HDF_FAILURE; - } - - vdiImpl_ = createVdiFunc(); - CHECK_NULLPOINTER_RETURN_VALUE(vdiImpl_, HDF_FAILURE); cacheMgr_ = DeviceCacheManager::GetInstance(); CHECK_NULLPOINTER_RETURN_VALUE(cacheMgr_, HDF_FAILURE); - cacheMgr_->SetNeedMap(false); - cmdResponser_ = V1_2::HdiDisplayCmdResponser::Create(vdiImpl_, cacheMgr_); - CHECK_NULLPOINTER_RETURN_VALUE(cmdResponser_, HDF_FAILURE); - return HDF_SUCCESS; -} - -int32_t DisplayComposerService::LoadVdiV1_1() -{ - CreateComposerVdiFuncV1_1 createVdiFunc = nullptr; - const char* errStr = nullptr; - - createVdiFunc = reinterpret_cast(dlsym(libHandle_, "CreateComposerVdiV1_1")); - if (createVdiFunc == nullptr) { - errStr = dlerror(); - if (errStr != nullptr) { - DISPLAY_LOGE("CreateVdiFuncV1_1 dlsym error: %{public}s", errStr); - } - return HDF_FAILURE; + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_, HDF_FAILURE); + if (vdiAdapter_->RegDisplayVBlankIdleCallback != nullptr) { + DISPLAY_LOGI("%{public}s Enable Map", __func__); + cacheMgr_->SetNeedMap(true); } - - destroyVdiFuncV1_1_ = reinterpret_cast(dlsym(libHandle_, "DestroyComposerVdiV1_1")); - if (destroyVdiFuncV1_1_ == nullptr) { - errStr = dlerror(); - if (errStr != nullptr) { - DISPLAY_LOGE("DestroyVdiFuncV1_1 dlsym error: %{public}s", errStr); - } - return HDF_FAILURE; - } - - vdiImplV1_1_ = createVdiFunc(); - CHECK_NULLPOINTER_RETURN_VALUE(vdiImplV1_1_, HDF_FAILURE); - vdiImpl_ = dynamic_cast(vdiImplV1_1_); - CHECK_NULLPOINTER_RETURN_VALUE(vdiImpl_, HDF_FAILURE); - cacheMgr_ = DeviceCacheManager::GetInstance(); - CHECK_NULLPOINTER_RETURN_VALUE(cacheMgr_, HDF_FAILURE); - cacheMgr_->SetNeedMap(true); - cmdResponserV1_1_ = V1_2::HdiDisplayCmdResponser_1_1::CreateV1_1(vdiImplV1_1_, cacheMgr_); - CHECK_NULLPOINTER_RETURN_VALUE(cmdResponserV1_1_, HDF_FAILURE); + cmdResponser_ = V1_2::HdiDisplayCmdResponser::Create(vdiAdapter_, cacheMgr_); + CHECK_NULLPOINTER_RETURN_VALUE(cmdResponser_, HDF_FAILURE); + DISPLAY_LOGI("%{public}s out", __func__); return HDF_SUCCESS; } @@ -258,16 +318,16 @@ int32_t DisplayComposerService::RegHotPlugCallback(const sptr& { DISPLAY_TRACE; - CHECK_NULLPOINTER_RETURN_VALUE(vdiImpl_, HDF_FAILURE); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_, HDF_FAILURE); hotPlugCb_ = cb; - int32_t ret = vdiImpl_->RegHotPlugCallback(OnHotPlug, this); + int32_t ret = vdiAdapter_->RegHotPlugCallback(OnHotPlug, this); DISPLAY_CHK_RETURN(ret != HDF_SUCCESS, HDF_FAILURE, DISPLAY_LOGE(" fail")); return ret; } int32_t DisplayComposerService::SetClientBufferCacheCount(uint32_t devId, uint32_t count) { - CHECK_NULLPOINTER_RETURN_VALUE(vdiImpl_, HDF_FAILURE); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_, HDF_FAILURE); CHECK_NULLPOINTER_RETURN_VALUE(cacheMgr_, HDF_FAILURE); std::lock_guard lock(cacheMgr_->GetCacheMgrMutex()); DeviceCache* devCache = cacheMgr_->DeviceCacheInstance(devId); @@ -281,8 +341,8 @@ int32_t DisplayComposerService::GetDisplayCapability(uint32_t devId, DisplayCapa { DISPLAY_TRACE; - CHECK_NULLPOINTER_RETURN_VALUE(vdiImpl_, HDF_FAILURE); - int32_t ret = vdiImpl_->GetDisplayCapability(devId, info); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_, HDF_FAILURE); + int32_t ret = vdiAdapter_->GetDisplayCapability(devId, info); DISPLAY_CHK_RETURN(ret != HDF_SUCCESS, HDF_FAILURE, DISPLAY_LOGE(" fail")); return HDF_SUCCESS; } @@ -291,8 +351,8 @@ int32_t DisplayComposerService::GetDisplaySupportedModes(uint32_t devId, std::ve { DISPLAY_TRACE; - CHECK_NULLPOINTER_RETURN_VALUE(vdiImpl_, HDF_FAILURE); - int32_t ret = vdiImpl_->GetDisplaySupportedModes(devId, modes); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_, HDF_FAILURE); + int32_t ret = vdiAdapter_->GetDisplaySupportedModes(devId, modes); DISPLAY_CHK_RETURN(ret != HDF_SUCCESS, HDF_FAILURE, DISPLAY_LOGE(" fail")); return ret; } @@ -301,8 +361,8 @@ int32_t DisplayComposerService::GetDisplayMode(uint32_t devId, uint32_t& modeId) { DISPLAY_TRACE; - CHECK_NULLPOINTER_RETURN_VALUE(vdiImpl_, HDF_FAILURE); - int32_t ret = vdiImpl_->GetDisplayMode(devId, modeId); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_, HDF_FAILURE); + int32_t ret = vdiAdapter_->GetDisplayMode(devId, modeId); DISPLAY_CHK_RETURN(ret != HDF_SUCCESS, HDF_FAILURE, DISPLAY_LOGE(" fail")); return ret; } @@ -311,8 +371,8 @@ int32_t DisplayComposerService::SetDisplayMode(uint32_t devId, uint32_t modeId) { DISPLAY_TRACE; - CHECK_NULLPOINTER_RETURN_VALUE(vdiImpl_, HDF_FAILURE); - int32_t ret = vdiImpl_->SetDisplayMode(devId, modeId); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_, HDF_FAILURE); + int32_t ret = vdiAdapter_->SetDisplayMode(devId, modeId); DISPLAY_CHK_RETURN(ret != HDF_SUCCESS, HDF_FAILURE, DISPLAY_LOGE(" fail")); return ret; } @@ -321,8 +381,8 @@ int32_t DisplayComposerService::GetDisplayPowerStatus(uint32_t devId, V1_0::Disp { DISPLAY_TRACE; - CHECK_NULLPOINTER_RETURN_VALUE(vdiImpl_, HDF_FAILURE); - int32_t ret = vdiImpl_->GetDisplayPowerStatus(devId, status); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_, HDF_FAILURE); + int32_t ret = vdiAdapter_->GetDisplayPowerStatus(devId, status); DISPLAY_CHK_RETURN(ret != HDF_SUCCESS, HDF_FAILURE, DISPLAY_LOGE(" fail")); return ret; } @@ -331,8 +391,8 @@ int32_t DisplayComposerService::SetDisplayPowerStatus(uint32_t devId, V1_0::Disp { DISPLAY_TRACE; - CHECK_NULLPOINTER_RETURN_VALUE(vdiImpl_, HDF_FAILURE); - int32_t ret = vdiImpl_->SetDisplayPowerStatus(devId, status); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_, HDF_FAILURE); + int32_t ret = vdiAdapter_->SetDisplayPowerStatus(devId, status); DISPLAY_LOGI("devid: %{public}u, status: %{public}u, vdi return %{public}d", devId, status, ret); DISPLAY_CHK_RETURN(ret != HDF_SUCCESS, HDF_FAILURE, DISPLAY_LOGE(" fail")); return ret; @@ -342,8 +402,8 @@ int32_t DisplayComposerService::GetDisplayBacklight(uint32_t devId, uint32_t& le { DISPLAY_TRACE; - CHECK_NULLPOINTER_RETURN_VALUE(vdiImpl_, HDF_FAILURE); - int32_t ret = vdiImpl_->GetDisplayBacklight(devId, level); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_, HDF_FAILURE); + int32_t ret = vdiAdapter_->GetDisplayBacklight(devId, level); DISPLAY_CHK_RETURN(ret == DISPLAY_NOT_SUPPORT, HDF_SUCCESS, level = currentBacklightLevel_); return ret; } @@ -352,8 +412,8 @@ int32_t DisplayComposerService::SetDisplayBacklight(uint32_t devId, uint32_t lev { DISPLAY_TRACE; - CHECK_NULLPOINTER_RETURN_VALUE(vdiImpl_, HDF_FAILURE); - int32_t ret = vdiImpl_->SetDisplayBacklight(devId, level); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_, HDF_FAILURE); + int32_t ret = vdiAdapter_->SetDisplayBacklight(devId, level); DISPLAY_LOGD("devid: %{public}u, level: %{public}u, vdi return %{public}d", devId, level, ret); DISPLAY_CHK_RETURN(ret != HDF_SUCCESS, HDF_FAILURE, DISPLAY_LOGE(" fail")); currentBacklightLevel_ = level; @@ -364,8 +424,8 @@ int32_t DisplayComposerService::GetDisplayProperty(uint32_t devId, uint32_t id, { DISPLAY_TRACE; - CHECK_NULLPOINTER_RETURN_VALUE(vdiImpl_, HDF_FAILURE); - int32_t ret = vdiImpl_->GetDisplayProperty(devId, id, value); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_, HDF_FAILURE); + int32_t ret = vdiAdapter_->GetDisplayProperty(devId, id, value); DISPLAY_CHK_RETURN(ret == DISPLAY_NOT_SUPPORT, HDF_ERR_NOT_SUPPORT); DISPLAY_CHK_RETURN(ret != HDF_SUCCESS && ret != HDF_ERR_NOT_SUPPORT, HDF_FAILURE, DISPLAY_LOGE(" fail")); return ret; @@ -374,9 +434,9 @@ int32_t DisplayComposerService::GetDisplayProperty(uint32_t devId, uint32_t id, int32_t DisplayComposerService::SetHardwareCursorPosition(uint32_t devId, int32_t x, int32_t y) { DISPLAY_TRACE; - - CHECK_NULLPOINTER_RETURN_VALUE(vdiImplV1_1_, HDF_ERR_NOT_SUPPORT); - int32_t ret = vdiImplV1_1_->SetHardwareCursorPosition(devId, x, y); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_, HDF_FAILURE); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_->SetHardwareCursorPosition, HDF_ERR_NOT_SUPPORT); + int32_t ret = vdiAdapter_->SetHardwareCursorPosition(devId, x, y); DISPLAY_CHK_RETURN(ret != HDF_SUCCESS && ret != HDF_ERR_NOT_SUPPORT, HDF_FAILURE, DISPLAY_LOGE(" fail")); return ret; } @@ -384,9 +444,9 @@ int32_t DisplayComposerService::SetHardwareCursorPosition(uint32_t devId, int32_ int32_t DisplayComposerService::EnableHardwareCursorStats(uint32_t devId, bool enable) { DISPLAY_TRACE; - - CHECK_NULLPOINTER_RETURN_VALUE(vdiImplV1_1_, HDF_ERR_NOT_SUPPORT); - int32_t ret = vdiImplV1_1_->EnableHardwareCursorStats(devId, enable); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_, HDF_FAILURE); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_->EnableHardwareCursorStats, HDF_ERR_NOT_SUPPORT); + int32_t ret = vdiAdapter_->EnableHardwareCursorStats(devId, enable); DISPLAY_CHK_RETURN(ret != HDF_SUCCESS && ret != HDF_ERR_NOT_SUPPORT, HDF_FAILURE, DISPLAY_LOGE(" fail")); return ret; } @@ -394,9 +454,9 @@ int32_t DisplayComposerService::EnableHardwareCursorStats(uint32_t devId, bool e int32_t DisplayComposerService::GetHardwareCursorStats(uint32_t devId, uint32_t& frameCount, uint32_t& vsyncCount) { DISPLAY_TRACE; - - CHECK_NULLPOINTER_RETURN_VALUE(vdiImplV1_1_, HDF_ERR_NOT_SUPPORT); - int32_t ret = vdiImplV1_1_->GetHardwareCursorStats(devId, frameCount, vsyncCount); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_, HDF_FAILURE); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_->EnableHardwareCursorStats, HDF_ERR_NOT_SUPPORT); + int32_t ret = vdiAdapter_->GetHardwareCursorStats(devId, frameCount, vsyncCount); DISPLAY_CHK_RETURN(ret != HDF_SUCCESS && ret != HDF_ERR_NOT_SUPPORT, HDF_FAILURE, DISPLAY_LOGE(" fail")); return ret; } @@ -405,8 +465,8 @@ int32_t DisplayComposerService::SetDisplayClientCrop(uint32_t devId, const IRect { DISPLAY_TRACE; - CHECK_NULLPOINTER_RETURN_VALUE(vdiImpl_, HDF_FAILURE); - int32_t ret = vdiImpl_->SetDisplayClientCrop(devId, rect); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_, HDF_FAILURE); + int32_t ret = vdiAdapter_->SetDisplayClientCrop(devId, rect); DISPLAY_CHK_RETURN(ret != HDF_SUCCESS, HDF_FAILURE, DISPLAY_LOGE(" fail")); return ret; } @@ -415,8 +475,8 @@ int32_t DisplayComposerService::SetDisplayVsyncEnabled(uint32_t devId, bool enab { DISPLAY_TRACE; - CHECK_NULLPOINTER_RETURN_VALUE(vdiImpl_, HDF_FAILURE); - int32_t ret = vdiImpl_->SetDisplayVsyncEnabled(devId, enabled); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_, HDF_FAILURE); + int32_t ret = vdiAdapter_->SetDisplayVsyncEnabled(devId, enabled); DISPLAY_CHK_RETURN(ret != HDF_SUCCESS, HDF_FAILURE, DISPLAY_LOGE(" fail")); return ret; } @@ -425,8 +485,8 @@ int32_t DisplayComposerService::RegDisplayVBlankCallback(uint32_t devId, const s { DISPLAY_TRACE; - CHECK_NULLPOINTER_RETURN_VALUE(vdiImpl_, HDF_FAILURE); - int32_t ret = vdiImpl_->RegDisplayVBlankCallback(devId, OnVBlank, cb.GetRefPtr()); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_, HDF_FAILURE); + int32_t ret = vdiAdapter_->RegDisplayVBlankCallback(devId, OnVBlank, cb.GetRefPtr()); DISPLAY_CHK_RETURN(ret != HDF_SUCCESS, HDF_FAILURE, DISPLAY_LOGE(" fail")); vBlankCb_ = cb; return ret; @@ -438,8 +498,8 @@ int32_t DisplayComposerService::GetDisplayReleaseFence( DISPLAY_TRACE; std::vector outFences; - CHECK_NULLPOINTER_RETURN_VALUE(vdiImpl_, HDF_FAILURE); - int32_t ret = vdiImpl_->GetDisplayReleaseFence(devId, layers, outFences); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_, HDF_FAILURE); + int32_t ret = vdiAdapter_->GetDisplayReleaseFence(devId, layers, outFences); for (uint i = 0; i < outFences.size(); i++) { int32_t dupFd = outFences[i]; sptr hdifd(new HdifdParcelable()); @@ -454,8 +514,8 @@ int32_t DisplayComposerService::CreateVirtualDisplay(uint32_t width, uint32_t he { DISPLAY_TRACE; - CHECK_NULLPOINTER_RETURN_VALUE(vdiImpl_, HDF_FAILURE); - int32_t ret = vdiImpl_->CreateVirtualDisplay(width, height, format, devId); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_, HDF_FAILURE); + int32_t ret = vdiAdapter_->CreateVirtualDisplay(width, height, format, devId); DISPLAY_CHK_RETURN(ret != HDF_SUCCESS, HDF_FAILURE, DISPLAY_LOGE(" fail")); return ret; } @@ -464,8 +524,8 @@ int32_t DisplayComposerService::DestroyVirtualDisplay(uint32_t devId) { DISPLAY_TRACE; - CHECK_NULLPOINTER_RETURN_VALUE(vdiImpl_, HDF_FAILURE); - int32_t ret = vdiImpl_->DestroyVirtualDisplay(devId); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_, HDF_FAILURE); + int32_t ret = vdiAdapter_->DestroyVirtualDisplay(devId); DISPLAY_CHK_RETURN(ret != HDF_SUCCESS, HDF_FAILURE, DISPLAY_LOGE(" fail")); return ret; } @@ -479,9 +539,9 @@ int32_t DisplayComposerService::SetVirtualDisplayBuffer( CHECK_NULLPOINTER_RETURN_VALUE(fence, HDF_FAILURE); BufferHandle* handle = buffer->GetBufferHandle(); int32_t inFence = fence->GetFd(); - CHECK_NULLPOINTER_RETURN_VALUE(vdiImpl_, HDF_FAILURE); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_, HDF_FAILURE); CHECK_NULLPOINTER_RETURN_VALUE(handle, HDF_FAILURE); - int32_t ret = vdiImpl_->SetVirtualDisplayBuffer(devId, *handle, inFence); + int32_t ret = vdiAdapter_->SetVirtualDisplayBuffer(devId, *handle, inFence); DISPLAY_CHK_RETURN(ret != HDF_SUCCESS, HDF_FAILURE, DISPLAY_LOGE(" fail")); return ret; } @@ -490,8 +550,8 @@ int32_t DisplayComposerService::SetDisplayProperty(uint32_t devId, uint32_t id, { DISPLAY_TRACE; - CHECK_NULLPOINTER_RETURN_VALUE(vdiImpl_, HDF_FAILURE); - int32_t ret = vdiImpl_->SetDisplayProperty(devId, id, value); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_, HDF_FAILURE); + int32_t ret = vdiAdapter_->SetDisplayProperty(devId, id, value); DISPLAY_CHK_RETURN(ret != HDF_SUCCESS, HDF_FAILURE, DISPLAY_LOGE(" fail")); return ret; } @@ -501,8 +561,8 @@ int32_t DisplayComposerService::CreateLayer(uint32_t devId, const LayerInfo& lay { DISPLAY_TRACE; - CHECK_NULLPOINTER_RETURN_VALUE(vdiImpl_, HDF_FAILURE); - int32_t ret = vdiImpl_->CreateLayer(devId, layerInfo, layerId); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_, HDF_FAILURE); + int32_t ret = vdiAdapter_->CreateLayer(devId, layerInfo, layerId); DISPLAY_CHK_RETURN(ret != HDF_SUCCESS, HDF_FAILURE, DISPLAY_LOGE(" fail")); CHECK_NULLPOINTER_RETURN_VALUE(cacheMgr_, HDF_FAILURE); @@ -516,8 +576,8 @@ int32_t DisplayComposerService::CreateLayer(uint32_t devId, const LayerInfo& lay int32_t DisplayComposerService::DestroyLayer(uint32_t devId, uint32_t layerId) { DISPLAY_TRACE; - CHECK_NULLPOINTER_RETURN_VALUE(vdiImpl_, HDF_FAILURE); - int32_t ret = vdiImpl_->DestroyLayer(devId, layerId); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_, HDF_FAILURE); + int32_t ret = vdiAdapter_->DestroyLayer(devId, layerId); DISPLAY_CHK_RETURN(ret != HDF_SUCCESS, HDF_FAILURE, DISPLAY_LOGE(" fail")); CHECK_NULLPOINTER_RETURN_VALUE(cacheMgr_, HDF_FAILURE); @@ -531,8 +591,9 @@ int32_t DisplayComposerService::DestroyLayer(uint32_t devId, uint32_t layerId) int32_t DisplayComposerService::RegSeamlessChangeCallback(const sptr& cb) { DISPLAY_TRACE; - DISPLAY_CHK_RETURN(vdiImplV1_1_ == nullptr, HDF_ERR_NOT_SUPPORT); - int32_t ret = vdiImplV1_1_->RegSeamlessChangeCallback(OnSeamlessChange, this); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_, HDF_FAILURE); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_->RegSeamlessChangeCallback, HDF_ERR_NOT_SUPPORT); + int32_t ret = vdiAdapter_->RegSeamlessChangeCallback(OnSeamlessChange, this); DISPLAY_CHK_RETURN(ret == DISPLAY_NOT_SUPPORT, HDF_ERR_NOT_SUPPORT); DISPLAY_CHK_RETURN(ret != HDF_SUCCESS && ret != HDF_ERR_NOT_SUPPORT, HDF_FAILURE, DISPLAY_LOGE(" fail")); if (ret == HDF_SUCCESS) { @@ -544,8 +605,9 @@ int32_t DisplayComposerService::RegSeamlessChangeCallback(const sptr& modes) { DISPLAY_TRACE; - DISPLAY_CHK_RETURN(vdiImplV1_1_ == nullptr, HDF_ERR_NOT_SUPPORT); - int32_t ret = vdiImplV1_1_->GetDisplaySupportedModesExt(devId, modes); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_, HDF_FAILURE); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_->GetDisplaySupportedModesExt, HDF_ERR_NOT_SUPPORT); + int32_t ret = vdiAdapter_->GetDisplaySupportedModesExt(devId, modes); DISPLAY_CHK_RETURN(ret == DISPLAY_NOT_SUPPORT, HDF_ERR_NOT_SUPPORT); DISPLAY_CHK_RETURN(ret != HDF_SUCCESS && ret != HDF_ERR_NOT_SUPPORT, HDF_FAILURE, DISPLAY_LOGE(" fail")); return ret; @@ -569,8 +631,9 @@ void DisplayComposerService::OnMode(uint32_t modeId, uint64_t vBlankPeriod, void int32_t DisplayComposerService::SetDisplayModeAsync(uint32_t devId, uint32_t modeId, const sptr& cb) { DISPLAY_TRACE; - DISPLAY_CHK_RETURN(vdiImplV1_1_ == nullptr, HDF_ERR_NOT_SUPPORT); - int32_t ret = vdiImplV1_1_->SetDisplayModeAsync(devId, modeId, OnMode, this); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_, HDF_FAILURE); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_->SetDisplayModeAsync, HDF_ERR_NOT_SUPPORT); + int32_t ret = vdiAdapter_->SetDisplayModeAsync(devId, modeId, OnMode, this); DISPLAY_CHK_RETURN(ret == DISPLAY_NOT_SUPPORT, HDF_ERR_NOT_SUPPORT); DISPLAY_CHK_RETURN(ret != HDF_SUCCESS && ret != HDF_ERR_NOT_SUPPORT, HDF_FAILURE, DISPLAY_LOGE(" fail")); if (ret == HDF_SUCCESS) { @@ -582,8 +645,9 @@ int32_t DisplayComposerService::SetDisplayModeAsync(uint32_t devId, uint32_t mod int32_t DisplayComposerService::GetDisplayVBlankPeriod(uint32_t devId, uint64_t& period) { DISPLAY_TRACE; - DISPLAY_CHK_RETURN(vdiImplV1_1_ == nullptr, HDF_ERR_NOT_SUPPORT); - int32_t ret = vdiImplV1_1_->GetDisplayVBlankPeriod(devId, period); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_, HDF_FAILURE); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_->GetDisplayVBlankPeriod, HDF_ERR_NOT_SUPPORT); + int32_t ret = vdiAdapter_->GetDisplayVBlankPeriod(devId, period); DISPLAY_CHK_RETURN(ret == DISPLAY_NOT_SUPPORT, HDF_ERR_NOT_SUPPORT); DISPLAY_CHK_RETURN(ret != HDF_SUCCESS && ret != HDF_ERR_NOT_SUPPORT, HDF_FAILURE, DISPLAY_LOGE(" fail")); return ret; @@ -609,12 +673,11 @@ int32_t DisplayComposerService::InitCmdRequest(const std::shared_ptrInitCmdRequest(request); - } else if (cmdResponser_ != nullptr) { + if (cmdResponser_ != nullptr) { ret = cmdResponser_->InitCmdRequest(request); } DISPLAY_CHK_RETURN(ret != HDF_SUCCESS, HDF_FAILURE, DISPLAY_LOGE(" fail")); + DISPLAY_LOGI("%{public}s out", __func__); return ret; } @@ -623,9 +686,7 @@ int32_t DisplayComposerService::CmdRequest( { int32_t ret = HDF_FAILURE; - if (cmdResponserV1_1_ != nullptr) { - ret = cmdResponserV1_1_->CmdRequest(inEleCnt, inFds, outEleCnt, outFds); - } else if (cmdResponser_ != nullptr) { + if (cmdResponser_ != nullptr) { ret = cmdResponser_->CmdRequest(inEleCnt, inFds, outEleCnt, outFds); } DISPLAY_CHK_RETURN(ret != HDF_SUCCESS, HDF_FAILURE, DISPLAY_LOGE(" fail")); @@ -636,9 +697,7 @@ int32_t DisplayComposerService::GetCmdReply(std::shared_ptrGetCmdReply(reply); - } else if (cmdResponser_ != nullptr) { + if (cmdResponser_ != nullptr) { ret = cmdResponser_->GetCmdReply(reply); } DISPLAY_CHK_RETURN(ret != HDF_SUCCESS, HDF_FAILURE, DISPLAY_LOGE(" fail")); @@ -649,8 +708,9 @@ int32_t DisplayComposerService::SetLayerPerFrameParameter(uint32_t devId, uint32 const std::vector& value) { DISPLAY_TRACE; - DISPLAY_CHK_RETURN(vdiImplV1_1_ == nullptr, HDF_ERR_NOT_SUPPORT); - int32_t ret = vdiImplV1_1_->SetLayerPerFrameParameter(devId, layerId, key, value); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_, HDF_FAILURE); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_->SetLayerPerFrameParameter, HDF_ERR_NOT_SUPPORT); + int32_t ret = vdiAdapter_->SetLayerPerFrameParameter(devId, layerId, key, value); DISPLAY_CHK_RETURN(ret == DISPLAY_NOT_SUPPORT, HDF_ERR_NOT_SUPPORT); DISPLAY_CHK_RETURN(ret != HDF_SUCCESS && ret != HDF_ERR_NOT_SUPPORT, HDF_FAILURE, DISPLAY_LOGE(" fail")); return ret; @@ -659,8 +719,9 @@ int32_t DisplayComposerService::SetLayerPerFrameParameter(uint32_t devId, uint32 int32_t DisplayComposerService::GetSupportedLayerPerFrameParameterKey(std::vector& keys) { DISPLAY_TRACE; - DISPLAY_CHK_RETURN(vdiImplV1_1_ == nullptr, HDF_ERR_NOT_SUPPORT); - int32_t ret = vdiImplV1_1_->GetSupportedLayerPerFrameParameterKey(keys); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_, HDF_FAILURE); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_->GetSupportedLayerPerFrameParameterKey, HDF_ERR_NOT_SUPPORT); + int32_t ret = vdiAdapter_->GetSupportedLayerPerFrameParameterKey(keys); DISPLAY_CHK_RETURN(ret == DISPLAY_NOT_SUPPORT, HDF_ERR_NOT_SUPPORT); DISPLAY_CHK_RETURN(ret != HDF_SUCCESS && ret != HDF_ERR_NOT_SUPPORT, HDF_FAILURE, DISPLAY_LOGE(" fail")); return ret; @@ -669,8 +730,9 @@ int32_t DisplayComposerService::GetSupportedLayerPerFrameParameterKey(std::vecto int32_t DisplayComposerService::SetDisplayOverlayResolution(uint32_t devId, uint32_t width, uint32_t height) { DISPLAY_TRACE; - DISPLAY_CHK_RETURN(vdiImplV1_1_ == nullptr, HDF_ERR_NOT_SUPPORT); - int32_t ret = vdiImplV1_1_->SetDisplayOverlayResolution(devId, width, height); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_, HDF_FAILURE); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_->SetDisplayOverlayResolution, HDF_ERR_NOT_SUPPORT); + int32_t ret = vdiAdapter_->SetDisplayOverlayResolution(devId, width, height); DISPLAY_CHK_RETURN(ret == DISPLAY_NOT_SUPPORT, HDF_ERR_NOT_SUPPORT); DISPLAY_CHK_RETURN(ret != HDF_SUCCESS && ret != HDF_ERR_NOT_SUPPORT, HDF_FAILURE, DISPLAY_LOGE(" fail")); return ret; @@ -694,8 +756,9 @@ void DisplayComposerService::OnRefresh(uint32_t devId, void *data) int32_t DisplayComposerService::RegRefreshCallback(const sptr& cb) { DISPLAY_TRACE; - DISPLAY_CHK_RETURN(vdiImplV1_1_ == nullptr, HDF_ERR_NOT_SUPPORT); - int32_t ret = vdiImplV1_1_->RegRefreshCallback(OnRefresh, this); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_, HDF_FAILURE); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_->RegRefreshCallback, HDF_ERR_NOT_SUPPORT); + int32_t ret = vdiAdapter_->RegRefreshCallback(OnRefresh, this); DISPLAY_CHK_RETURN(ret == DISPLAY_NOT_SUPPORT, HDF_ERR_NOT_SUPPORT); DISPLAY_CHK_RETURN(ret != HDF_SUCCESS && ret != HDF_ERR_NOT_SUPPORT, HDF_FAILURE, DISPLAY_LOGE(" fail")); if (ret == HDF_SUCCESS) { @@ -707,8 +770,9 @@ int32_t DisplayComposerService::RegRefreshCallback(const sptr& int32_t DisplayComposerService::GetDisplaySupportedColorGamuts(uint32_t devId, std::vector& gamuts) { DISPLAY_TRACE; - DISPLAY_CHK_RETURN(vdiImplV1_1_ == nullptr, HDF_ERR_NOT_SUPPORT); - int32_t ret = vdiImplV1_1_->GetDisplaySupportedColorGamuts(devId, gamuts); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_, HDF_FAILURE); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_->GetDisplaySupportedColorGamuts, HDF_ERR_NOT_SUPPORT); + int32_t ret = vdiAdapter_->GetDisplaySupportedColorGamuts(devId, gamuts); DISPLAY_CHK_RETURN(ret == DISPLAY_NOT_SUPPORT, HDF_ERR_NOT_SUPPORT); DISPLAY_CHK_RETURN(ret != HDF_SUCCESS && ret != HDF_ERR_NOT_SUPPORT, HDF_FAILURE, DISPLAY_LOGE(" fail")); return ret; @@ -717,8 +781,9 @@ int32_t DisplayComposerService::GetDisplaySupportedColorGamuts(uint32_t devId, s int32_t DisplayComposerService::GetHDRCapabilityInfos(uint32_t devId, HDRCapability& info) { DISPLAY_TRACE; - DISPLAY_CHK_RETURN(vdiImplV1_1_ == nullptr, HDF_ERR_NOT_SUPPORT); - int32_t ret = vdiImplV1_1_->GetHDRCapabilityInfos(devId, info); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_, HDF_FAILURE); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_->GetHDRCapabilityInfos, HDF_ERR_NOT_SUPPORT); + int32_t ret = vdiAdapter_->GetHDRCapabilityInfos(devId, info); DISPLAY_CHK_RETURN(ret == DISPLAY_NOT_SUPPORT, HDF_ERR_NOT_SUPPORT); DISPLAY_CHK_RETURN(ret != HDF_SUCCESS && ret != HDF_ERR_NOT_SUPPORT, HDF_FAILURE, DISPLAY_LOGE(" fail")); return ret; @@ -743,9 +808,10 @@ void DisplayComposerService::OnVBlankIdleCallback(uint32_t devId, uint64_t ns, v int32_t DisplayComposerService::RegDisplayVBlankIdleCallback(const sptr& cb) { DISPLAY_TRACE; - DISPLAY_CHK_RETURN(vdiImplV1_1_ == nullptr, HDF_ERR_NOT_SUPPORT); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_, HDF_FAILURE); + CHECK_NULLPOINTER_RETURN_VALUE(vdiAdapter_->RegDisplayVBlankIdleCallback, HDF_ERR_NOT_SUPPORT); VBlankIdleCb_ = cb; - int32_t ret = vdiImplV1_1_->RegDisplayVBlankIdleCallback(OnVBlankIdleCallback, this); + int32_t ret = vdiAdapter_->RegDisplayVBlankIdleCallback(OnVBlankIdleCallback, this); DISPLAY_CHK_RETURN(ret != HDF_SUCCESS && ret != HDF_ERR_NOT_SUPPORT, HDF_FAILURE, DISPLAY_LOGE(" fail")); return ret; }