diff --git a/display/buffer/v1_0/BUILD.gn b/display/buffer/v1_0/BUILD.gn index 249dec9c2c1ab531504987432aa000e49d40d78c..ff5d1fbe620ec5798076bd6c824fb8122dfce733 100644 --- a/display/buffer/v1_0/BUILD.gn +++ b/display/buffer/v1_0/BUILD.gn @@ -51,6 +51,7 @@ ohos_shared_library("libdisplay_buffer_hdi_impl") { "hdf_core:libhdi", "hdf_core:libpub_utils", "hilog:libhilog", + "hitrace:hitrace_meter", "ipc:ipc_single", ] diff --git a/display/buffer/v1_0/hdi_impl/display_buffer_hdi_impl.cpp b/display/buffer/v1_0/hdi_impl/display_buffer_hdi_impl.cpp index 7fdcc3114620316a886b5c314844c905ae288328..cf61bc74864a1a2c90b67395c61e0c71a36182c6 100644 --- a/display/buffer/v1_0/hdi_impl/display_buffer_hdi_impl.cpp +++ b/display/buffer/v1_0/hdi_impl/display_buffer_hdi_impl.cpp @@ -22,6 +22,7 @@ namespace Buffer { namespace V1_0 { IDisplayBuffer *IDisplayBuffer::Get() { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s", __func__); IDisplayBuffer *instance = new HdiDisplayBufferImpl(); if (instance == nullptr) { return nullptr; diff --git a/display/buffer/v1_0/hdi_impl/display_buffer_hdi_impl.h b/display/buffer/v1_0/hdi_impl/display_buffer_hdi_impl.h index 925dd06f12e888e7724a4c9025c72286b125f945..634a01ee4a42744eddedfa5bcba6d5626a315f0d 100644 --- a/display/buffer/v1_0/hdi_impl/display_buffer_hdi_impl.h +++ b/display/buffer/v1_0/hdi_impl/display_buffer_hdi_impl.h @@ -21,6 +21,7 @@ #include #include "hdf_log.h" #include "hilog/log.h" +#include "hdf_trace.h" #include "buffer_handle.h" #include "v1_0/display_buffer_type.h" #include "v1_0/iallocator.h" @@ -75,6 +76,7 @@ public: explicit DisplayBufferHdiImpl(bool isAllocLocal = false) : allocator_(nullptr), mapper_(nullptr), recipient_(nullptr) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s", __func__); while ((allocator_ = IAllocator::Get(isAllocLocal)) == nullptr) { // Waiting for allocator service ready usleep(WAIT_TIME_INTERVAL); @@ -86,6 +88,7 @@ public: } virtual ~DisplayBufferHdiImpl() { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s", __func__); if (recipient_ != nullptr) { sptr remoteObj = OHOS::HDI::hdi_objcast(allocator_); remoteObj->RemoveDeathRecipient(recipient_); @@ -95,6 +98,7 @@ public: bool AddDeathRecipient(const sptr& recipient) override { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s", __func__); sptr remoteObj = OHOS::HDI::hdi_objcast(allocator_); if (recipient_ != nullptr) { HDF_LOGE("%{public}s: the existing recipient is removed, and add the new. %{public}d", @@ -113,6 +117,7 @@ public: bool RemoveDeathRecipient() override { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s", __func__); if (recipient_ != nullptr) { sptr remoteObj = OHOS::HDI::hdi_objcast(allocator_); remoteObj->RemoveDeathRecipient(recipient_); @@ -123,6 +128,7 @@ public: int32_t AllocMem(const AllocInfo& info, BufferHandle*& handle) const override { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s", __func__); CHECK_NULLPOINTER_RETURN_VALUE(allocator_, HDF_FAILURE); sptr hdiBuffer; int32_t ret = allocator_->AllocMem(info, hdiBuffer); @@ -140,6 +146,7 @@ public: void FreeMem(const BufferHandle& handle) const override { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s", __func__); CHECK_NULLPOINTER_RETURN(mapper_); sptr hdiBuffer = new NativeBuffer(); CHECK_NULLPOINTER_RETURN(hdiBuffer); @@ -149,6 +156,7 @@ public: void *Mmap(const BufferHandle& handle) const override { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s", __func__); CHECK_NULLPOINTER_RETURN_VALUE(mapper_, nullptr); sptr hdiBuffer = new NativeBuffer(); CHECK_NULLPOINTER_RETURN_VALUE(hdiBuffer, nullptr); @@ -160,6 +168,7 @@ public: int32_t Unmap(const BufferHandle& handle) const override { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s", __func__); CHECK_NULLPOINTER_RETURN_VALUE(mapper_, HDF_FAILURE); sptr hdiBuffer = new NativeBuffer(); CHECK_NULLPOINTER_RETURN_VALUE(hdiBuffer, HDF_FAILURE); @@ -170,6 +179,7 @@ public: int32_t FlushCache(const BufferHandle& handle) const override { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s", __func__); CHECK_NULLPOINTER_RETURN_VALUE(mapper_, HDF_FAILURE); sptr hdiBuffer = new NativeBuffer(); CHECK_NULLPOINTER_RETURN_VALUE(hdiBuffer, HDF_FAILURE); @@ -180,6 +190,7 @@ public: int32_t InvalidateCache(const BufferHandle& handle) const override { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s", __func__); CHECK_NULLPOINTER_RETURN_VALUE(mapper_, HDF_FAILURE); sptr hdiBuffer = new NativeBuffer(); CHECK_NULLPOINTER_RETURN_VALUE(hdiBuffer, HDF_FAILURE); @@ -191,6 +202,8 @@ public: int32_t IsSupportedAlloc(const std::vector& infos, std::vector& supporteds) const override { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: infos.size %zu, supporteds.size %zu", __func__, infos.size(), + supporteds.size()); (void)infos; (void)supporteds; return HDF_ERR_NOT_SUPPORT; diff --git a/display/buffer/v1_1/BUILD.gn b/display/buffer/v1_1/BUILD.gn index 8dbaae28132af7435004f1071df5c57c0bfea029..ff4b53d7e87f3e30f7d49eb0b88c708254cb4b11 100644 --- a/display/buffer/v1_1/BUILD.gn +++ b/display/buffer/v1_1/BUILD.gn @@ -52,6 +52,7 @@ ohos_shared_library("libdisplay_buffer_hdi_impl_v1_1") { "hdf_core:libhdi", "hdf_core:libpub_utils", "hilog:libhilog", + "hitrace:hitrace_meter", "ipc:ipc_single", ] diff --git a/display/buffer/v1_1/hdi_impl/display_buffer_hdi_impl.cpp b/display/buffer/v1_1/hdi_impl/display_buffer_hdi_impl.cpp index 519af47cfe12ab752d62fea9781d11206f3a54cc..8c788a7e062f4a004be75971c3bb07bc03faca73 100644 --- a/display/buffer/v1_1/hdi_impl/display_buffer_hdi_impl.cpp +++ b/display/buffer/v1_1/hdi_impl/display_buffer_hdi_impl.cpp @@ -22,6 +22,7 @@ namespace V1_1 { using namespace OHOS::HDI::Display::Buffer::V1_1; IDisplayBuffer *IDisplayBuffer::Get() { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s", __func__); IDisplayBuffer *instance = new V1_1::HdiDisplayBufferImpl(); if (instance == nullptr) { return nullptr; diff --git a/display/buffer/v1_1/hdi_impl/display_buffer_hdi_impl.h b/display/buffer/v1_1/hdi_impl/display_buffer_hdi_impl.h index 983059ae22b604065458b5479959848748775142..e02bceb20bab2acfaefc457c47480c844da09db5 100644 --- a/display/buffer/v1_1/hdi_impl/display_buffer_hdi_impl.h +++ b/display/buffer/v1_1/hdi_impl/display_buffer_hdi_impl.h @@ -39,6 +39,7 @@ class DisplayBufferHdiImpl : public V1_0::DisplayBufferHdiImpl { public: explicit DisplayBufferHdiImpl(bool isAllocLocal = false) : BaseType1_0(isAllocLocal), metadata_(nullptr) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s", __func__); while ((metadata_ = IMetadata::Get(true)) == nullptr) { // Waiting for metadata service ready usleep(WAIT_TIME_INTERVAL); @@ -48,6 +49,7 @@ public: int32_t RegisterBuffer(const BufferHandle& handle) override { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s", __func__); CHECK_NULLPOINTER_RETURN_VALUE(metadata_, HDF_FAILURE); sptr hdiBuffer = new NativeBuffer(); CHECK_NULLPOINTER_RETURN_VALUE(hdiBuffer, HDF_FAILURE); @@ -58,6 +60,7 @@ public: int32_t SetMetadata(const BufferHandle& handle, uint32_t key, const std::vector& value) override { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: key %u, value.size %zu", __func__, key, value.size()); CHECK_NULLPOINTER_RETURN_VALUE(metadata_, HDF_FAILURE); sptr hdiBuffer = new NativeBuffer(); CHECK_NULLPOINTER_RETURN_VALUE(hdiBuffer, HDF_FAILURE); @@ -68,6 +71,7 @@ public: int32_t GetMetadata(const BufferHandle& handle, uint32_t key, std::vector& value) override { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: key %u, value.size %zu", __func__, key, value.size()); CHECK_NULLPOINTER_RETURN_VALUE(metadata_, HDF_FAILURE); sptr hdiBuffer = new NativeBuffer(); CHECK_NULLPOINTER_RETURN_VALUE(hdiBuffer, HDF_FAILURE); @@ -78,6 +82,7 @@ public: int32_t ListMetadataKeys(const BufferHandle& handle, std::vector& keys) override { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: value.size %zu", __func__, keys.size()); CHECK_NULLPOINTER_RETURN_VALUE(metadata_, HDF_FAILURE); sptr hdiBuffer = new NativeBuffer(); CHECK_NULLPOINTER_RETURN_VALUE(hdiBuffer, HDF_FAILURE); @@ -88,6 +93,7 @@ public: int32_t EraseMetadataKey(const BufferHandle& handle, uint32_t key) override { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: key %u", __func__, key); CHECK_NULLPOINTER_RETURN_VALUE(metadata_, HDF_FAILURE); sptr hdiBuffer = new NativeBuffer(); CHECK_NULLPOINTER_RETURN_VALUE(hdiBuffer, HDF_FAILURE); diff --git a/display/buffer/v1_2/BUILD.gn b/display/buffer/v1_2/BUILD.gn index f39754414d2c1c685f60c54129952ae0acb6d111..0e6530855c1e46acbc568ba3b039b4fd0dfd160c 100644 --- a/display/buffer/v1_2/BUILD.gn +++ b/display/buffer/v1_2/BUILD.gn @@ -58,6 +58,7 @@ ohos_shared_library("libdisplay_buffer_hdi_impl_v1_2") { "hdf_core:libhdi", "hdf_core:libpub_utils", "hilog:libhilog", + "hitrace:hitrace_meter", "ipc:ipc_single", ] diff --git a/display/buffer/v1_2/hdi_impl/display_buffer_hdi_impl.cpp b/display/buffer/v1_2/hdi_impl/display_buffer_hdi_impl.cpp index be38135e681fe43502fcedf8e4561bfb99cd0b8f..69e6d16da537c7219855dd7151b75aad7ef52255 100644 --- a/display/buffer/v1_2/hdi_impl/display_buffer_hdi_impl.cpp +++ b/display/buffer/v1_2/hdi_impl/display_buffer_hdi_impl.cpp @@ -22,6 +22,7 @@ namespace V1_2 { using namespace OHOS::HDI::Display::Buffer::V1_2; IDisplayBuffer *IDisplayBuffer::Get() { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s", __func__); IDisplayBuffer *instance = new V1_2::HdiDisplayBufferImpl(); if (instance == nullptr) { return nullptr; diff --git a/display/buffer/v1_2/hdi_impl/display_buffer_hdi_impl.h b/display/buffer/v1_2/hdi_impl/display_buffer_hdi_impl.h index 7dde832097b5b1720318058de757e922852cc754..107d417f43e02d445a1312aed54c7a0186318594 100644 --- a/display/buffer/v1_2/hdi_impl/display_buffer_hdi_impl.h +++ b/display/buffer/v1_2/hdi_impl/display_buffer_hdi_impl.h @@ -42,6 +42,7 @@ class DisplayBufferHdiImpl : public V1_1::DisplayBufferHdiImpl { public: explicit DisplayBufferHdiImpl(bool isAllocLocal = false) : BaseType2_0(isAllocLocal), mapper_v1_2_(nullptr) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s", __func__); while ((mapper_v1_2_ = IMapper::Get(true)) == nullptr) { // Waiting for metadata service ready usleep(WAIT_TIME_INTERVAL); @@ -51,6 +52,7 @@ public: int32_t GetImageLayout(const BufferHandle& handle, ImageLayout& layout) const override { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s", __func__); CHECK_NULLPOINTER_RETURN_VALUE(mapper_v1_2_, HDF_FAILURE); sptr hdiBuffer = new NativeBuffer(); CHECK_NULLPOINTER_RETURN_VALUE(hdiBuffer, HDF_FAILURE); diff --git a/display/composer/cache_manager/BUILD.gn b/display/composer/cache_manager/BUILD.gn index 2f9a86631531eaec637d6aa0f69828fd14e446fa..46aa8195f4222fec96b204dfff101ced3655e2a5 100644 --- a/display/composer/cache_manager/BUILD.gn +++ b/display/composer/cache_manager/BUILD.gn @@ -36,6 +36,7 @@ ohos_shared_library("libcomposer_buffer_cache") { "hdf_core:libhdi", "hdf_core:libpub_utils", "hilog:libhilog", + "hitrace:hitrace_meter", "ipc:ipc_single", ] diff --git a/display/composer/cache_manager/buffer_cache_utils.h b/display/composer/cache_manager/buffer_cache_utils.h index 56f156bf5bd608a91f09aaf67f42752372e3321d..9d4cf6c88791e229083eadbea0b649955ce95ff6 100644 --- a/display/composer/cache_manager/buffer_cache_utils.h +++ b/display/composer/cache_manager/buffer_cache_utils.h @@ -35,6 +35,8 @@ public: static BufferHandle* NativeBufferCache(const std::shared_ptr>& cacheMgr, BufferHandle* buffer, uint32_t seqNo, uint32_t callerId, bool &needFreeBuffer) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: buffer %p, seqNo %u, callerId %u, needFreeBuffer %d", __func__, buffer, + seqNo, callerId, needFreeBuffer); BufferHandle* handle = nullptr; needFreeBuffer = false; if (buffer == nullptr && seqNo != UINT32_MAX) { diff --git a/display/composer/cache_manager/device_cache.cpp b/display/composer/cache_manager/device_cache.cpp index bcd8b9459f3adc2a836762f9c358315d879eaa41..197dcaea47341f7390cf7b762c71b30914b2837d 100644 --- a/display/composer/cache_manager/device_cache.cpp +++ b/display/composer/cache_manager/device_cache.cpp @@ -27,6 +27,7 @@ namespace Composer { DeviceCache* DeviceCache::Create(uint32_t id, DeviceType type) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: id %u", __func__, id); DeviceCache* device = new DeviceCache(id, type); DISPLAY_CHK_RETURN(device == nullptr, nullptr, HDF_LOGE("%{public}s: create device cache failed", __func__)); @@ -50,6 +51,7 @@ DeviceCache::~DeviceCache() int32_t DeviceCache::Init() { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s", __func__); layerCaches_.reset(new CacheManager()); DISPLAY_CHK_RETURN(layerCaches_ == nullptr, HDF_FAILURE, HDF_LOGE("%{public}s: create layer caches failed", __func__)); @@ -72,16 +74,19 @@ int32_t DeviceCache::Init() int32_t DeviceCache::SetClientBufferCacheCount(uint32_t bufferCacheCount) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: bufferCacheCount %u", __func__, bufferCacheCount); return clientBufferCaches_->SetCacheMaxCount(bufferCacheCount) ? HDF_SUCCESS : HDF_FAILURE; } LayerCache* DeviceCache::LayerCacheInstance(uint32_t layerId) const { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: layerId %u", __func__, layerId); return layerCaches_->SearchCache(layerId); } int32_t DeviceCache::AddLayerCache(uint32_t id, uint32_t bufferCacheCount) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: id %u, bufferCacheCount %u", __func__, id, bufferCacheCount); LayerCache* layer = LayerCache::Create(id); DISPLAY_CHK_RETURN(layer == nullptr, HDF_FAILURE, HDF_LOGE("%{public}s: Create cache failed", __func__)); @@ -105,6 +110,7 @@ int32_t DeviceCache::AddLayerCache(uint32_t id, uint32_t bufferCacheCount) int32_t DeviceCache::RemoveLayerCache(uint32_t id) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: id %u", __func__, id); bool ret = layerCaches_->EraseCache(id); DISPLAY_CHK_RETURN(ret != true, HDF_FAILURE, HDF_LOGE("%{public}s: Destroy cache failed", __func__)); @@ -113,6 +119,7 @@ int32_t DeviceCache::RemoveLayerCache(uint32_t id) int32_t DeviceCache::ClearClientCache() { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s", __func__); HDF_LOGI("%{public}s", __func__); clientBufferCaches_.reset(new CacheManager()); DISPLAY_CHK_RETURN(clientBufferCaches_ == nullptr, HDF_FAILURE, @@ -125,6 +132,7 @@ int32_t DeviceCache::ClearClientCache() int32_t DeviceCache::ClearLayerBuffer(uint32_t layerId) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: layerId %u", __func__, layerId); HDF_LOGI("%{public}s, layerId %{public}u", __func__, layerId); if (layerCaches_ == nullptr) { return HDF_FAILURE; @@ -141,6 +149,8 @@ int32_t DeviceCache::ClearLayerBuffer(uint32_t layerId) int32_t DeviceCache::SetDisplayClientBuffer(BufferHandle*& buffer, uint32_t seqNo, bool &needFreeBuffer, std::function realFunc) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: buffer %p, seqNo %u, needFreeBuffer %d", __func__, buffer, seqNo, + needFreeBuffer); if (buffer != nullptr) { HDF_LOGI("%{public}s, seqNo %{public}u, fd %{public}d, size %{public}d", __func__, seqNo, buffer->fd, buffer->size); @@ -162,6 +172,8 @@ int32_t DeviceCache::SetDisplayClientBuffer(BufferHandle*& buffer, uint32_t seqN int32_t DeviceCache::SetVirtualDisplayBuffer(BufferHandle*& buffer, uint32_t seqNo, bool &needFreeBuffer, std::function realFunc) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: buffer %p, seqNo %u, needFreeBuffer %d", __func__, buffer, seqNo, + needFreeBuffer); int32_t ret = HDF_FAILURE; if (CacheType() == DEVICE_TYPE_VIRTUAL) { BufferHandle* handle = BufferCacheUtils::NativeBufferCache(outputBufferCaches_, buffer, seqNo, deviceId_, @@ -188,6 +200,7 @@ DeviceCache::DeviceType DeviceCache::CacheType() const void DeviceCache::Dump() const { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s", __func__); clientBufferCaches_->TravelCaches([this](int32_t id, const NativeBuffer& buffer)->void { auto info = buffer.Dump(); HDF_LOGE("devId-%{public}d, clientBuffer[%{public}d]: %{public}s", deviceId_, id, info.c_str()); diff --git a/display/composer/cache_manager/device_cache_manager.cpp b/display/composer/cache_manager/device_cache_manager.cpp index 28d94f4b4ec735387c37ff17ee6b61d9e2db8606..1497b03e3b7d2214826c8e1a6ff76adeb36b81c4 100644 --- a/display/composer/cache_manager/device_cache_manager.cpp +++ b/display/composer/cache_manager/device_cache_manager.cpp @@ -26,6 +26,7 @@ namespace Composer { std::shared_ptr DeviceCacheManager::GetInstance() { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s", __func__); static std::shared_ptr mgr = nullptr; if (mgr == nullptr) { mgr = std::make_shared(); @@ -55,6 +56,7 @@ DeviceCacheManager::~DeviceCacheManager() int32_t DeviceCacheManager::Init() { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s", __func__); deviceCaches_.reset(new CacheManager()); DISPLAY_CHK_RETURN(deviceCaches_ == nullptr, HDF_FAILURE, HDF_LOGE("%{public}s: init deviceCaches failed", __func__)); @@ -64,11 +66,13 @@ int32_t DeviceCacheManager::Init() int32_t DeviceCacheManager::AddDeviceCache(uint32_t deviceId) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: deviceId %u", __func__, deviceId); return AddCacheInternal(deviceId, DeviceCache::DEVICE_TYPE_DEVICE); } int32_t DeviceCacheManager::RemoveDeviceCache(uint32_t deviceId) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: deviceId %u", __func__, deviceId); bool ret = deviceCaches_->EraseCache(deviceId); DISPLAY_CHK_RETURN(ret != true, HDF_FAILURE, HDF_LOGE("%{public}s: Destroy cache failed", __func__)); @@ -77,11 +81,13 @@ int32_t DeviceCacheManager::RemoveDeviceCache(uint32_t deviceId) int32_t DeviceCacheManager::CreateVirtualDisplayCache(uint32_t deviceId) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: deviceId %u", __func__, deviceId); return AddCacheInternal(deviceId, DeviceCache::DEVICE_TYPE_VIRTUAL); } int32_t DeviceCacheManager::DestroyVirtualDisplayCache(uint32_t deviceId) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: deviceId %u", __func__, deviceId); auto cache = deviceCaches_->SearchCache(deviceId); DISPLAY_CHK_RETURN((cache == nullptr) || (cache->CacheType() != DeviceCache::DEVICE_TYPE_VIRTUAL), HDF_FAILURE, HDF_LOGE("%{public}s: device is not virtual display cache", __func__)); @@ -95,12 +101,14 @@ int32_t DeviceCacheManager::DestroyVirtualDisplayCache(uint32_t deviceId) int32_t DeviceCacheManager::DestroyCaches() { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s", __func__); deviceCaches_.reset(); return HDF_SUCCESS; } DeviceCache* DeviceCacheManager::DeviceCacheInstance(uint32_t deviceId) const { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: deviceId %u", __func__, deviceId); auto devCache = deviceCaches_->SearchCache(deviceId); DISPLAY_CHK_RETURN(devCache == nullptr, nullptr, HDF_LOGE("%{public}s: Can't find device Cache", __func__)); @@ -109,6 +117,7 @@ DeviceCache* DeviceCacheManager::DeviceCacheInstance(uint32_t deviceId) const LayerCache* DeviceCacheManager::LayerCacheInstance(uint32_t deviceId, uint32_t layerId) const { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: deviceId %u, layerId %u", __func__, deviceId, layerId); auto devCache = deviceCaches_->SearchCache(deviceId); DISPLAY_CHK_RETURN(devCache == nullptr, nullptr, HDF_LOGE("%{public}s: Can't find device Cache", __func__)); @@ -120,6 +129,7 @@ LayerCache* DeviceCacheManager::LayerCacheInstance(uint32_t deviceId, uint32_t l void DeviceCacheManager::Dump() const { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s", __func__); HDF_LOGE("********************************"); HDF_LOGE(" Devicecache dump start"); HDF_LOGE("--------------------------------"); @@ -135,6 +145,7 @@ void DeviceCacheManager::Dump() const int32_t DeviceCacheManager::AddCacheInternal(uint32_t deviceId, DeviceCache::DeviceType type) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: deviceId %u", __func__, deviceId); DeviceCache* device = DeviceCache::Create(deviceId, type); DISPLAY_CHK_RETURN(device == nullptr, HDF_FAILURE, HDF_LOGE("%{public}s: Create cache failed", __func__)); diff --git a/display/composer/cache_manager/layer_cache.cpp b/display/composer/cache_manager/layer_cache.cpp index 3d7f1ba7e2000ab5cd3abebf66ed0b69887bb0a2..99cf73c436ffcf448872d7b8fc57658f6538feb5 100644 --- a/display/composer/cache_manager/layer_cache.cpp +++ b/display/composer/cache_manager/layer_cache.cpp @@ -27,6 +27,7 @@ namespace Composer { LayerCache* LayerCache::Create(uint32_t id) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: id %u", __func__, id); LayerCache* layer = new LayerCache(id); DISPLAY_CHK_RETURN(layer == nullptr, nullptr, HDF_LOGE("%{public}s: create layer cache failed", __func__)); @@ -50,6 +51,7 @@ LayerCache::~LayerCache() int32_t LayerCache::Init() { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s", __func__); bufferCaches_.reset(new CacheManager()); DISPLAY_CHK_RETURN(bufferCaches_ == nullptr, HDF_FAILURE, HDF_LOGE("%{public}s: create buffer caches failed", __func__)); @@ -61,6 +63,7 @@ int32_t LayerCache::Init() int32_t LayerCache::SetBufferCacheMaxCount(uint32_t cacheCount) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: cacheCount %u", __func__, cacheCount); bool ret = bufferCaches_->SetCacheMaxCount(cacheCount); DISPLAY_CHK_RETURN(ret == false, HDF_FAILURE, HDF_LOGE("%{public}s: failed", __func__)); return HDF_SUCCESS; @@ -69,6 +72,8 @@ int32_t LayerCache::SetBufferCacheMaxCount(uint32_t cacheCount) int32_t LayerCache::SetLayerBuffer(BufferHandle*& buffer, uint32_t seqNo, bool &needFreeBuffer, const std::vector& deletingList, std::function realFunc) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: buffer %p, seqNo %u, needFreeBuffer %d, deletingList.size %zu", __func__, + buffer, seqNo, needFreeBuffer, deletingList.size()); if (buffer != nullptr) { HDF_LOGI("%{public}s, seqNo %{public}u, fd %{public}d, size %{public}d", __func__, seqNo, buffer->fd, buffer->size); @@ -92,12 +97,14 @@ int32_t LayerCache::SetLayerBuffer(BufferHandle*& buffer, uint32_t seqNo, bool & int32_t LayerCache::ResetLayerBuffer() { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s", __func__); HDF_LOGI("%{public}s", __func__); return Init(); } void LayerCache::NativeBufferInit(sptr& buffer) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s", __func__); if (buffer == nullptr) { HDF_LOGW("NativeBufferInit buffer nullptr!"); return; @@ -110,6 +117,7 @@ void LayerCache::NativeBufferInit(sptr& buffer) void LayerCache::NativeBufferCleanUp(sptr& buffer) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s", __func__); if (buffer == nullptr) { HDF_LOGW("NativeBufferCleanUp buffer nullptr!"); return; @@ -122,6 +130,7 @@ void LayerCache::NativeBufferCleanUp(sptr& buffer) sptr LayerCache::GetMetaService() { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s", __func__); static sptr metaService = nullptr; if (metaService == nullptr) { metaService = Buffer::V1_1::IMetadata::Get(true); @@ -131,6 +140,7 @@ sptr LayerCache::GetMetaService() sptr LayerCache::GetMapperService() { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s", __func__); static sptr mapperService = nullptr; if (mapperService == nullptr) { mapperService = Buffer::V1_2::IMapper::Get(true); @@ -140,6 +150,7 @@ sptr LayerCache::GetMapperService() int32_t LayerCache::Mmap(sptr& buffer) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s", __func__); auto mapperService = GetMapperService(); if (mapperService == nullptr) { HDF_LOGE("GetMapperService failed!"); @@ -150,6 +161,7 @@ int32_t LayerCache::Mmap(sptr& buffer) int32_t LayerCache::Unmap(sptr& buffer) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s", __func__); auto mapperService = GetMapperService(); if (mapperService == nullptr) { HDF_LOGE("GetMapperService failed!"); @@ -160,6 +172,7 @@ int32_t LayerCache::Unmap(sptr& buffer) int32_t LayerCache::FreeMem(sptr& buffer) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s", __func__); auto mapperService = GetMapperService(); if (mapperService == nullptr) { HDF_LOGE("GetMapperService failed!"); @@ -174,6 +187,7 @@ int32_t LayerCache::FreeMem(sptr& buffer) int32_t LayerCache::RegisterBuffer(sptr& buffer) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s", __func__); auto metaService = GetMetaService(); if (metaService == nullptr) { return HDF_FAILURE; @@ -192,6 +206,7 @@ int32_t LayerCache::RegisterBuffer(sptr& buffer) void LayerCache::Dump() const { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s", __func__); bufferCaches_->TravelCaches([this](const int32_t id, const NativeBuffer& buffer)->void { auto info = buffer.Dump(); HDF_LOGE("layerId-%{public}d, buffer[%{public}d]: %{public}s", layerId_, id, info.c_str()); diff --git a/display/composer/common/include/display_interface_utils.h b/display/composer/common/include/display_interface_utils.h index 0e6dd1b3c9323528646933f06e57750cf305c3bb..6d9f3d51543ead68d573aab2f2b812c88bca1803 100644 --- a/display/composer/common/include/display_interface_utils.h +++ b/display/composer/common/include/display_interface_utils.h @@ -17,6 +17,7 @@ #define DISPLAY_INTERFACE_UTILS_H #include "hilog/log.h" +#include "hdf_trace.h" #define DISPLAY_CHECK(val, ...) \ do { \ diff --git a/display/composer/hdifd_parcelable/BUILD.gn b/display/composer/hdifd_parcelable/BUILD.gn index 7890e1a7f710db3315cae2a056ef74a60e8b082c..93c87041f32a9f0a22742de036005f4e8930abf1 100644 --- a/display/composer/hdifd_parcelable/BUILD.gn +++ b/display/composer/hdifd_parcelable/BUILD.gn @@ -27,6 +27,7 @@ ohos_shared_library("libhdifd_parcelable") { "hdf_core:libhdi", "hdf_core:libpub_utils", "hilog:libhilog", + "hitrace:hitrace_meter", "ipc:ipc_single", ] diff --git a/display/composer/hdifd_parcelable/hdifd_parcelable.cpp b/display/composer/hdifd_parcelable/hdifd_parcelable.cpp index 3ab07c9a5d1fa9119534f2e3c1ac27db77e70bfa..921e8e9df7345a5ebec615131964317ef17a5db6 100644 --- a/display/composer/hdifd_parcelable/hdifd_parcelable.cpp +++ b/display/composer/hdifd_parcelable/hdifd_parcelable.cpp @@ -19,6 +19,7 @@ #include "securec.h" #include "hdf_log.h" #include "hilog/log.h" +#include "hdf_trace.h" #include "ipc_file_descriptor.h" #undef LOG_TAG @@ -37,6 +38,7 @@ HdifdParcelable::HdifdParcelable() HdifdParcelable::HdifdParcelable(int32_t fd) : isOwner_(true), hdiFd_(fd) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: fd %d", __func__, fd); } HdifdParcelable::~HdifdParcelable() @@ -48,6 +50,7 @@ HdifdParcelable::~HdifdParcelable() bool HdifdParcelable::Init(int32_t fd) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: fd %d", __func__, fd); bool ret = true; if (isOwner_) { @@ -70,6 +73,7 @@ bool HdifdParcelable::Init(int32_t fd) bool HdifdParcelable::WriteFileDescriptor(const int fd, Parcel& parcel) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: fd %d", __func__, fd); if (fd < 0) { return false; } @@ -95,6 +99,7 @@ bool HdifdParcelable::WriteFileDescriptor(const int fd, Parcel& parcel) int HdifdParcelable::ReadFileDescriptor(Parcel& parcel) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s", __func__); sptr descriptor = parcel.ReadObject(); if (descriptor == nullptr) { return -1; @@ -108,6 +113,7 @@ int HdifdParcelable::ReadFileDescriptor(Parcel& parcel) bool HdifdParcelable::Marshalling(Parcel& parcel) const { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s", __func__); bool validFlag = (hdiFd_ >= 0); if (!parcel.WriteBool(validFlag)) { HDF_LOGE("%{public}s: parcel.WriteBool failed", __func__); @@ -122,6 +128,7 @@ bool HdifdParcelable::Marshalling(Parcel& parcel) const sptr HdifdParcelable::Unmarshalling(Parcel& parcel) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s", __func__); bool validFlag = false; if (!parcel.ReadBool(validFlag)) { HDF_LOGE("%{public}s: ReadBool validFlag failed", __func__); @@ -149,17 +156,20 @@ sptr HdifdParcelable::Unmarshalling(Parcel& parcel) int32_t HdifdParcelable::GetFd() { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s", __func__); return hdiFd_; } int32_t HdifdParcelable::Move() { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s", __func__); isOwner_ = false; return hdiFd_; } std::string HdifdParcelable::Dump() const { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s", __func__); std::stringstream os; os << "fd: {" << hdiFd_ << "}\n"; return os.str(); diff --git a/display/composer/v1_0/display_command/display_cmd_requester.h b/display/composer/v1_0/display_command/display_cmd_requester.h index dd073ac55ed2a66478e5623f16677315bc4beee6..7fccd1f8865604d70c4739f815285caf79b5c7e4 100755 --- a/display/composer/v1_0/display_command/display_cmd_requester.h +++ b/display/composer/v1_0/display_command/display_cmd_requester.h @@ -48,6 +48,7 @@ public: static std::unique_ptr Create(sptr hdi) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s V1_0", __func__); DISPLAY_CHK_RETURN(hdi == nullptr, nullptr, HDF_LOGE("%{public}s: hdi is nullptr", __func__)); auto requester = std::make_unique(hdi); DISPLAY_CHK_RETURN(requester == nullptr, nullptr, @@ -62,6 +63,7 @@ public: int32_t Init(uint32_t eleCnt) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: eleCnt %u", __func__, eleCnt); request_ = std::make_shared(eleCnt, SmqType::SYNCED_SMQ); DISPLAY_CHK_RETURN(request_ == nullptr, HDF_FAILURE, HDF_LOGE("%{public}s: request_ is nullptr", __func__)); @@ -92,6 +94,7 @@ public: int32_t PrepareDisplayLayers(uint32_t devId, bool &needFlushFb) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: devId %u, needFlushFb %d", __func__, devId, needFlushFb); uint32_t replyEleCnt; std::vector outFds; std::shared_ptr replyData; @@ -126,6 +129,8 @@ EXIT: int32_t SetDisplayClientBuffer(uint32_t devId, const BufferHandle* buffer, uint32_t seqNo, int32_t fence) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: devId %u, buffer %p, seqNo %u, fence %d", __func__, devId, buffer, + seqNo, fence); int32_t ret = 0; bool retBool = false; int32_t writePos = requestPacker_.ValidSize(); @@ -166,6 +171,7 @@ EXIT: int32_t SetDisplayClientDamage(uint32_t devId, std::vector &rects) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: devId %u, rects.size %zu", __func__, devId, rects.size()); int32_t ret = 0; bool retBool = false; int32_t writePos = requestPacker_.ValidSize(); @@ -207,6 +213,7 @@ EXIT: int32_t Commit(uint32_t devId, int32_t &fence) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: devId %u, fence %d", __func__, devId, fence); uint32_t replyEleCnt = 0; std::vector outFds; std::shared_ptr replyData; @@ -240,6 +247,7 @@ EXIT: int32_t SetLayerAlpha(uint32_t devId, uint32_t layerId, const LayerAlpha &alpha) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: devId %u, layerId %u", __func__, devId, layerId); int32_t ret = 0; bool retBool = false; int32_t writePos = requestPacker_.ValidSize(); @@ -288,6 +296,8 @@ EXIT: int32_t SetLayerRegion(uint32_t devId, uint32_t layerId, const IRect &rect) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: devId %u, layerId %u, rect (%d,%d,%d,%d)", __func__, devId, layerId, + rect.x, rect.y, rect.w, rect.h); int32_t ret = 0; int32_t writePos = requestPacker_.ValidSize(); @@ -319,6 +329,8 @@ EXIT: int32_t SetLayerCrop(uint32_t devId, uint32_t layerId, const IRect &rect) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: devId %u, layerId %u, rect (%d,%d,%d,%d)", __func__, devId, layerId, + rect.x, rect.y, rect.w, rect.h); int32_t ret = 0; int32_t writePos = requestPacker_.ValidSize(); @@ -350,6 +362,7 @@ EXIT: int32_t SetLayerZorder(uint32_t devId, uint32_t layerId, uint32_t zorder) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: devId %u, layerId %u, zorder %u", __func__, devId, layerId, zorder); int32_t ret = 0; bool retBool = false; int32_t writePos = requestPacker_.ValidSize(); @@ -382,6 +395,7 @@ EXIT: int32_t SetLayerPreMulti(uint32_t devId, uint32_t layerId, bool preMul) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: devId %u, layerId %u, preMul %d", __func__, devId, layerId, preMul); int32_t ret = 0; bool retBool = false; int32_t writePos = requestPacker_.ValidSize(); @@ -415,6 +429,7 @@ EXIT: int32_t SetLayerTransformMode(uint32_t devId, uint32_t layerId, TransformType type) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: devId %u, layerId %u, type %d", __func__, devId, layerId, type); int32_t ret = 0; bool retBool = false; int32_t writePos = requestPacker_.ValidSize(); @@ -447,6 +462,8 @@ EXIT: int32_t SetLayerDirtyRegion(uint32_t devId, uint32_t layerId, const std::vector &rects) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: devId %u, layerId %u, rects.size %zu", __func__, devId, layerId, + rects.size()); int32_t ret = 0; bool retBool = false; int32_t writePos = requestPacker_.ValidSize(); @@ -487,6 +504,8 @@ EXIT: int32_t SetLayerVisibleRegion(uint32_t devId, uint32_t layerId, std::vector &rects) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: devId %u, layerId %u, rects.size %zu", __func__, devId, layerId, + rects.size()); int32_t ret = 0; bool retBool = false; int32_t writePos = requestPacker_.ValidSize(); @@ -528,6 +547,9 @@ EXIT: int32_t SetLayerBuffer(uint32_t devId, uint32_t layerId, const BufferHandle* buffer, uint32_t seqNo, int32_t fence, const std::vector& deletingList) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, + "%s: devId %u, layerId %u, buffer %p, seqNo %u, fence %d, deletingList.size %zu", + __func__, devId, layerId, buffer, seqNo, fence, deletingList.size()); int32_t ret = 0; bool retBool = false; bool result = false; @@ -582,6 +604,7 @@ EXIT: int32_t SetLayerCompositionType(uint32_t devId, uint32_t layerId, CompositionType type) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: devId %u, layerId %u, type %d", __func__, devId, layerId, type); int32_t ret = 0; bool retBool = false; int32_t writePos = requestPacker_.ValidSize(); @@ -614,6 +637,7 @@ EXIT: int32_t SetLayerBlendType(uint32_t devId, uint32_t layerId, BlendType type) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: devId %u, layerId %u, type %d", __func__, devId, layerId, type); int32_t ret = 0; bool retBool = false; int32_t writePos = requestPacker_.ValidSize(); @@ -646,6 +670,7 @@ EXIT: int32_t SetLayerMaskInfo(uint32_t devId, uint32_t layerId, const MaskInfo maskInfo) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: devId %u, layerId %u, maskInfo %d", __func__, devId, layerId, maskInfo); int32_t ret = 0; bool retBool = false; int32_t writePos = requestPacker_.ValidSize(); @@ -678,6 +703,7 @@ EXIT: int32_t SetLayerColor(uint32_t devId, uint32_t layerId, const LayerColor& layerColor) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: devId %u, layerId %u", __func__, devId, layerId); int32_t ret = 0; int32_t writePos = requestPacker_.ValidSize(); @@ -709,6 +735,8 @@ EXIT: int32_t GetDisplayCompChange(uint32_t devId, std::vector& layers, std::vector& types) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: devId %u, layers.size %zu, types.size %zu", __func__, devId, + layers.size(), types.size()); layers = compChangeLayers_[devId]; types = compChangeTypes_[devId]; compChangeLayers_.erase(devId); @@ -718,6 +746,7 @@ EXIT: protected: int32_t OnReplySetError(CommandDataUnpacker& replyUnpacker, std::unordered_map &errMaps) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: errMaps.size %zu", __func__, errMaps.size()); uint32_t errCnt = 0; bool retBool = replyUnpacker.ReadUint32(errCnt); DISPLAY_CHK_RETURN(retBool == false, HDF_FAILURE, @@ -740,6 +769,7 @@ protected: int32_t OnReplyPrepareDisplayLayers(CommandDataUnpacker& replyUnpacker, bool &needFlushFb) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: needFlushFb %d", __func__, needFlushFb); uint32_t devId = 0; int32_t retBool = replyUnpacker.ReadUint32(devId); DISPLAY_CHK_RETURN(retBool == false, HDF_FAILURE, HDF_LOGE("%{public}s: read devId failed", __func__)); @@ -781,6 +811,7 @@ protected: int32_t OnReplyCommit( CommandDataUnpacker& replyUnpacker, std::vector& replyFds, int32_t &fenceFd) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: replyFds.size %zu, fenceFd %d", __func__, replyFds.size(), fenceFd); int32_t ret = CmdUtils::FileDescriptorUnpack(replyUnpacker, replyFds, fenceFd); DISPLAY_CHK_RETURN(ret != HDF_SUCCESS, ret, HDF_LOGE("%{public}s: FileDescriptorUnpack failed", __func__)); @@ -790,6 +821,7 @@ protected: int32_t ProcessUnpackCmd(CommandDataUnpacker& replyUnpacker, int32_t unpackCmd, std::vector& replyFds, std::function fn) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: unpackCmd %d, replyFds.size %zu", __func__, unpackCmd, replyFds.size()); int32_t ret = HDF_SUCCESS; while (replyUnpacker.NextSection()) { bool retBool = replyUnpacker.BeginSection(unpackCmd); @@ -839,6 +871,8 @@ protected: int32_t DoReplyResults(uint32_t replyEleCnt, std::vector& replyFds, std::shared_ptr replyData, std::function fn) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: replyEleCnt %u, replyFds.size %zu", __func__, replyEleCnt, + replyFds.size()); CommandDataUnpacker replyUnpacker; replyUnpacker.Init(replyData.get(), replyEleCnt << CmdUtils::MOVE_SIZE); #ifdef DEBUG_DISPLAY_CMD_RAW_DATA @@ -867,6 +901,7 @@ protected: int32_t DoRequest(uint32_t &replyEleCnt, std::vector &outFds, std::shared_ptr &replyData) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: replyEleCnt %u, outFds.size %zu", __func__, replyEleCnt, outFds.size()); #ifdef DEBUG_DISPLAY_CMD_RAW_DATA requestPacker_.Dump(); #endif // DEBUG_DISPLAY_CMD_RAW_DATA @@ -895,6 +930,7 @@ protected: int32_t PeriodDataReset() { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s", __func__); for (uint32_t i = 0; i < requestHdiFds_.size(); ++i) { int32_t fd = requestHdiFds_[i].hdiFd->Move(); if (fd != -1) { diff --git a/display/composer/v1_0/display_command/display_cmd_responser.h b/display/composer/v1_0/display_command/display_cmd_responser.h index 5deab17a169ed310fadf9daf7ab02f0c09abc481..30cb2d75622b6bc888bfb025f5992382c4f3d6d6 100755 --- a/display/composer/v1_0/display_command/display_cmd_responser.h +++ b/display/composer/v1_0/display_command/display_cmd_responser.h @@ -55,7 +55,7 @@ using HdifdSet = std::vector>; static constexpr uint32_t TIME_BUFFER_MAX_LEN = 15; static constexpr uint32_t BUFFER_QUEUE_MAX_SIZE = 6; static constexpr unsigned int REDUCE_COUNT = 50; -static constexpr unsigned int ERROR_FENCE_COUNT = 500; +static constexpr int32_t ERROR_FENCE_COUNT = 500; static sptr g_bufferServiceImpl = nullptr; static constexpr uint32_t COMMIT_PRINT_INTERVAL = 1200; @@ -65,6 +65,7 @@ class DisplayCmdResponser { public: static std::unique_ptr Create(VdiImpl* impl, std::shared_ptr cacheMgr) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: V1_0", __func__); DISPLAY_CHK_RETURN(impl == nullptr, nullptr, HDF_LOGE("%{public}s: error, VdiImpl is nullptr", __func__)); DISPLAY_CHK_RETURN(cacheMgr == nullptr, nullptr, @@ -92,6 +93,7 @@ public: int32_t InitCmdRequest(const std::shared_ptr& request) { + DISPLAY_TRACE; DISPLAY_CHK_RETURN(request == nullptr, HDF_FAILURE, HDF_LOGE("%{public}s: error, request is nullptr", __func__)); std::lock_guard lock(requestMutex_); @@ -105,6 +107,7 @@ public: int32_t GetCmdReply(std::shared_ptr& reply) { + DISPLAY_TRACE; std::lock_guard lock(replyMutex_); int32_t ret = HDF_SUCCESS; if (isReplyUpdated_ == false) { @@ -128,6 +131,8 @@ public: int32_t ProcessRequestCmd(CommandDataUnpacker& unpacker, int32_t cmd, const std::vector& inFds, std::vector& outFds) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: cmd %d, inFds.size %zu, outFds.size %zu", __func__, cmd, inFds.size(), + outFds.size()); int32_t ret = HDF_SUCCESS; switch (cmd) { case REQUEST_CMD_PREPARE_DISPLAY_LAYERS: OnPrepareDisplayLayers(unpacker); break; @@ -159,6 +164,8 @@ public: int32_t CmdRequest(uint32_t inEleCnt, const std::vector& inFds, uint32_t& outEleCnt, std::vector& outFds) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: inEleCnt %u, inFds.size %zu, outEleCnt %u, outFds.size %zu", __func__, + inEleCnt, inFds.size(), outEleCnt, outFds.size()); if (inEleCnt > CmdUtils::MAX_ELE_COUNT) { HDF_LOGE("%{public}s: inEleCnt:%{public}u is too large", __func__, inEleCnt); return HDF_FAILURE; @@ -211,6 +218,7 @@ public: protected: int32_t CmdRequestDataRead(std::shared_ptr requestData, uint32_t inEleCnt) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: inEleCnt %u", __func__, inEleCnt); std::lock_guard lock(requestMutex_); if (request_ == nullptr || requestData == nullptr) { HDF_LOGE("%{public}s: inEleCnt: %{public}u request_ is nullptr", __func__, inEleCnt); @@ -222,6 +230,7 @@ protected: int32_t CmdRequestDataWrite(uint32_t outEleCnt) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: outEleCnt %u", __func__, outEleCnt); std::lock_guard lock(replyMutex_); if (reply_ == nullptr) { HDF_LOGE("%{public}s: reply_ is nullptr", __func__); @@ -233,6 +242,7 @@ protected: int32_t InitReply(uint32_t size) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: size %u", __func__, size); if (size > CmdUtils::MAX_MEMORY) { HDF_LOGE("%{public}s: size:%{public}u is too large", __func__, size); return HDF_FAILURE; @@ -346,6 +356,7 @@ EXIT: int32_t UnpackDisplayClientBufferInfo(CommandDataUnpacker& unpacker, const std::vector& inFds, ClientBufferData& data) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: inFds.size %zu", __func__, inFds.size()); if (!unpacker.ReadUint32(data.devId)) { return HDF_FAILURE; } @@ -372,6 +383,7 @@ EXIT: int32_t SetDisplayClientBuffer(ClientBufferData& data, bool &needFreeBuffer, bool &needMoveFd, int fd) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: needFreeBuffer %d, needMoveFd %d, fd %d", __func__, needFreeBuffer, fd); if (cacheMgr_ == nullptr) { HDF_LOGE("%{public}s, get cache manager error", __func__); return HDF_FAILURE; @@ -389,22 +401,23 @@ EXIT: #ifdef DISPLAY_COMSPOER_DEBUG_DUMP DumpLayerBuffer(data.devId, data.seqNo, data.fence, handle, "client_"); #endif - std::string traceMsg = ""; - if (data.buffer == nullptr) { - traceMsg = "data.buffer is nullptr! seqNo:" + std::to_string(data.seqNo); - } else { - traceMsg = "HDI:DISP:HARDWARE " - "height:" + std::to_string(data.buffer->height) + - " width:" + std::to_string(data.buffer->width) + - " data.buffer->fd:" + std::to_string(data.buffer->fd) + - " seqNo:" + std::to_string(data.seqNo); - } - traceMsg += " fd:" + std::to_string(fd); if (data.fence > ERROR_FENCE_COUNT) { - HDF_LOGI("SetDisplayClientBuffer: %{public}s", traceMsg.c_str()); + HDF_LOGW("SetDisplayClientBuffer:%{public}s data.devId:%{public}d, data.buffer->fd:%{public}d, " + "data.seqNo:%{public}d, fd:%{public}d", + data.buffer == nullptr ? "data.buffer is nullptr!" : "", + data.devId, + data.buffer == nullptr ? -1 : data.buffer->fd, + data.seqNo, + fd); } - HdfTrace traceVdi("SetDisplayClientBuffer", traceMsg); needMoveFd = true; + HITRACE_METER_FMT(HITRACE_TAG_HDF, + "SetDisplayClientBuffer:%s data.devId:%d, data.buffer->fd:%d, data.seqNo:%d, fd:%d", + data.buffer == nullptr ? "data.buffer is nullptr!" : "", + data.devId, + data.buffer == nullptr ? -1 : data.buffer->fd, + data.seqNo, + fd); int rc = impl_->SetDisplayClientBuffer(data.devId, handle, fd); DISPLAY_CHK_RETURN(rc != HDF_SUCCESS, HDF_FAILURE, HDF_LOGE(" fail")); return HDF_SUCCESS; @@ -414,7 +427,7 @@ EXIT: void OnSetDisplayClientBuffer(CommandDataUnpacker& unpacker, const std::vector& inFds) { - DISPLAY_TRACE; + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: inFds.size %zu", __func__, inFds.size()); ClientBufferData data = {0}; data.fence = -1; @@ -482,7 +495,7 @@ EXIT: void OnCommit(CommandDataUnpacker& unpacker, std::vector& outFds) { - DISPLAY_TRACE; + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: outFds.size %zu", __func__, outFds.size()); uint32_t devId = 0; int32_t fence = -1; @@ -794,6 +807,8 @@ EXIT: int32_t UnPackLayerBufferInfo(CommandDataUnpacker& unpacker, const std::vector& inFds, struct LayerBufferData *data, std::vector &deletingList) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: inFds.size %zu, deletingList.size %zu", __func__, inFds.size(), + deletingList.size()); DISPLAY_CHK_RETURN(HDF_SUCCESS != CmdUtils::SetupDeviceUnpack(unpacker, data->devId, data->layerId), HDF_FAILURE, HDF_LOGE("%{public}s, read devId error", __func__)); @@ -828,6 +843,8 @@ EXIT: int32_t SetLayerBuffer(LayerBufferData& data, std::vector &deletingList, bool &needFreeBuffer, bool &needMoveFd, int fd) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: deletingList.size %zu, needFreeBuffer %d, needMoveFd %d, fd %d", + __func__, deletingList.size(), needFreeBuffer, needMoveFd, fd); DISPLAY_CHECK(cacheMgr_ == nullptr, return HDF_FAILURE); std::lock_guard lock(cacheMgr_->GetCacheMgrMutex()); DeviceCache* devCache = nullptr; @@ -842,22 +859,24 @@ EXIT: #ifdef DISPLAY_COMSPOER_DEBUG_DUMP DumpLayerBuffer(data.devId, data.layerId, data.fence, handle, "layer_"); #endif - std::string traceMsg = ""; - if (data.buffer == nullptr) { - traceMsg = "data.buffer is nullptr! seqNo:" + std::to_string(data.seqNo); - } else { - traceMsg = "HDI:DISP:HARDWARE" - "height:" + std::to_string(data.buffer->height) + - " width:" + std::to_string(data.buffer->width) + - " data.buffer->fd:" + std::to_string(data.buffer->fd) + - " seqNo:" + std::to_string(data.seqNo); - } - traceMsg += " fd:" + std::to_string(fd); if (data.fence > ERROR_FENCE_COUNT) { - HDF_LOGI("SetLayerBuffer: %{public}s", traceMsg.c_str()); + HDF_LOGW("SetLayerBuffer:%{public}s data.devId:%{public}d, data.layerId:%{public}d, " + "data.buffer->fd:%{public}d, data.seqNo:%{public}d, fd:%{public}d", + data.buffer == nullptr ? "data.buffer is nullptr!" : "", + data.devId, + data.layerId, + data.buffer == nullptr ? -1 : data.buffer->fd, + data.seqNo, + fd); } - HdfTrace traceVdi("SetLayerBuffer", traceMsg); needMoveFd = true; + HITRACE_METER_FMT(HITRACE_TAG_HDF, + "SetLayerBuffer:%s data.devId:%d, data.buffer->fd:%d, data.seqNo:%d, fd:%d", + data.buffer == nullptr ? "data.buffer is nullptr!" : "", + data.devId, + data.buffer == nullptr ? -1 : data.buffer->fd, + data.seqNo, + fd); int rc = impl_->SetLayerBuffer(data.devId, data.layerId, handle, fd); DISPLAY_CHK_RETURN(rc != HDF_SUCCESS, HDF_FAILURE, HDF_LOGE(" fail")); return HDF_SUCCESS; @@ -867,7 +886,7 @@ EXIT: void OnSetLayerBuffer(CommandDataUnpacker& unpacker, const std::vector& inFds) { - DISPLAY_TRACE; + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: inFds.size %zu", __func__, inFds.size()); struct LayerBufferData data; std::vector deletingList; @@ -1007,6 +1026,7 @@ EXIT: int32_t PeriodDataReset() { + DISPLAY_TRACE; replyCommandCnt_ = 0; errMaps_.clear(); @@ -1019,6 +1039,7 @@ EXIT: static std::string GetFileName(uint32_t devId, uint32_t layerId, const BufferHandle& buffer) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: devId %u, layerId %u", __func__, devId, layerId); struct timeval tv; char nowStr[TIME_BUFFER_MAX_LEN] = {0}; @@ -1093,6 +1114,7 @@ EXIT: static int32_t WaitFence(int32_t fence, uint32_t timeout) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: fence %d, timeout %u", __func__, fence, timeout); int retCode = -1; if (fence < 0) { HDF_LOGE("The fence id is invalid."); @@ -1123,6 +1145,7 @@ EXIT: void FreeBufferWithDelay(BufferHandle *handle) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: handle %p", __func__, handle); delayFreeQueue_.push(handle); if (delayFreeQueue_.size() >= BUFFER_QUEUE_MAX_SIZE) { BufferHandle *temp = delayFreeQueue_.front(); diff --git a/display/composer/v1_0/display_command/display_cmd_utils.h b/display/composer/v1_0/display_command/display_cmd_utils.h index db512bbb48a66c9fc093056fd19ce2af7355bce7..90cce9c053c35dab5da51b6f26bcf151417ecec3 100644 --- a/display/composer/v1_0/display_command/display_cmd_utils.h +++ b/display/composer/v1_0/display_command/display_cmd_utils.h @@ -47,6 +47,7 @@ public: #define SWITCHCASE(x) case (x): {return #x;} static const char *CommandToString(int32_t cmdId) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: cmdId %d", __func__, cmdId); switch (cmdId) { /* request cmd */ SWITCHCASE(REQUEST_CMD_PREPARE_DISPLAY_LAYERS); @@ -83,21 +84,25 @@ public: static int32_t StartPack(int32_t cmdId, CommandDataPacker& packer) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: cmdId %d", __func__, cmdId); return packer.PackBegin(cmdId) ? HDF_SUCCESS : HDF_FAILURE; } static int32_t EndPack(CommandDataPacker& packer) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s", __func__); return packer.PackEnd(CONTROL_CMD_REQUEST_END) ? HDF_SUCCESS : HDF_FAILURE; } static int32_t StartSection(int32_t cmdId, CommandDataPacker& packer) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: cmdId %d", __func__, cmdId); return packer.BeginSection(cmdId) ? HDF_SUCCESS : HDF_FAILURE; } static int32_t SetupDevice(uint32_t devId, uint32_t layerId, CommandDataPacker& packer) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: devId %u, layerId %u", __func__, devId, layerId); DISPLAY_CHK_RETURN(packer.WriteUint32(devId) == false, HDF_FAILURE, HDF_LOGE("%{public}s, write devId error", __func__)); DISPLAY_CHK_RETURN(packer.WriteUint32(layerId) == false, HDF_FAILURE, @@ -107,11 +112,13 @@ public: static int32_t EndSection(CommandDataPacker& packer) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s", __func__); return packer.EndSection() ? HDF_SUCCESS : HDF_FAILURE; } static int32_t GenerateHdifdSeqid() { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s", __func__); static int32_t HdifdSeqidCursor = 0; if (HdifdSeqidCursor <= MAX_INT) { @@ -124,6 +131,7 @@ public: static bool MatchHdiFd(int32_t id, std::vector hdiFds, int32_t& fd) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: id %d, hdiFds.size %zu, fd %d", __func__, id, hdiFds.size(), fd); for (uint32_t i = 0; i < hdiFds.size(); ++i) { if (hdiFds[i].hdiFd == nullptr) { HDF_LOGE("%{public}s, hdiFd is nullptr", __func__); @@ -139,6 +147,7 @@ public: static int32_t RectPack(const IRect& rect, CommandDataPacker& packer) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s", __func__); DISPLAY_CHK_RETURN(packer.WriteInt32(rect.x) == false, HDF_FAILURE, HDF_LOGE("%{public}s, write rect.x error", __func__)); DISPLAY_CHK_RETURN(packer.WriteInt32(rect.y) == false, HDF_FAILURE, @@ -152,6 +161,7 @@ public: static int32_t LayerColorPack(const LayerColor& layerColor, CommandDataPacker& packer) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s", __func__); DISPLAY_CHK_RETURN(packer.WriteUint8(layerColor.r) == false, HDF_FAILURE, HDF_LOGE("%{public}s, write layerColor.r error", __func__)); DISPLAY_CHK_RETURN(packer.WriteUint8(layerColor.g) == false, HDF_FAILURE, @@ -166,6 +176,7 @@ public: static int32_t FileDescriptorPack( const int32_t fd, CommandDataPacker& packer, std::vector& hdiFds, bool dupFd = true) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: fd %d, hdiFds.size %zu, dupFd %d", __func__, fd, hdiFds.size(), dupFd); if (fd < 0) { DISPLAY_CHK_RETURN(packer.WriteInt32(fd) == false, HDF_FAILURE, HDF_LOGE("%{public}s, write fd error", __func__)); @@ -198,6 +209,7 @@ public: static int32_t BufferHandlePack(const BufferHandle* buffer, CommandDataPacker& packer, std::vector& hdiFds) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: buffer %p, hdiFds.size %zu", __func__, buffer, hdiFds.size()); if (buffer == nullptr) { DISPLAY_CHK_RETURN(packer.WriteUint32(UINT32_MAX) == false, HDF_FAILURE, HDF_LOGE("%{public}s, write null buffer reserveFds error", __func__)); @@ -244,6 +256,7 @@ public: static int32_t SetupDeviceUnpack(CommandDataUnpacker& unpacker, uint32_t& devId, uint32_t& layerId) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: devId %u, layerId %u", __func__, devId, layerId); DISPLAY_CHK_RETURN(unpacker.ReadUint32(devId) == false, HDF_FAILURE, HDF_LOGE("%{public}s, read devId failed", __func__)); DISPLAY_CHK_RETURN(unpacker.ReadUint32(layerId) == false, HDF_FAILURE, @@ -253,6 +266,7 @@ public: static int32_t RectUnpack(CommandDataUnpacker& unpacker, IRect& rect) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s", __func__); DISPLAY_CHK_RETURN(unpacker.ReadInt32(rect.x) == false, HDF_FAILURE, HDF_LOGE("%{public}s, read rect.x failed", __func__)); DISPLAY_CHK_RETURN(unpacker.ReadInt32(rect.y) == false, HDF_FAILURE, @@ -267,6 +281,7 @@ public: static int32_t FileDescriptorUnpack( CommandDataUnpacker& unpacker, const std::vector& hdiFds, int32_t& fd) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: hdiFds.size %zu, fd %d", __func__, hdiFds.size(), fd); int32_t fdId = -1; DISPLAY_CHK_RETURN(unpacker.ReadInt32(fdId) == false, HDF_FAILURE, HDF_LOGE("%{public}s, read fdId failed", __func__)); @@ -280,6 +295,7 @@ public: static bool UnpackBasicInfo(CommandDataUnpacker& unpacker, const std::vector& hdiFds, BufferHandle *handle) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: hdiFds.size %zu", __func__, hdiFds.size()); int32_t ret = FileDescriptorUnpack(unpacker, hdiFds, handle->fd); bool retVal = (ret == HDF_SUCCESS ? true : false); DISPLAY_CHK_CONDITION(retVal, true, unpacker.ReadInt32(handle->width), @@ -302,6 +318,7 @@ public: static bool UnpackExtraInfo(CommandDataUnpacker& unpacker, const std::vector& hdiFds, BufferHandle *handle) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: hdiFds.size %zu, handle %p", __func__, hdiFds.size(), handle); bool retVal = true; uint32_t i = 0; for (i = 0; i < handle->reserveFds; i++) { @@ -325,6 +342,7 @@ public: static int32_t BufferHandleUnpack(CommandDataUnpacker& unpacker, const std::vector& hdiFds, BufferHandle*& buffer) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: hdiFds.size %zu, buffer %p", __func__, hdiFds.size(), buffer); uint32_t fdsNum = 0; uint32_t intsNum = 0; DISPLAY_CHK_RETURN(unpacker.ReadUint32(fdsNum) == false, HDF_FAILURE, @@ -356,6 +374,7 @@ public: static int32_t LayerColorUnpack(CommandDataUnpacker& unpacker, LayerColor& layerColor) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s", __func__); DISPLAY_CHK_RETURN(unpacker.ReadUint8(layerColor.r) == false, HDF_FAILURE, HDF_LOGE("%{public}s, read layerColor.r failed", __func__)); DISPLAY_CHK_RETURN(unpacker.ReadUint8(layerColor.g) == false, HDF_FAILURE, diff --git a/display/composer/v1_0/hdi_impl/display_composer_hdi_impl.h b/display/composer/v1_0/hdi_impl/display_composer_hdi_impl.h index 317bc5946d5e7d088164d3f45adf5149e0c1d93e..fa17c268fd951f6996c0cc14db45dab777c93a8d 100644 --- a/display/composer/v1_0/hdi_impl/display_composer_hdi_impl.h +++ b/display/composer/v1_0/hdi_impl/display_composer_hdi_impl.h @@ -51,6 +51,7 @@ class DisplayComposerHdiImpl : public Interface, public IHotPlugCallback, public public: static IDisplayComposerInterface* Create(bool needSMQ) { + DISPLAY_TRACE; sptr hdi; std::shared_ptr req = nullptr; HDF_LOGI("%{public}s: hdi V1_0 start", __func__); @@ -82,6 +83,7 @@ public: virtual ~DisplayComposerHdiImpl() { + DISPLAY_TRACE; if (recipient_ != nullptr) { sptr remoteObj = OHOS::HDI::hdi_objcast(hdi_); remoteObj->RemoveDeathRecipient(recipient_); @@ -91,6 +93,7 @@ public: virtual bool AddDeathRecipient(const sptr& recipient) override { + DISPLAY_TRACE; sptr remoteObj = OHOS::HDI::hdi_objcast(hdi_); if (recipient_ != nullptr) { HDF_LOGI("%{public}s: the existing recipient is removed, and add the new. %{public}d", @@ -109,6 +112,7 @@ public: virtual bool RemoveDeathRecipient() override { + DISPLAY_TRACE; if (recipient_ != nullptr) { sptr remoteObj = OHOS::HDI::hdi_objcast(hdi_); remoteObj->RemoveDeathRecipient(recipient_); @@ -120,6 +124,7 @@ public: // device func virtual int32_t RegHotPlugCallback(HotPlugCallback cb, void *data) override { + DISPLAY_TRACE; hotPlugCb_ = cb; hotPlugCbData_ = data; COMPOSER_CHECK_NULLPTR_RETURN(hdi_); @@ -128,42 +133,49 @@ public: virtual int32_t SetClientBufferCacheCount(uint32_t devId, uint32_t cacheCount) override { + DISPLAY_TRACE; COMPOSER_CHECK_NULLPTR_RETURN(hdi_); return ToDispErrCode(hdi_->SetClientBufferCacheCount(devId, cacheCount)); } virtual int32_t GetDisplayCapability(uint32_t devId, DisplayCapability& info) override { + DISPLAY_TRACE; COMPOSER_CHECK_NULLPTR_RETURN(hdi_); return ToDispErrCode(hdi_->GetDisplayCapability(devId, info)); } virtual int32_t GetDisplaySupportedModes(uint32_t devId, std::vector& modes) override { + DISPLAY_TRACE; COMPOSER_CHECK_NULLPTR_RETURN(hdi_); return ToDispErrCode(hdi_->GetDisplaySupportedModes(devId, modes)); } virtual int32_t GetDisplayMode(uint32_t devId, uint32_t& modeId) override { + DISPLAY_TRACE; COMPOSER_CHECK_NULLPTR_RETURN(hdi_); return ToDispErrCode(hdi_->GetDisplayMode(devId, modeId)); } virtual int32_t SetDisplayMode(uint32_t devId, uint32_t modeId) override { + DISPLAY_TRACE; COMPOSER_CHECK_NULLPTR_RETURN(hdi_); return ToDispErrCode(hdi_->SetDisplayMode(devId, modeId)); } virtual int32_t GetDisplayPowerStatus(uint32_t devId, DispPowerStatus& status) override { + DISPLAY_TRACE; COMPOSER_CHECK_NULLPTR_RETURN(hdi_); return ToDispErrCode(hdi_->GetDisplayPowerStatus(devId, status)); } virtual int32_t SetDisplayPowerStatus(uint32_t devId, DispPowerStatus status) override { + DISPLAY_TRACE; COMPOSER_CHECK_NULLPTR_RETURN(hdi_); int32_t ret = hdi_->SetDisplayPowerStatus(devId, status); HDF_LOGI("devId: %{public}u, status: %{public}u", devId, status); @@ -172,18 +184,21 @@ public: virtual int32_t GetDisplayBacklight(uint32_t devId, uint32_t& level) override { + DISPLAY_TRACE; COMPOSER_CHECK_NULLPTR_RETURN(hdi_); return ToDispErrCode(hdi_->GetDisplayBacklight(devId, level)); } virtual int32_t SetDisplayBacklight(uint32_t devId, uint32_t level) override { + DISPLAY_TRACE; COMPOSER_CHECK_NULLPTR_RETURN(hdi_); return ToDispErrCode(hdi_->SetDisplayBacklight(devId, level)); } virtual int32_t GetDisplayProperty(uint32_t devId, uint32_t id, uint64_t& value) override { + DISPLAY_TRACE; COMPOSER_CHECK_NULLPTR_RETURN(hdi_); return ToDispErrCode(hdi_->GetDisplayProperty(devId, id, value)); } @@ -191,12 +206,14 @@ public: virtual int32_t GetDisplayCompChange( uint32_t devId, std::vector& layers, std::vector& types) override { + DISPLAY_TRACE; COMPOSER_CHECK_NULLPTR_RETURN(req_); return ToDispErrCode(req_->GetDisplayCompChange(devId, layers, types)); } virtual int32_t SetDisplayClientCrop(uint32_t devId, const IRect& rect) override { + DISPLAY_TRACE; COMPOSER_CHECK_NULLPTR_RETURN(hdi_); return ToDispErrCode(hdi_->SetDisplayClientCrop(devId, rect)); } @@ -204,18 +221,21 @@ public: virtual int32_t SetDisplayClientBuffer(uint32_t devId, const BufferHandle* buffer, uint32_t seqNo, int32_t fence) override { + DISPLAY_TRACE; COMPOSER_CHECK_NULLPTR_RETURN(req_); return ToDispErrCode(req_->SetDisplayClientBuffer(devId, buffer, seqNo, fence)); } virtual int32_t SetDisplayClientDamage(uint32_t devId, std::vector& rects) override { + DISPLAY_TRACE; COMPOSER_CHECK_NULLPTR_RETURN(req_); return ToDispErrCode(req_->SetDisplayClientDamage(devId, rects)); } virtual int32_t SetDisplayVsyncEnabled(uint32_t devId, bool enabled) override { + DISPLAY_TRACE; COMPOSER_CHECK_NULLPTR_RETURN(hdi_); /* Already enabled, return success */ @@ -236,6 +256,7 @@ public: virtual int32_t RegDisplayVBlankCallback(uint32_t devId, VBlankCallback cb, void *data) override { + DISPLAY_TRACE; vBlankCb_ = cb; vBlankCbData_ = data; COMPOSER_CHECK_NULLPTR_RETURN(hdi_); @@ -245,6 +266,7 @@ public: virtual int32_t GetDisplayReleaseFence( uint32_t devId, std::vector& layers, std::vector& fences) override { + DISPLAY_TRACE; std::vector> hdiFences; COMPOSER_CHECK_NULLPTR_RETURN(hdi_); int32_t ret = ToDispErrCode(hdi_->GetDisplayReleaseFence(devId, layers, hdiFences)); @@ -262,18 +284,21 @@ public: virtual int32_t CreateVirtualDisplay(uint32_t width, uint32_t height, int32_t& format, uint32_t& devId) override { + DISPLAY_TRACE; COMPOSER_CHECK_NULLPTR_RETURN(hdi_); return ToDispErrCode(hdi_->CreateVirtualDisplay(width, height, format, devId)); } virtual int32_t DestroyVirtualDisplay(uint32_t devId) override { + DISPLAY_TRACE; COMPOSER_CHECK_NULLPTR_RETURN(hdi_); return ToDispErrCode(hdi_->DestroyVirtualDisplay(devId)); } virtual int32_t SetVirtualDisplayBuffer(uint32_t devId, const BufferHandle& buffer, const int32_t fence) override { + DISPLAY_TRACE; int32_t ret = DISPLAY_SUCCESS; sptr hdiBuffer = new NativeBuffer(); @@ -291,52 +316,62 @@ public: virtual int32_t SetDisplayProperty(uint32_t devId, uint32_t id, uint64_t value) override { + DISPLAY_TRACE; COMPOSER_CHECK_NULLPTR_RETURN(hdi_); return ToDispErrCode(hdi_->SetDisplayProperty(devId, id, value)); } virtual int32_t Commit(uint32_t devId, int32_t& fence) override { + DISPLAY_TRACE; COMPOSER_CHECK_NULLPTR_RETURN(req_); return ToDispErrCode(req_->Commit(devId, fence)); } virtual int32_t GetDisplaySupportedColorGamuts(uint32_t devId, std::vector& gamuts) override { + DISPLAY_TRACE; return DISPLAY_NOT_SUPPORT; } virtual int32_t GetDisplayColorGamut(uint32_t devId, ColorGamut& gamut) override { + DISPLAY_TRACE; return DISPLAY_NOT_SUPPORT; } virtual int32_t SetDisplayColorGamut(uint32_t devId, const ColorGamut& gamut) override { + DISPLAY_TRACE; return DISPLAY_NOT_SUPPORT; } virtual int32_t GetDisplayGamutMap(uint32_t devId, GamutMap& gamutMap) override { + DISPLAY_TRACE; return DISPLAY_NOT_SUPPORT; } virtual int32_t SetDisplayGamutMap(uint32_t devId, const GamutMap& gamutMap) override { + DISPLAY_TRACE; return DISPLAY_NOT_SUPPORT; } virtual int32_t SetDisplayColorTransform(uint32_t devId, const std::vector& matrix) override { + DISPLAY_TRACE; return DISPLAY_NOT_SUPPORT; } virtual int32_t GetHDRCapabilityInfos(uint32_t devId, HDRCapability& info) override { + DISPLAY_TRACE; return DISPLAY_NOT_SUPPORT; } virtual int32_t GetSupportedMetadataKey(uint32_t devId, std::vector& keys) override { + DISPLAY_TRACE; return DISPLAY_NOT_SUPPORT; } @@ -344,66 +379,77 @@ public: virtual int32_t CreateLayer(uint32_t devId, const LayerInfo& layerInfo, uint32_t cacheCount, uint32_t& layerId) override { + DISPLAY_TRACE; COMPOSER_CHECK_NULLPTR_RETURN(hdi_); return ToDispErrCode(hdi_->CreateLayer(devId, layerInfo, cacheCount, layerId)); } virtual int32_t DestroyLayer(uint32_t devId, uint32_t layerId) override { + DISPLAY_TRACE; COMPOSER_CHECK_NULLPTR_RETURN(hdi_); return ToDispErrCode(hdi_->DestroyLayer(devId, layerId)); } virtual int32_t PrepareDisplayLayers(uint32_t devId, bool& needFlushFb) override { + DISPLAY_TRACE; COMPOSER_CHECK_NULLPTR_RETURN(req_); return ToDispErrCode(req_->PrepareDisplayLayers(devId, needFlushFb)); } virtual int32_t SetLayerAlpha(uint32_t devId, uint32_t layerId, const LayerAlpha& alpha) override { + DISPLAY_TRACE; COMPOSER_CHECK_NULLPTR_RETURN(req_); return ToDispErrCode(req_->SetLayerAlpha(devId, layerId, alpha)); } virtual int32_t SetLayerRegion(uint32_t devId, uint32_t layerId, const IRect& rect) override { + DISPLAY_TRACE; COMPOSER_CHECK_NULLPTR_RETURN(req_); return ToDispErrCode(req_->SetLayerRegion(devId, layerId, rect)); } virtual int32_t SetLayerCrop(uint32_t devId, uint32_t layerId, const IRect& rect) override { + DISPLAY_TRACE; COMPOSER_CHECK_NULLPTR_RETURN(req_); return ToDispErrCode(req_->SetLayerCrop(devId, layerId, rect)); } virtual int32_t SetLayerZorder(uint32_t devId, uint32_t layerId, uint32_t zorder) override { + DISPLAY_TRACE; COMPOSER_CHECK_NULLPTR_RETURN(req_); return ToDispErrCode(req_->SetLayerZorder(devId, layerId, zorder)); } virtual int32_t SetLayerPreMulti(uint32_t devId, uint32_t layerId, bool preMul) override { + DISPLAY_TRACE; COMPOSER_CHECK_NULLPTR_RETURN(req_); return ToDispErrCode(req_->SetLayerPreMulti(devId, layerId, preMul)); } virtual int32_t SetLayerTransformMode(uint32_t devId, uint32_t layerId, TransformType type) override { + DISPLAY_TRACE; COMPOSER_CHECK_NULLPTR_RETURN(req_); return ToDispErrCode(req_->SetLayerTransformMode(devId, layerId, type)); } virtual int32_t SetLayerDirtyRegion(uint32_t devId, uint32_t layerId, std::vector& rects) override { + DISPLAY_TRACE; COMPOSER_CHECK_NULLPTR_RETURN(req_); return ToDispErrCode(req_->SetLayerDirtyRegion(devId, layerId, rects)); } virtual int32_t SetLayerVisibleRegion(uint32_t devId, uint32_t layerId, std::vector& rects) override { + DISPLAY_TRACE; COMPOSER_CHECK_NULLPTR_RETURN(req_); return ToDispErrCode(req_->SetLayerVisibleRegion(devId, layerId, rects)); } @@ -411,72 +457,85 @@ public: virtual int32_t SetLayerBuffer(uint32_t devId, uint32_t layerId, const BufferHandle* buffer, uint32_t seqNo, int32_t fence, const std::vector& deletingList) override { + DISPLAY_TRACE; COMPOSER_CHECK_NULLPTR_RETURN(req_); return ToDispErrCode(req_->SetLayerBuffer(devId, layerId, buffer, seqNo, fence, deletingList)); } virtual int32_t SetLayerCompositionType(uint32_t devId, uint32_t layerId, CompositionType type) override { + DISPLAY_TRACE; COMPOSER_CHECK_NULLPTR_RETURN(req_); return ToDispErrCode(req_->SetLayerCompositionType(devId, layerId, type)); } virtual int32_t SetLayerBlendType(uint32_t devId, uint32_t layerId, BlendType type) override { + DISPLAY_TRACE; COMPOSER_CHECK_NULLPTR_RETURN(req_); return ToDispErrCode(req_->SetLayerBlendType(devId, layerId, type)); } virtual int32_t SetLayerMaskInfo(uint32_t devId, uint32_t layerId, const MaskInfo maskInfo) override { + DISPLAY_TRACE; COMPOSER_CHECK_NULLPTR_RETURN(hdi_); return ToDispErrCode(req_->SetLayerMaskInfo(devId, layerId, maskInfo)); } virtual int32_t SetLayerColorTransform(uint32_t devId, uint32_t layerId, const std::vector& matrix) override { + DISPLAY_TRACE; return DISPLAY_NOT_SUPPORT; } virtual int32_t SetLayerColorDataSpace(uint32_t devId, uint32_t layerId, const ColorDataSpace colorSpace) override { + DISPLAY_TRACE; return DISPLAY_NOT_SUPPORT; } virtual int32_t GetLayerColorDataSpace(uint32_t devId, uint32_t layerId, ColorDataSpace& colorSpace) override { + DISPLAY_TRACE; return DISPLAY_NOT_SUPPORT; } virtual int32_t SetLayerMetaData(uint32_t devId, uint32_t layerId, const std::vector& metaData) override { + DISPLAY_TRACE; return DISPLAY_NOT_SUPPORT; } virtual int32_t SetLayerMetaDataSet(uint32_t devId, uint32_t layerId, HDRMetadataKey key, const std::vector& metaData) override { + DISPLAY_TRACE; return DISPLAY_NOT_SUPPORT; } virtual int32_t GetSupportedPresentTimestamp(uint32_t devId, uint32_t layerId, PresentTimestampType& type) override { + DISPLAY_TRACE; return DISPLAY_NOT_SUPPORT; } virtual int32_t GetHwPresentTimestamp(uint32_t devId, uint32_t layerId, PresentTimestamp& pts) override { + DISPLAY_TRACE; return DISPLAY_NOT_SUPPORT; } virtual int32_t SetLayerTunnelHandle(uint32_t devId, uint32_t layerId, const ExtDataHandle& handle) override { + DISPLAY_TRACE; return DISPLAY_NOT_SUPPORT; } virtual int32_t SetLayerColor(uint32_t devId, uint32_t layerId, const LayerColor& layerColor) override { + DISPLAY_TRACE; COMPOSER_CHECK_NULLPTR_RETURN(req_); return ToDispErrCode(req_->SetLayerColor(devId, layerId, layerColor)); } diff --git a/display/composer/v1_1/display_command/display_cmd_requester.h b/display/composer/v1_1/display_command/display_cmd_requester.h index 2eed6cbc2bccf78c01be8166c7190c81829cc2c6..093b3cb145ff7bee4cc62b98c888ddc2ea05cbc3 100644 --- a/display/composer/v1_1/display_command/display_cmd_requester.h +++ b/display/composer/v1_1/display_command/display_cmd_requester.h @@ -35,6 +35,7 @@ public: static std::unique_ptr Create(sptr hdi) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: V1_1", __func__); DISPLAY_CHK_RETURN(hdi == nullptr, nullptr, HDF_LOGE("%{public}s: hdi is nullptr", __func__)); auto requester = std::make_unique(hdi); DISPLAY_CHK_RETURN(requester == nullptr, nullptr, diff --git a/display/composer/v1_1/display_command/display_cmd_responser.h b/display/composer/v1_1/display_command/display_cmd_responser.h index 63bc8c5b2a1f7fb77c541510beeaf92dacf29e2a..6997e42697ff0231f98122e7f16ac9e4c197dba6 100644 --- a/display/composer/v1_1/display_command/display_cmd_responser.h +++ b/display/composer/v1_1/display_command/display_cmd_responser.h @@ -33,6 +33,7 @@ class DisplayCmdResponser : public V1_0::DisplayCmdResponser public: static std::unique_ptr Create(VdiImpl* impl, std::shared_ptr cacheMgr) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: V1_1", __func__); DISPLAY_CHK_RETURN(impl == nullptr, nullptr, HDF_LOGE("%{public}s: error, VdiImpl is nullptr", __func__)); DISPLAY_CHK_RETURN(cacheMgr == nullptr, nullptr, diff --git a/display/composer/v1_1/hdi_impl/display_composer_hdi_impl.h b/display/composer/v1_1/hdi_impl/display_composer_hdi_impl.h index 9b1c1b74e91fa9f8fdeaec02a874c3d70458dbd0..ea89e165f3f9ad78f6dfa5cc5462a6713e2018c7 100644 --- a/display/composer/v1_1/hdi_impl/display_composer_hdi_impl.h +++ b/display/composer/v1_1/hdi_impl/display_composer_hdi_impl.h @@ -40,6 +40,7 @@ class DisplayComposerHdiImpl : public V1_0::DisplayComposerHdiImpl hdi; std::shared_ptr req = nullptr; HDF_LOGI("%{public}s: hdi v1_1 start", __func__); @@ -86,6 +87,7 @@ public: virtual int32_t RegSeamlessChangeCallback(SeamlessChangeCallback cb, void *data) override { + DISPLAY_TRACE; seamlessChangeCb_ = cb; seamlessChangeCbData_ = data; COMPOSER_CHECK_NULLPTR_RETURN(hdi_v1_1_); @@ -94,6 +96,7 @@ public: virtual int32_t GetDisplaySupportedModesExt(unsigned int devId, std::vector &modes) override { + DISPLAY_TRACE; COMPOSER_CHECK_NULLPTR_RETURN(hdi_v1_1_); return ToDispErrCode(hdi_v1_1_->GetDisplaySupportedModesExt(devId, modes)); } @@ -115,6 +118,7 @@ public: virtual int32_t SetDisplayModeAsync(uint32_t devId, uint32_t modeId, ModeCallback cb) override { + DISPLAY_TRACE; modeCb_ = cb; COMPOSER_CHECK_NULLPTR_RETURN(hdi_v1_1_); return ToDispErrCode(hdi_v1_1_->SetDisplayModeAsync(devId, modeId, this)); @@ -122,6 +126,7 @@ public: virtual int32_t GetDisplayVBlankPeriod(uint32_t devId, uint64_t &period) override { + DISPLAY_TRACE; COMPOSER_CHECK_NULLPTR_RETURN(hdi_v1_1_); return ToDispErrCode(hdi_v1_1_->GetDisplayVBlankPeriod(devId, period)); } @@ -129,16 +134,19 @@ public: virtual int32_t SetLayerPerFrameParameter(uint32_t devId, uint32_t layerId, const std::string& key, const std::vector& value) override { + DISPLAY_TRACE; return ToDispErrCode(hdi_v1_1_->SetLayerPerFrameParameter(devId, layerId, key, value)); } virtual int32_t GetSupportedLayerPerFrameParameterKey(std::vector& keys) override { + DISPLAY_TRACE; return ToDispErrCode(hdi_v1_1_->GetSupportedLayerPerFrameParameterKey(keys)); } virtual int32_t SetDisplayOverlayResolution(uint32_t devId, uint32_t width, uint32_t height) override { + DISPLAY_TRACE; return ToDispErrCode(hdi_v1_1_->SetDisplayOverlayResolution(devId, width, height)); } @@ -159,6 +167,7 @@ public: virtual int32_t RegRefreshCallback(RefreshCallback cb, void *data) override { + DISPLAY_TRACE; refreshCb_ = cb; refreshCbData_ = data; COMPOSER_CHECK_NULLPTR_RETURN(hdi_v1_1_); @@ -167,12 +176,14 @@ public: virtual int32_t GetDisplaySupportedColorGamuts(uint32_t devId, std::vector& gamuts) override { + DISPLAY_TRACE; COMPOSER_CHECK_NULLPTR_RETURN(hdi_v1_1_); return ToDispErrCode(hdi_v1_1_->GetDisplaySupportedColorGamuts(devId, gamuts)); } virtual int32_t GetHDRCapabilityInfos(uint32_t devId, HDRCapability& info) override { + DISPLAY_TRACE; COMPOSER_CHECK_NULLPTR_RETURN(hdi_v1_1_); return ToDispErrCode(hdi_v1_1_->GetHDRCapabilityInfos(devId, info)); } diff --git a/display/composer/v1_2/display_command/display_cmd_requester.h b/display/composer/v1_2/display_command/display_cmd_requester.h index a5953cfd888746befe3467df17b78cb842f42ddc..b7f52a846c187ce84a4b416ab217c5bb40263605 100644 --- a/display/composer/v1_2/display_command/display_cmd_requester.h +++ b/display/composer/v1_2/display_command/display_cmd_requester.h @@ -35,6 +35,7 @@ public: static std::unique_ptr Create(sptr hdi) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: V1_2", __func__); DISPLAY_CHK_RETURN(hdi == nullptr, nullptr, HDF_LOGE("%{public}s: hdi is nullptr", __func__)); auto requester = std::make_unique(hdi); DISPLAY_CHK_RETURN(requester == nullptr, nullptr, @@ -50,6 +51,10 @@ public: int32_t CommitAndGetReleaseFence(uint32_t devId, int32_t& fence, bool isSupportSkipValidate, int32_t& skipState, bool& needFlush, std::vector& layers, std::vector& fences, bool isValidated) { + HITRACE_METER_FMT(HITRACE_TAG_HDF,"%s: devId %u, fence %d, isSupportSkipValidate %d, skipState %d, " + "needFlush %d, layers.size %zu, fences.size %zu, isValidated %d", + __func__, devId, fence, isSupportSkipValidate, skipState, needFlush, + layers.size(), fences.size(), isValidated); uint32_t replyEleCnt = 0; std::vector outFds; std::shared_ptr replyData; @@ -102,6 +107,7 @@ EXIT: int32_t OnReplySkipStateFailed(CommandDataUnpacker& replyUnpacker, bool &needFlush) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: V1_2, needFlush %d", __func__, needFlush); uint32_t devId = 0; int32_t retBool = replyUnpacker.ReadUint32(devId); DISPLAY_CHK_RETURN(retBool == false, HDF_FAILURE, HDF_LOGE("%{public}s: read devId failed", __func__)); @@ -146,6 +152,10 @@ EXIT: std::vector& replyFds, int32_t& fenceFd, int32_t& skipState, bool& needFlush, std::vector& layers, std::vector& fences) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: replyFds.size %zu, fenceFd %d, skipState %d, needFlush %d, " + "layers.size %zu, fences.size %zu", + __func__, replyFds.size(), fenceFd, skipState, needFlush, + layers.size(), fences.size()); int32_t ret = CmdUtils::FileDescriptorUnpack(replyUnpacker, replyFds, fenceFd); DISPLAY_CHK_RETURN(ret != HDF_SUCCESS, ret, HDF_LOGE("%{public}s: FileDescriptorUnpack failed", __func__)); @@ -195,6 +205,8 @@ EXIT: int32_t ProcessUnpackCmd(CommandDataUnpacker& replyUnpacker, int32_t unpackCmd, std::vector& replyFds, std::function fn) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: unpackCmd %d, replyFds.size %zu", + __func__, unpackCmd, replyFds.size()); int32_t ret = HDF_SUCCESS; while (replyUnpacker.NextSection()) { bool retBool = replyUnpacker.BeginSection(unpackCmd); @@ -228,6 +240,8 @@ EXIT: int32_t DoReplyResults(uint32_t replyEleCnt, std::vector& replyFds, std::shared_ptr replyData, std::function fn) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: replyEleCnt %u, replyFds.size %zu", __func__, replyEleCnt, + replyFds.size()); CommandDataUnpacker replyUnpacker; replyUnpacker.Init(replyData.get(), replyEleCnt << CmdUtils::MOVE_SIZE); #ifdef DEBUG_DISPLAY_CMD_RAW_DATA @@ -257,6 +271,8 @@ EXIT: // LTPO新增接口 int32_t SetDisplayConstraint(uint32_t devId, uint64_t frameID, uint64_t ns, uint32_t type) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: devId %u, frameID %llu, ns %llu, type %u", + __func__, devId, frameID, ns, type); int32_t ret = 0; bool retBool = false; int32_t writePos = requestPacker_.ValidSize(); diff --git a/display/composer/v1_2/display_command/display_cmd_responser.h b/display/composer/v1_2/display_command/display_cmd_responser.h index 2ee974fdb42e8054a8a3384193a673ba5ec17211..4ba110ecaf1fa04a5c35e43849c2768dbddebc0a 100644 --- a/display/composer/v1_2/display_command/display_cmd_responser.h +++ b/display/composer/v1_2/display_command/display_cmd_responser.h @@ -45,6 +45,7 @@ class DisplayCmdResponser : public V1_1::DisplayCmdResponser public: static std::unique_ptr Create(VdiImpl* impl, std::shared_ptr cacheMgr) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: V1_2", __func__); DISPLAY_CHK_RETURN(impl == nullptr, nullptr, HDF_LOGE("%{public}s: error, VdiImpl is nullptr", __func__)); DISPLAY_CHK_RETURN(cacheMgr == nullptr, nullptr, @@ -55,6 +56,7 @@ public: static std::unique_ptr CreateV1_1( VdiImpl1_1* impl, std::shared_ptr cacheMgr) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: V1_2", __func__); DISPLAY_CHK_RETURN(impl == nullptr, nullptr, HDF_LOGE("%{public}s: error, VdiImpl is nullptr", __func__)); DISPLAY_CHK_RETURN(cacheMgr == nullptr, nullptr, @@ -74,6 +76,8 @@ public: int32_t ProcessRequestCmd(CommandDataUnpacker& unpacker, int32_t cmd, const std::vector& inFds, std::vector& outFds) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: cmd %d, inFds.size %zu, outFds.size %zu", + __func__, cmd, inFds.size(), outFds.size()); HDF_LOGD("%{public}s: HDI 1.2 PackSection, cmd-[%{public}d] = %{public}s", __func__, cmd, CmdUtils::CommandToString(cmd)); if (cmd == REQUEST_CMD_COMMIT_AND_GET_RELEASE_FENCE) { @@ -88,6 +92,7 @@ public: void ReplyNotSkipInfo(uint32_t& devId, CommitInfo& commitInfo) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: devId %u", __func__, devId); DISPLAY_CHECK(replyPacker_.WriteUint32(devId) == false, HDF_LOGE("%{public}s, write devId error", __func__)); @@ -116,6 +121,7 @@ public: void ReplyCommitAndGetReleaseFence(std::vector& outFds, uint32_t& devId, CommitInfo& commitInfo) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: outFds.size %zu, devId %u", __func__, outFds.size(), devId); int32_t ret = HDF_SUCCESS; uint32_t vectSize = 0; @@ -169,6 +175,7 @@ public: void CommitInfoDump(void) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s", __func__); #ifdef DISPLAY_COMSPOER_DEBUG_DUMP const std::string SWITCH_ON = "on"; const uint32_t DUMP_CACHE_SWITCH_LEN = 4; @@ -183,7 +190,7 @@ public: void OnCommitAndGetReleaseFence(CommandDataUnpacker& unpacker, std::vector& outFds) { - DISPLAY_TRACE; + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: outFds.size %zu", __func__, outFds.size()); uint32_t devId = 0; bool isSupportSkipValidate = false; bool isValidated = false; @@ -236,6 +243,8 @@ REPLY: int32_t CmdRequest(uint32_t inEleCnt, const std::vector& inFds, uint32_t& outEleCnt, std::vector& outFds) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: inEleCnt %u, inFds.size %zu, outEleCnt %u, outFds.size %zu", + __func__, inEleCnt, inFds.size(), outEleCnt, outFds.size()); std::shared_ptr requestData(new char[inEleCnt * CmdUtils::ELEMENT_SIZE], std::default_delete()); int32_t ret = CmdRequestDataRead(requestData, inEleCnt); diff --git a/display/composer/v1_2/display_command/display_cmd_utils.h b/display/composer/v1_2/display_command/display_cmd_utils.h index bf839d2c7ea855d47e4ee54db84ba7813205f3e5..44dbbc5f45df94bdd39a2538b64c8171cc059952 100644 --- a/display/composer/v1_2/display_command/display_cmd_utils.h +++ b/display/composer/v1_2/display_command/display_cmd_utils.h @@ -35,6 +35,7 @@ public: #define SWITCHCASE(x) case (x): {return #x;} static const char *CommandToString(int32_t cmdId) { + HITRACE_METER_FMT(HITRACE_TAG_HDF, "%s: cmdId %d", __func__, cmdId); switch (cmdId) { /* request cmd */ SWITCHCASE(REQUEST_CMD_PREPARE_DISPLAY_LAYERS); diff --git a/display/composer/v1_2/hdi_impl/display_composer_hdi_impl.h b/display/composer/v1_2/hdi_impl/display_composer_hdi_impl.h index 8c14a70fd0cc90a95096227d50af3e5e56189570..3d0fa6887037afd055ba25fc544e452bf2ac92e8 100644 --- a/display/composer/v1_2/hdi_impl/display_composer_hdi_impl.h +++ b/display/composer/v1_2/hdi_impl/display_composer_hdi_impl.h @@ -40,6 +40,7 @@ class DisplayComposerHdiImpl : public V1_1::DisplayComposerHdiImpl hdi; std::shared_ptr req = nullptr; HDF_LOGI("%{public}s: hdi v1_2 start", __func__); @@ -71,6 +72,7 @@ public: virtual int32_t CommitAndGetReleaseFence(uint32_t devId, int32_t& fence, int32_t& skipState, bool& needFlush, std::vector& layers, std::vector& fences, bool isValidated) override { + DISPLAY_TRACE; COMPOSER_CHECK_NULLPTR_RETURN(req_v1_2_); bool isSupportSkipValidate = (isSupportSkipValidate_ == 1) ? 1 : 0; return ToDispErrCode(req_v1_2_->CommitAndGetReleaseFence(devId, fence, @@ -79,6 +81,7 @@ public: virtual int32_t GetDisplayProperty(uint32_t devId, uint32_t id, uint64_t& value) override { + DISPLAY_TRACE; COMPOSER_CHECK_NULLPTR_RETURN(hdi_v1_2_); value = 0; int32_t ret = ToDispErrCode(hdi_v1_2_->GetDisplayProperty(devId, id, value)); @@ -91,6 +94,7 @@ public: virtual int32_t RegDisplayVBlankIdleCallback(VBlankIdleCallback cb, void *data) override { + DISPLAY_TRACE; VBlankIdleCb_ = cb; VBlankIdleCbData_ = data; COMPOSER_CHECK_NULLPTR_RETURN(hdi_v1_2_); @@ -99,12 +103,14 @@ public: virtual int32_t SetDisplayConstraint(uint32_t devId, uint64_t frameID, uint64_t ns, uint32_t type) override { + DISPLAY_TRACE; COMPOSER_CHECK_NULLPTR_RETURN(req_v1_2_); return ToDispErrCode(req_v1_2_->SetDisplayConstraint(devId, frameID, ns, type)); } virtual int32_t OnVBlankIdleCallback(uint32_t devId, uint64_t ns) override { + DISPLAY_TRACE; int32_t ret = HDF_SUCCESS; if (VBlankIdleCb_ != nullptr) { VBlankIdleCb_(devId, ns, VBlankIdleCbData_); @@ -116,18 +122,21 @@ public: } virtual int32_t ClearClientBuffer(uint32_t devId) override { + DISPLAY_TRACE; COMPOSER_CHECK_NULLPTR_RETURN(req_v1_2_); return ToDispErrCode(hdi_v1_2_->ClearClientBuffer(devId)); } virtual int32_t ClearLayerBuffer(uint32_t devId, uint32_t layerId) override { + DISPLAY_TRACE; COMPOSER_CHECK_NULLPTR_RETURN(req_v1_2_); return ToDispErrCode(hdi_v1_2_->ClearLayerBuffer(devId, layerId)); } virtual int32_t SetHardwareCursorPosition(uint32_t devId, int32_t x, int32_t y) override { + DISPLAY_TRACE; COMPOSER_CHECK_NULLPTR_RETURN(hdi_v1_2_); int32_t ret = ToDispErrCode(hdi_v1_2_->SetHardwareCursorPosition(devId, x, y)); return ret; @@ -135,6 +144,7 @@ public: virtual int32_t EnableHardwareCursorStats(uint32_t devId, bool enable) override { + DISPLAY_TRACE; COMPOSER_CHECK_NULLPTR_RETURN(hdi_v1_2_); int32_t ret = ToDispErrCode(hdi_v1_2_->EnableHardwareCursorStats(devId, enable)); return ret; @@ -142,6 +152,7 @@ public: virtual int32_t GetHardwareCursorStats(uint32_t devId, uint32_t& frameCount, uint32_t& vsyncCount) override { + DISPLAY_TRACE; COMPOSER_CHECK_NULLPTR_RETURN(hdi_v1_2_); int32_t ret = ToDispErrCode(hdi_v1_2_->GetHardwareCursorStats(devId, frameCount, vsyncCount)); return ret;