From b456e8ba3702a8805472eaea9e88a7a2b0341735 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E5=B8=B8=E5=BE=B7?= Date: Thu, 25 Jul 2024 17:37:41 +0800 Subject: [PATCH] Fix virtual screen blacklist timing issue MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 钱常德 Change-Id: I64ba6a86e68be9610797233edce7d94d1f317293 --- .../rs_display_render_node_drawable.cpp | 13 +-- .../rs_display_render_node_drawable.h | 4 +- .../rs_uni_render_virtual_processor.cpp | 73 -------------- .../rs_uni_render_virtual_processor.h | 3 - .../core/pipeline/rs_uni_render_visitor.cpp | 12 +-- .../core/pipeline/rs_uni_render_visitor.h | 2 +- .../core/screen_manager/rs_screen_manager.cpp | 63 ++++++------- .../core/screen_manager/rs_screen_manager.h | 14 +-- .../src/pipeline/rs_surface_render_node.cpp | 2 + .../core/ui/rs_surface_node.cpp | 2 +- .../rs_uni_render_virtual_processor_test.cpp | 94 ------------------- 11 files changed, 45 insertions(+), 237 deletions(-) diff --git a/rosen/modules/render_service/core/drawable/rs_display_render_node_drawable.cpp b/rosen/modules/render_service/core/drawable/rs_display_render_node_drawable.cpp index 20abd3aa60..0ff414a767 100644 --- a/rosen/modules/render_service/core/drawable/rs_display_render_node_drawable.cpp +++ b/rosen/modules/render_service/core/drawable/rs_display_render_node_drawable.cpp @@ -474,14 +474,7 @@ void RSDisplayRenderNodeDrawable::OnDraw(Drawing::Canvas& canvas) WiredScreenProjection(*params, processor); return; } - castScreenEnableSkipWindow_ = screenManager->GetCastScreenEnableSkipWindow(paramScreenId); - if (castScreenEnableSkipWindow_) { - RS_LOGD("RSDisplayRenderNodeDrawable::OnDraw, Enable CastScreen SkipWindow."); - screenManager->GetCastScreenBlackList(currentBlackList_); - } else { - RS_LOGD("RSDisplayRenderNodeDrawable::OnDraw, Enable RecordScreen SkipWindow."); - currentBlackList_ = screenManager->GetVirtualScreenBlackList(paramScreenId); - } + currentBlackList_ = screenManager->GetVirtualScreenBlackList(paramScreenId); uniParam->SetBlackList(currentBlackList_); uniParam->SetWhiteList(screenInfo.whiteList); curSecExemption_ = params->GetSecurityExemption(); @@ -724,6 +717,10 @@ int32_t RSDisplayRenderNodeDrawable::GetSpecialLayerType(RSDisplayRenderParams& { auto hasGeneralSpecialLayer = params.HasSecurityLayer() || params.HasSkipLayer() || params.HasProtectedLayer() || RSUniRenderThread::Instance().IsCurtainScreenOn() || params.GetHDRPresent(); + RS_LOGD("RSDisplayRenderNodeDrawable::GetSpecialLayerType, SecurityLayer:%{public}d, SkipLayer:%{public}d," + "ProtectedLayer:%{public}d, CurtainScreen:%{public}d, HDRPresent:%{public}d", params.HasSecurityLayer(), + params.HasSkipLayer(), params.HasProtectedLayer(), RSUniRenderThread::Instance().IsCurtainScreenOn(), + params.GetHDRPresent()); if (RSUniRenderThread::GetCaptureParam().isSnapshot_) { return hasGeneralSpecialLayer ? HAS_SPECIAL_LAYER : (params.HasCaptureWindow() ? CAPTURE_WINDOW : NO_SPECIAL_LAYER); diff --git a/rosen/modules/render_service/core/drawable/rs_display_render_node_drawable.h b/rosen/modules/render_service/core/drawable/rs_display_render_node_drawable.h index d0d6b71d1b..184d573142 100644 --- a/rosen/modules/render_service/core/drawable/rs_display_render_node_drawable.h +++ b/rosen/modules/render_service/core/drawable/rs_display_render_node_drawable.h @@ -180,8 +180,8 @@ private: mutable std::shared_ptr curCanvas_ = nullptr; std::shared_ptr offscreenSurface_ = nullptr; // temporary holds offscreen surface std::shared_ptr canvasBackup_ = nullptr; // backup current canvas before offscreen rende - std::unordered_set currentBlackList_; - std::unordered_set lastBlackList_; + std::unordered_set currentBlackList_ = {}; + std::unordered_set lastBlackList_ = {}; bool curSecExemption_ = false; bool lastSecExemption_ = false; std::shared_ptr cacheImgForCapture_ = nullptr; diff --git a/rosen/modules/render_service/core/pipeline/rs_uni_render_virtual_processor.cpp b/rosen/modules/render_service/core/pipeline/rs_uni_render_virtual_processor.cpp index 96c9ef9c1f..24958710b9 100644 --- a/rosen/modules/render_service/core/pipeline/rs_uni_render_virtual_processor.cpp +++ b/rosen/modules/render_service/core/pipeline/rs_uni_render_virtual_processor.cpp @@ -175,29 +175,6 @@ bool RSUniRenderVirtualProcessor::RequestVirtualFrame(DrawableV2::RSDisplayRende return true; } -void RSUniRenderVirtualProcessor::CanvasInit(RSDisplayRenderNode& node) -{ - if (node.IsFirstTimeToProcessor() || canvasRotation_) { - if (node.IsFirstTimeToProcessor()) { - RS_LOGI("RSUniRenderVirtualProcessor::FirstInit, id: %{public}" PRIu64 ", " \ - "screen(%{public}f, %{public}f, %{public}f, %{public}f), " \ - "rotation: %{public}d, correction: %{public}d, needRotation: %{public}d, scaleMode: %{public}d", - node.GetScreenId(), mainWidth_, mainHeight_, mirrorWidth_, mirrorHeight_, - screenRotation_, screenCorrection_, canvasRotation_, scaleMode_); - } - node.SetOriginScreenRotation(screenRotation_); - } - auto rotationDiff = static_cast(node.GetOriginScreenRotation()) - static_cast(screenCorrection_); - auto rotationAngle = static_cast((rotationDiff + SCREEN_ROTATION_NUM) % SCREEN_ROTATION_NUM); - OriginScreenRotation(rotationAngle, renderFrameConfig_.width, renderFrameConfig_.height); - - RS_LOGD("RSUniRenderVirtualProcessor::CanvasInit, id: %{public}" PRIu64 ", " \ - "screen(%{public}f, %{public}f, %{public}f, %{public}f), " \ - "rotation: %{public}d, correction: %{public}d, needRotation: %{public}d, rotationAngle: %{public}d", - node.GetScreenId(), mainWidth_, mainHeight_, mirrorWidth_, mirrorHeight_, - screenRotation_, screenCorrection_, canvasRotation_, rotationAngle); -} - void RSUniRenderVirtualProcessor::CanvasInit(DrawableV2::RSDisplayRenderNodeDrawable& displayDrawable) { // Save the initial canvas state @@ -301,36 +278,6 @@ void RSUniRenderVirtualProcessor::OriginScreenRotation(ScreenRotation screenRota } } -void RSUniRenderVirtualProcessor::ScaleMirrorIfNeed(RSDisplayRenderNode& node, RSPaintFilterCanvas& canvas) -{ - if (screenCorrection_ == ScreenRotation::ROTATION_90 || - screenCorrection_ == ScreenRotation::ROTATION_270) { - std::swap(mirrorWidth_, mirrorHeight_); - } - - auto angle = node.GetOriginScreenRotation(); - if (angle == ScreenRotation::ROTATION_90 || - angle == ScreenRotation::ROTATION_270) { - std::swap(mirrorWidth_, mirrorHeight_); - } - - RS_LOGD("RSUniRenderVirtualProcessor::ScaleMirrorIfNeed:(%{public}f, %{public}f, %{public}f, %{public}f), " \ - "screenCorrection:%{public}d, oriRotation:%{public}d, scaleMode:%{public}d", - mainWidth_, mainHeight_, mirrorWidth_, mirrorHeight_, - static_cast(screenCorrection_), static_cast(angle), static_cast(scaleMode_)); - - if (mainWidth_ == mirrorWidth_ && mainHeight_ == mirrorHeight_) { - return; - } - - canvas.Clear(SK_ColorBLACK); - if (scaleMode_ == ScreenScaleMode::FILL_MODE) { - Fill(canvas, mainWidth_, mainHeight_, mirrorWidth_, mirrorHeight_); - } else if (scaleMode_ == ScreenScaleMode::UNISCALE_MODE) { - UniScale(canvas, mainWidth_, mainHeight_, mirrorWidth_, mirrorHeight_); - } -} - void RSUniRenderVirtualProcessor::ScaleMirrorIfNeed(const ScreenRotation angle, RSPaintFilterCanvas& canvas) { if (screenCorrection_ == ScreenRotation::ROTATION_90 || @@ -383,26 +330,6 @@ void RSUniRenderVirtualProcessor::ProcessSurface(RSSurfaceRenderNode& node) RS_LOGI("RSUniRenderVirtualProcessor::ProcessSurface() is not supported."); } -void RSUniRenderVirtualProcessor::CalculateTransform(RSDisplayRenderNode& node) -{ - if (isExpand_) { - return; - } - auto drawable = node.GetRenderDrawable(); - if (!drawable) { - return; - } - auto displayDrawable = std::static_pointer_cast(drawable); - if (canvas_ == nullptr || displayDrawable->GetRSSurfaceHandlerOnDraw()->GetBuffer() == nullptr) { - RS_LOGE("RSUniRenderVirtualProcessor::ProcessDisplaySurface: Canvas or buffer is null!"); - return; - } - - canvas_->Save(); - ScaleMirrorIfNeed(node, *canvas_); - canvasMatrix_ = canvas_->GetTotalMatrix(); -} - void RSUniRenderVirtualProcessor::CalculateTransform(DrawableV2::RSDisplayRenderNodeDrawable& displayDrawable) { if (canvas_ == nullptr || displayDrawable.GetRSSurfaceHandlerOnDraw()->GetBuffer() == nullptr) { diff --git a/rosen/modules/render_service/core/pipeline/rs_uni_render_virtual_processor.h b/rosen/modules/render_service/core/pipeline/rs_uni_render_virtual_processor.h index 47550af7f5..ee9b2a39cc 100644 --- a/rosen/modules/render_service/core/pipeline/rs_uni_render_virtual_processor.h +++ b/rosen/modules/render_service/core/pipeline/rs_uni_render_virtual_processor.h @@ -50,7 +50,6 @@ public: void ProcessSurface(RSSurfaceRenderNode& node) override; void ProcessRcdSurface(RSRcdSurfaceRenderNode& node) override; void PostProcess() override; - void ScaleMirrorIfNeed(RSDisplayRenderNode& node, RSPaintFilterCanvas& canvas); void Fill(RSPaintFilterCanvas& canvas, float mainWidth, float mainHeight, float mirrorWidth, float mirrorHeight); void UniScale(RSPaintFilterCanvas& canvas, @@ -77,13 +76,11 @@ public: // when virtual screen partial refresh closed, use this function to reset RoiRegion in buffer GSError SetRoiRegionToCodec(std::vector& damageRegion); bool RequestVirtualFrame(DrawableV2::RSDisplayRenderNodeDrawable& displayDrawable); - void CalculateTransform(RSDisplayRenderNode& node); void CalculateTransform(DrawableV2::RSDisplayRenderNodeDrawable& displayDrawable); void ScaleMirrorIfNeed(const ScreenRotation angle, RSPaintFilterCanvas& canvas); void ProcessVirtualDisplaySurface(DrawableV2::RSDisplayRenderNodeDrawable& displayDrawable); private: void CanvasInit(DrawableV2::RSDisplayRenderNodeDrawable& displayDrawable); - void CanvasInit(RSDisplayRenderNode& node); void OriginScreenRotation(ScreenRotation screenRotation, float width, float height); sptr producerSurface_; diff --git a/rosen/modules/render_service/core/pipeline/rs_uni_render_visitor.cpp b/rosen/modules/render_service/core/pipeline/rs_uni_render_visitor.cpp index ed4650edf2..b8aa93268b 100644 --- a/rosen/modules/render_service/core/pipeline/rs_uni_render_visitor.cpp +++ b/rosen/modules/render_service/core/pipeline/rs_uni_render_visitor.cpp @@ -762,7 +762,7 @@ void RSUniRenderVisitor::CalculateOcclusion(RSSurfaceRenderNode& node) // check current surface Participate In Occlusion if (node.CheckParticipateInOcclusion() && !isAllSurfaceVisibleDebugEnabled_) { accumulatedOcclusionRegion_.OrSelf(node.GetOpaqueRegion()); - std::unordered_set currentBlackList = GetCurrentBlackList(); + const auto& currentBlackList = GetCurrentBlackList(); if (IsValidInVirtualScreen(node) && currentBlackList.find(node.GetId()) == currentBlackList.end()) { occlusionRegionWithoutSkipLayer_.OrSelf(node.GetOpaqueRegion()); } @@ -848,19 +848,13 @@ void RSUniRenderVisitor::SurfaceOcclusionCallbackToWMS() } } -std::unordered_set RSUniRenderVisitor::GetCurrentBlackList() const +const std::unordered_set& RSUniRenderVisitor::GetCurrentBlackList() const { if (!screenManager_ || !curDisplayNode_) { return std::unordered_set(); } - std::unordered_set currentBlackList; - if (screenManager_->GetCastScreenEnableSkipWindow(curDisplayNode_->GetScreenId())) { - screenManager_->GetCastScreenBlackList(currentBlackList); - } else { - currentBlackList = screenManager_->GetVirtualScreenBlackList(curDisplayNode_->GetScreenId()); - } - return currentBlackList; + return screenManager_->GetVirtualScreenBlackList(curDisplayNode_->GetScreenId()); } RSVisibleLevel RSUniRenderVisitor::GetRegionVisibleLevel(const Occlusion::Region& visibleRegion, diff --git a/rosen/modules/render_service/core/pipeline/rs_uni_render_visitor.h b/rosen/modules/render_service/core/pipeline/rs_uni_render_visitor.h index 6c6aa96f6d..ecc181adf3 100644 --- a/rosen/modules/render_service/core/pipeline/rs_uni_render_visitor.h +++ b/rosen/modules/render_service/core/pipeline/rs_uni_render_visitor.h @@ -142,7 +142,7 @@ public: void SurfaceOcclusionCallbackToWMS(); - std::unordered_set GetCurrentBlackList() const; + const std::unordered_set& GetCurrentBlackList() const; static void ClearRenderGroupCache(); diff --git a/rosen/modules/render_service/core/screen_manager/rs_screen_manager.cpp b/rosen/modules/render_service/core/screen_manager/rs_screen_manager.cpp index 9326b03430..25c12154fe 100644 --- a/rosen/modules/render_service/core/screen_manager/rs_screen_manager.cpp +++ b/rosen/modules/render_service/core/screen_manager/rs_screen_manager.cpp @@ -932,36 +932,25 @@ ScreenId RSScreenManager::CreateVirtualScreen( return newId; } -void RSScreenManager::GetCastScreenBlackList(std::unordered_set& screenBlackList) -{ - std::lock_guard lock(blackListMutex_); - screenBlackList = castScreenBlackLists_; -} - -void RSScreenManager::SetCastScreenBlackList(std::unordered_set& screenBlackList) -{ - std::lock_guard lock(blackListMutex_); - castScreenBlackLists_ = screenBlackList; -} - int32_t RSScreenManager::SetVirtualScreenBlackList(ScreenId id, const std::vector& blackList) { + std::lock_guard lock(mutex_); std::unordered_set screenBlackList(blackList.begin(), blackList.end()); if (id == INVALID_SCREEN_ID) { - RS_LOGD("RSScreenManager %{public}s: CastScreenBlackLists.", __func__); - SetCastScreenBlackList(screenBlackList); + RS_LOGI("RSScreenManager %{public}s: Cast screen blacklists for id %{public}" PRIu64 ".", __func__, id); + castScreenBlackLists_ = screenBlackList; return SUCCESS; } - std::lock_guard lock(mutex_); auto virtualScreen = screens_.find(id); if (virtualScreen == screens_.end()) { RS_LOGW("RSScreenManager %{public}s: There is no screen for id %{public}" PRIu64 ".", __func__, id); return SCREEN_NOT_FOUND; } else { if (virtualScreen->second != nullptr) { + RS_LOGI("RSScreenManager %{public}s: Record screen blacklists for id %{public}" PRIu64 ".", __func__, id); virtualScreen->second->SetBlackList(screenBlackList); } else { - RS_LOGW("RSScreenManager %{public}s: Null screen for id %{public}" PRIu64 ".", __func__, id); + RS_LOGW("RSScreenManager %{public}s: BlackLists are null for id %{public}" PRIu64 ".", __func__, id); return SCREEN_NOT_FOUND; } } @@ -975,7 +964,8 @@ int32_t RSScreenManager::SetVirtualScreenBlackList(ScreenId id, const std::vecto if (mainScreen->second != nullptr) { mainScreen->second->SetBlackList(screenBlackList); } else { - RS_LOGW("RSScreenManager %{public}s: Null screen for id %{public}" PRIu64 ".", __func__, mainId); + RS_LOGW("RSScreenManager %{public}s: BlackLists are null for id %{public}" PRIu64 ".", + __func__, mainId); return SCREEN_NOT_FOUND; } } @@ -1030,6 +1020,26 @@ const std::vector RSScreenManager::GetVirtualScreenSecurityExemptionLi return virtualScreen->second->GetSecurityExemptionList(); } +std::unordered_set RSScreenManager::GetVirtualScreenBlackList(ScreenId id) const +{ + std::lock_guard lock(mutex_); + auto virtualScreen = screens_.find(id); + if (virtualScreen == screens_.end()) { + RS_LOGW("RSScreenManager %{public}s: There is no screen for id %{public}" PRIu64 ".", __func__, id); + return {}; + } + if (GetCastScreenEnableSkipWindow(id)) { + RS_LOGD("RSScreenManager %{public}s: Cast screen blacklists for id %{public}" PRIu64 ".", __func__, id); + return castScreenBlackLists_; + } + if (virtualScreen->second != nullptr) { + RS_LOGD("RSScreenManager %{public}s: Record screen blacklists for id %{public}" PRIu64 ".", __func__, id); + return virtualScreen->second->GetBlackList(); + } + RS_LOGD("RSScreenManager %{public}s: BlackLists are null for id %{public}" PRIu64 ".", __func__, id); + return {}; +} + int32_t RSScreenManager::SetCastScreenEnableSkipWindow(ScreenId id, bool enable) { std::lock_guard lock(mutex_); @@ -1048,7 +1058,7 @@ int32_t RSScreenManager::SetCastScreenEnableSkipWindow(ScreenId id, bool enable) } } -bool RSScreenManager::GetCastScreenEnableSkipWindow(ScreenId id) +bool RSScreenManager::GetCastScreenEnableSkipWindow(ScreenId id) const { std::lock_guard lock(mutex_); auto virtualScreen = screens_.find(id); @@ -1065,23 +1075,6 @@ bool RSScreenManager::GetCastScreenEnableSkipWindow(ScreenId id) } } -std::unordered_set RSScreenManager::GetVirtualScreenBlackList(ScreenId id) -{ - std::lock_guard lock(mutex_); - auto virtualScreen = screens_.find(id); - if (virtualScreen == screens_.end()) { - RS_LOGW("RSScreenManager %{public}s: There is no screen for id %{public}" PRIu64 ".", __func__, id); - return {}; - } else { - if (virtualScreen->second != nullptr) { - return virtualScreen->second->GetBlackList(); - } else { - RS_LOGW("RSScreenManager %{public}s: Null screen for id %{public}" PRIu64 ".", __func__, id); - return {}; - } - } -} - int32_t RSScreenManager::SetVirtualScreenSurface(ScreenId id, sptr surface) { std::lock_guard lock(mutex_); diff --git a/rosen/modules/render_service/core/screen_manager/rs_screen_manager.h b/rosen/modules/render_service/core/screen_manager/rs_screen_manager.h index 97d2290328..125efde211 100644 --- a/rosen/modules/render_service/core/screen_manager/rs_screen_manager.h +++ b/rosen/modules/render_service/core/screen_manager/rs_screen_manager.h @@ -78,12 +78,8 @@ public: virtual const std::vector GetVirtualScreenSecurityExemptionList(ScreenId id) = 0; virtual int32_t SetCastScreenEnableSkipWindow(ScreenId id, bool enable) = 0; - - virtual void GetCastScreenBlackList(std::unordered_set& screenBlackList) = 0; - - virtual bool GetCastScreenEnableSkipWindow(ScreenId id) = 0; - virtual std::unordered_set GetVirtualScreenBlackList(ScreenId id) = 0; + virtual std::unordered_set GetVirtualScreenBlackList(ScreenId id) const = 0; virtual int32_t SetVirtualScreenSurface(ScreenId id, sptr surface) = 0; @@ -282,12 +278,8 @@ public: const std::vector GetVirtualScreenSecurityExemptionList(ScreenId id) override; int32_t SetCastScreenEnableSkipWindow(ScreenId id, bool enable) override; - - void GetCastScreenBlackList(std::unordered_set& screenBlackList) override; - - bool GetCastScreenEnableSkipWindow(ScreenId id) override; - std::unordered_set GetVirtualScreenBlackList(ScreenId id) override; + std::unordered_set GetVirtualScreenBlackList(ScreenId id) const override; int32_t SetVirtualScreenSurface(ScreenId id, sptr surface) override; @@ -467,7 +459,6 @@ private: ScreenRotation GetScreenCorrectionLocked(ScreenId id) const; int32_t GetScreenBacklightLocked(ScreenId id) const; - void SetCastScreenBlackList(std::unordered_set& screenBlackList); void RemoveVirtualScreenLocked(ScreenId id); ScreenId GenerateVirtualScreenIdLocked(); void ReuseVirtualScreenIdLocked(ScreenId id); @@ -491,6 +482,7 @@ private: int32_t GetScreenColorSpaceLocked(ScreenId id, GraphicCM_ColorSpaceType& colorSpace) const; int32_t SetScreenColorSpaceLocked(ScreenId id, GraphicCM_ColorSpaceType colorSpace); ScreenInfo QueryScreenInfoLocked(ScreenId id) const; + bool GetCastScreenEnableSkipWindow(ScreenId id) const; #ifdef RS_SUBSCRIBE_SENSOR_ENABLE void RegisterSensorCallback(); diff --git a/rosen/modules/render_service_base/src/pipeline/rs_surface_render_node.cpp b/rosen/modules/render_service_base/src/pipeline/rs_surface_render_node.cpp index 1d2d518332..7f6b784b78 100644 --- a/rosen/modules/render_service_base/src/pipeline/rs_surface_render_node.cpp +++ b/rosen/modules/render_service_base/src/pipeline/rs_surface_render_node.cpp @@ -797,6 +797,8 @@ void RSSurfaceRenderNode::SetSecurityLayer(bool isSecurityLayer) } else { securityLayerIds_.erase(GetId()); } + ROSEN_LOGI("RSSurfaceRenderNode::SetSecurityLayer, Node id: %{public}" PRIu64 ", SecurityLayer:%{public}d", + GetId(), isSecurityLayer); SyncSecurityInfoToFirstLevelNode(); } diff --git a/rosen/modules/render_service_client/core/ui/rs_surface_node.cpp b/rosen/modules/render_service_client/core/ui/rs_surface_node.cpp index 7ebdeb0699..cd888f0c6d 100644 --- a/rosen/modules/render_service_client/core/ui/rs_surface_node.cpp +++ b/rosen/modules/render_service_client/core/ui/rs_surface_node.cpp @@ -254,7 +254,7 @@ void RSSurfaceNode::SetSecurityLayer(bool isSecurityLayer) if (transactionProxy != nullptr) { transactionProxy->AddCommand(command, true); } - ROSEN_LOGD("RSSurfaceNode::SetSecurityLayer, surfaceNodeId:[%{public}" PRIu64 "] isSecurityLayer:%{public}s", + ROSEN_LOGI("RSSurfaceNode::SetSecurityLayer, surfaceNodeId:[%{public}" PRIu64 "] isSecurityLayer:%{public}s", GetId(), isSecurityLayer ? "true" : "false"); } diff --git a/rosen/test/render_service/render_service/unittest/pipeline/rs_uni_render_virtual_processor_test.cpp b/rosen/test/render_service/render_service/unittest/pipeline/rs_uni_render_virtual_processor_test.cpp index cdc12c9af8..da9d1c8856 100644 --- a/rosen/test/render_service/render_service/unittest/pipeline/rs_uni_render_virtual_processor_test.cpp +++ b/rosen/test/render_service/render_service/unittest/pipeline/rs_uni_render_virtual_processor_test.cpp @@ -184,38 +184,6 @@ HWTEST_F(RSUniRenderVirtualProcessorTest, OriginScreenRotation, TestSize.Level2) virtualProcessor->OriginScreenRotation(ScreenRotation::ROTATION_270, DEFAULT_CANVAS_WIDTH, DEFAULT_CANVAS_HEIGHT); } -/** - * @tc.name: ScaleMirrorIfNeed - * @tc.desc: ScaleMirrorIfNeed Test - * @tc.type: FUNC - * @tc.require: issueI992VW - */ -HWTEST_F(RSUniRenderVirtualProcessorTest, ScaleMirrorIfNeed, TestSize.Level2) -{ - auto processor = RSProcessorFactory::CreateProcessor(RSDisplayRenderNode::CompositeType:: - UNI_RENDER_MIRROR_COMPOSITE); - auto virtualProcessor = std::static_pointer_cast(processor); - ASSERT_NE(nullptr, virtualProcessor); - RSDisplayNodeConfig config; - NodeId id = 0; - RSDisplayRenderNode rsDisplayRenderNode(id, config); - auto drawingCanvas = std::make_shared(DEFAULT_CANVAS_WIDTH, DEFAULT_CANVAS_HEIGHT); - ASSERT_NE(nullptr, drawingCanvas); - virtualProcessor->canvas_ = std::make_unique(drawingCanvas.get()); - ASSERT_NE(nullptr, virtualProcessor->canvas_); - virtualProcessor->scaleMode_ = ScreenScaleMode::FILL_MODE; - virtualProcessor->ScaleMirrorIfNeed(rsDisplayRenderNode, *virtualProcessor->canvas_); - - virtualProcessor->virtualScreenWidth_ = DEFAULT_CANVAS_WIDTH; - virtualProcessor->virtualScreenHeight_ = DEFAULT_CANVAS_HEIGHT; - virtualProcessor->mirroredScreenWidth_ = DEFAULT_CANVAS_WIDTH / 2; - virtualProcessor->mirroredScreenHeight_ = DEFAULT_CANVAS_HEIGHT / 2; - virtualProcessor->ScaleMirrorIfNeed(rsDisplayRenderNode, *virtualProcessor->canvas_); - - virtualProcessor->scaleMode_ = ScreenScaleMode::UNISCALE_MODE; - virtualProcessor->ScaleMirrorIfNeed(rsDisplayRenderNode, *virtualProcessor->canvas_); -} - /** * @tc.name: Fill * @tc.desc: Fill Test @@ -366,68 +334,6 @@ HWTEST_F(RSUniRenderVirtualProcessorTest, SetDirtyInfo_002, TestSize.Level2) virtualProcessor_->SetDirtyInfo(damageRegion); } -/** - * @tc.name: CalculateTransform_001 - * @tc.desc: CalculateTransform Test, isExpand_ is false, return directly - * @tc.type:FUNC - * @tc.require:issuesIAJ4FW - */ -HWTEST_F(RSUniRenderVirtualProcessorTest, CalculateTransform_001, TestSize.Level2) -{ - virtualProcessor_->isExpand_ = false; - - virtualProcessor_->CalculateTransform(*rsDisplayRenderNode_); -} - -/** - * @tc.name: CalculateTransform_002 - * @tc.desc: CalculateTransform Test, isExpand_ is true, renderDrawable_ is null , return directly - * @tc.type:FUNC - * @tc.require:issuesIAJ4FW - */ -HWTEST_F(RSUniRenderVirtualProcessorTest, CalculateTransform_002, TestSize.Level2) -{ - virtualProcessor_->isExpand_ = true; - rsDisplayRenderNode_->renderDrawable_ = nullptr; - ASSERT_EQ(rsDisplayRenderNode_->GetRenderDrawable(), nullptr); - - virtualProcessor_->CalculateTransform(*rsDisplayRenderNode_); -} - -/** - * @tc.name: CalculateTransform_003 - * @tc.desc: CalculateTransform Test,isExpand_ is true, renderDrawable_ is not null,and canvas_ is null - * @tc.type:FUNC - * @tc.require:issuesIAJ4FW - */ -HWTEST_F(RSUniRenderVirtualProcessorTest, CalculateTransform_003, TestSize.Level2) -{ - virtualProcessor_->isExpand_ = true; - auto rsRenderNode = std::make_shared(nodeId_); - rsDisplayRenderNode_->renderDrawable_ = std::make_shared(rsRenderNode); - ASSERT_NE(rsDisplayRenderNode_->GetRenderDrawable(), nullptr); - - virtualProcessor_->canvas_ = nullptr; - virtualProcessor_->CalculateTransform(*rsDisplayRenderNode_); -} - -/** - * @tc.name: CalculateTransform_004 - * @tc.desc: CalculateTransform Test,isExpand_ is true, renderDrawable_ is not null,and canvas_ not null - * @tc.type:FUNC - * @tc.require:issuesIAJ4FW - */ -HWTEST_F(RSUniRenderVirtualProcessorTest, CalculateTransform_004, TestSize.Level2) -{ - virtualProcessor_->isExpand_ = true; - auto rsRenderNode = std::make_shared(nodeId_); - rsDisplayRenderNode_->renderDrawable_ = std::make_shared(rsRenderNode); - ASSERT_NE(rsDisplayRenderNode_->GetRenderDrawable(), nullptr); - - ASSERT_NE(virtualProcessor_->canvas_, nullptr); - virtualProcessor_->CalculateTransform(*rsDisplayRenderNode_); -} - /** * @tc.name: ProcessDisplaySurfaceForRenderThread_001 * @tc.desc: ProcessDisplaySurfaceForRenderThread Test, isExpand_ is true, return directly