mirror of
https://gitee.com/openharmony/graphic_graphic_2d
synced 2024-11-24 07:30:38 +00:00
surpport interface for switching tp in rs.
Signed-off-by: SuellaSun <sunyang34@huawei.com> Change-Id: I1109da16f3ec7f86ca00b8139e933aa32dd01d5d
This commit is contained in:
parent
70a8079400
commit
a585054be9
@ -121,7 +121,7 @@ tp_defines = []
|
||||
tp_feature_enable = false
|
||||
if (feature_tp_switch_enbale) {
|
||||
tp_feature_enable = true
|
||||
tp_defines = ["TP_FEATURE_ENABLE"]
|
||||
tp_defines = [ "TP_FEATURE_ENABLE" ]
|
||||
}
|
||||
|
||||
graphic_2d_ext_configs = {
|
||||
|
@ -101,7 +101,7 @@ ohos_shared_library("librender_service") {
|
||||
}
|
||||
|
||||
if (tp_feature_enable) {
|
||||
sources += ["core/touch_screen/touch_screen.cpp"]
|
||||
sources += [ "core/touch_screen/touch_screen.cpp" ]
|
||||
}
|
||||
|
||||
include_dirs = [
|
||||
|
@ -33,6 +33,10 @@
|
||||
#include "rs_main_thread.h"
|
||||
#include "rs_trace.h"
|
||||
|
||||
#ifdef TP_FEATURE_ENABLE
|
||||
#include "touch_screen/touch_screen.h"
|
||||
#endif
|
||||
|
||||
namespace OHOS {
|
||||
namespace Rosen {
|
||||
// we guarantee that when constructing this object,
|
||||
@ -864,13 +868,13 @@ void RSRenderServiceConnection::SetCacheEnabledForRotation(bool isEnabled)
|
||||
#ifdef TP_FEATURE_ENABLE
|
||||
void RSRenderServiceConnection::SetTpFeatureConfig(int32_t feature, const char* config)
|
||||
{
|
||||
auto renderType = RSUniRenderJudgement::GetUniRenderEnabledType();
|
||||
if (renderType == UniRenderEnabledType::UNI_RENDER_ENABLED_FOR_ALL) {
|
||||
RSHardwareThread::Instance().ScheduleTask(
|
||||
[=]() { screenManager_->SetTpFeatureConfig(feature, config); }).wait();
|
||||
} else {
|
||||
mainThread_->ScheduleTask(
|
||||
[=]() { screenManager_->SetTpFeatureConfig(feature, config); }).wait();
|
||||
if (TOUCH_SCREEN->tsSetFeatureConfig_ == nullptr) {
|
||||
RS_LOGW("RSRenderServiceConnection::SetTpFeatureConfig: touch screen function symbol is nullptr.");
|
||||
return;
|
||||
}
|
||||
if (TOUCH_SCREEN->tsSetFeatureConfig_(feature, config) < 0) {
|
||||
RS_LOGW("RSRenderServiceConnection::SetTpFeatureConfig: tsSetFeatureConfig_ failed.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -22,10 +22,6 @@
|
||||
#include "platform/common/rs_log.h"
|
||||
#include "vsync_sampler.h"
|
||||
|
||||
#ifdef TP_FEATURE_ENABLE
|
||||
#include "touch_screen/touch_screen.h"
|
||||
#endif
|
||||
|
||||
namespace OHOS {
|
||||
namespace Rosen {
|
||||
using namespace HiviewDFX;
|
||||
@ -1112,20 +1108,6 @@ int32_t RSScreenManager::SetScreenSkipFrameInterval(ScreenId id, uint32_t skipFr
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
return SetScreenSkipFrameIntervalLocked(id, skipFrameInterval);
|
||||
}
|
||||
|
||||
#ifdef TP_FEATURE_ENABLE
|
||||
void RSScreenManager::SetTpFeatureConfig(int32_t feature, const char* config)
|
||||
{
|
||||
if (TOUCH_SCREEN->tsSetFeatureConfig_ == nullptr) {
|
||||
RS_LOGW("RSScreenManager %{public}s: touch screen function symbol is nullptr." PRIu64 ".", __func__);
|
||||
return;
|
||||
}
|
||||
if (TOUCH_SCREEN->tsSetFeatureConfig_(feature, config) < 0) {
|
||||
RS_LOGW("RSScreenManager %{public}s: tsSetFeatureConfig_ failed.", __func__);
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
} // namespace impl
|
||||
|
||||
sptr<RSScreenManager> CreateOrGetScreenManager()
|
||||
|
@ -157,10 +157,6 @@ public:
|
||||
|
||||
virtual int32_t SetScreenSkipFrameInterval(ScreenId id, uint32_t skipFrameInterval) = 0;
|
||||
|
||||
#ifdef TP_FEATURE_ENABLE
|
||||
virtual void SetTpFeatureConfig(int32_t feature, const char* config) = 0;
|
||||
#endif
|
||||
|
||||
/* only used for mock tests */
|
||||
virtual void MockHdiScreenConnected(std::unique_ptr<impl::RSScreen>& rsScreen) = 0;
|
||||
};
|
||||
|
@ -23,12 +23,9 @@ namespace {
|
||||
const std::string TOUCHSCREEN_WRAPPER_PATH = "../../vendor/lib64/libhw_touchscreen.default.so";
|
||||
} // namespace
|
||||
|
||||
TouchScreen::TouchScreen() {
|
||||
RS_LOGE("SetTpFeatureConfig start init touch screen");
|
||||
}
|
||||
TouchScreen::TouchScreen() {}
|
||||
TouchScreen::~TouchScreen()
|
||||
{
|
||||
RS_LOGE("SetTpFeatureConfig start release touch screen");
|
||||
dlclose(touchScreenHandle_);
|
||||
touchScreenHandle_ = nullptr;
|
||||
}
|
||||
@ -37,16 +34,16 @@ void TouchScreen::InitTouchScreen()
|
||||
{
|
||||
touchScreenHandle_ = dlopen(TOUCHSCREEN_WRAPPER_PATH.c_str(), RTLD_NOW);
|
||||
if (touchScreenHandle_ == nullptr) {
|
||||
RS_LOGE("SetTpFeatureConfig libhw_touchscreen.default.so was not loaded, error: %{public}s", dlerror());
|
||||
RS_LOGE("libhw_touchscreen.default.so was not loaded, error: %{public}s", dlerror());
|
||||
return;
|
||||
}
|
||||
|
||||
tsSetFeatureConfig_ = (TS_SET_FEATURE_CONFIG_)dlsym(touchScreenHandle_, "ts_set_feature_config");
|
||||
if (tsSetFeatureConfig_ == nullptr) {
|
||||
RS_LOGE("SetTpFeatureConfig touch screen get symbol failed, error: %{public}s", dlerror());
|
||||
RS_LOGE("touch screen get symbol failed, error: %{public}s", dlerror());
|
||||
return;
|
||||
}
|
||||
RS_LOGE("SetTpFeatureConfig touch scree wrapper init success");
|
||||
RS_LOGI("touch scree wrapper init success");
|
||||
}
|
||||
} // namespace MMI
|
||||
} // namespace OHOS
|
@ -970,6 +970,19 @@ int RSRenderServiceConnectionStub::OnRemoteRequest(
|
||||
SetCacheEnabledForRotation(isEnabled);
|
||||
break;
|
||||
}
|
||||
#ifdef TP_FEATURE_ENABLE
|
||||
case static_cast<uint32_t>(RSIRenderServiceConnectionInterfaceCode::SET_TP_FEATURE_CONFIG) : {
|
||||
auto token = data.ReadInterfaceToken();
|
||||
if (token != RSIRenderServiceConnection::GetDescriptor()) {
|
||||
ret = ERR_INVALID_STATE;
|
||||
break;
|
||||
}
|
||||
int32_t feature = data.ReadInt32();
|
||||
auto config = data.ReadCString();
|
||||
SetTpFeatureConfig(feature, config);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
default: {
|
||||
return IPCObjectStub::OnRemoteRequest(code, data, reply, option);
|
||||
}
|
||||
|
@ -1471,12 +1471,20 @@ void RSRenderServiceConnectionProxy::SetTpFeatureConfig(int32_t feature, const c
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
|
||||
if (!data.WriteInterfaceToken(RSIRenderServiceConnection::GetDescriptor())) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!data.WriteInt32(feature)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!data.WriteCString(config)) {
|
||||
return;
|
||||
}
|
||||
|
||||
option.SetFlags(MessageOption::TF_SYNC);
|
||||
data.WriteInt32(feature);
|
||||
data.WriteCString(config);
|
||||
uint32_t code = static_cast<uint32_t>(RSIRenderServiceConnectionInterfaceCode::SET_TP_FEATURE_CONFIG);
|
||||
int32_t err = Remote()->SendRequest(code, data, reply, option);
|
||||
if (err != NO_ERROR) {
|
||||
|
@ -193,6 +193,10 @@ template("render_service_client_source_set") {
|
||||
deps += [ "$rosen_root/modules/platform:eventhandler" ]
|
||||
}
|
||||
|
||||
if (tp_feature_enable) {
|
||||
defines += tp_defines
|
||||
}
|
||||
|
||||
if (defined(use_new_render_context) && use_new_render_context) {
|
||||
public_deps += [ "$graphic_2d_root/rosen/modules/render_service_base/src/render_backend:librender_backend" ]
|
||||
}
|
||||
|
@ -1076,64 +1076,5 @@ HWTEST_F(RSInterfacesTest, RegisterHgmConfigChangeCallback_Test, Function | Smal
|
||||
int32_t ret = rsInterfaces->RegisterHgmConfigChangeCallback(cb);
|
||||
ASSERT_EQ(ret, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Function: SetTpFeatureConfig001
|
||||
* Type: Function
|
||||
* Rank: Important(2)
|
||||
* EnvConditions: N/A
|
||||
* CaseDescription: 1. call SetTpFeatureConfig with INVALID_SCREEN_ID
|
||||
* 2. check
|
||||
*/
|
||||
HWTEST_F(RSInterfacesTest, SetTpFeatureConfig001, Function | SmallTest | Level2)
|
||||
{
|
||||
auto screenId = rsInterfaces->GetDefaultScreenId();
|
||||
EXPECT_NE(screenId, INVALID_SCREEN_ID);
|
||||
|
||||
int32_t feature = 12;
|
||||
std::string config = "0"
|
||||
rsInterfaces->SetTpFeatureConfig(INVALID_SCREEN_ID, feature, config);
|
||||
}
|
||||
|
||||
/*
|
||||
* Function: SetTpFeatureConfig001
|
||||
* Type: Function
|
||||
* Rank: Important(2)
|
||||
* EnvConditions: N/A
|
||||
* CaseDescription: 1. call SetTpFeatureConfig with INVALID_SCREEN_ID
|
||||
* 2. check
|
||||
*/
|
||||
HWTEST_F(RSInterfacesTest, SetTpFeatureConfig001, Function | SmallTest | Level2)
|
||||
{
|
||||
int32_t feature = 12;
|
||||
std::string config = "0"
|
||||
rsInterfaces->SetTpFeatureConfig(feature, config);
|
||||
}
|
||||
|
||||
/*
|
||||
* Function: SetTpFeatureConfig002
|
||||
* Type: Function
|
||||
* Rank: Important(2)
|
||||
* EnvConditions: N/A
|
||||
* CaseDescription: 1. call SetTpFeatureConfig when swith screen.
|
||||
* 2. check
|
||||
*/
|
||||
HWTEST_F(RSInterfacesTest, SetTpFeatureConfig001, Function | SmallTest | Level2)
|
||||
{
|
||||
int32_t feature = 12;
|
||||
ScreenId screenId0 = static_cast<uint64_t>(5);
|
||||
std::string config0 = "0"
|
||||
rsInterfaces->SetTpFeatureConfig(feature, config0);
|
||||
usleep(50000);
|
||||
rsInterfaces->SetScreenPowerStatus(screenId0, ScreenPowerStatus::POWER_STATUS_OFF);
|
||||
usleep(50000); // wait 50000us to ensure SetScreenPowerStatus done.
|
||||
|
||||
ScreenId screenId1 = static_cast<uint64_t>(0);
|
||||
std::string config1 = "2"
|
||||
rsInterfaces->SetTpFeatureConfig(feature, config1);
|
||||
usleep(50000);
|
||||
rsInterfaces->SetScreenPowerStatus(screenId1, ScreenPowerStatus::POWER_STATUS_OFF);
|
||||
usleep(50000); // wait 50000us to ensure SetScreenPowerStatus done.
|
||||
}
|
||||
} // namespace Rosen
|
||||
} // namespace OHOS
|
||||
|
@ -726,18 +726,4 @@ HWTEST_F(RSScreenManagerTest, SetScreenSkipFrameInterval_001, TestSize.Level1)
|
||||
auto result = screenManager->SetScreenSkipFrameInterval(screenId, interval);
|
||||
ASSERT_EQ(result, StatusCode::SCREEN_NOT_FOUND);
|
||||
}
|
||||
|
||||
/*
|
||||
* @tc.name: SetTpFeatureConfig_001
|
||||
* @tc.desc: Test SetTpFeatureConfig
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: issueI7AABN
|
||||
*/
|
||||
HWTEST_F(RSScreenManagerTest, SetTpFeatureConfig_001, TestSize.Level1)
|
||||
{
|
||||
auto screenManager = CreateOrGetScreenManager();
|
||||
int32_t feature = 12;
|
||||
std::string config = "0"
|
||||
screenManager->SetTpFeatureConfig(feature, config);
|
||||
}
|
||||
} // namespace OHOS::Rosen
|
||||
|
@ -65,8 +65,6 @@ bool RSPhysicalScreenFuzzTest(const uint8_t* data, size_t size)
|
||||
uint32_t level = GetData<uint32_t>();
|
||||
int32_t modeIdx = GetData<uint32_t>();
|
||||
uint32_t skipFrameInterval = GetData<uint32_t>();
|
||||
int32_t feature = GetData<int32_t>();
|
||||
const char* config = GetData<const char*>();
|
||||
|
||||
// test
|
||||
auto& rsInterfaces = RSInterfaces::GetInstance();
|
||||
@ -95,7 +93,6 @@ bool RSPhysicalScreenFuzzTest(const uint8_t* data, size_t size)
|
||||
rsInterfaces.GetScreenHDRCapability(static_cast<ScreenId>(id), screenHdrCapability);
|
||||
RSScreenType screenType = RSScreenType::BUILT_IN_TYPE_SCREEN;
|
||||
rsInterfaces.GetScreenType(static_cast<ScreenId>(id), screenType);
|
||||
rsInterfaces.SetTpFeatureConfig(feature, config);
|
||||
|
||||
sleep(1);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user