meson_display:  add api to get rx capabilities by hdr_cap2 node [1/1]

PD#SWPL-185274

Problem:
add api to get rx capabilities by hdr_cap2 node

Solution:
add api to get rx capabilities by hdr_cap2 node

Verify:
AH212

Change-Id: I56f254116c79f3db1e0bc491ba08bf6c80828424
Signed-off-by: chen.wang1 <chen.wang1@amlogic.com>
diff --git a/display_framework/src/extension/display_settings/display_settings.h b/display_framework/src/extension/display_settings/display_settings.h
index 3a8bc12..3279696 100644
--- a/display_framework/src/extension/display_settings/display_settings.h
+++ b/display_framework/src/extension/display_settings/display_settings.h
@@ -167,6 +167,7 @@
 int getDisplaySupportedDvMode(DISPLAY_CONNECTOR_TYPE connType);
 uint32_t getDisplayHDRSupportList(DISPLAY_CONNECTOR_TYPE connType);
 uint32_t getDisplayDvCap(DISPLAY_CONNECTOR_TYPE connType);
+uint32_t getDisplayRxSupportHdrList(DISPLAY_CONNECTOR_TYPE connType);
 int getDisplaySupportAttrList(DisplayModeInfo* modeInfo,DISPLAY_CONNECTOR_TYPE connType);
 int getDisplayDpmsStatus(DISPLAY_CONNECTOR_TYPE connType);
 float getDisplayFrameRate( DISPLAY_CONNECTOR_TYPE connType);
diff --git a/display_framework/src/extension/display_settings/displayattribute/display_attribute.c b/display_framework/src/extension/display_settings/displayattribute/display_attribute.c
index b76f5be..c776b11 100644
--- a/display_framework/src/extension/display_settings/displayattribute/display_attribute.c
+++ b/display_framework/src/extension/display_settings/displayattribute/display_attribute.c
@@ -30,6 +30,7 @@
 #define MESON_DISPLAY_DV_MODE_FLAG 0xf8
 
 static uint32_t getDisplayHDRSupportedList(uint64_t hdrlist, uint64_t dvlist);
+static uint32_t getDisplayRxSupportedHdrList(uint32_t hdrlist, uint32_t dvlist);
 
 int display_meson_get_open() {
     int fd = -1;
@@ -718,6 +719,43 @@
     return ret;
 }
 
