meson-display: HDMI output enable/disable and get hdcp version [1/1]
PD#SWPL-163440
Problem:
Add HDMI output enable/disable and get hdcp version
Solution:
add HDMI output enable/disable and get hdcp version API
Verify:
AH212
Change-Id: I193026d47bfec075c2bd14cf3a452ed2f19b2c08
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 961e7b2..d3c574f 100644
--- a/display_framework/src/extension/display_settings/display_settings.h
+++ b/display_framework/src/extension/display_settings/display_settings.h
@@ -175,6 +175,8 @@
int getDisplaySignalTimingInfo(uint16_t* htotal, uint16_t* vtotal, uint16_t* hstart,
uint16_t* vstart, DISPLAY_CONNECTOR_TYPE connType);
int getDisplayIsBestMode(int* value);
+int setDisplayPlaneMute(unsigned int plane_type, unsigned int plane_mute);
+int getDisplayRxSupportedHdcpVersion(DISPLAY_CONNECTOR_TYPE connType);
int display_meson_get_open();
int display_meson_set_open();
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 1a8fa7a..d45e3f2 100644
--- a/display_framework/src/extension/display_settings/displayattribute/display_attribute.c
+++ b/display_framework/src/extension/display_settings/displayattribute/display_attribute.c
@@ -236,7 +236,7 @@
int getDisplayModesList(DisplayModeInfo** modeInfo, int* modeCount,DISPLAY_CONNECTOR_TYPE connType) {
int fd = 0;
int ret = -1;
- if (modeInfo == NULL || *modeInfo == NULL || modeCount == NULL) {
+ if (modeInfo == NULL || modeCount == NULL) {
ERROR(" %s %d invalid parameter return",__FUNCTION__,__LINE__);
return ret;
}
@@ -734,3 +734,15 @@
meson_close_drm(fd);
return ret;
}
+
+/* return 1: HDCP 1.4 supported*/
+/* return 2: HDCP 2.2 supported*/
+/* return 3: HDCP 1.4 and 2.2 all support*/
+int getDisplayRxSupportedHdcpVersion(DISPLAY_CONNECTOR_TYPE connType) {
+ int fd = display_meson_get_open();
+ int value = meson_drm_getRxSupportedHdcpVersion(fd, connType);
+ meson_close_drm(fd);
+ DEBUG("%s %d get prop_value %d",__FUNCTION__,__LINE__, value);
+ return value;
+}
+
diff --git a/display_framework/src/extension/display_settings/meson/meson_settings.c b/display_framework/src/extension/display_settings/meson/meson_settings.c
index 265de37..6e1859a 100644
--- a/display_framework/src/extension/display_settings/meson/meson_settings.c
+++ b/display_framework/src/extension/display_settings/meson/meson_settings.c
@@ -769,3 +769,16 @@
return ret;
}
+int setDisplayPlaneMute(unsigned int plane_type, unsigned int plane_mute) {
+ int res = -1;
+ int fd = -1;
+ DEBUG("%s %d set plane_type: %d plane_mute:%d",__FUNCTION__,__LINE__,plane_type,plane_mute);
+ fd = display_meson_set_open();
+ res = meson_drm_setPlaneMute(fd, plane_type, plane_mute);
+ if (res) {
+ ERROR("%s %d set plane mute fail",__FUNCTION__,__LINE__);
+ }
+ meson_close_drm(fd);
+ return res;
+}
+
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 697519b..362329d 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
@@ -45,7 +45,7 @@
if (select_s == 0 && select_len == 1) {
printf("set:0->hdmi mode 1->cvbs mode 2->hdr policy 3->av mute 4->HDMI HDCP enable 5-><colorDepth, colorSpace>"
"6->HDCP Content Type 7->DvEnable 8->active 9->vrr Enable 10->auto mode 11->dummy mode 12->aspect ratio"
- "13->mode attr 14->FunctionAttribute 15->video zorder 16->dv mode\n");
+ "13->mode attr 14->FunctionAttribute 15->video zorder 16->dv mode 17->plane mute \n");
len = scanf("%d",&set);
if (set == 0 && len == 1) {
printf("please input modeInfo:interlace, w, h, vrefresh\n");
@@ -55,6 +55,9 @@
}else{
printf("setDisplayModeFail\n");
}
+ if (modeInfo) {
+ free(modeInfo);
+ }
} else if(set == 1 && len == 1){
printf("please input modeInfo:interlace, w, h, vrefresh\n");
scanf("%d %d %d %d",&modeInfo->interlace,&modeInfo->w, &modeInfo->h,&modeInfo->vrefresh);
@@ -63,6 +66,9 @@
}else{
printf("setDisplayModeFail\n");
}
+ if (modeInfo) {
+ free(modeInfo);
+ }
} else if (set == 2 && len == 1) {
/*
* setDisplayHDRPolicy API hdrPolicy Parameter Description
@@ -177,6 +183,9 @@
}else{
printf("setModeFail\n");
}
+ if (modeInfo) {
+ free(modeInfo);
+ }
} else if (set == 12 && len == 1 ) {
printf("\n aspect ratio:\n");
int ASPECTRATIO =-1;
@@ -209,6 +218,9 @@
} else {
printf("\n setDisplayModeAttr Fail!\n");
}
+ if (modeInfo) {
+ free(modeInfo);
+ }
} else if (set == 14 && len == 1) {
int policy = 0;
int colorDepth = 0;
@@ -245,6 +257,22 @@
}else{
printf("setDisplayDvMode Fail\n");
}
+ } else if (set == 17 && len == 1) {
+ printf("\ninput:plane_type:1 plane_mute:1 -> display black screen \n"
+ "plane_type:1 plane_mute:0 -> normal display \n");
+ printf("\n please enter the parameters in order(plane_type plane_mute): \n");
+ int plane_type = 0; /* 0:osd plane, 1:video plane */
+ int plane_mute = 0; /* 0:umute plane, 1:mute plane */
+ len = scanf("%d %d",&plane_type,&plane_mute);
+ if (len == 2) {
+ if (setDisplayPlaneMute(plane_type, plane_mute) == 0) {
+ printf("\n setDisplayPlaneMute Success\n");
+ } else {
+ printf("setDisplayPlaneMute Fail\n");
+ }
+ } else {
+ printf("\n \ scanf fail \n");
+ }
}
}
else if(select_s == 1 && select_len == 1) {
@@ -253,7 +281,7 @@
" 12->Dv Enable 13->active 14->vrr Enable 15->av mute 16->hdr mode 17->CvbsModesList 18-> mode support check"
" 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 \n");
+ " 29->physical size 30->Timing information 31->dv mode 32->rx supported hdcp version\n");
len = scanf("%d",&get);
if (get == 0 && len == 1) {
ENUM_DISPLAY_HDR_POLICY value = getDisplayHDRPolicy( DISPLAY_CONNECTOR_HDMIA);
@@ -266,6 +294,8 @@
} else {
printf("\n getDisplayModeFail\n");
}
+ if (modeInfo)
+ free(modeInfo);
} else if(get == 2 && len == 1) {
/*Rx and Tx successful authentication after get hdcp_version*/
ENUM_DISPLAY_HDCP_VERSION value = getDisplayHdcpVersion( DISPLAY_CONNECTOR_HDMIA);
@@ -306,11 +336,12 @@
" DISPLAY_AUTH_STATUS_SUCCESS = 1 \n value:%d\n", value);
} else if (get == 8 && len == 1) {
int count = 0;
+ DisplayModeInfo* modeInfo = NULL;
if (0 == getDisplayModesList( &modeInfo, &count,DISPLAY_CONNECTOR_HDMIA )) {
printf("\n mode count:%d\n",count);
int i = 0;
for (int i=0; i<count; i++) {
- printf(" (%s %d %d %d %d)\n", modeInfo[i].name, modeInfo[i].w, modeInfo[i].h, modeInfo[i].interlace,modeInfo[i].vrefresh);
+ printf("mode (%s %d %d %d %d)\n", modeInfo[i].name, modeInfo[i].w, modeInfo[i].h, modeInfo[i].interlace,modeInfo[i].vrefresh);
}
if (modeInfo)
free(modeInfo);
@@ -365,11 +396,12 @@
, value);
} else if (get == 17 && len == 1) {
int count = 0;
+ DisplayModeInfo* modeInfo = NULL;
if (getDisplayModesList( &modeInfo, &count,DISPLAY_CONNECTOR_CVBS ) == 0) {
printf("\n mode count:%d\n",count);
int i = 0;
for (int i=0; i< count; i++) {
- printf(" (%s %d %d %d %d)\n", modeInfo[i].name, modeInfo[i].w, modeInfo[i].h, modeInfo[i].interlace,modeInfo[i].vrefresh);
+ printf("mode (%s %d %d %d %d)\n", modeInfo[i].name, modeInfo[i].w, modeInfo[i].h, modeInfo[i].interlace,modeInfo[i].vrefresh);
}
if (modeInfo)
free(modeInfo);
@@ -454,12 +486,12 @@
} else {
printf("\n getDisplaySupportAttrList Fail");
}
- free(modeInfo);
+ if (modeInfo)
+ free(modeInfo);
} else if(get == 27 && len == 1) {
//name:FRAC_RATE_POLICY value:0 整数mode, value:1 小数mode , 大部分情况下默认开机是小数
float value = getDisplayFrameRate(DISPLAY_CONNECTOR_HDMIA);
printf("\n get framrate %.2f",value);
- free(modeInfo);
} else if(get == 28 && len == 1) {
int width = 0;
int height = 0;
@@ -496,6 +528,20 @@
} else {
printf("\n get dv mode value: %d\n",value);
}
+ } else if (get == 32 && len == 1) {
+ int value = getDisplayRxSupportedHdcpVersion(DISPLAY_CONNECTOR_HDMIA );
+ if (value & 0x1) {
+ printf("\nRX HDCP 1.4 supported \n");
+ if (value & 0x2) {
+ printf("RX HDCP 2.2 supported as well\n");
+ } else {
+ printf("RX HDCP 2.2 not supported\n");
+ }
+ } else {
+ if (!(value & 0x2)) {
+ printf("\n get_prop fail\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 760e20a..a982ffa 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
@@ -55,6 +55,9 @@
}else{
printf("setDisplayModeFail\n");
}
+ if (modeInfo) {
+ free(modeInfo);
+ }
} else if(set == 1 && len == 1){
printf("please input modeInfo:interlace, w, h, vrefresh\n");
scanf("%d %d %d %d",&modeInfo->interlace,&modeInfo->w, &modeInfo->h,&modeInfo->vrefresh);
@@ -63,6 +66,9 @@
}else{
printf("setDisplayModeFail\n");
}
+ if (modeInfo) {
+ free(modeInfo);
+ }
} else if (set == 2 && len == 1) {
/*
* setDisplayHDRPolicy API hdrPolicy Parameter Description
@@ -177,6 +183,9 @@
}else{
printf("setModeFail\n");
}
+ if (modeInfo) {
+ free(modeInfo);
+ }
} else if (set == 12 && len == 1 ) {
printf("\n aspect ratio:\n");
int ASPECTRATIO =-1;
@@ -230,7 +239,8 @@
" 12->Dv Enable 13->active 14->vrr Enable 15->av mute 16->hdr mode 17->CvbsModesList 18-> mode support check"
"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\n");
+ " 30->primar plane fb size 31->physical size 32->Timing information 33->is bestmode 34->dv mode "
+ " 35->rx supported hdcp version\n");
len = scanf("%d",&get);
if (get == 0 && len == 1) {
ENUM_DISPLAY_HDR_POLICY value = getDisplayHDRPolicy( DISPLAY_CONNECTOR_HDMIA);
@@ -243,7 +253,8 @@
} else {
printf("\n getDisplayModeFail\n");
}
- free(modeInfo);
+ if (modeInfo)
+ free(modeInfo);
} else if(get == 2 && len == 1) {
ENUM_DISPLAY_HDCP_VERSION value = getDisplayHdcpVersion( DISPLAY_CONNECTOR_HDMIA);
printf("\n DISPLAY_HDCP_14 = 0\n"
@@ -283,11 +294,12 @@
" DISPLAY_AUTH_STATUS_SUCCESS = 1 \n value:%d\n", value);
} else if (get == 8 && len == 1) {
int count = 0;
+ DisplayModeInfo* modeInfo = NULL;
if (0 == getDisplayModesList( &modeInfo, &count,DISPLAY_CONNECTOR_HDMIA )) {
printf("\n mode count:%d\n",count);
int i = 0;
for (int i=0; i<count; i++) {
- printf(" (%s %d %d %d %d)\n", modeInfo[i].name, modeInfo[i].w, modeInfo[i].h, modeInfo[i].interlace,modeInfo[i].vrefresh);
+ printf("mode (%s %d %d %d %d)\n", modeInfo[i].name, modeInfo[i].w, modeInfo[i].h, modeInfo[i].interlace,modeInfo[i].vrefresh);
}
if (modeInfo)
free(modeInfo);
@@ -342,6 +354,7 @@
, value);
} else if (get == 17 && len == 1) {
int count = 0;
+ DisplayModeInfo* modeInfo = NULL;
if (getDisplayModesList( &modeInfo, &count,DISPLAY_CONNECTOR_CVBS ) == 0) {
printf("\n mode count:%d\n",count);
int i = 0;
@@ -447,12 +460,12 @@
} else {
printf("\n getDisplaySupportAttrList Fail\n");
}
- free(modeInfo);
+ if (modeInfo)
+ free(modeInfo);
} else if(get == 29 && len == 1) {
//name:FRAC_RATE_POLICY value:0 整数mode, value:1 小数mode , 大部分情况下默认开机是小数
float value = getDisplayFrameRate( DISPLAY_CONNECTOR_HDMIA);
printf("\n get framrate %.2f\n",value);
- free(modeInfo);
} else if(get == 30 && len == 1) {
int width = 0;
int height = 0;
@@ -496,6 +509,20 @@
} else {
printf("\n get dv mode value: %d\n",value);
}
+ } else if (get == 35 && len == 1) {
+ int value = getDisplayRxSupportedHdcpVersion(DISPLAY_CONNECTOR_HDMIA );
+ if (value & 0x1) {
+ printf("\nRX HDCP 1.4 supported \n");
+ if (value & 0x2) {
+ printf("RX HDCP 2.2 supported as well\n");
+ } else {
+ printf("RX HDCP 2.2 not supported\n");
+ }
+ } else {
+ if (!(value & 0x2)) {
+ printf("\n get_prop fail\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 5c1b469..109b988 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
@@ -51,7 +51,7 @@
" 12->Dv Enable 13->active 14->vrr Enable 15->av mute 16->hdr mode 17->CvbsModesList 18-> mode support check"
"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->dv mode\n");
+ " 30->primar plane fb size 31->physical size 32->Timing information 33->dv mode 34->rx supported hdcp version\n");
len = scanf("%d",&get);
if (get == 0 && len == 1) {
ENUM_DISPLAY_HDR_POLICY value = getDisplayHDRPolicy( DISPLAY_CONNECTOR_HDMIA);
@@ -63,6 +63,8 @@
} else {
printf("\n getDisplayModeFail\n");
}
+ if (modeInfo)
+ free(modeInfo);
} else if(get == 2 && len == 1) {
ENUM_DISPLAY_HDCP_VERSION value = getDisplayHdcpVersion( DISPLAY_CONNECTOR_HDMIA);
printf("\n DISPLAY_HDCP_14 = 0\n"
@@ -102,11 +104,12 @@
" DISPLAY_AUTH_STATUS_SUCCESS = 1 \n value:%d\n", value);
} else if (get == 8 && len == 1) {
int count = 0;
+ DisplayModeInfo* modeInfo = NULL;
if (0 == getDisplayModesList( &modeInfo, &count,DISPLAY_CONNECTOR_HDMIA )) {
printf("\n mode count:%d\n",count);
int i = 0;
for (int i=0; i<count; i++) {
- printf(" (%s %d %d %d %d)\n", modeInfo[i].name, modeInfo[i].w, modeInfo[i].h, modeInfo[i].interlace,modeInfo[i].vrefresh);
+ printf("mode (%s %d %d %d %d)\n", modeInfo[i].name, modeInfo[i].w, modeInfo[i].h, modeInfo[i].interlace,modeInfo[i].vrefresh);
}
if (modeInfo)
free(modeInfo);
@@ -161,6 +164,7 @@
, value);
} else if (get == 17 && len == 1) {
int count = 0;
+ DisplayModeInfo* modeInfo = NULL;
if (getDisplayModesList( &modeInfo, &count,DISPLAY_CONNECTOR_CVBS ) == 0) {
printf("\n mode count:%d\n",count);
int i = 0;
@@ -254,11 +258,11 @@
} else {
printf("\n getDisplaySupportAttrList Fail");
}
- free(modeInfo);
+ if (modeInfo)
+ free(modeInfo);
} else if(get == 29 && len == 1) {
float value = getDisplayFrameRate( DISPLAY_CONNECTOR_HDMIA);
printf("\n get framrate %.2f",value);
- free(modeInfo);
} else if(get == 30 && len == 1) {
int width = 0;
int height = 0;
@@ -295,6 +299,20 @@
} else {
printf("\n get dv mode value: %d\n",value);
}
+ } else if (get == 34 && len == 1) {
+ int value = getDisplayRxSupportedHdcpVersion(DISPLAY_CONNECTOR_HDMIA );
+ if (value & 0x1) {
+ printf("\nRX HDCP 1.4 supported \n");
+ if (value & 0x2) {
+ printf("RX HDCP 2.2 supported as well\n");
+ } else {
+ printf("RX HDCP 2.2 not supported\n");
+ }
+ } else {
+ if (!(value & 0x2)) {
+ printf("\n get_prop fail\n");
+ }
+ }
}
}
else {