diff --git a/window_scene/session_manager/include/screen_session_dumper.h b/window_scene/session_manager/include/screen_session_dumper.h index c60ac784e700f89cf3c42af02bf5807083792720..2c0e9696de33da1239a52b8cd7b7cf9b42988f44 100644 --- a/window_scene/session_manager/include/screen_session_dumper.h +++ b/window_scene/session_manager/include/screen_session_dumper.h @@ -40,6 +40,10 @@ private: void ShowHelpInfo(); void ShowAllScreenInfo(); void OutputDumpInfo(); + void DumpScreenSessionById(ScreenId id); + void DumpRsInfoById(ScreenId id); + void DumpRsInfoById01(sptr screenSession); + void DumpCutoutInfoById(ScreenId id); void DumpScreenInfoById(ScreenId id); void DumpScreenPropertyById(ScreenId id); diff --git a/window_scene/session_manager/src/screen_session_dumper.cpp b/window_scene/session_manager/src/screen_session_dumper.cpp index bbe2086913ca715a16593c0dc3b051d8c203dee2..641a9859447a5c0e67680630675fba957042a445 100644 --- a/window_scene/session_manager/src/screen_session_dumper.cpp +++ b/window_scene/session_manager/src/screen_session_dumper.cpp @@ -22,7 +22,7 @@ namespace OHOS { namespace Rosen { namespace { -constexpr int LINE_WIDTH = 25; +constexpr int LINE_WIDTH = 30; constexpr HiviewDFX::HiLogLabel LABEL = { LOG_CORE, HILOG_DOMAIN_DISPLAY, "ScreenSessionDumper" }; } @@ -91,11 +91,161 @@ void ScreenSessionDumper::ShowAllScreenInfo() std::ostringstream oss; oss << "---------------- Screen ID: " << screenId << " ----------------" << std::endl; dumpInfo_.append(oss.str()); + DumpScreenSessionById(screenId); + DumpRsInfoById(screenId); + DumpCutoutInfoById(screenId); DumpScreenInfoById(screenId); DumpScreenPropertyById(screenId); } } +void ScreenSessionDumper::DumpScreenSessionById(ScreenId id) +{ + std::ostringstream oss; + oss << "[SCREEN SESSION]" << std::endl; + auto screenSession = ScreenSessionManager::GetInstance().GetScreenSession(id); + if (screenSession == nullptr) { + WLOGFE("screenSession nullptr. screen id: %{public}" PRIu64"", id); + return; + } + oss << std::left << std::setw(LINE_WIDTH) << "Name: " + << screenSession->GetName() << std::endl; + oss << std::left << std::setw(LINE_WIDTH) << "RSScreenId: " + << screenSession->GetRSScreenId() << std::endl; + sptr activeModes = screenSession->GetActiveScreenMode(); + if (activeModes != nullptr) { + oss << std::left << std::setw(LINE_WIDTH) << "activeModes: " + << activeModes->id_ << ", " << activeModes->width_ << ", " + << activeModes->height_ << ", " << activeModes->refreshRate_ << std::endl; + } + oss << std::left << std::setw(LINE_WIDTH) << "SourceMode: " + << static_cast(screenSession->GetSourceMode()) << std::endl; + oss << std::left << std::setw(LINE_WIDTH) << "ScreenCombination: " + << static_cast(screenSession->GetScreenCombination()) << std::endl; + oss << std::left << std::setw(LINE_WIDTH) << "Orientation: " + << static_cast(screenSession->GetOrientation()) << std::endl; + oss << std::left << std::setw(LINE_WIDTH) << "Rotation: " + << static_cast(screenSession->GetRotation()) << std::endl; + oss << std::left << std::setw(LINE_WIDTH) << "ScreenRequestedOrientation: " + << static_cast(screenSession->GetScreenRequestedOrientation()) << std::endl; + dumpInfo_.append(oss.str()); +} + +void ScreenSessionDumper::DumpRsInfoById(ScreenId id) +{ + std::ostringstream oss; + oss << "[RS INFO]" << std::endl; + auto screenSession = ScreenSessionManager::GetInstance().GetScreenSession(id); + if (screenSession == nullptr) { + WLOGFE("screenSession nullptr. screen id: %{public}" PRIu64"", id); + return; + } + std::vector colorGamuts; + DMError ret = screenSession->GetScreenSupportedColorGamuts(colorGamuts); + if (ret == DMError::DM_OK) { + oss << std::left << std::setw(LINE_WIDTH) << "SupportedColorGamuts: "; + for (uint32_t i = 0; i < colorGamuts.size() -1 ; i++) { + oss << static_cast(colorGamuts[i]) << ", "; + } + oss << static_cast(colorGamuts[colorGamuts.size() -1]) << std::endl; + } + ScreenColorGamut colorGamut; + ret = screenSession->GetScreenColorGamut(colorGamut); + if (ret == DMError::DM_OK) { + oss << std::left << std::setw(LINE_WIDTH) << "ScreenColorGamut: " + << static_cast(colorGamut) << std::endl; + } + ScreenGamutMap gamutMap; + ret = screenSession->GetScreenGamutMap(gamutMap); + if (ret == DMError::DM_OK) { + oss << std::left << std::setw(LINE_WIDTH) << "ScreenGamutMap: " + << static_cast(gamutMap) << std::endl; + } + GraphicPixelFormat pixelFormat; + ret = screenSession->GetPixelFormat(pixelFormat); + if (ret == DMError::DM_OK) { + oss << std::left << std::setw(LINE_WIDTH) << "GraphicPixelFormat: " + << static_cast(pixelFormat) << std::endl; + } + dumpInfo_.append(oss.str()); + DumpRsInfoById01(screenSession); // 拆分函数,避免函数过长 +} + +void ScreenSessionDumper::DumpRsInfoById01(sptr screenSession) +{ + std::ostringstream oss; + std::vector hdrFormats; + DMError ret = screenSession->GetSupportedHDRFormats(hdrFormats); + if (ret == DMError::DM_OK) { + oss << std::left << std::setw(LINE_WIDTH) << "SupportedScreenHDRFormat: "; + for (uint32_t i = 0; i < hdrFormats.size() -1 ; i++) { + oss << static_cast(hdrFormats[i]) << ", "; + } + oss << static_cast(hdrFormats[hdrFormats.size() -1]) << std::endl; + } + ScreenHDRFormat hdrFormat; + ret = screenSession->GetScreenHDRFormat(hdrFormat); + if (ret == DMError::DM_OK) { + oss << std::left << std::setw(LINE_WIDTH) << "ScreenHDRFormat: " + << static_cast(hdrFormat) << std::endl; + } + std::vector colorSpaces; + ret = screenSession->GetSupportedColorSpaces(colorSpaces); + if (ret == DMError::DM_OK) { + oss << std::left << std::setw(LINE_WIDTH) << "SupportedColorSpaces: "; + for (uint32_t i = 0; i < colorSpaces.size() -1 ; i++) { + oss << static_cast(colorSpaces[i]) << ", "; + } + oss << static_cast(colorSpaces[colorSpaces.size() -1]) << std::endl; + } + GraphicCM_ColorSpaceType colorSpace; + ret = screenSession->GetScreenColorSpace(colorSpace); + if (ret == DMError::DM_OK) { + oss << std::left << std::setw(LINE_WIDTH) << "ScreenColorSpace: " + << static_cast(colorSpace) << std::endl; + } + dumpInfo_.append(oss.str()); +} + +void ScreenSessionDumper::DumpCutoutInfoById(ScreenId id) +{ + std::ostringstream oss; + oss << "[CUTOUT INFO]" << std::endl; + sptr cutoutInfo = ScreenSessionManager::GetInstance().GetCutoutInfo(id); + if (cutoutInfo == nullptr) { + WLOGFE("cutoutInfo nullptr. screen id: %{public}" PRIu64"", id); + return; + } + oss << std::left << std::setw(LINE_WIDTH) << "WaterFall_L: " + << cutoutInfo->GetWaterfallDisplayAreaRects().left.posX_ << ", " + << cutoutInfo->GetWaterfallDisplayAreaRects().left.posY_ << ", " + << cutoutInfo->GetWaterfallDisplayAreaRects().left.width_ << ", " + << cutoutInfo->GetWaterfallDisplayAreaRects().left.height_ << std::endl; + oss << std::left << std::setw(LINE_WIDTH) << "WaterFall_T: " + << cutoutInfo->GetWaterfallDisplayAreaRects().top.posX_ << ", " + << cutoutInfo->GetWaterfallDisplayAreaRects().top.posY_ << ", " + << cutoutInfo->GetWaterfallDisplayAreaRects().top.width_ << ", " + << cutoutInfo->GetWaterfallDisplayAreaRects().top.height_ << std::endl; + oss << std::left << std::setw(LINE_WIDTH) << "WaterFall_R: " + << cutoutInfo->GetWaterfallDisplayAreaRects().right.posX_ << ", " + << cutoutInfo->GetWaterfallDisplayAreaRects().right.posY_ << ", " + << cutoutInfo->GetWaterfallDisplayAreaRects().right.width_ << ", " + << cutoutInfo->GetWaterfallDisplayAreaRects().right.height_ << std::endl; + oss << std::left << std::setw(LINE_WIDTH) << "WaterFall_B: " + << cutoutInfo->GetWaterfallDisplayAreaRects().bottom.posX_ << ", " + << cutoutInfo->GetWaterfallDisplayAreaRects().bottom.posY_ << ", " + << cutoutInfo->GetWaterfallDisplayAreaRects().bottom.width_ << ", " + << cutoutInfo->GetWaterfallDisplayAreaRects().bottom.height_ << std::endl; + + std::vector boundingRects = cutoutInfo->GetBoundingRects(); + oss << std::left << std::setw(LINE_WIDTH) << "BoundingRects: "; + for (auto rect : boundingRects) { + oss << "[" << rect.posX_ << ", " << rect.posY_ << ", " << rect.width_ << ", " << rect.height_ << "] "; + } + oss << std::endl; + dumpInfo_.append(oss.str()); +} + void ScreenSessionDumper::DumpScreenInfoById(ScreenId id) { std::ostringstream oss; @@ -105,10 +255,6 @@ void ScreenSessionDumper::DumpScreenInfoById(ScreenId id) WLOGFE("screenInfo nullptr. screen id: %{public}" PRIu64"", id); return; } - auto modes = screenInfo->GetModes(); - auto modeId = screenInfo->GetModeId(); - oss << std::left << std::setw(LINE_WIDTH) << "Name: " - << screenInfo->GetName() << std::endl; oss << std::left << std::setw(LINE_WIDTH) << "VirtualWidth: " << screenInfo->GetVirtualWidth() << std::endl; oss << std::left << std::setw(LINE_WIDTH) << "VirtualHeight: " @@ -129,19 +275,6 @@ void ScreenSessionDumper::DumpScreenInfoById(ScreenId id) << static_cast(screenInfo->GetSourceMode()) << std::endl; oss << std::left << std::setw(LINE_WIDTH) << "ScreenType: " << static_cast(screenInfo->GetType()) << std::endl; - oss << std::left << std::setw(LINE_WIDTH) << "ModeId: " << modeId << std::endl; - if (modes.size() > modeId) { - oss << std::left << std::setw(LINE_WIDTH) << "modes: " - << modes[modeId]->id_ << std::endl; - oss << std::left << std::setw(LINE_WIDTH) << "modes: " - << modes[modeId]->width_ << std::endl; - oss << std::left << std::setw(LINE_WIDTH) << "modes: " - << modes[modeId]->height_ << std::endl; - oss << std::left << std::setw(LINE_WIDTH) << "modes: " - << modes[modeId]->refreshRate_ << std::endl; - } else { - WLOGFW("invalid modes size: %{public}u ", static_cast(modes.size())); - } dumpInfo_.append(oss.str()); }