CPU点屏指导
版本要求:4.0 release及之前版本。 当前只有4.0之前的版本可以支持CPU点屏,4.1开始之后的版本包括master暂时不支持CPU点屏。 原因:4.1release开始,OHOS的arkui自己实现了flutter相关的API,摆脱了对flutter的依赖,所以框架内删除了flutter的三方库组件。但是CPU点屏依然使用了其中部分API,所以在4.1之后的版本上进行CPU点屏会出现f
版本要求:4.0 release及之前版本。
当前只有4.0之前的版本可以支持CPU点屏,4.1开始之后的版本包括master暂时不支持CPU点屏。
原因:4.1release开始,OHOS的arkui自己实现了flutter相关的API,摆脱了对flutter的依赖,所以框架内删除了flutter的三方库组件。但是CPU点屏依然使用了其中部分API,所以在4.1之后的版本上进行CPU点屏会出现flutter、skia等API相关报错。
注意:4.1 release解决方案,待后续更新。
点屏流程
点屏实操
编译阶段
从编译框架的层面将原本的GPU点屏模式改为CPU点屏模式。
路径1:vendor/hihope/rk3568/config.json
修改目的:
- 关闭selinux,避免点屏操作被安全机制拒绝。
- 去掉对GPU的依赖。
diff --git a/rk3568/config.json b/rk3568/config.json
index ea2d588..21b5ec2 100755
--- a/rk3568/config.json
+++ b/rk3568/config.json
@@ -9,7 +9,7 @@
"api_version": 8,
"enable_ramdisk": true,
"enable_absystem": false,
- "build_selinux": true,
+ "build_selinux": false,
"build_seccomp": true,
"inherit": [ "productdefine/common/inherit/rich.json", "productdefine/common/inherit/chipset_common.json" ],
"subsystems": [
@@ -64,7 +64,7 @@
"component": "ace_engine",
"features": [
"ace_engine_feature_enable_accessibility = true",
- "ace_engine_feature_enable_web = true"
+ "ace_engine_feature_enable_web = false"
]
},
{
@@ -200,7 +200,7 @@
{
"component": "graphic_2d",
"features": [
- "graphic_2d_feature_rs_enable_eglimage = true"
+ "graphic_2d_feature_rs_enable_eglimage = false"
]
}
]
路径2:productdefine/common/inherit/rich.json
修改目的:
- 切换点屏模式。
- 4.0 release版本的fingerprint_auth组件对GPU有依赖,需要裁掉此组件。
diff --git a/inherit/rich.json b/inherit/rich.json
index 255af7f..5549de9 100644
--- a/inherit/rich.json
+++ b/inherit/rich.json
@@ -501,7 +501,7 @@
{
"component": "graphic_2d",
"features": [
- "graphic_2d_feature_ace_enable_gpu = true"
+ "graphic_2d_feature_ace_enable_gpu = false"
]
},
{
@@ -533,10 +533,6 @@
{
"component": "face_auth",
"features": []
- },
- {
- "component": "fingerprint_auth",
- "features": []
}
]
},
@@ -1012,10 +1008,6 @@
"component": "drivers_interface_user_auth",
"features": []
},
- {
- "component": "drivers_interface_fingerprint_auth",
- "features": []
- },
{
"component": "drivers_interface_huks",
"feature":[]
路径3:foundation/graphic/graphic_2d/graphic_config.gni
修改目的:
- 切换点屏模式。
- 去掉对GPU的依赖。
- 解决编译报错问题。此参数在GPU点屏时,会在GPU的分支中进行定义,后续脚本中会对此参数进行判断。切换成CPU之后,没有定义此参数,直接进行了判断,所以报错。
diff --git a/graphic_config.gni b/graphic_config.gni
index f7b7b3bdb..cf220aaff 100644
--- a/graphic_config.gni
+++ b/graphic_config.gni
@@ -13,14 +13,14 @@
declare_args() {
graphic_2d_feature_bootanimation_enable = true
- graphic_2d_feature_ace_enable_gpu = true
+ graphic_2d_feature_ace_enable_gpu = false
graphic_2d_feature_color_gamut_enable = false
graphic_2d_feature_rs_enable_eglimage = false
graphic_2d_feature_rs_enable_uni_render = false
graphic_2d_feature_wuji_enable = false
graphic_2d_feature_enable_afbc = false
graphic_2d_feature_freemem_enable = false
- graphic_2d_feature_parallel_render_enable = true
+ graphic_2d_feature_parallel_render_enable = false
graphic_2d_feature_enable_vulkan = false
if (defined(is_arkui_x) && is_arkui_x) {
use_new_render_context = false
@@ -65,6 +65,7 @@ if (graphic_2d_feature_ace_enable_gpu) {
}
} else {
gpu_defines = [ "ACE_DISABLE_GL" ]
+ rs_enable_parallel_render = false
ace_enable_gpu = false
rs_enable_gpu = false
surface_enable_gpu = false
路径:foundation/graphic/graphic_2d/rosen/modules/render_service_base/BUILD.gn
修改目的:
- 解决编译中报错问题。此处的cpp源文件在GPU模式下,会被添加到config列表中。但是切换为CPU模式后,CPU分支没有引用此文件,所以在已经生效的config列表中找不到此文件,所以无法进行"sources-"的操作,最终导致报错。
diff --git a/rosen/modules/render_service_base/BUILD.gn b/rosen/modules/render_service_base/BUILD.gn
index 900f4d903..2ea222a40 100644
--- a/rosen/modules/render_service_base/BUILD.gn
+++ b/rosen/modules/render_service_base/BUILD.gn
@@ -243,7 +243,7 @@ ohos_source_set("render_service_base_src") {
if (current_os == "mingw" || current_os == "mac" || current_os == "linux" ||
current_os == "ios") {
- sources -= [ "src/common/rs_shared_context.cpp" ]
+ # sources -= [ "src/common/rs_shared_context.cpp" ]
}
if (current_os == "ohos") {
功能实现
路径:device/soc/rockchip/rk3568/hardware/display/src/display_device/hdi_gfx_composition.cpp
修改目的:
- 引用头文件,定义"IDisplayBufferVdi"。
- 进行CPU点屏时,canhandle需要返回false,否则合成会出现异常卡在开机动画界面(hello_composer测试时需要改为true)。
- 实现了一个简单的合成动作。将多个图层合成为一张图,并送到显示的buff中。如果不做修改会出现开机进入桌面无法操作的现象。
diff --git a/rk3568/hardware/display/src/display_device/hdi_gfx_composition.cpp b/rk3568/hardware/display/src/display_device/hdi_gfx_composition.cpp
index 93d9174..11b207a 100644
--- a/rk3568/hardware/display/src/display_device/hdi_gfx_composition.cpp
+++ b/rk3568/hardware/display/src/display_device/hdi_gfx_composition.cpp
@@ -22,6 +22,8 @@
#include "hitrace_meter.h"
#include "v1_0/display_composer_type.h"
+#include "display_buffer_vdi_impl.h"
+
using namespace OHOS::HDI::Display::Composer::V1_0;
namespace OHOS {
@@ -84,7 +86,8 @@ bool HdiGfxComposition::CanHandle(HdiLayer &hdiLayer)
{
DISPLAY_LOGD();
(void)hdiLayer;
- return true;
+ // return true;
+ return false;
}
bool HdiGfxComposition::UseCompositionClient(std::vector<HdiLayer *> &layers)
@@ -202,7 +205,8 @@ int32_t HdiGfxComposition::Apply(bool modeSet)
{
StartTrace(HITRACE_TAG_HDF, "HDI:DISP:Apply");
int32_t ret;
- DISPLAY_LOGD("composer layers size %{public}zd", mCompLayers.size());
+ static std::shared_ptr<IDisplayBufferVdi> g_buffer = nullptr;
+ DISPLAY_LOGD("map composer layers size %{public}zd", mCompLayers.size());
for (uint32_t i = 0; i < mCompLayers.size(); i++) {
HdiLayer *layer = mCompLayers[i];
CompositionType compType = layer->GetCompositionType();
@@ -213,9 +217,32 @@ int32_t HdiGfxComposition::Apply(bool modeSet)
DISPLAY_LOGE("clear layer %{public}d failed", i));
break;
case COMPOSITION_DEVICE:
- ret = BlitLayer(*layer, *mClientLayer);
- DISPLAY_CHK_RETURN((ret != DISPLAY_SUCCESS), DISPLAY_FAILURE,
- DISPLAY_LOGE("blit layer %{public}d failed ", i));
+ // ret = BlitLayer(*layer, *mClientLayer);
+ // DISPLAY_CHK_RETURN((ret != DISPLAY_SUCCESS), DISPLAY_FAILURE,
+ // DISPLAY_LOGE("blit layer %{public}d failed ", i));
+ {
+ if (g_buffer== nullptr) {
+ IDisplayBufferVdi* dispBuf = new DisplayBufferVdiImpl();
+ DISPLAY_CHK_RETURN((dispBuf == nullptr), DISPLAY_FAILURE, DISPLAY_LOGE("map dispBuf init failed"));
+ g_buffer.reset(dispBuf);
+ DISPLAY_LOGD("map new DisplayBufferVdiImpl");
+ }
+ char *clientBuff = (char *)g_buffer->Mmap(mClientLayer->GetCurrentBuffer()->mHandle);
+ if(clientBuff) {
+ DISPLAY_LOGD("map in int");
+ HdiLayerBuffer *hdiLayer = layer->GetCurrentBuffer();
+ char *layerBuff = (char *)g_buffer->Mmap(hdiLayer->mHandle);
+ for(int y = 0; y < hdiLayer->GetHeight(); y++) {
+ memcpy(&clientBuff[mClientLayer->GetCurrentBuffer()->GetStride() *
+ (y + layer->GetLayerDisplayRect().y) + layer->GetLayerDisplayRect().x * 4],
+ (char *)(&layerBuff[hdiLayer->GetStride() * y]), hdiLayer->GetStride());
+ }
+ g_buffer->Unmap(hdiLayer->mHandle);
+ g_buffer->Unmap(mClientLayer->GetCurrentBuffer()->mHandle);
+ } else {
+ DISPLAY_LOGD("map in err");
+ }
+ }
break;
default:
DISPLAY_LOGE("the gfx composition can not surpport the type %{public}d", compType);
@@ -225,6 +252,7 @@ int32_t HdiGfxComposition::Apply(bool modeSet)
FinishTrace(HITRACE_TAG_HDF);
return DISPLAY_SUCCESS;
}
+
} // namespace OHOS
} // namespace HDI
} // namespace DISPLAY
更多推荐
所有评论(0)