讨论广场 问答详情
openharmony4.0 cpu点屏图像显示不对请教
songze_lee 2025-03-19 21:37:56
124 评论 分享

openharmony4.0 cpu点屏图像显示不对请教

bin文件为底层kernel drm驱动中dump出来的framebuff数据,使用vooya工具显示图像情况,和实际显示屏图像一样。目前怀疑上层传到底层数据不对,暂时不清楚问题原因?

代码为:从版本发布Tag节点获取源码。获取与v4.0-Release版本发布时完全一致的源码。

repo init -u git@gitee.com:openharmony/manifest.git -b refs/tags/OpenHarmony-v4.0-Release --no-repo-verify
repo sync -c
repo forall -c 'git lfs pull'

芯片平台:为第三方arm32位soc,arm cortex-A7

modetest 测试图像正常,以及运行lvgl显示正常。

cpu点屏patch如下:

foundation_graphic_graphic_2d.patch

diff --git a/bundle.json b/bundle.json
index f82b846d0a..f8d1b274b5 100755
--- a/bundle.json
+++ b/bundle.json
@@ -94,7 +94,8 @@
             "//third_party/libpng:libpng",
             "//foundation/graphic/graphic_2d/interfaces/kits/napi:napi_packages",
             "//foundation/graphic/graphic_2d/rosen/modules/composer:libcomposer",
-            "//foundation/graphic/graphic_2d/rosen/modules/composer/native_vsync:libnative_vsync",
+        "//foundation/graphic/graphic_2d/rosen/samples/composer:hello_composer",
+        "//foundation/graphic/graphic_2d/rosen/modules/composer/native_vsync:libnative_vsync",
             "//foundation/graphic/graphic_2d/rosen/modules/2d_graphics:2d_graphics",
             "//foundation/graphic/graphic_2d/rosen/modules/effect/effectChain:libeffectchain",
             "//foundation/graphic/graphic_2d/rosen/modules/effect/color_picker:color_picker",
diff --git a/frameworks/bootanimation/include/boot_animationconfig.h b/frameworks/bootanimation/include/boot_animationconfig.h
index 9914326416..228112e2dd 100644
--- a/frameworks/bootanimation/include/boot_animationconfig.h
+++ b/frameworks/bootanimation/include/boot_animationconfig.h
@@ -33,7 +33,7 @@ public:
     bool IsBootVideoEnabled();
 private:
     BootCustomConfig custConfig_;
-    bool bootVideoEnabled_ = true;
+    bool bootVideoEnabled_ = false;
 };
 } // namespace OHOS
 
diff --git a/graphic_config.gni b/graphic_config.gni
index 7ad24df2bc..e156025e5b 100644
--- a/graphic_config.gni
+++ b/graphic_config.gni
@@ -13,7 +13,7 @@
 
 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
diff --git a/rosen/modules/effect/skia_effectChain/BUILD.gn b/rosen/modules/effect/skia_effectChain/BUILD.gn
index b4a23f6cae..c8296f1200 100644
--- a/rosen/modules/effect/skia_effectChain/BUILD.gn
+++ b/rosen/modules/effect/skia_effectChain/BUILD.gn
@@ -37,6 +37,7 @@ config("effect_SKeffectChian_public_config") {
     "//foundation/multimedia/image_framework/interfaces/innerkits/include",
     "$graphic_2d_root/utils/log",
     "include",
+    "//third_party/openGLES/api",
   ]
 }
 