+static uint32_t getDisplayRxSupportedHdrList(uint32_t hdrlist, uint32_t dvlist) {
+    uint32_t ret = 0;
+    DEBUG("%s %d hdrlist: %d, dvlist: %d",__FUNCTION__,__LINE__, hdrlist,dvlist);
+    if (!!(hdrlist & 0x1))
+        ret = ret | (0x1 << (int)MESON_DISPLAY_HDR10PLUS);
+
+    if (!!(dvlist & 0x1A))
+        ret = ret | (0x1 << (int)MESON_DISPLAY_DolbyVision_STD);
+
+    if (!!(dvlist & 0xE0))
+        ret = ret | (0x1 << (int)MESON_DISPLAY_DolbyVision_Lowlatency);
+
+    if (!!(hdrlist & 0x8))
+        ret = ret | (0x1 << (int)MESON_DISPLAY_HDR10_ST2084);
+
+    if (!!(hdrlist & 0x4))
+        ret = ret | (0x1 << (int)MESON_DISPLAY_HDR10_TRADITIONAL);
+
+    if (!!(hdrlist & 0x10))
+        ret = ret | (0x1 << (int)MESON_DISPLAY_HDR_HLG);
+
+    if (!!(hdrlist & 0x2))
+        ret = ret | (0x1 << (int)MESON_DISPLAY_SDR);
+
+    return ret;
+}
+
+uint32_t getDisplayRxSupportHdrList(DISPLAY_CONNECTOR_TYPE connType) {
+    int fd = display_meson_get_open();
+    uint32_t hdrcap = meson_drm_getRxHdrCap( fd, connType );
+    uint32_t dvcap = meson_drm_getRxDvCap( fd, connType );
+    uint32_t value = getDisplayRxSupportedHdrList(hdrcap, dvcap);
+    DEBUG("%s %d get rx support hdr list %d",__FUNCTION__,__LINE__,value);
+    meson_close_drm(fd);
+    return value;
+}
+
 int getDisplayHdcpTopoInfo( DISPLAY_CONNECTOR_TYPE connType ) {
     int fd = display_meson_get_open();
     int value = meson_drm_getHdcpTopoInfo(fd, connType);
diff --git a/display_framework/src/extension/display_settings/meson/meson_settings_Test.c b/display_framework/src/extension/display_settings/meson/meson_settings_Test.c
index dd974ac..ba5e4df 100644
--- a/display_framework/src/extension/display_settings/meson/meson_settings_Test.c
+++ b/display_framework/src/extension/display_settings/meson/meson_settings_Test.c
@@ -357,7 +357,7 @@
          " 19->current aspect ratio 20->event test 21->frac rate policy 22->Supported dvmode 23->hdr supportedlist "
          " 24->DvCap 25->dpms status 26->mode support attrlist 27->framrate 28->primar plane fb size"
          " 29->physical size 30->Timing information 31->dv mode 32->rx supported hdcp version 33->cvbs video mute"
-         " 34->hdcp topo info\n");
+         " 34->hdcp topo info 35->Rx supported hdr list\n");
         len = scanf("%d",&get);
         if (get == 0 && len == 1) {
             ENUM_DISPLAY_HDR_POLICY value = getDisplayHDRPolicy( DISPLAY_CONNECTOR_HDMIA);
@@ -624,6 +624,23 @@
         } else if (get == 34 && len == 1) {
             int value = getDisplayHdcpTopoInfo(DISPLAY_CONNECTOR_HDMIA );
             printf("\n get hdcp topo info: %d\n",value);
+        } else if (get == 35 && len == 1) {
+            uint32_t value  = getDisplayRxSupportHdrList(DISPLAY_CONNECTOR_HDMIA);
+            printf("\n value %d\n",value);
+            if (value & 0x1)
+                printf("\n MESON_DRM_HDR10PLUS\n");
+            if (value & 0x2)
+                printf("\n MESON_DRM_DOLBYVISION_STD\n");
+            if (value & 0x4)
+                printf("\n MESON_DRM_DOLBYVISION_LL\n");
+            if (value & 0x8)
+                printf("\n MESON_DRM_HDR10_ST2084\n");
+            if (value & 0x10)
+                printf("\n MESON_DRM_HDR10_TRADITIONAL\n");
+            if (value & 0x20)
+                printf("\n MESON_DRM_HDR_HLG\n");
+            if (value & 0x40)
+                printf("\n MESON_DRM_SDR\n");
         }
     }
     else {
diff --git a/display_framework/src/extension/display_settings/westeros/westeros_settings_Test.c b/display_framework/src/extension/display_settings/westeros/westeros_settings_Test.c
index e70cc94..0d9888e 100644
--- a/display_framework/src/extension/display_settings/westeros/westeros_settings_Test.c
+++ b/display_framework/src/extension/display_settings/westeros/westeros_settings_Test.c
@@ -271,7 +271,7 @@
          "19->current aspect ratio 20->event test 21->frac rate policy 22->scaling 23->supported dvmode"
          " 24->hdr supportedlist 25->DvCap 26->display enabled 27->dpms status 28->mode support attrlist 29->framrate"
          " 30->primar plane fb size 31->physical size 32->Timing information 33->is bestmode 34->dv mode "
-         " 35->rx supported hdcp version 36->cvbs video mute 37->hdcp topo info\n");
+         " 35->rx supported hdcp version 36->cvbs video mute 37->hdcp topo info 38->Rx supported hdr list\n");
         len = scanf("%d",&get);
         if (get == 0 && len == 1) {
             ENUM_DISPLAY_HDR_POLICY value = getDisplayHDRPolicy( DISPLAY_CONNECTOR_HDMIA);
@@ -560,6 +560,23 @@
         } else if (get == 37 && len == 1) {
             int value = getDisplayHdcpTopoInfo(DISPLAY_CONNECTOR_HDMIA );
             printf("\n get hdcp topo info: %d\n", value);
+        } else if (get == 38 && len == 1) {
+            uint32_t value  = getDisplayRxSupportHdrList(DISPLAY_CONNECTOR_HDMIA);
+            printf("\n value %d\n",value);
+            if (value & 0x1)
+                printf("\n MESON_DRM_HDR10PLUS\n");
+            if (value & 0x2)
+                printf("\n MESON_DRM_DOLBYVISION_STD\n");
+            if (value & 0x4)
+                printf("\n MESON_DRM_DOLBYVISION_LL\n");
+            if (value & 0x8)
+                printf("\n MESON_DRM_HDR10_ST2084\n");
+            if (value & 0x10)
+                printf("\n MESON_DRM_HDR10_TRADITIONAL\n");
+            if (value & 0x20)
+                printf("\n MESON_DRM_HDR_HLG\n");
+            if (value & 0x40)
+                printf("\n MESON_DRM_SDR\n");
         }
     }
     else {
diff --git a/display_framework/src/extension/display_settings/weston/weston_settings_Test.c b/display_framework/src/extension/display_settings/weston/weston_settings_Test.c
index a345521..525aaa0 100644
--- a/display_framework/src/extension/display_settings/weston/weston_settings_Test.c
+++ b/display_framework/src/extension/display_settings/weston/weston_settings_Test.c
@@ -284,7 +284,8 @@
          " 19->current aspect ratio 20->event test 21->frac rate policy 22->Supported dvmode 23->hdr supportedlist"
          " 24->DvCap 25->dpms status 26->mode support attrlist 27->framrate 28->primar plane fb size "
          " 29>physical size 30->Timing information 31->dv mode 32->rx supported hdcp version 33->cvbs video mute "
-         " 34->frac rate policy 35->hdcp topo info 36->scaling 37->auto-frm-mode 38->display enabled 39->is bestmode\n");
+         " 34->frac rate policy 35->hdcp topo info 36->scaling 37->auto-frm-mode 38->display enabled 39->is bestmode"
+         " 40->Rx supported hdr list\n");
         len = scanf("%d",&get);
         if (get == 0 && len == 1) {
             ENUM_DISPLAY_HDR_POLICY value = getDisplayHDRPolicy( DISPLAY_CONNECTOR_HDMIA);
@@ -586,6 +587,23 @@
                    printf("\n get best mode status value %d (is.bestmode: false)\n",value);
                }
             }
+        } else if (get == 40 && len == 1) {
+            uint32_t value  = getDisplayRxSupportHdrList(DISPLAY_CONNECTOR_HDMIA);
+            printf("\n value %d\n",value);
+            if (value & 0x1)
+                printf("\n MESON_DRM_HDR10PLUS\n");
+            if (value & 0x2)
+                printf("\n MESON_DRM_DOLBYVISION_STD\n");
+            if (value & 0x4)
+                printf("\n MESON_DRM_DOLBYVISION_LL\n");
+            if (value & 0x8)
+                printf("\n MESON_DRM_HDR10_ST2084\n");
+            if (value & 0x10)
+                printf("\n MESON_DRM_HDR10_TRADITIONAL\n");
+            if (value & 0x20)
+                printf("\n MESON_DRM_HDR_HLG\n");
+            if (value & 0x40)
+                printf("\n MESON_DRM_SDR\n");
         }
     }
     else {