!17393 修复图库大图预览边框闪烁问题

Merge pull request !17393 from jimsu7/master
This commit is contained in:
openharmony_ci 2024-11-22 11:54:17 +00:00 committed by Gitee
commit 033b7134ac
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
4 changed files with 10 additions and 107 deletions

View File

@ -720,6 +720,9 @@ void RSDisplayRenderNodeDrawable::OnDraw(Drawing::Canvas& canvas)
RSMainThread::Instance()->SetFrameIsRender(true);
CheckAndUpdateFilterCacheOcclusion(*params, curScreenInfo);
if (isHdrOn) {
params->SetNewPixelFormat(GRAPHIC_PIXEL_FMT_RGBA_1010102);
}
RSUniRenderThread::Instance().WaitUntilDisplayNodeBufferReleased(*this);
// displayNodeSp to get rsSurface witch only used in renderThread
auto renderFrame = RequestFrame(*params, processor);

View File

@ -319,52 +319,13 @@ void RSUniRenderVisitor::HandleColorGamuts(RSDisplayRenderNode& node, const sptr
newColorSpace_ = GRAPHIC_COLOR_GAMUT_SRGB;
}
void RSUniRenderVisitor::CheckPixelFormatWithSelfDrawingNode(RSSurfaceRenderNode& node)
{
if (!node.IsOnTheTree()) {
RS_LOGD("RSUniRenderVisitor::CheckPixelFormatWithSelfDrawingNode node(%{public}s) is not on the tree",
node.GetName().c_str());
return;
}
if (!node.IsHardwareForcedDisabled()) {
RS_LOGD("RSUniRenderVisitor::CheckPixelFormatWithSelfDrawingNode node(%{public}s) is hardware-enabled",
node.GetName().c_str());
return;
}
if (!node.GetRSSurfaceHandler() || !node.GetRSSurfaceHandler()->GetBuffer()) {
RS_LOGD("RSUniRenderVisitor::CheckPixelFormatWithSelfDrawingNode node(%{public}s) did not have buffer.",
node.GetName().c_str());
return;
}
auto bufferPixelFormat = node.GetRSSurfaceHandler()->GetBuffer()->GetFormat();
if (RSMainThread::CheckIsHdrSurface(node)) {
newPixelFormat_ = GRAPHIC_PIXEL_FMT_RGBA_1010102;
RS_LOGD("RSUniRenderVisitor::CheckPixelFormatWithSelfDrawingNode HDRService pixelformat is set to 1010102");
}
}
void RSUniRenderVisitor::UpdatePixelFormatAfterHwcCalc(RSDisplayRenderNode& node)
{
const auto& selfDrawingNodes = RSMainThread::Instance()->GetSelfDrawingNodes();
for (const auto& selfDrawingNode : selfDrawingNodes) {
if (newPixelFormat_ == GRAPHIC_PIXEL_FMT_RGBA_1010102) {
RS_LOGD("RSUniRenderVisitor::UpdatePixelFormatAfterHwcCalc newPixelFormat is already 1010102.");
return;
}
auto ancestorNode = selfDrawingNode->GetAncestorDisplayNode().lock();
if (!selfDrawingNode || !ancestorNode) {
RS_LOGD("RSUniRenderVisitor::UpdatePixelFormatAfterHwcCalc selfDrawingNode or ancestorNode is nullptr");
continue;
}
auto ancestor = ancestorNode->ReinterpretCastTo<RSDisplayRenderNode>();
if (ancestor != nullptr && node.GetId() == ancestor->GetId()) {
CheckPixelFormatWithSelfDrawingNode(*selfDrawingNode);
}
}
}
void RSUniRenderVisitor::CheckPixelFormat(RSSurfaceRenderNode& node)
{
if (node.GetHDRPresent()) {
RS_LOGD("RSUniRenderVisitor::CheckPixelFormat HDRService SetHDRPresent true, surfaceNode: %{public}" PRIu64 "",
node.GetId());
hasUniRenderHdrSurface_ = true;
}
if (hasFingerprint_[currentVisitDisplay_]) {
RS_LOGD("RSUniRenderVisitor::CheckPixelFormat hasFingerprint is true.");
return;
@ -375,11 +336,9 @@ void RSUniRenderVisitor::CheckPixelFormat(RSSurfaceRenderNode& node)
RS_LOGD("RSUniRenderVisitor::CheckPixelFormat newPixelFormat_ is set 1010102 for fingerprint.");
return;
}
if (node.GetHDRPresent()) {
RS_LOGD("RSUniRenderVisitor::CheckPixelFormat HDRService SetHDRPresent true, surfaceNode: %{public}" PRIu64 "",
node.GetId());
hasUniRenderHdrSurface_ = true;
if (RSMainThread::CheckIsHdrSurface(node) && !IsHardwareComposerEnabled()) {
newPixelFormat_ = GRAPHIC_PIXEL_FMT_RGBA_1010102;
RS_LOGD("RSUniRenderVisitor::CheckPixelFormat pixelformat is set to 1010102 for 10bit buffer");
}
}
@ -417,7 +376,6 @@ void RSUniRenderVisitor::HandlePixelFormat(RSDisplayRenderNode& node, const sptr
}
}
stagingDisplayParams->SetNewPixelFormat(newPixelFormat_);
newPixelFormat_ = GRAPHIC_PIXEL_FMT_RGBA_8888;
}
void RSUniRenderVisitor::ResetCurSurfaceInfoAsUpperSurfaceParent(RSSurfaceRenderNode& node)
@ -748,7 +706,6 @@ void RSUniRenderVisitor::QuickPrepareDisplayRenderNode(RSDisplayRenderNode& node
curDisplayNode_->UpdateScreenRenderParams(screenRenderParams);
curDisplayNode_->UpdateOffscreenRenderParams(curDisplayNode_->IsRotationChanged());
UpdateColorSpaceAfterHwcCalc(node);
UpdatePixelFormatAfterHwcCalc(node);
HandleColorGamuts(node, screenManager_);
HandlePixelFormat(node, screenManager_);
if (UNLIKELY(!SharedTransitionParam::unpairedShareTransitions_.empty())) {

View File

@ -275,8 +275,6 @@ private:
void CheckColorSpace(RSSurfaceRenderNode& node);
void CheckColorSpaceWithSelfDrawingNode(RSSurfaceRenderNode& node);
void UpdateColorSpaceAfterHwcCalc(RSDisplayRenderNode& node);
void CheckPixelFormatWithSelfDrawingNode(RSSurfaceRenderNode& node);
void UpdatePixelFormatAfterHwcCalc(RSDisplayRenderNode& node);
void HandleColorGamuts(RSDisplayRenderNode& node, const sptr<RSScreenManager>& screenManager);
void CheckPixelFormat(RSSurfaceRenderNode& node);
void HandlePixelFormat(RSDisplayRenderNode& node, const sptr<RSScreenManager>& screenManager);

View File

@ -1422,61 +1422,6 @@ HWTEST_F(RSUniRenderVisitorTest, UpdateColorSpaceAfterHwcCalc_001, TestSize.Leve
ASSERT_EQ(rsUniRenderVisitor->newColorSpace_, GraphicColorGamut::GRAPHIC_COLOR_GAMUT_SRGB);
}
/**
* @tc.name: CheckPixelFormatWithSelfDrawingNode001
* @tc.desc: Test CheckPixelFormatWithSelfDrawingNode
* @tc.type: FUNC
* @tc.require: issueIAW3W0
*/
HWTEST_F(RSUniRenderVisitorTest, CheckPixelFormatWithSelfDrawingNode001, TestSize.Level2)
{
auto selfDrawingNode = RSTestUtil::CreateSurfaceNodeWithBuffer();
ASSERT_NE(selfDrawingNode, nullptr);
auto rsUniRenderVisitor = std::make_shared<RSUniRenderVisitor>();
ASSERT_NE(rsUniRenderVisitor, nullptr);
selfDrawingNode->SetIsOnTheTree(false);
rsUniRenderVisitor->CheckPixelFormatWithSelfDrawingNode(*selfDrawingNode);
selfDrawingNode->SetIsOnTheTree(true);
rsUniRenderVisitor->CheckPixelFormatWithSelfDrawingNode(*selfDrawingNode);
selfDrawingNode->SetHardwareForcedDisabledState(false);
rsUniRenderVisitor->CheckPixelFormatWithSelfDrawingNode(*selfDrawingNode);
selfDrawingNode->SetHardwareForcedDisabledState(true);
rsUniRenderVisitor->CheckPixelFormatWithSelfDrawingNode(*selfDrawingNode);
ASSERT_NE(selfDrawingNode->GetRSSurfaceHandler(), nullptr);
auto bufferHandle = selfDrawingNode->GetRSSurfaceHandler()->buffer_.buffer->GetBufferHandle();
ASSERT_NE(bufferHandle, nullptr);
bufferHandle->format = GraphicPixelFormat::GRAPHIC_PIXEL_FMT_RGBA_1010102;
rsUniRenderVisitor->CheckPixelFormatWithSelfDrawingNode(*selfDrawingNode);
}
/*
* @tc.name: UpdatePixelFormatAfterHwcCalc001
* @tc.desc: Test UpdatePixelFormatAfterHwcCalc
* @tc.type: FUNC
* @tc.require: issueIAW3W0
*/
HWTEST_F(RSUniRenderVisitorTest, UpdatePixelFormatAfterHwcCalc001, TestSize.Level2)
{
auto rsUniRenderVisitor = std::make_shared<RSUniRenderVisitor>();
ASSERT_NE(rsUniRenderVisitor, nullptr);
auto selfDrawingNode = RSTestUtil::CreateSurfaceNodeWithBuffer();
ASSERT_NE(selfDrawingNode, nullptr);
NodeId id = 0;
RSDisplayNodeConfig config;
auto displayNode = std::make_shared<RSDisplayRenderNode>(id, config);
ASSERT_NE(displayNode, nullptr);
selfDrawingNode->SetAncestorDisplayNode(displayNode);
selfDrawingNode->SetHardwareForcedDisabledState(true);
ASSERT_NE(selfDrawingNode->GetRSSurfaceHandler(), nullptr);
auto bufferHandle = selfDrawingNode->GetRSSurfaceHandler()->buffer_.buffer->GetBufferHandle();
ASSERT_NE(bufferHandle, nullptr);
bufferHandle->format = GraphicPixelFormat::GRAPHIC_PIXEL_FMT_RGBA_1010102;
rsUniRenderVisitor->UpdatePixelFormatAfterHwcCalc(*displayNode);
}
/*
* @tc.name: ResetCurSurfaceInfoAsUpperSurfaceParent001
* @tc.desc: Reset but keep single node's surfaceInfo