回退 'Pull Request !16220 : 消除代码差异'

This commit is contained in:
oh_ci 2024-10-24 02:15:47 +00:00 committed by Gitee
parent 1f9194c3cd
commit 953691448a
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
24 changed files with 29 additions and 124 deletions

View File

@ -794,7 +794,7 @@ void RSSurfaceRenderNodeDrawable::DrawBufferForRotationFixed(RSPaintFilterCanvas
RS_LOGE("DrawBufferForRotationFixed failed to get invert matrix");
}
canvas.ConcatMatrix(inverse);
auto params = RSUniRenderUtil::CreateBufferDrawParamForRotationFixed(*this, surfaceParams);
auto params = RSUniRenderUtil::CreateBufferDrawParam(*this, surfaceParams);
RSUniRenderThread::Instance().GetRenderEngine()->DrawSurfaceNodeWithParams(canvas, *this, params);
canvas.Restore();
}

View File

@ -222,6 +222,8 @@ public:
std::shared_ptr<RSDirtyRegionManager> GetSyncDirtyManager() const override;
GraphicColorGamut GetAncestorDisplayColorGamut(const RSSurfaceRenderParams& surfaceParams);
void DealWithSelfDrawingNodeBuffer(RSPaintFilterCanvas& canvas, RSSurfaceRenderParams& surfaceParams);
void ClipHoleForSelfDrawingNode(RSPaintFilterCanvas& canvas, RSSurfaceRenderParams& surfaceParams);
void DrawBufferForRotationFixed(RSPaintFilterCanvas& canvas, RSSurfaceRenderParams& surfaceParams);
void ClearCacheSurfaceOnly();
bool PrepareOffscreenRender();
@ -257,6 +259,7 @@ private:
using Registrar = RenderNodeDrawableRegistrar<RSRenderNodeType::SURFACE_NODE, OnGenerate>;
static Registrar instance_;
std::string name_;
bool DrawUIFirstCache(RSPaintFilterCanvas& rscanvas, bool canSkipWait);
bool DrawUIFirstCacheWithStarting(RSPaintFilterCanvas& rscanvas, NodeId id);
// To be deleted after captureWindow being deleted
@ -276,11 +279,8 @@ private:
void DrawSelfDrawingNodeBuffer(RSPaintFilterCanvas& canvas,
const RSSurfaceRenderParams& surfaceParams, BufferDrawParam& params);
void ClipHoleForSelfDrawingNode(RSPaintFilterCanvas& canvas, RSSurfaceRenderParams& surfaceParams);
void DrawBufferForRotationFixed(RSPaintFilterCanvas& canvas, RSSurfaceRenderParams& surfaceParams);
std::string name_;
RSSurfaceNodeType surfaceNodeType_ = RSSurfaceNodeType::DEFAULT;
#ifndef ROSEN_CROSS_PLATFORM
sptr<IBufferConsumerListener> consumerListener_ = nullptr;
#endif

View File

