CPU点屏指导

版本要求: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解决方案,待后续更新。

点屏流程

img

点屏实操

编译阶段

从编译框架的层面将原本的GPU点屏模式改为CPU点屏模式。

路径1:vendor/hihope/rk3568/config.json

修改目的:

  1. 关闭selinux,避免点屏操作被安全机制拒绝。
  2. 去掉对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

修改目的:

  1. 切换点屏模式。
  2. 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

修改目的:

  1. 切换点屏模式。
  2. 去掉对GPU的依赖。
  3. 解决编译报错问题。此参数在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

修改目的:

  1. 解决编译中报错问题。此处的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

修改目的:

  1. 引用头文件,定义"IDisplayBufferVdi"。
  2. 进行CPU点屏时,canhandle需要返回false,否则合成会出现异常卡在开机动画界面(hello_composer测试时需要改为true)。
  3. 实现了一个简单的合成动作。将多个图层合成为一张图,并送到显示的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

  • 17
    点赞
  • 20
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
内容介绍 项目结构: Controller层:使用Spring MVC来处理用户请求,负责将请求分发到相应的业务逻辑层,并将数据传递给视图层进行展示。Controller层通常包含控制器类,这些类通过注解如@Controller、@RequestMapping等标记,负责处理HTTP请求并返回响应。 Service层:Spring的核心部分,用于处理业务逻辑。Service层通过接口和实现类的方式,将业务逻辑与具体的实现细节分离。常见的注解有@Service和@Transactional,后者用于管理事务。 DAO层:使用MyBatis来实现数据持久化,DAO层与数据库直接交互,执行CRUD操作。MyBatis通过XML映射文件或注解的方式,将SQL语句与Java对象绑定,实现高效的数据访问。 Spring整合: Spring核心配置:包括Spring的IOC容器配置,管理Service和DAO层的Bean。配置文件通常包括applicationContext.xml或采用Java配置类。 事务管理:通过Spring的声明式事务管理,简化了事务的处理,确保数据一致性和完整性。 Spring MVC整合: 视图解析器:配置Spring MVC的视图解析器,将逻辑视图名解析为具体的JSP或其他类型的视图。 拦截器:通过配置Spring MVC的拦截器,处理请求的预处理和后处理,常用于权限验证、日志记录等功能。 MyBatis整合: 数据源配置:配置数据库连接池(如Druid或C3P0),确保应用可以高效地访问数据库。 SQL映射文件:使用MyBatis的XML文件或注解配置,将SQL语句与Java对象映射,支持复杂的查询、插入、更新和删除操作。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值