@@ -44,13 +45,15 @@ ohos_shared_library("skeffectchain") {
   public_deps = [
     "$graphic_2d_root:libsurface",
     "$graphic_2d_root/rosen/modules/effect/egl:libegl_effect",
+    "//third_party/EGL:libEGL",
+    "//third_party/openGLES:libGLES",
   ]
 
   if (ace_enable_gpu) {
     defines = gpu_defines
     public_deps += [ "$graphic_2d_root:libgl" ]
   }
-
+  public_deps += [ "$graphic_2d_root:libgl" ]
   if (defined(use_new_skia) && use_new_skia) {
     public_deps += [ "//third_party/skia:skia_ohos" ]
   } else {
diff --git a/rosen/modules/render_service/BUILD.gn b/rosen/modules/render_service/BUILD.gn
index 77b26ea2fd..5363e26c2c 100644
--- a/rosen/modules/render_service/BUILD.gn
+++ b/rosen/modules/render_service/BUILD.gn
@@ -183,6 +183,13 @@ ohos_shared_library("librender_service") {
     defines += accessibility_defines
   }
 
+  cflags = [
+    "-Wall",
+    "-Wno-unused-const-variable",
+  ]
+
+ cflags_cc = [ "-Wno-unused-const-variable" ]
+
   part_name = "graphic_2d"
   subsystem_name = "graphic"
 }
diff --git a/rosen/modules/render_service/core/pipeline/rs_base_render_engine.cpp b/rosen/modules/render_service/core/pipeline/rs_base_render_engine.cpp
index c7418e0fbd..558320fb74 100644
--- a/rosen/modules/render_service/core/pipeline/rs_base_render_engine.cpp
+++ b/rosen/modules/render_service/core/pipeline/rs_base_render_engine.cpp
@@ -85,6 +85,7 @@ void RSBaseRenderEngine::Init()
 
 bool RSBaseRenderEngine::NeedForceCPU(const std::vector<LayerInfoPtr>& layers)
 {
+#ifdef RS_ENABLE_GL
     bool forceCPU = false;
     for (const auto& layer: layers) {
         if (layer == nullptr) {
@@ -111,8 +112,10 @@ bool RSBaseRenderEngine::NeedForceCPU(const std::vector<LayerInfoPtr>& layers)
             break;
         }
     }
-
     return forceCPU;
+#else
+    return true;
+#endif
 }
 
 #ifndef USE_ROSEN_DRAWING
diff --git a/rosen/modules/render_service_base/src/platform/ohos/BUILD.gn b/rosen/modules/render_service_base/src/platform/ohos/BUILD.gn
index e1bf2eb3bd..cfa6676f1f 100644
--- a/rosen/modules/render_service_base/src/platform/ohos/BUILD.gn
+++ b/rosen/modules/render_service_base/src/platform/ohos/BUILD.gn
@@ -109,6 +109,7 @@ ohos_source_set("rosen_ohos_sources") {
     "//drivers/peripheral/display/interfaces/include/",
     "$graphic_2d_root/rosen/modules/render_service_client/core",
     "$graphic_2d_root/utils/log",
+    "//third_party/openGLES/api",
   ]
 
   public_deps = [
@@ -116,6 +117,8 @@ ohos_source_set("rosen_ohos_sources") {
     "$graphic_2d_root/rosen/modules/2d_graphics:2d_graphics",
     "$graphic_2d_root/rosen/modules/composer/vsync:libvsync",
     "$graphic_2d_root/utils:sync_fence",
+    "//third_party/EGL:libEGL",
+    "//third_party/openGLES:libGLES",
   ]
   if (defined(use_new_skia) && use_new_skia) {
     public_deps += [ "//third_party/skia:skia_ohos" ]
diff --git a/rosen/samples/composer/BUILD.gn b/rosen/samples/composer/BUILD.gn
index df741b6762..dc61ae0f98 100644
--- a/rosen/samples/composer/BUILD.gn
+++ b/rosen/samples/composer/BUILD.gn
@@ -55,6 +55,7 @@ ohos_executable("hello_composer") {
   ]
 
   external_deps = [
+    "c_utils:utils",
     "eventhandler:libeventhandler",
     "hilog:libhilog",
   ]
diff --git a/rosen/samples/composer/hello_composer.cpp b/rosen/samples/composer/hello_composer.cpp
index a907af7dbe..82042a306e 100644
--- a/rosen/samples/composer/hello_composer.cpp
+++ b/rosen/samples/composer/hello_composer.cpp
@@ -74,7 +74,7 @@ void HelloComposer::Run(const std::vector<std::string> &runArgs)
     sleep(1);
     std::shared_ptr<OHOS::AppExecFwk::EventRunner> runner = OHOS::AppExecFwk::EventRunner::Create(false);
     mainThreadHandler_ = std::make_shared<OHOS::AppExecFwk::EventHandler>(runner);
-    g_receiver = new VSyncReceiver(vsyncConnection, mainThreadHandler_);
+    g_receiver = new VSyncReceiver(vsyncConnection, nullptr, mainThreadHandler_);
     g_receiver->Init();
     mainThreadHandler_->PostTask(std::bind(&HelloComposer::RequestSync, this));
     runner->Run();
@@ -473,6 +473,7 @@ void HelloComposer::DoPrepareCompleted(sptr<Surface> surface, const struct Prepa
             clientCount++;
         }
     }
+    LOGI("clientCount value: %{public}d", clientCount);
 
     auto addr = static_cast<uint8_t *>(fbBuffer->GetVirAddr());
     if (hasClient) {

base_useriam_fingerprint_auth.patch

diff --git a/services_ex/BUILD.gn b/services_ex/BUILD.gn
  index c2741b0..0b2547d 100644
  --- a/services_ex/BUILD.gn
  +++ b/services_ex/BUILD.gn
  @@ -57,6 +57,20 @@ ohos_source_set("fingerprintauthservice_ex_source_set") {
   
     remove_configs = [ "//build/config/compiler:no_exceptions" ]
   
  +  cflags = [
  +    "-Wall",
  +    "-Wno-unused-const-variable",
  +    "-Wno-unused-function",
  +  ]
  +
  + cflags_cc = [ 
  +    "-Wno-unused-const-variable",
  +    "-Wno-unused-function",
  +  ]
  +
  +
  +
  +
     subsystem_name = "useriam"
     part_name = "fingerprint_auth"
   }
  diff --git a/services_ex/inc/sensor_illumination_task.h b/services_ex/inc/sensor_illumination_task.h
  index 5fdac12..ff16d63 100644
  --- a/services_ex/inc/sensor_illumination_task.h
  +++ b/services_ex/inc/sensor_illumination_task.h
  @@ -65,7 +65,9 @@ private:
       std::shared_ptr<Rosen::RSSurfaceNode> rsSurfaceNode_ = nullptr;
       std::shared_ptr<Rosen::RSSurface> rsSurface_ = nullptr;
       std::shared_ptr<Rosen::RenderContext> renderContext_ = nullptr;
  +    #if 0
       Rosen::DisplayId defaultDisplayId_ = INVALID_DISPLAY_ID;
  +    #endif
       Rosen::ScreenId defaultScreenId_ = Rosen::INVALID_SCREEN_ID;
       CanvasParam canvasParam_ = {};
       uint32_t brightness_ = INVALID_BRIGHTNESS;
  @@ -81,4 +83,4 @@ std::shared_ptr<ISensorIlluminationTask> GetSensorIlluminationTask();
   } // namespace UserIam
   } // namespace OHOS
   
  -#endif // SENSOR_ILLUMINATION_TASK
  \ No newline at end of file
  +#endif // SENSOR_ILLUMINATION_TASK
  diff --git a/services_ex/src/sensor_illumination_task.cpp b/services_ex/src/sensor_illumination_task.cpp
  index 49a247c..100794b 100644
  --- a/services_ex/src/sensor_illumination_task.cpp
  +++ b/services_ex/src/sensor_illumination_task.cpp
  @@ -160,6 +160,7 @@ SensorIlluminationTask::~SensorIlluminationTask()
   ResultCode SensorIlluminationTask::EnableSensorIllumination(uint32_t centerX, uint32_t centerY, uint32_t radius,
       uint32_t color)
   {
  +    #if 0
       std::lock_guard<std::recursive_mutex> lock(recursiveMutex_);
       IAM_LOGI("start");
   
  @@ -212,6 +213,8 @@ ResultCode SensorIlluminationTask::EnableSensorIllumination(uint32_t centerX, ui
   
       IAM_LOGI("success");
       return ResultCode::SUCCESS;
  +    #endif
  +    return ResultCode::SUCCESS;
   }
   
   ResultCode SensorIlluminationTask::DisableSensorIllumination()
  @@ -350,4 +353,4 @@ std::shared_ptr<ISensorIlluminationTask> GetSensorIlluminationTask()
   }
   } // namespace FingerprintAuth
   } // namespace UserIam
  -} // namespace OHOS
  \ No newline at end of file
  +} // namespace OHOS
  