@ -45,6 +45,7 @@
namespace OHOS {
namespace Rosen {
namespace {
constexpr int32_t FIX_ROTATION_DEGREE_FOR_FOLD_SCREEN = -90;
const std::string DUMP_CACHESURFACE_DIR = "/data/cachesurface";
inline int64_t GenerateCurrentTimeStamp()
@ -1219,7 +1220,9 @@ void RSBaseRenderUtil::DealWithSurfaceRotationAndGravity(GraphicTransformType tr
// the surface can rotate itself.
auto rotationTransform = GetRotateTransform(transform);
int extraRotation = 0;
int32_t rotationDegree = static_cast<int32_t>(RSSystemProperties::GetDefaultDeviceRotationOffset());
static int32_t rotationDegree = (system::GetParameter("const.build.product", "") == "ALT") ||
(system::GetParameter("const.build.product", "") == "ICL") ?
FIX_ROTATION_DEGREE_FOR_FOLD_SCREEN : 0;
if (nodeParams != nullptr && nodeParams->GetFixRotationByUser()) {
int degree = RSUniRenderUtil::GetRotationDegreeFromMatrix(nodeParams->GetLayerInfo().matrix);
extraRotation = degree - rotationDegree;

View File

@ -1877,11 +1877,6 @@ void RSRenderServiceConnection::SetCacheEnabledForRotation(bool isEnabled)
mainThread_->PostTask(task);
}
void RSRenderServiceConnection::SetDefaultDeviceRotationOffset(uint32_t offset)
{
RSSystemProperties::SetDefaultDeviceRotationOffset(offset);
}
std::vector<ActiveDirtyRegionInfo> RSRenderServiceConnection::GetActiveDirtyRegionInfo()
{
const auto& activeDirtyRegionInfos = GpuDirtyRegionCollection::GetInstance().GetActiveDirtyRegionInfo();

View File

@ -263,8 +263,6 @@ private:
void SetCacheEnabledForRotation(bool isEnabled) override;
void SetDefaultDeviceRotationOffset(uint32_t offset) override;
bool SetVirtualScreenStatus(ScreenId id, VirtualScreenStatus screenStatus) override;
std::vector<ActiveDirtyRegionInfo> GetActiveDirtyRegionInfo() override;

View File

@ -53,6 +53,7 @@
namespace OHOS {
namespace Rosen {
namespace {
constexpr int32_t FIX_ROTATION_DEGREE_FOR_FOLD_SCREEN = -90;
constexpr const char* CAPTURE_WINDOW_NAME = "CapsuleWindow";
constexpr float GAMMA2_2 = 2.2f;
}
@ -551,7 +552,7 @@ BufferDrawParam RSUniRenderUtil::CreateBufferDrawParam(
return params;
}
BufferDrawParam RSUniRenderUtil::CreateBufferDrawParamForRotationFixed(
BufferDrawParam RSUniRenderUtil::CreateBufferDrawParam(
const DrawableV2::RSSurfaceRenderNodeDrawable& surfaceDrawable, RSSurfaceRenderParams& renderParams)
{
BufferDrawParam params;
@ -582,6 +583,11 @@ BufferDrawParam RSUniRenderUtil::CreateBufferDrawParamForRotationFixed(
params.matrix = Drawing::Matrix();
params.matrix.PreTranslate(static_cast<float>(dstRect.x), static_cast<float>(dstRect.y));
auto consumer = surfaceDrawable.GetConsumerOnDraw();
if (consumer == nullptr) {
return params;
}
auto layerTransform = renderParams.GetLayerInfo().transformType;
int realRotation = RSBaseRenderUtil::RotateEnumToInt(RSBaseRenderUtil::GetRotateTransform(layerTransform));
auto flip = RSBaseRenderUtil::GetFlipTransform(layerTransform);
@ -1332,10 +1338,14 @@ GraphicTransformType RSUniRenderUtil::GetRotateTransformForRotationFixed(RSSurfa
auto transformType = RSBaseRenderUtil::GetRotateTransform(RSBaseRenderUtil::GetSurfaceBufferTransformType(
node.GetRSSurfaceHandler()->GetConsumer(), node.GetRSSurfaceHandler()->GetBuffer()));
int extraRotation = 0;
int32_t rotationDegree = static_cast<int32_t>(RSSystemProperties::GetDefaultDeviceRotationOffset());
int degree = RSUniRenderUtil::GetRotationDegreeFromMatrix(
node.GetRenderProperties().GetBoundsGeometry()->GetAbsMatrix());
extraRotation = degree - rotationDegree;
static int32_t rotationDegree = (system::GetParameter("const.build.product", "") == "ALT") ||
(system::GetParameter("const.build.product", "") == "ICL") ?
FIX_ROTATION_DEGREE_FOR_FOLD_SCREEN : 0;
if (node.GetFixRotationByUser()) {
int degree = RSUniRenderUtil::GetRotationDegreeFromMatrix(
node.GetRenderProperties().GetBoundsGeometry()->GetAbsMatrix());
extraRotation = degree - rotationDegree;
}
transformType = static_cast<GraphicTransformType>(
(transformType + extraRotation / RS_ROTATION_90 + SCREEN_ROTATION_NUM) % SCREEN_ROTATION_NUM);
return transformType;
@ -1388,12 +1398,7 @@ void RSUniRenderUtil::UpdateRealSrcRect(RSSurfaceRenderNode& node, const RectI&
if (!consumer || !buffer) {
return;
}
auto transformType = GraphicTransformType::GRAPHIC_ROTATE_NONE;
if (node.GetFixRotationByUser()) {
transformType = RSUniRenderUtil::GetRotateTransformForRotationFixed(node, consumer);
} else {
transformType = RSBaseRenderUtil::GetRotateTransform(consumer->GetTransform());
}
auto transformType = RSUniRenderUtil::GetRotateTransformForRotationFixed(node, consumer);
auto srcRect = SrcRectRotateTransform(node, transformType);
const auto& property = node.GetRenderProperties();
const auto bufferWidth = buffer->GetSurfaceBufferWidth();
@ -1549,7 +1554,9 @@ GraphicTransformType RSUniRenderUtil::GetLayerTransform(RSSurfaceRenderNode& nod
return GraphicTransformType::GRAPHIC_ROTATE_NONE;
}
auto consumer = surfaceHandler->GetConsumer();
int32_t rotationDegree = static_cast<int32_t>(RSSystemProperties::GetDefaultDeviceRotationOffset());
static int32_t rotationDegree = (system::GetParameter("const.build.product", "") == "ALT") ||
(system::GetParameter("const.build.product", "") == "ICL") ?
FIX_ROTATION_DEGREE_FOR_FOLD_SCREEN : 0;
int surfaceNodeRotation = node.GetFixRotationByUser() ? -1 * rotationDegree :
RSUniRenderUtil::GetRotationFromMatrix(node.GetTotalMatrix());
auto transformType = GraphicTransformType::GRAPHIC_ROTATE_NONE;

View File

@ -81,7 +81,7 @@ public:
static BufferDrawParam CreateBufferDrawParam(const RSSurfaceHandler& surfaceHandler, bool forceCPU);
static BufferDrawParam CreateBufferDrawParam(
const DrawableV2::RSSurfaceRenderNodeDrawable& surfaceDrawable, bool forceCPU, uint32_t threadIndex);
static BufferDrawParam CreateBufferDrawParamForRotationFixed(
static BufferDrawParam CreateBufferDrawParam(
const DrawableV2::RSSurfaceRenderNodeDrawable& surfaceDrawable, RSSurfaceRenderParams& renderParams);
static BufferDrawParam CreateLayerBufferDrawParam(const LayerInfoPtr& layer, bool forceCPU);
static void DealWithRotationAndGravityForRotationFixed(GraphicTransformType transform, Gravity gravity,

View File

@ -219,10 +219,6 @@ bool RSIRenderServiceConnectionInterfaceCodeAccessVerifier::IsExclusiveVerificat
hasPermission = IsSystemApp();
break;
}
case static_cast<CodeUnderlyingType>(CodeEnumType::SET_DEFAULT_DEVICE_ROTATION_OFFSET): {
hasPermission = IsSystemCalling(codeEnumTypeName_ + "::SET_DEFAULT_DEVICE_ROTATION_OFFSET");
break;
}
case static_cast<CodeUnderlyingType>(CodeEnumType::SET_SCREEN_REFRESH_RATE): {
hasPermission = IsSystemCalling(codeEnumTypeName_ + "::SET_SCREEN_REFRESH_RATE");
break;

View File

@ -123,7 +123,6 @@ static constexpr std::array descriptorCheckList = {
static_cast<uint32_t>(RSIRenderServiceConnectionInterfaceCode::UNREGISTER_SURFACE_OCCLUSION_CHANGE_CALLBACK),
static_cast<uint32_t>(RSIRenderServiceConnectionInterfaceCode::REGISTER_HGM_CFG_CALLBACK),
static_cast<uint32_t>(RSIRenderServiceConnectionInterfaceCode::SET_ROTATION_CACHE_ENABLED),
static_cast<uint32_t>(RSIRenderServiceConnectionInterfaceCode::SET_DEFAULT_DEVICE_ROTATION_OFFSET),
static_cast<uint32_t>(RSIRenderServiceConnectionInterfaceCode::SET_TP_FEATURE_CONFIG),
static_cast<uint32_t>(RSIRenderServiceConnectionInterfaceCode::SET_VIRTUAL_SCREEN_USING_STATUS),
static_cast<uint32_t>(RSIRenderServiceConnectionInterfaceCode::REFRESH_RATE_MODE_CHANGE_CALLBACK),
@ -1586,11 +1585,6 @@ int RSRenderServiceConnectionStub::OnRemoteRequest(
SetCacheEnabledForRotation(isEnabled);
break;
}
case static_cast<uint32_t>(RSIRenderServiceConnectionInterfaceCode::SET_DEFAULT_DEVICE_ROTATION_OFFSET) : {
uint32_t offset = data.ReadUint32();
SetDefaultDeviceRotationOffset(offset);
break;
}
case static_cast<uint32_t>(RSIRenderServiceConnectionInterfaceCode::GET_ACTIVE_DIRTY_REGION_INFO) : {
const auto& activeDirtyRegionInfos = GetActiveDirtyRegionInfo();
if (!reply.WriteInt32(activeDirtyRegionInfos.size())) {

View File

@ -169,8 +169,6 @@ public:
static bool GetDrawTextAsBitmap();
static void SetCacheEnabledForRotation(bool flag);
static bool GetCacheEnabledForRotation();
static void SetDefaultDeviceRotationOffset(uint32_t offset);
static uint32_t GetDefaultDeviceRotationOffset();
static ParallelRenderingType GetPrepareParallelRenderingEnabled();
static ParallelRenderingType GetParallelRenderingEnabled();
static HgmRefreshRates GetHgmRefreshRatesEnabled();
@ -283,7 +281,6 @@ private:
static inline bool isUniRenderEnabled_ = false;
inline static bool isDrawTextAsBitmap_ = false;
inline static bool cacheEnabledForRotation_ = false;
inline static std::atomic<uint32_t> defaultDeviceRotationOffset_ = 0;
static inline bool forceHpsBlurDisabled_ = false;
static const GpuApiType systemGpuApiType_;
static const DdgrOpincType ddgrOpincType_;

View File

@ -263,8 +263,6 @@ public:
virtual void SetCacheEnabledForRotation(bool isEnabled) = 0;
virtual void SetDefaultDeviceRotationOffset(uint32_t offset) = 0;
virtual void SetOnRemoteDiedCallback(const OnRemoteDiedCallback& callback) = 0;
virtual void RunOnRemoteDiedCallback() = 0;

View File

@ -108,7 +108,6 @@ enum class RSIRenderServiceConnectionInterfaceCode : CodeUnderlyingType {
UNREGISTER_SURFACE_OCCLUSION_CHANGE_CALLBACK,
REGISTER_HGM_CFG_CALLBACK,
SET_ROTATION_CACHE_ENABLED,
SET_DEFAULT_DEVICE_ROTATION_OFFSET,
SET_TP_FEATURE_CONFIG,
SET_VIRTUAL_SCREEN_USING_STATUS,
REFRESH_RATE_MODE_CHANGE_CALLBACK,

View File

@ -319,8 +319,6 @@ public:
void SetCacheEnabledForRotation(bool isEnabled);
void SetDefaultDeviceRotationOffset(uint32_t offset);
void SetOnRemoteDiedCallback(const OnRemoteDiedCallback& callback);
std::vector<ActiveDirtyRegionInfo> GetActiveDirtyRegionInfo();

View File

@ -523,10 +523,6 @@ void RSRenderServiceClient::SetCacheEnabledForRotation(bool isEnabled)
{
}
void RSRenderServiceClient::SetDefaultDeviceRotationOffset(uint32_t offset)
{
}
void RSRenderServiceClient::SetOnRemoteDiedCallback(const OnRemoteDiedCallback& callback)
{
}

View File

@ -175,15 +175,6 @@ bool RSSystemProperties::GetCacheEnabledForRotation()
return {};
}
void RSSystemProperties::SetDefaultDeviceRotationOffset(uint32_t offset)
{
}
uint32_t RSSystemProperties::SetDefaultDeviceRotationOffset()
{
return {};
}
#ifndef NEW_SKIA
bool RSSystemProperties::GetReleaseResourceEnabled()
{

View File

@ -1322,14 +1322,6 @@ void RSRenderServiceClient::SetCacheEnabledForRotation(bool isEnabled)
}
}
void RSRenderServiceClient::SetDefaultDeviceRotationOffset(uint32_t offset)
{
auto renderService = RSRenderServiceConnectHub::GetRenderService();
if (renderService != nullptr) {
renderService->SetDefaultDeviceRotationOffset(offset);
}
}
void RSRenderServiceClient::SetOnRemoteDiedCallback(const OnRemoteDiedCallback& callback)
{
auto renderService = RSRenderServiceConnectHub::GetRenderService();

View File

@ -2464,26 +2464,6 @@ void RSRenderServiceConnectionProxy::SetCacheEnabledForRotation(bool isEnabled)
}
}
void RSRenderServiceConnectionProxy::SetDefaultDeviceRotationOffset(uint32_t offset)
{
MessageParcel data;
MessageParcel reply;
MessageOption option;
if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) {
return;
}
if (!data.WriteUint32(offset)) {
return;
}
option.SetFlags(MessageOption::TF_ASYNC);
uint32_t code = static_cast<uint32_t>(RSIRenderServiceConnectionInterfaceCode::SET_DEFAULT_DEVICE_ROTATION_OFFSET);
int32_t err = Remote()->SendRequest(code, data, reply, option);
if (err != NO_ERROR) {
ROSEN_LOGE("RSRenderServiceConnectionProxy::SetDefaultDeviceRotationOffset: Send Request err.");
return;
}
}
void RSRenderServiceConnectionProxy::SetOnRemoteDiedCallback(const OnRemoteDiedCallback& callback)
{
OnRemoteDiedCallback_ = callback;

View File

@ -236,8 +236,6 @@ public:
void SetCacheEnabledForRotation(bool isEnabled) override;
void SetDefaultDeviceRotationOffset(uint32_t offset) override;
void SetOnRemoteDiedCallback(const OnRemoteDiedCallback& callback) override;
void RunOnRemoteDiedCallback() override;

View File

@ -440,16 +440,6 @@ bool RSSystemProperties::GetCacheEnabledForRotation()
return cacheEnabledForRotation_;
}
void RSSystemProperties::SetDefaultDeviceRotationOffset(uint32_t offset)
{
defaultDeviceRotationOffset_ = offset;
}
uint32_t RSSystemProperties::GetDefaultDeviceRotationOffset()
{
return defaultDeviceRotationOffset_;
}
ParallelRenderingType RSSystemProperties::GetPrepareParallelRenderingEnabled()
{
static ParallelRenderingType systemPropertiePrepareType = static_cast<ParallelRenderingType>(

View File

@ -523,10 +523,6 @@ void RSRenderServiceClient::SetCacheEnabledForRotation(bool isEnabled)
{
}
void RSRenderServiceClient::SetDefaultDeviceRotationOffset(uint32_t offset)
{
}
void RSRenderServiceClient::SetOnRemoteDiedCallback(const OnRemoteDiedCallback& callback)
{
}

View File

@ -177,10 +177,6 @@ void RSSystemProperties::SetCacheEnabledForRotation(bool flag)
{
}
void RSSystemProperties::SetDefaultDeviceRotationOffset(uint32_t offset)
{
}
bool RSSystemProperties::GetCacheEnabledForRotation()
{
return {};

View File

@ -584,11 +584,6 @@ void RSInterfaces::EnableCacheForRotation()
renderServiceClient_->SetCacheEnabledForRotation(true);
}
void RSInterfaces::SetDefaultDeviceRotationOffset(uint32_t offset)
{
renderServiceClient_->SetDefaultDeviceRotationOffset(offset);
}
void RSInterfaces::NotifyLightFactorStatus(bool isSafe)
{
renderServiceClient_->NotifyLightFactorStatus(isSafe);

View File

@ -248,8 +248,6 @@ public:
void ReportGameStateData(GameStateData info);
void SetDefaultDeviceRotationOffset(uint32_t offset);
void EnableCacheForRotation();
void DisableCacheForRotation();

View File

@ -456,18 +456,6 @@ HWTEST_F(RSSystemPropertiesTest, GetCacheEnabledForRotation, TestSize.Level1)
ASSERT_TRUE(RSSystemProperties::GetCacheEnabledForRotation());
}
/**
* @tc.name: GetDefaultDeviceRotationOffset
* @tc.desc: GetDefaultDeviceRotationOffset Test
* @tc.type:FUNC
* @tc.require: issueI9JZWC
*/
HWTEST_F(RSSystemPropertiesTest, GetDefaultDeviceRotationOffset, TestSize.Level1)
{
RSSystemProperties::SetDefaultDeviceRotationOffset(90);
ASSERT_TRUE(RSSystemProperties::GetDefaultDeviceRotationOffset() == 90);
}
/**
* @tc.name: GetPrepareParallelRenderingEnabled
* @tc.desc: GetPrepareParallelRenderingEnabled Test