在OpenHarmony上适配图形显示【3】——添加显示接口类型 原创

离北况归
发布于 2025-9-9 00:19
浏览
0收藏

下文以添加dp显示接口为例在OpenHarmony中添加显示接口类型。直至OpenHarmony 6.0 Release版本,OpenHarmony支持的接口类型有以下类型,包括常见的MIPIHDMI等,不包括dp还有edp等,需要开发者自行添加。不添加会被默认识别为Unknown(但是要对接上层应用api的话,最好还是添加一下屏幕类型)具体如下图。

在OpenHarmony上适配图形显示【3】——添加显示接口类型-鸿蒙开发者社区

文章写作环境

  • OpenHarmony 5.0.0-5.0.3

步骤


--- a/foundation/graphic/graphic_2d/rosen/modules/composer/hdi_backend/include/hdi_display_type.h
+++ b/foundation/graphic/graphic_2d/rosen/modules/composer/hdi_backend/include/hdi_display_type.h
@@ -49,6 +49,7 @@ typedef enum {
     GRAPHIC_DISP_INTF_VGA,            /**< VGA interface */
     GRAPHIC_DISP_INTF_MIPI,           /**< MIPI interface */
     GRAPHIC_DISP_INTF_PANEL,          /**< PANEL interface */
+    GRAPHIC_DISP_INTF_DP,             /**< DP interface */
     GRAPHIC_DISP_INTF_BUTT,
 } GraphicInterfaceType;
 

--- a/foundation/graphic/graphic_2d/rosen/modules/render_service/core/screen_manager/rs_screen.cpp
+++ b/foundation/graphic/graphic_2d/rosen/modules/render_service/core/screen_manager/rs_screen.cpp
@@ -451,6 +451,10 @@ void RSScreen::CapabilityTypeDump(GraphicInterfaceType capabilityType, std::stri
             dumpString += "DISP_INTF_BT656, ";
             break;
         }
+        case GRAPHIC_DISP_INTF_DP: {
+            dumpString += "DISP_INTF_DP, ";
+            break;
+        }
         default:
             dumpString += "INVILID_DISP_INTF, ";
             break;

--- a/foundation/graphic/graphic_2d/rosen/modules/render_service_base/include/screen_manager/screen_types.h
+++ b/foundation/graphic/graphic_2d/rosen/modules/render_service_base/include/screen_manager/screen_types.h
@@ -91,6 +91,7 @@ typedef enum : uint32_t {
     DISP_INTF_MIPI,
     DISP_INTF_PANEL,
     DISP_INTF_BUTT,
+    DISP_INTF_DP,
     DISP_INVALID,
 } ScreenInterfaceType;
 
--- a/drivers/interface/display/composer/v1_0/DisplayComposerType.idl
+++ b/drivers/interface/display/composer/v1_0/DisplayComposerType.idl
@@ -305,6 +305,7 @@ enum InterfaceType {
     DISP_INTF_VGA,                  /**< VGA interface */
     DISP_INTF_MIPI,                 /**< MIPI interface */
     DISP_INTF_PANEL,                /**< PANEL interface */
+    DISP_INTF_DP,                   /**< DP interface */
     DISP_INTF_BUTT,
 };
 
--- a/foundation/ability/idl_tool/test/hdi_unittest/display_composer_v1_0/foo/display/composer/v1_0/DisplayComposerType.idl
+++ b/foundation/ability/idl_tool/test/hdi_unittest/display_composer_v1_0/foo/display/composer/v1_0/DisplayComposerType.idl
@@ -305,6 +305,7 @@ enum InterfaceType {
     DISP_INTF_VGA,                  /**< VGA interface */
     DISP_INTF_MIPI,                 /**< MIPI interface */
     DISP_INTF_PANEL,                /**< PANEL interface */
+    DISP_INTF_DP,                   /**< DP interface */
     DISP_INTF_BUTT,
 };
 
--- a/device/soc/xxxxx/display/src/display_device/drm/drm_connector.cpp	2025-08-22 11:56:49.339805024 +0800
+++ b/device/soc/xxxxx/display/src/display_device/drm/drm_connector.cpp	2025-08-22 11:58:09.129765896 +0800
@@ -169,6 +169,9 @@
         case DISP_INTF_MIPI:
             name = "MIPI";
             break;
+         case DISP_INTF_DP:
+             name = "DP";
+             break;
         default:
             name = "Unknown";
             break;
@@ -188,6 +191,9 @@
         case DRM_MODE_CONNECTOR_HDMIB:
             hdiType = DISP_INTF_HDMI;
             break;
+        case DRM_MODE_CONNECTOR_DisplayPort:
+             hdiType = DISP_INTF_DP;
+             break;
         default:
             hdiType = DISP_INTF_BUTT;
             break;

©著作权归作者所有,如需转载,请注明出处,否则将追究法律责任
标签
已于2025-9-9 00:19:44修改
收藏
回复
举报
回复
    相关推荐