display/soc/xxx/display

  复制的DIEMIT的树莓派4B部分,[device_soc_opc: OHOS Porting Communities-开源鸿蒙系统移植社区-soc整合代码仓 - Gitee.com](https://gitee.com/ohos-porting-communities/device_soc_opc/tree/OpenHarmony-4.0-Release/), 只修改了其中BUILD.gn 中part_name 和代码中drm_name。

vendor 中config.json以下也改为了false

"ace_engine_feature_enable_web = false"

"graphic_2d_feature_ace_enable_gpu = false",

"graphic_2d_feature_rs_enable_eglimage = false"

同时kernel底层也检查了上层传递的format格式为DRM_FORMAT_ARGB8888,是符合预期的。

124 评论 分享
写回答
全部评论(5)
4 楼

在DIEMIT大佬的指导下,修改display/src/display_gralloc/allocator.h, 将WIDTH_ALIGN=64 修改为WIDTH_ALIGN=8,图形显示正常,只是色彩不对。

再次修改display/src/display_gralloc/drm_allocator.cpp中 Allocate函数中强制配置格式为handle.format=PIXEL_FMT_BGRA_8888 色彩正常。

2025-03-21 23:43:32
3 楼

你看下你数据的路径有没有问题

2025-03-20 11:40:10
2025-03-20 16:45:29
请教一下,这块具体咋操作
2025-03-20 16:45:29
2 楼
2025-03-20 10:06:23

要不尝试改下格式看看

 

2025-03-20 09:34:50