mirror of
https://gitee.com/openharmony/graphic_graphic_2d
synced 2024-11-23 07:02:25 +00:00
Merge branch 'master' of gitee.com:openharmony/graphic_graphic_2d into gaojin Signed-off-by: balingbaling <libingbing12@huawei.com> Change-Id: I39a296a466aec6ccf8086b93d134f6be91e02ace
This commit is contained in:
parent
a5865d60e1
commit
998d249bdd
@ -84,7 +84,7 @@ void RSHardwareThread::Start()
|
||||
hdiBackend_ = HdiBackend::GetInstance();
|
||||
runner_ = AppExecFwk::EventRunner::Create("RSHardwareThread");
|
||||
handler_ = std::make_shared<AppExecFwk::EventHandler>(runner_);
|
||||
redrawCb_ = std::bind(&RSHardwareThread::Redraw, this,std::placeholders::_1, std::placeholders::_2,
|
||||
redrawCb_ = std::bind(&RSHardwareThread::Redraw, this, std::placeholders::_1, std::placeholders::_2,
|
||||
std::placeholders::_3);
|
||||
if (handler_) {
|
||||
ScheduleTask(
|
||||
|
@ -13,8 +13,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef RS_CORE_PIPELINE_PROCESSOR_H
|
||||
#define RS_CORE_PIPELINE_PROCESSOR_H
|
||||
#ifndef RS_CORE_PIPELINE_PROCESSOR_H
|
||||
#define RS_CORE_PIPELINE_PROCESSOR_H
|
||||
|
||||
#include <memory>
|
||||
|
||||
|
@ -25,7 +25,7 @@ namespace Rosen {
|
||||
|
||||
std::shared_ptr<RSProcessor> RSProcessorFactory::CreateProcessor(RSDisplayRenderNode::CompositeType type)
|
||||
{
|
||||
switch(type) {
|
||||
switch (type) {
|
||||
case RSDisplayRenderNode::CompositeType::SOFTWARE_COMPOSITE:
|
||||
return std::make_shared<RSVirtualScreenProcessor>();
|
||||
case RSDisplayRenderNode::CompositeType::HARDWARE_COMPOSITE:
|
||||
|
@ -13,8 +13,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef RS_PROCESSOR_FACTORY_H
|
||||
#define RS_PROCESSOR_FACTORY_H
|
||||
#ifndef RS_PROCESSOR_FACTORY_H
|
||||
#define RS_PROCESSOR_FACTORY_H
|
||||
|
||||
#include "pipeline/rs_processor.h"
|
||||
|
||||
|
@ -34,12 +34,14 @@ void RSRealtimeRefreshRateManager::SetShowRefreshRateEnabled(bool enable)
|
||||
if (enableState_ == enable) {
|
||||
return;
|
||||
}
|
||||
RS_LOGI("RSRealtimeRefreshRateManager state change: %{public}d -> %{public}d", static_cast<bool>(enableState_), enable);
|
||||
RS_LOGI("RSRealtimeRefreshRateManager state change: %{public}d -> %{public}d",
|
||||
static_cast<bool>(enableState_), enable);
|
||||
enableState_ = enable;
|
||||
|
||||
static constexpr uint8_t IDLE_FPS_THRESHOLD = 8;
|
||||
static auto NS_PER_S = std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::seconds(1)).count();
|
||||
static auto NS_FPS_SHOW_INTERVAL = std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::milliseconds(250));
|
||||
static auto NS_FPS_SHOW_INTERVAL =
|
||||
std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::milliseconds(250));
|
||||
|
||||
static std::mutex threadMutex;
|
||||
static std::condition_variable threadCondVar;
|
||||
|
@ -44,6 +44,7 @@
|
||||
|
||||
namespace OHOS {
|
||||
namespace Rosen {
|
||||
constexpr int SLEEP_TIME_US = 1000;
|
||||
// we guarantee that when constructing this object,
|
||||
// all these pointers are valid, so will not check them.
|
||||
RSRenderServiceConnection::RSRenderServiceConnection(
|
||||
@ -230,7 +231,8 @@ void RSRenderServiceConnection::RSApplicationRenderThreadDeathRecipient::OnRemot
|
||||
|
||||
auto rsConn = conn_.promote();
|
||||
if (rsConn == nullptr) {
|
||||
RS_LOGW("RSApplicationRenderThreadDeathRecipient::OnRemoteDied: RSRenderServiceConnection was dead, do nothing.");
|
||||
RS_LOGW("RSApplicationRenderThreadDeathRecipient::OnRemoteDied: "
|
||||
"RSRenderServiceConnection was dead, do nothing.");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -285,7 +287,7 @@ sptr<Surface> RSRenderServiceConnection::CreateNodeAndSurface(const RSSurfaceRen
|
||||
{
|
||||
if (auto preNode = mainThread_->GetContext().GetNodeMap().GetRenderNode(config.id)) {
|
||||
RS_LOGE("CreateNodeAndSurface same id node:%{public}" PRIu64 ", type:%d", config.id, preNode->GetType());
|
||||
usleep(1000);
|
||||
usleep(SLEEP_TIME_US);
|
||||
}
|
||||
std::shared_ptr<RSSurfaceRenderNode> node =
|
||||
std::make_shared<RSSurfaceRenderNode>(config, mainThread_->GetContext().weak_from_this());
|
||||
|
@ -31,7 +31,7 @@ public:
|
||||
void OnTunnelHandleChange() override;
|
||||
void OnCleanCache() override;
|
||||
void OnGoBackground() override;
|
||||
private :
|
||||
private:
|
||||
std::weak_ptr<RSSurfaceRenderNode> surfaceRenderNode_;
|
||||
};
|
||||
} // namespace Rosen
|
||||
|
@ -92,11 +92,9 @@ void RSRenderServiceVisitor::PrepareDisplayRenderNode(RSDisplayRenderNode& node)
|
||||
ScreenRotation rotation = node.GetRotation();
|
||||
int32_t logicalScreenWidth = static_cast<int32_t>(node.GetRenderProperties().GetFrameWidth());
|
||||
int32_t logicalScreenHeight = static_cast<int32_t>(node.GetRenderProperties().GetFrameHeight());
|
||||
|
||||
if (logicalScreenWidth <= 0 || logicalScreenHeight <= 0) {
|
||||
logicalScreenWidth = static_cast<int32_t>(curScreenInfo.width);
|
||||
logicalScreenHeight = static_cast<int32_t>(curScreenInfo.height);
|
||||
|
||||
if (rotation == ScreenRotation::ROTATION_90 || rotation == ScreenRotation::ROTATION_270) {
|
||||
std::swap(logicalScreenWidth, logicalScreenHeight);
|
||||
}
|
||||
|
@ -34,6 +34,7 @@ namespace OHOS {
|
||||
namespace Rosen {
|
||||
using namespace std;
|
||||
constexpr uint32_t FLAT_ANGLE = 180;
|
||||
static const int GLOBAL_ALPHA_MAX = 255;
|
||||
bool RSUniRenderComposerAdapter::Init(const ScreenInfo& screenInfo, int32_t offsetX, int32_t offsetY,
|
||||
float mirrorAdaptiveCoefficient)
|
||||
{
|
||||
@ -112,7 +113,7 @@ ComposeInfo RSUniRenderComposerAdapter::BuildComposeInfo(RSDisplayRenderNode& no
|
||||
info.visibleRect = GraphicIRect {info.dstRect.x, info.dstRect.y, info.dstRect.w, info.dstRect.h};
|
||||
info.zOrder = static_cast<int32_t>(node.GetGlobalZOrder());
|
||||
info.alpha.enGlobalAlpha = true;
|
||||
info.alpha.gAlpha = 255;
|
||||
info.alpha.gAlpha = GLOBAL_ALPHA_MAX;
|
||||
SetPreBufferInfo(node, info);
|
||||
info.buffer = buffer;
|
||||
info.fence = node.GetAcquireFence();
|
||||
@ -136,7 +137,7 @@ ComposeInfo RSUniRenderComposerAdapter::BuildComposeInfo(RSDrivenSurfaceRenderNo
|
||||
info.visibleRect = info.dstRect;
|
||||
info.zOrder = static_cast<int32_t>(node.GetGlobalZOrder());
|
||||
info.alpha.enGlobalAlpha = true;
|
||||
info.alpha.gAlpha = 255;
|
||||
info.alpha.gAlpha = GLOBAL_ALPHA_MAX;
|
||||
SetPreBufferInfo(node, info);
|
||||
info.buffer = buffer;
|
||||
info.fence = node.GetAcquireFence();
|
||||
|
@ -69,6 +69,8 @@ std::map<ScreenHDRFormat, GraphicHDRFormat> RSScreen::RS_TO_HDI_HDR_FORMAT_MAP {
|
||||
{IMAGE_HDR_ISO_SINGLE, GRAPHIC_NOT_SUPPORT_HDR},
|
||||
};
|
||||
|
||||
constexpr int MAX_LUM = 1000;
|
||||
|
||||
RSScreen::RSScreen(ScreenId id,
|
||||
bool isVirtual,
|
||||
std::shared_ptr<HdiOutput> output,
|
||||
@ -751,7 +753,7 @@ int32_t RSScreen::GetScreenGamutMap(ScreenGamutMap &mode) const
|
||||
|
||||
const GraphicHDRCapability& RSScreen::GetHDRCapability()
|
||||
{
|
||||
hdrCapability_.maxLum = 1000; // mock data
|
||||
hdrCapability_.maxLum = MAX_LUM; // mock data
|
||||
return hdrCapability_;
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
namespace OHOS {
|
||||
namespace Rosen {
|
||||
RSScreenModeInfo::RSScreenModeInfo(int32_t width, int32_t height, uint32_t refreshRate, int32_t id)
|
||||
: width_(width),height_(height), refreshRate_(refreshRate), modeId_(id)
|
||||
: width_(width), height_(height), refreshRate_(refreshRate), modeId_(id)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -15,8 +15,8 @@
|
||||
|
||||
#include "rsrenderserviceconnection_fuzzer.h"
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
|
||||
const int FUZZ_DATA_LEN = 3;
|
||||
const int FUZZ_FST_DATA = 0;
|
||||
|
@ -40,13 +40,13 @@ const std::u16string RENDERSERVICECONNECTION_INTERFACE_TOKEN = u"ohos.rosen.Rend
|
||||
static std::shared_ptr<RSRenderServiceClient> rsClient = std::make_shared<RSRenderServiceClient>();
|
||||
|
||||
namespace {
|
||||
const uint8_t* data_ = nullptr;
|
||||
size_t size_ = 0;
|
||||
size_t pos;
|
||||
const uint8_t* g_data = nullptr;
|
||||
size_t g_size = 0;
|
||||
size_t g_pos;
|
||||
} // namespace
|
||||
|
||||
/*
|
||||
* describe: get data from outside untrusted data(data_) which size is according to sizeof(T)
|
||||
* describe: get data from outside untrusted data(g_data) which size is according to sizeof(T)
|
||||
* tips: only support basic type
|
||||
*/
|
||||
template<class T>
|
||||
@ -54,14 +54,14 @@ T GetData()
|
||||
{
|
||||
T object {};
|
||||
size_t objectSize = sizeof(object);
|
||||
if (data_ == nullptr || objectSize > size_ - pos) {
|
||||
if (g_data == nullptr || objectSize > g_size - g_pos) {
|
||||
return object;
|
||||
}
|
||||
errno_t ret = memcpy_s(&object, objectSize, data_ + pos, objectSize);
|
||||
errno_t ret = memcpy_s(&object, objectSize, g_data + g_pos, objectSize);
|
||||
if (ret != EOK) {
|
||||
return {};
|
||||
}
|
||||
pos += objectSize;
|
||||
g_pos += objectSize;
|
||||
return object;
|
||||
}
|
||||
|
||||
@ -76,9 +76,9 @@ bool DoCommitTransaction(const uint8_t* data, size_t size)
|
||||
}
|
||||
|
||||
// initialize
|
||||
data_ = data;
|
||||
size_ = size;
|
||||
pos = 0;
|
||||
g_data = data;
|
||||
g_size = size;
|
||||
g_pos = 0;
|
||||
|
||||
auto transactionData = std::make_unique<RSTransactionData>();
|
||||
rsClient->CommitTransaction(transactionData);
|
||||
@ -128,9 +128,9 @@ bool DoSetFocusAppInfo(const uint8_t* data, size_t size)
|
||||
}
|
||||
|
||||
// initialize
|
||||
data_ = data;
|
||||
size_ = size;
|
||||
pos = 0;
|
||||
g_data = data;
|
||||
g_size = size;
|
||||
g_pos = 0;
|
||||
|
||||
MessageParcel datas;
|
||||
datas.WriteBuffer(data, size);
|
||||
@ -173,9 +173,9 @@ bool DoSetScreenChangeCallback(const uint8_t* data, size_t size)
|
||||
}
|
||||
|
||||
// initialize
|
||||
data_ = data;
|
||||
size_ = size;
|
||||
pos = 0;
|
||||
g_data = data;
|
||||
g_size = size;
|
||||
g_pos = 0;
|
||||
|
||||
static ScreenId screenId = INVALID_SCREEN_ID;
|
||||
static ScreenEvent screenEvent = ScreenEvent::UNKNOWN;
|
||||
@ -200,9 +200,9 @@ bool DoSetScreenActiveMode(const uint8_t* data, size_t size)
|
||||
}
|
||||
|
||||
// initialize
|
||||
data_ = data;
|
||||
size_ = size;
|
||||
pos = 0;
|
||||
g_data = data;
|
||||
g_size = size;
|
||||
g_pos = 0;
|
||||
|
||||
ScreenId id = GetData<ScreenId>();
|
||||
uint32_t modeId = GetData<uint32_t>();
|
||||
@ -292,9 +292,9 @@ bool DoTakeSurfaceCapture(const uint8_t* data, size_t size)
|
||||
}
|
||||
|
||||
// initialize
|
||||
data_ = data;
|
||||
size_ = size;
|
||||
pos = 0;
|
||||
g_data = data;
|
||||
g_size = size;
|
||||
g_pos = 0;
|
||||
|
||||
auto nodeId = GetData<NodeId>();
|
||||
float scaleX = GetData<float>();
|
||||
@ -316,9 +316,9 @@ bool DoGetScreenSupportedModes(const uint8_t* data, size_t size)
|
||||
}
|
||||
|
||||
// initialize
|
||||
data_ = data;
|
||||
size_ = size;
|
||||
pos = 0;
|
||||
g_data = data;
|
||||
g_size = size;
|
||||
g_pos = 0;
|
||||
|
||||
ScreenId id = GetData<ScreenId>();
|
||||
rsClient->GetScreenSupportedModes(id);
|
||||
@ -336,9 +336,9 @@ bool DoGetMemoryGraphic(const uint8_t* data, size_t size)
|
||||
}
|
||||
|
||||
// initialize
|
||||
data_ = data;
|
||||
size_ = size;
|
||||
pos = 0;
|
||||
g_data = data;
|
||||
g_size = size;
|
||||
g_pos = 0;
|
||||
|
||||
int pid = GetData<int>();
|
||||
rsClient->GetMemoryGraphic(pid);
|
||||
@ -356,9 +356,9 @@ bool DoGetScreenCapability(const uint8_t* data, size_t size)
|
||||
}
|
||||
|
||||
// initialize
|
||||
data_ = data;
|
||||
size_ = size;
|
||||
pos = 0;
|
||||
g_data = data;
|
||||
g_size = size;
|
||||
g_pos = 0;
|
||||
|
||||
ScreenId id = GetData<ScreenId>();
|
||||
rsClient->GetScreenCapability(id);
|
||||
@ -376,9 +376,9 @@ bool DoGetScreenData(const uint8_t* data, size_t size)
|
||||
}
|
||||
|
||||
// initialize
|
||||
data_ = data;
|
||||
size_ = size;
|
||||
pos = 0;
|
||||
g_data = data;
|
||||
g_size = size;
|
||||
g_pos = 0;
|
||||
|
||||
ScreenId id = GetData<ScreenId>();
|
||||
rsClient->GetScreenData(id);
|
||||
@ -396,9 +396,9 @@ bool DoGetScreenBacklight(const uint8_t* data, size_t size)
|
||||
}
|
||||
|
||||
// initialize
|
||||
data_ = data;
|
||||
size_ = size;
|
||||
pos = 0;
|
||||
g_data = data;
|
||||
g_size = size;
|
||||
g_pos = 0;
|
||||
|
||||
ScreenId id = GetData<ScreenId>();
|
||||
uint32_t level = GetData<uint32_t>();
|
||||
@ -418,9 +418,9 @@ bool DoRegisterBufferAvailableListener(const uint8_t* data, size_t size)
|
||||
}
|
||||
|
||||
// initialize
|
||||
data_ = data;
|
||||
size_ = size;
|
||||
pos = 0;
|
||||
g_data = data;
|
||||
g_size = size;
|
||||
g_pos = 0;
|
||||
|
||||
NodeId id = GetData<NodeId>();
|
||||
bool isFromRenderThread = GetData<bool>();
|
||||
@ -458,9 +458,9 @@ bool DoGetScreenColorGamut(const uint8_t* data, size_t size)
|
||||
}
|
||||
|
||||
// initialize
|
||||
data_ = data;
|
||||
size_ = size;
|
||||
pos = 0;
|
||||
g_data = data;
|
||||
g_size = size;
|
||||
g_pos = 0;
|
||||
|
||||
ScreenId id = GetData<ScreenId>();
|
||||
int32_t modeIdx = GetData<int32_t>();
|
||||
@ -481,9 +481,9 @@ bool DoSetScreenGamutMap(const uint8_t* data, size_t size)
|
||||
}
|
||||
|
||||
// initialize
|
||||
data_ = data;
|
||||
size_ = size;
|
||||
pos = 0;
|
||||
g_data = data;
|
||||
g_size = size;
|
||||
g_pos = 0;
|
||||
|
||||
ScreenId id = *(reinterpret_cast<const uint32_t*>(data));
|
||||
ScreenGamutMap mapMode = ScreenGamutMap::GAMUT_MAP_CONSTANT;
|
||||
@ -569,9 +569,9 @@ bool DoSetScreenSkipFrameInterval(const uint8_t* data, size_t size)
|
||||
}
|
||||
|
||||
// initialize
|
||||
data_ = data;
|
||||
size_ = size;
|
||||
pos = 0;
|
||||
g_data = data;
|
||||
g_size = size;
|
||||
g_pos = 0;
|
||||
|
||||
ScreenId id = *(reinterpret_cast<const uint32_t*>(data));
|
||||
uint32_t skipFrameInterval = GetData<uint32_t>();
|
||||
@ -605,9 +605,9 @@ bool DoSetAppWindowNum(const uint8_t* data, size_t size)
|
||||
}
|
||||
|
||||
// initialize
|
||||
data_ = data;
|
||||
size_ = size;
|
||||
pos = 0;
|
||||
g_data = data;
|
||||
g_size = size;
|
||||
g_pos = 0;
|
||||
|
||||
uint32_t num = GetData<uint32_t>();
|
||||
rsClient->SetAppWindowNum(num);
|
||||
@ -625,9 +625,9 @@ bool DoShowWatermark(const uint8_t* data, size_t size)
|
||||
}
|
||||
|
||||
// initialize
|
||||
data_ = data;
|
||||
size_ = size;
|
||||
pos = 0;
|
||||
g_data = data;
|
||||
g_size = size;
|
||||
g_pos = 0;
|
||||
|
||||
bool isShow = GetData<bool>();
|
||||
std::shared_ptr<Media::PixelMap> pixelMap1;
|
||||
@ -663,9 +663,9 @@ bool DoSetHardwareEnabled(const uint8_t* data, size_t size)
|
||||
}
|
||||
|
||||
// initialize
|
||||
data_ = data;
|
||||
size_ = size;
|
||||
pos = 0;
|
||||
g_data = data;
|
||||
g_size = size;
|
||||
g_pos = 0;
|
||||
|
||||
auto isEnabled = GetData<bool>();
|
||||
rsClient->SetHardwareEnabled(0, isEnabled, SelfDrawingNodeType::DEFAULT);
|
||||
|
@ -98,7 +98,7 @@ HWTEST_F(RSDropFrameProcessorTest, TestDropFrame001, TestSize.Level1)
|
||||
ASSERT_EQ(4, static_cast<int>(psurf->GetQueueSize()));
|
||||
|
||||
// request&&flush 3 buffer, make dirtyList size equal queuesize -1
|
||||
for (int i = 0; i < 3; i ++) {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
sptr<SurfaceBuffer> buffer;
|
||||
sptr<SyncFence> requestFence = SyncFence::INVALID_FENCE;
|
||||
GSError ret = psurf->RequestBuffer(buffer, requestFence, requestConfig);
|
||||
|
@ -15,8 +15,8 @@
|
||||
|
||||
#include "rsbaserendernode_fuzzer.h"
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
|
||||
const int FUZZ_DATA_LEN = 3;
|
||||
const int FUZZ_FST_DATA = 0;
|
||||
|
@ -22,13 +22,13 @@
|
||||
namespace OHOS {
|
||||
namespace Rosen {
|
||||
namespace {
|
||||
const uint8_t* data_ = nullptr;
|
||||
size_t size_ = 0;
|
||||
size_t pos;
|
||||
const uint8_t* g_data = nullptr;
|
||||
size_t g_size = 0;
|
||||
size_t g_pos;
|
||||
} // namespace
|
||||
|
||||
/*
|
||||
* describe: get data from outside untrusted data(data_) which size is according to sizeof(T)
|
||||
* describe: get data from outside untrusted data(g_data) which size is according to sizeof(T)
|
||||
* tips: only support basic type
|
||||
*/
|
||||
template<class T>
|
||||
@ -36,14 +36,14 @@ T GetData()
|
||||
{
|
||||
T object {};
|
||||
size_t objectSize = sizeof(object);
|
||||
if (data_ == nullptr || objectSize > size_ - pos) {
|
||||
if (g_data == nullptr || objectSize > g_size - g_pos) {
|
||||
return object;
|
||||
}
|
||||
errno_t ret = memcpy_s(&object, objectSize, data_ + pos, objectSize);
|
||||
errno_t ret = memcpy_s(&object, objectSize, g_data + g_pos, objectSize);
|
||||
if (ret != EOK) {
|
||||
return {};
|
||||
}
|
||||
pos += objectSize;
|
||||
g_pos += objectSize;
|
||||
return object;
|
||||
}
|
||||
|
||||
@ -54,9 +54,9 @@ bool RSPhysicalScreenFuzzTest(const uint8_t* data, size_t size)
|
||||
}
|
||||
|
||||
// initialize
|
||||
data_ = data;
|
||||
size_ = size;
|
||||
pos = 0;
|
||||
g_data = data;
|
||||
g_size = size;
|
||||
g_pos = 0;
|
||||
|
||||
// get data
|
||||
uint64_t id = GetData<uint64_t>();
|
||||
|
@ -284,7 +284,9 @@ Matrix3x3 Invert(const Matrix3x3& src)
|
||||
double b0 = a00 * a11 - a01 * a10;
|
||||
double b1 = a00 * a12 - a02 * a10;
|
||||
double b2 = a01 * a12 - a02 * a11;
|
||||
double b3 = a20, b4 = a21, b5 = a22;
|
||||
double b3 = a20;
|
||||
double b4 = a21;
|
||||
double b5 = a22;
|
||||
|
||||
double determinant = b0 * b5 - b1 * b4 + b2 * b3;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user