35 #include <sys/types.h>
45 #include "libIBusDaemon.h"
51 #include "hostPersistence.hpp"
52 #include "dsserverlogger.h"
54 #include "dsVideoPortSettings.h"
56 #include "safec_lib.h"
58 #ifdef DEVICESETTINGS_DEFAULT_RESOLUTION
59 #define DEFAULT_RESOLUTION DEVICESETTINGS_DEFAULT_RESOLUTION
61 #define DEFAULT_RESOLUTION "720p"
63 #define DEFAULT_SD_RESOLUTION "480i"
65 static int m_isInitialized = 0;
66 static int m_isPlatInitialized = 0;
67 static pthread_mutex_t dsLock = PTHREAD_MUTEX_INITIALIZER;
68 static std::string _dsHDMIResolution(DEFAULT_RESOLUTION);
69 static std::string _dsCompResolution(DEFAULT_RESOLUTION);
70 static std::string _dsBBResolution(DEFAULT_SD_RESOLUTION);
71 static std::string _dsRFResolution(DEFAULT_SD_RESOLUTION);
73 static bool force_disable_4K =
false;
74 extern bool enableHDRDVStatus;
75 static const dsDisplayColorDepth_t DEFAULT_COLOR_DEPTH = dsDISPLAY_COLORDEPTH_AUTO;
76 static dsDisplayColorDepth_t hdmiColorDept = DEFAULT_COLOR_DEPTH;
78 #define IARM_BUS_Lock(lock) pthread_mutex_lock(&dsLock)
79 #define IARM_BUS_Unlock(lock) pthread_mutex_unlock(&dsLock)
81 IARM_Result_t _dsVideoPortInit(
void *arg);
82 IARM_Result_t _dsGetVideoPort(
void *arg);
83 IARM_Result_t _dsIsVideoPortEnabled(
void *arg);
84 IARM_Result_t _dsIsDisplayConnected(
void *arg);
85 IARM_Result_t _dsIsDisplaySurround(
void *arg);
86 IARM_Result_t _dsGetSurroundMode(
void *arg);
87 IARM_Result_t _dsEnableVideoPort(
void *arg);
88 IARM_Result_t _dsSetResolution(
void *arg);
89 IARM_Result_t _dsGetResolution(
void *arg);
90 IARM_Result_t _dsColorDepthCapabilities(
void *arg);
91 IARM_Result_t _dsGetPreferredColorDepth(
void *arg);
92 IARM_Result_t _dsSetPreferredColorDepth(
void *arg);
93 IARM_Result_t _dsVideoPortTerm(
void *arg);
94 IARM_Result_t _dsEnableHDCP(
void *arg);
95 IARM_Result_t _dsIsHDCPEnabled(
void *arg);
96 IARM_Result_t _dsGetHDCPStatus(
void *arg);
97 IARM_Result_t _dsGetHDCPProtocol(
void *arg);
98 IARM_Result_t _dsGetHDCPReceiverProtocol(
void *arg);
99 IARM_Result_t _dsGetHDCPCurrentProtocol(
void *arg);
100 IARM_Result_t _dsIsVideoPortActive(
void *arg);
101 IARM_Result_t _dsGetTVHDRCapabilities(
void *arg);
102 IARM_Result_t _dsSupportedTvResolutions(
void *arg);
103 IARM_Result_t _dsSetForceDisable4K(
void *arg);
104 IARM_Result_t _dsGetForceDisable4K(
void *arg);
105 IARM_Result_t _dsSetScartParameter(
void *arg);
106 IARM_Result_t _dsIsOutputHDR(
void *arg);
107 IARM_Result_t _dsResetOutputToSDR(
void *arg);
108 IARM_Result_t _dsSetHdmiPreference(
void *arg);
109 IARM_Result_t _dsGetHdmiPreference(
void *arg);
110 IARM_Result_t _dsGetVideoEOTF(
void *arg);
111 IARM_Result_t _dsGetMatrixCoefficients(
void* arg);
112 IARM_Result_t _dsGetColorDepth(
void* arg);
113 IARM_Result_t _dsGetColorSpace(
void* arg);
114 IARM_Result_t _dsGetQuantizationRange(
void* arg);
115 IARM_Result_t _dsGetCurrentOutputSettings(
void* arg);
116 IARM_Result_t _dsSetBackgroundColor(
void *arg);
117 IARM_Result_t _dsSetForceHDRMode(
void *arg);
118 IARM_Result_t _dsGetIgnoreEDIDStatus(
void *arg);
126 void _dsHdcpCallback(intptr_t handle, dsHdcpStatus_t event);
128 void resetColorDepthOnHdmiReset(intptr_t handle);
129 static dsDisplayColorDepth_t getPersistentColorDepth ();
130 static dsDisplayColorDepth_t getBestSupportedColorDepth (intptr_t handle, dsDisplayColorDepth_t inColorDepth);
133 static IARM_Result_t setPreferredColorDepth(
void *arg);
134 static dsError_t handleDsColorDepthCapabilities(intptr_t handle,
unsigned int *colorDepthCapability );
135 static dsError_t handleDsGetPreferredColorDepth(intptr_t handle, dsDisplayColorDepth_t *colorDepth,
bool persist);
136 static dsError_t handleDsSetPreferredColorDepth(intptr_t handle,dsDisplayColorDepth_t colorDepth,
bool persist);
138 #define IsHDCompatible(p) (((p) >= dsVIDEO_PIXELRES_1280x720 ) && ((p) < dsVIDEO_PIXELRES_MAX))
143 void VideoConfigInit()
148 resetColorDepthOnHdmiReset(handle);
150 __TIMESTAMP();printf(
"HDMI get port handle failed %d \r\n", eRet);
154 IARM_Result_t dsVideoPortMgr_init()
157 std::string _Resolution(DEFAULT_RESOLUTION);
168 __TIMESTAMP();printf(
"The Persistent HDMI resolution read is %s \r\n",_dsHDMIResolution.c_str());
169 #ifdef HAS_ONLY_COMPOSITE
170 _Resolution = DEFAULT_RESOLUTION;
173 _Resolution = DEFAULT_RESOLUTION;
176 __TIMESTAMP();printf(
"The Persistent Component/Composite resolution read is %s \r\n",_dsCompResolution.c_str());
178 __TIMESTAMP();printf(
"The Persistent RF resolution read is %s \r\n",_dsRFResolution.c_str());
180 __TIMESTAMP();printf(
"The Persistent BB resolution read is %s \r\n",_dsBBResolution.c_str());
182 if (!m_isPlatInitialized)
189 m_isPlatInitialized ++;
193 printf(
"Error in Getting the Video Resolution on Startup..... \r\n");
197 std::string _4K_setting(
"false");
199 if (_4K_setting.compare(
"true") == 0)
201 force_disable_4K =
true;
202 printf(
"4K support in disabled configuration.\n");
206 force_disable_4K =
false;
211 printf(
"Exception in getting force-disable-4K setting at start up.\r\n");
213 IARM_BUS_Unlock(lock);
215 return IARM_RESULT_SUCCESS;
218 IARM_Result_t dsVideoPortMgr_term()
220 return IARM_RESULT_SUCCESS;
224 IARM_Result_t _dsVideoPortInit(
void *arg)
228 if (!m_isInitialized) {
230 #ifdef HAS_HDCP_CALLBACK
271 dsError_t eRet = _dsVideoFormatUpdateRegisterCB (_dsVideoFormatUpdateCB) ;
273 printf (
"%s: _dsVideoFormatUpdateRegisterCB eRet:%04x", __FUNCTION__, eRet);
278 if (!m_isPlatInitialized) {
283 m_isPlatInitialized++;
285 IARM_BUS_Unlock(lock);
287 return IARM_RESULT_SUCCESS;
291 IARM_Result_t _dsGetVideoPort(
void *arg)
300 IARM_BUS_Unlock(lock);
301 return IARM_RESULT_SUCCESS;
304 IARM_Result_t _dsIsVideoPortEnabled(
void *arg)
312 IARM_BUS_Unlock(lock);
314 return IARM_RESULT_SUCCESS;
317 IARM_Result_t _dsIsVideoPortActive(
void *arg)
333 param->active =
true;
338 param->active =
true;
342 IARM_BUS_Unlock(lock);
344 return IARM_RESULT_SUCCESS;
347 IARM_Result_t _dsGetVideoEOTF(
void* arg)
349 #ifndef RDK_DSHAL_NAME
350 #warning "RDK_DSHAL_NAME is not defined"
351 #define RDK_DSHAL_NAME "RDK_DSHAL_NAME is not defined"
357 static dsGetVideoEOTF_t func = 0;
359 void *dllib = dlopen(RDK_DSHAL_NAME, RTLD_LAZY);
361 func = (dsGetVideoEOTF_t) dlsym(dllib,
"dsGetVideoEOTF");
363 printf(
"dsGetVideoEOTF_t(int, dsHDRStandard_t*) is defined and loaded\r\n");
366 printf(
"dsGetVideoEOTF_t(int, dsHDRStandard_t*) is not defined\r\n");
371 printf(
"Opening RDK_DSHAL_NAME [%s] failed\r\n", RDK_DSHAL_NAME);
378 param->result = func(param->handle, ¶m->video_eotf);
384 IARM_BUS_Unlock(lock);
386 return IARM_RESULT_SUCCESS;
389 IARM_Result_t _dsGetMatrixCoefficients(
void* arg)
391 #ifndef RDK_DSHAL_NAME
392 #warning "RDK_DSHAL_NAME is not defined"
393 #define RDK_DSHAL_NAME "RDK_DSHAL_NAME is not defined"
398 typedef dsError_t (*dsGetMatrixCoefficients_t)(intptr_t handle, dsDisplayMatrixCoefficients_t* matrix_coefficients);
399 static dsGetMatrixCoefficients_t func = 0;
401 void *dllib = dlopen(RDK_DSHAL_NAME, RTLD_LAZY);
403 func = (dsGetMatrixCoefficients_t) dlsym(dllib,
"dsGetMatrixCoefficients");
405 printf(
"dsGetMatrixCoefficients_t(int, dsDisplayMatrixCoefficients_t*) is defined and loaded\r\n");
408 printf(
"dsGetMatrixCoefficients_t(int, dsDisplayMatrixCoefficients_t*) is not defined\r\n");
413 printf(
"Opening RDK_DSHAL_NAME [%s] failed\r\n", RDK_DSHAL_NAME);
420 param->result = func(param->handle, ¶m->matrix_coefficients);
423 param->matrix_coefficients = dsDISPLAY_MATRIXCOEFFICIENT_UNKNOWN;
426 IARM_BUS_Unlock(lock);
428 return IARM_RESULT_SUCCESS;
431 IARM_Result_t _dsGetColorDepth(
void* arg)
433 #ifndef RDK_DSHAL_NAME
434 #warning "RDK_DSHAL_NAME is not defined"
435 #define RDK_DSHAL_NAME "RDK_DSHAL_NAME is not defined"
440 typedef dsError_t (*dsGetColorDepth_t)(intptr_t handle,
unsigned int* color_depth);
441 static dsGetColorDepth_t func = 0;
443 void *dllib = dlopen(RDK_DSHAL_NAME, RTLD_LAZY);
445 func = (dsGetColorDepth_t) dlsym(dllib,
"dsGetColorDepth");
447 printf(
"dsGetColorDepth_t(int, unsigned int*) is defined and loaded\r\n");
450 printf(
"dsGetColorDepth_t(int, unsigned int*) is not defined\r\n");
455 printf(
"Opening RDK_DSHAL_NAME [%s] failed\r\n", RDK_DSHAL_NAME);
462 param->result = func(param->handle, ¶m->color_depth);
465 param->color_depth = 0;
468 IARM_BUS_Unlock(lock);
470 return IARM_RESULT_SUCCESS;
473 IARM_Result_t _dsGetColorSpace(
void* arg)
475 #ifndef RDK_DSHAL_NAME
476 #warning "RDK_DSHAL_NAME is not defined"
477 #define RDK_DSHAL_NAME "RDK_DSHAL_NAME is not defined"
482 typedef dsError_t (*dsGetColorSpace_t)(intptr_t handle, dsDisplayColorSpace_t* color_space);
483 static dsGetColorSpace_t func = 0;
485 void *dllib = dlopen(RDK_DSHAL_NAME, RTLD_LAZY);
487 func = (dsGetColorSpace_t) dlsym(dllib,
"dsGetColorSpace");
489 printf(
"dsGetColorSpace_t(int, dsDisplayColorSpace_t*) is defined and loaded\r\n");
492 printf(
"dsGetColorSpace_t(int, dsDisplayColorSpace_t*) is not defined\r\n");
497 printf(
"Opening RDK_DSHAL_NAME [%s] failed\r\n", RDK_DSHAL_NAME);
504 param->result = func(param->handle, ¶m->color_space);
507 param->color_space = dsDISPLAY_COLORSPACE_UNKNOWN;
510 IARM_BUS_Unlock(lock);
512 return IARM_RESULT_SUCCESS;
515 IARM_Result_t _dsGetQuantizationRange(
void* arg)
517 #ifndef RDK_DSHAL_NAME
518 #warning "RDK_DSHAL_NAME is not defined"
519 #define RDK_DSHAL_NAME "RDK_DSHAL_NAME is not defined"
524 typedef dsError_t (*dsGetQuantizationRange_t)(intptr_t handle, dsDisplayQuantizationRange_t* quantization_range);
525 static dsGetQuantizationRange_t func = 0;
527 void *dllib = dlopen(RDK_DSHAL_NAME, RTLD_LAZY);
529 func = (dsGetQuantizationRange_t) dlsym(dllib,
"dsGetQuantizationRange");
531 printf(
"dsGetQuantizationRange_t(int, dsDisplayQuantizationRange_t*) is defined and loaded\r\n");
534 printf(
"dsGetQuantizationRange_t(int, dsDisplayQuantizationRange_t*) is not defined\r\n");
539 printf(
"Opening RDK_DSHAL_NAME [%s] failed\r\n", RDK_DSHAL_NAME);
546 param->result = func(param->handle, ¶m->quantization_range);
549 param->quantization_range = dsDISPLAY_QUANTIZATIONRANGE_UNKNOWN;
552 IARM_BUS_Unlock(lock);
554 return IARM_RESULT_SUCCESS;
557 IARM_Result_t _dsGetCurrentOutputSettings(
void* arg)
559 #ifndef RDK_DSHAL_NAME
560 #warning "RDK_DSHAL_NAME is not defined"
561 #define RDK_DSHAL_NAME "RDK_DSHAL_NAME is not defined"
566 typedef dsError_t (*dsGetCurrentOutputSettings_t)(intptr_t handle,
dsHDRStandard_t* video_eotf, dsDisplayMatrixCoefficients_t* matrix_coefficients, dsDisplayColorSpace_t* color_space,
unsigned int* color_depth, dsDisplayQuantizationRange_t* quantization_range);
567 static dsGetCurrentOutputSettings_t func = 0;
569 void *dllib = dlopen(RDK_DSHAL_NAME, RTLD_LAZY);
571 func = (dsGetCurrentOutputSettings_t) dlsym(dllib,
"dsGetCurrentOutputSettings");
573 printf(
"dsGetCurrentOutputSettings_t(int, dsHDRStandard_t*, dsDisplayMatrixCoefficients_t*, dsDisplayColorSpace_t*, unsigned int*, dsDisplayQuantizationRange_t*) is defined and loaded\r\n");
576 printf(
"dsGetCurrentOutputSettings_t(int, dsHDRStandard_t*, dsDisplayMatrixCoefficients_t*, dsDisplayColorSpace_t*, unsigned int*, dsDisplayQuantizationRange_t*) is not defined\r\n");
581 printf(
"Opening RDK_DSHAL_NAME [%s] failed\r\n", RDK_DSHAL_NAME);
588 param->result = func(param->handle, ¶m->video_eotf, ¶m->matrix_coefficients, ¶m->color_space, ¶m->color_depth, ¶m->quantization_range);
591 param->color_space = dsDISPLAY_COLORSPACE_UNKNOWN;
592 param->color_depth = 0;
593 param->matrix_coefficients = dsDISPLAY_MATRIXCOEFFICIENT_UNKNOWN;
595 param->quantization_range = dsDISPLAY_QUANTIZATIONRANGE_UNKNOWN;
598 IARM_BUS_Unlock(lock);
600 return IARM_RESULT_SUCCESS;
603 IARM_Result_t _dsIsHDCPEnabled(
void *arg)
613 __TIMESTAMP();printf(
"isHDCP =true !!!!!!..\r\n");
616 __TIMESTAMP();printf(
"isHDCP =false !!!!!!..\r\n");
620 IARM_BUS_Unlock(lock);
622 return IARM_RESULT_SUCCESS;
625 IARM_Result_t _dsIsDisplayConnected(
void *arg)
633 IARM_BUS_Unlock(lock);
635 return IARM_RESULT_SUCCESS;
638 IARM_Result_t _dsIsDisplaySurround(
void *arg)
641 #ifndef RDK_DSHAL_NAME
642 #warning "RDK_DSHAL_NAME is not defined"
643 #define RDK_DSHAL_NAME "RDK_DSHAL_NAME is not defined"
649 printf(
"dsSRV::_dsIsDisplaySurround \r\n");
651 typedef dsError_t (*dsIsDisplaySurround_t)(intptr_t handle,
bool *surround);
652 static dsIsDisplaySurround_t func = 0;
654 void *dllib = dlopen(RDK_DSHAL_NAME, RTLD_LAZY);
656 func = (dsIsDisplaySurround_t) dlsym(dllib,
"dsIsDisplaySurround");
658 printf(
"dsIsDisplaySurround_t(int, bool*) is defined and loaded\r\n");
661 printf(
"dsIsDisplaySurround_t(int, bool*) is not defined\r\n");
666 printf(
"Opening RDK_DSHAL_NAME [%s] failed\r\n", RDK_DSHAL_NAME);
673 dsError_t ret = func(param->handle, ¶m->surround);
674 printf(
"dsSRV ::isDisplaySurround() returns %d %d\r\n", ret, param->surround);
677 param->surround =
false;
680 IARM_BUS_Unlock(lock);
682 return IARM_RESULT_SUCCESS;
685 IARM_Result_t _dsGetSurroundMode(
void *arg)
688 #ifndef RDK_DSHAL_NAME
689 #warning "RDK_DSHAL_NAME is not defined"
690 #define RDK_DSHAL_NAME "RDK_DSHAL_NAME is not defined"
696 printf(
"dsSRV::_dsGetSurroundMode \r\n");
698 typedef dsError_t (*dsGetSurroundMode_t)(intptr_t handle,
int *surround);
699 static dsGetSurroundMode_t func = 0;
701 void *dllib = dlopen(RDK_DSHAL_NAME, RTLD_LAZY);
703 func = (dsGetSurroundMode_t) dlsym(dllib,
"dsGetSurroundMode");
705 printf(
"dsGetSurroundMode_t(int, int*) is defined and loaded\r\n");
708 printf(
"dsGetSurroundMode_t(int, int*) is not defined\r\n");
713 printf(
"Opening RDK_DSHAL_NAME [%s] failed\r\n", RDK_DSHAL_NAME);
720 dsError_t ret = func(param->handle, ¶m->surround);
721 printf(
"dsSRV ::_dsGetSurroundMode() returns %d %d\r\n", ret, param->surround);
724 param->surround = dsSURROUNDMODE_NONE;
727 IARM_BUS_Unlock(lock);
728 return IARM_RESULT_SUCCESS;
731 IARM_Result_t _dsEnableVideoPort(
void *arg)
739 IARM_BUS_Unlock(lock);
741 return IARM_RESULT_SUCCESS;
744 IARM_Result_t _dsGetResolution(
void *arg)
752 std::string _Resolution(DEFAULT_RESOLUTION);
764 __TIMESTAMP();printf(
"Reading HDMI persistent resolution %s\r\n",_Resolution.c_str());
769 _Resolution = resolution->
name;
770 __TIMESTAMP();printf(
"ResOverride platform reported resolution is: %s. Cached resolution is: %s\r\n",_Resolution.c_str(), _dsHDMIResolution.c_str());
773 _Resolution = _dsHDMIResolution;
779 if(param->toPersist){
780 #ifdef HAS_ONLY_COMPOSITE
785 __TIMESTAMP();printf(
"Reading Component persistent resolution %s\r\n",_Resolution.c_str());
788 _Resolution = _dsCompResolution;
793 if(param->toPersist){
795 __TIMESTAMP();printf(
"Reading BB persistent resolution %s\r\n",_Resolution.c_str());
798 _Resolution = _dsBBResolution;
803 if(param->toPersist){
805 __TIMESTAMP();printf(
"Reading RF persistent resolution %s\r\n",_Resolution.c_str());
808 _Resolution = _dsRFResolution;
811 rc = strcpy_s(resolution->
name,
sizeof(resolution->
name),_Resolution.c_str());
816 printf(
"%s _VPortType:%d resolution::%s \n",__FUNCTION__,_VPortType,resolution->
name);
817 IARM_BUS_Unlock(lock);
819 return IARM_RESULT_SUCCESS;
823 IARM_Result_t _dsSetResolution(
void *arg)
834 bool isConnected = 0;
838 printf(
"Port _VPortType:%d not connected..Ignoring Resolution Request------\r\n",_VPortType);
841 IARM_BUS_Unlock(lock);
842 return IARM_RESULT_SUCCESS;
846 std::string resolutionName(resolution.
name);
847 __TIMESTAMP();printf(
"Resolution Requested ..%s \r\n",resolution.
name);
851 std::size_t location = resolutionName.find(
"2160");
852 if(std::string::npos != location)
855 printf(
"Error! Cannot set 4K resolution. Support for 4K is disabled.\n");
858 IARM_BUS_Unlock(lock);
859 return IARM_RESULT_SUCCESS;
866 IARM_BUS_Unlock(lock);
868 memset(&ignoreEdidParam,0,
sizeof(ignoreEdidParam));
869 ignoreEdidParam.handle = _VPortType;
870 _dsGetIgnoreEDIDStatus(&ignoreEdidParam);
871 bool IsIgnoreEdid = ignoreEdidParam.ignoreEDID;
873 __TIMESTAMP();printf(
"ResOverride _dsSetResolution IsIgnoreEdid:%d\n", IsIgnoreEdid);
877 memset(platresolution.
name,
'\0',
sizeof(platresolution.
name));
879 __TIMESTAMP();printf(
"Resolution Requested ..%s Platform Resolution - %s\r\n",resolution.
name,platresolution.
name);
880 if ((strcmp(resolution.
name,platresolution.
name) == 0 ))
883 printf(
"Same Resolution ..Ignoring Resolution Request------\r\n");
884 _dsHDMIResolution = platresolution.
name;
886 persistResolution(param);
888 IARM_BUS_Unlock(lock);
889 return IARM_RESULT_SUCCESS;
893 _dsVideoPortPreResolutionCall(¶m->resolution);
896 ret =
dsSetResolution(param->handle, ¶m->resolution, param->toPersist);
899 _dsSendVideoPortPostResolutionCall(¶m->resolution);
904 persistResolution(param);
909 IARM_BUS_Unlock(lock);
911 return IARM_RESULT_SUCCESS;
914 dsDisplayColorDepth_t getPersistentColorDepth ()
916 dsDisplayColorDepth_t _colorDepth = DEFAULT_COLOR_DEPTH;
917 std::string strColorDept = std::to_string (_colorDepth);
920 _colorDepth = (dsDisplayColorDepth_t)stoi (strColorDept);
923 __TIMESTAMP();printf(
"Reading HDMI persistent color dept %s conversion failed\r\n", strColorDept.c_str());
925 __TIMESTAMP();printf(
"Reading HDMI persistent color dept %d\r\n", _colorDepth);
929 dsError_t handleDsGetPreferredColorDepth(intptr_t handle, dsDisplayColorDepth_t *colorDepth,
bool persist)
931 #ifndef RDK_DSHAL_NAME
932 #warning "RDK_DSHAL_NAME is not defined"
933 #define RDK_DSHAL_NAME "RDK_DSHAL_NAME is not defined"
937 typedef dsError_t (*dsGetPreferredColorDepth_t)(intptr_t handle, dsDisplayColorDepth_t *colorDepth,
bool persist);
938 static dsGetPreferredColorDepth_t func = 0;
940 void *dllib = dlopen(RDK_DSHAL_NAME, RTLD_LAZY);
942 func = (dsGetPreferredColorDepth_t) dlsym(dllib,
"dsGetPreferredColorDepth");
944 printf(
"dsGetPreferredColorDepth(intptr_t handle, dsDisplayColorDepth_t *colorDepth, bool persist ) is defined and loaded\r\n");
947 printf(
"dsGetPreferredColorDepth(intptr_t handle, dsDisplayColorDepth_t *colorDepth, bool persist ) is not defined\r\n");
952 printf(
"Opening RDK_DSHAL_NAME [%s] failed\r\n", RDK_DSHAL_NAME);
958 ret = func(handle, colorDepth, persist);
961 printf(
"%s:%d not able to load funtion func:%p\r\n", func);
967 IARM_Result_t _dsGetPreferredColorDepth(
void *arg)
973 dsDisplayColorDepth_t _colorDepth = DEFAULT_COLOR_DEPTH;
975 dsDisplayColorDepth_t *pcolorDepth = ¶m->colorDepth;
983 _colorDepth = getPersistentColorDepth ();
987 dsError_t error = handleDsGetPreferredColorDepth (param->handle, &_colorDepth,
false);
989 __TIMESTAMP();printf(
"ColorDepthOverride platform reported color dept is: 0x%x. Cached color dept is: 0x%x\r\n", _colorDepth, hdmiColorDept);
992 _colorDepth = hdmiColorDept;
997 __TIMESTAMP();printf(
"%s:%d not supported for video port: %d\r\n",__FUNCTION__, __LINE__, _VPortType);
999 *pcolorDepth = _colorDepth;
1000 printf(
"%s _VPortType:%d color dept::0x%x \n",__FUNCTION__,_VPortType, *pcolorDepth);
1002 IARM_BUS_Unlock(lock);
1004 return IARM_RESULT_SUCCESS;
1008 dsDisplayColorDepth_t getBestSupportedColorDepth (intptr_t handle, dsDisplayColorDepth_t inColorDepth)
1010 unsigned int colorDepthCapability = 0;
1012 int ret = handleDsColorDepthCapabilities (handle,&(colorDepthCapability));
1013 __TIMESTAMP();printf(
"dsColorDepthCapabilities returned: %d colorDepthCapability: 0x%x\r\n",
1014 ret, colorDepthCapability);
1016 if ((colorDepthCapability & inColorDepth) &&
1017 (inColorDepth!=dsDISPLAY_COLORDEPTH_AUTO)) {
1018 return inColorDepth;
1022 __TIMESTAMP();printf(
"getBestSupportedColorDepth inColorDepth:0x%x not supported by edid searching in auto mode.\r\n", inColorDepth);
1023 if ((colorDepthCapability & dsDISPLAY_COLORDEPTH_12BIT)){
1024 return dsDISPLAY_COLORDEPTH_12BIT;
1025 }
else if ((colorDepthCapability & dsDISPLAY_COLORDEPTH_10BIT)){
1026 return dsDISPLAY_COLORDEPTH_10BIT;
1027 }
else if ((colorDepthCapability & dsDISPLAY_COLORDEPTH_8BIT)) {
1028 return dsDISPLAY_COLORDEPTH_8BIT;
1034 return dsDISPLAY_COLORDEPTH_8BIT;
1038 dsError_t handleDsSetPreferredColorDepth(intptr_t handle,dsDisplayColorDepth_t colorDepth,
bool persist)
1040 #ifndef RDK_DSHAL_NAME
1041 #warning "RDK_DSHAL_NAME is not defined"
1042 #define RDK_DSHAL_NAME "RDK_DSHAL_NAME is not defined"
1046 typedef dsError_t (*dsSetPreferredColorDepth_t)(intptr_t handle,dsDisplayColorDepth_t colorDepth,
bool persist);
1047 static dsSetPreferredColorDepth_t func = 0;
1049 void *dllib = dlopen(RDK_DSHAL_NAME, RTLD_LAZY);
1051 func = (dsSetPreferredColorDepth_t) dlsym(dllib,
"dsSetPreferredColorDepth");
1053 printf(
"dsSetPreferredColorDepth(intptr_t handle,dsDisplayColorDepth_t colorDepth, bool persist) is defined and loaded\r\n");
1056 printf(
"dsSetPreferredColorDepth(intptr_t handle,dsDisplayColorDepth_t colorDepth, bool persist) is not defined\r\n");
1061 printf(
"Opening RDK_DSHAL_NAME [%s] failed\r\n", RDK_DSHAL_NAME);
1067 ret = func(handle, colorDepth, persist);
1070 printf(
"%s:%d not able to load funtion func:%p\r\n", func);
1076 IARM_Result_t setPreferredColorDepth(
void *arg)
1086 bool isConnected = 0;
1090 printf(
"Port _VPortType:%d not connected..Ignoring Set color dept Request------\r\n",_VPortType);
1092 param->result = ret;
1093 return IARM_RESULT_SUCCESS;
1096 dsDisplayColorDepth_t colorDepth = param->colorDepth;
1098 dsDisplayColorDepth_t platColorDept;
1101 handleDsGetPreferredColorDepth (param->handle,&platColorDept,
false);
1102 __TIMESTAMP();printf(
"Color dept Requested ..0x%x Platform color dept - 0x%x\r\n",colorDepth,platColorDept);
1103 if (colorDepth == platColorDept)
1105 printf(
"Same color dept ..Ignoring color dept Request------\r\n");
1106 hdmiColorDept = platColorDept;
1108 if(param->toPersist){
1109 std::string strColorDept = std::to_string (param->colorDepth);
1112 param->result = ret;
1113 return IARM_RESULT_SUCCESS;
1117 dsDisplayColorDepth_t colorDepthToSet = getBestSupportedColorDepth (param->handle, param->colorDepth);
1120 ret = handleDsSetPreferredColorDepth (param->handle, colorDepthToSet, param->toPersist);
1124 hdmiColorDept = param->colorDepth;
1125 if(param->toPersist){
1127 std::string strColorDept = std::to_string (param->colorDepth);
1131 param->result = ret;
1133 return IARM_RESULT_SUCCESS;
1137 IARM_Result_t _dsSetPreferredColorDepth(
void *arg)
1141 IARM_BUS_Lock(lock);
1142 IARM_Result_t ret = setPreferredColorDepth (arg);
1143 IARM_BUS_Unlock(lock);
1148 dsError_t handleDsColorDepthCapabilities(intptr_t handle,
unsigned int *colorDepthCapability )
1150 #ifndef RDK_DSHAL_NAME
1151 #warning "RDK_DSHAL_NAME is not defined"
1152 #define RDK_DSHAL_NAME "RDK_DSHAL_NAME is not defined"
1156 typedef dsError_t (*dsColorDepthCapabilities_t)(intptr_t handle,
unsigned int *colorDepthCapability);
1157 static dsColorDepthCapabilities_t func = 0;
1159 void *dllib = dlopen(RDK_DSHAL_NAME, RTLD_LAZY);
1161 func = (dsColorDepthCapabilities_t) dlsym(dllib,
"dsColorDepthCapabilities");
1163 printf(
"dsColorDepthCapabilities(intptr_t handle, unsigned int *colorDepthCapability ) is defined and loaded\r\n");
1166 printf(
"dsColorDepthCapabilities(intptr_t handle, unsigned int *colorDepthCapability ) is not defined\r\n");
1171 printf(
"Opening RDK_DSHAL_NAME [%s] failed\r\n", RDK_DSHAL_NAME);
1177 ret = func(handle, colorDepthCapability);
1180 printf(
"%s:%d not able to load funtion func:%p\r\n", func);
1186 IARM_Result_t _dsColorDepthCapabilities(
void *arg)
1190 IARM_BUS_Lock(lock);
1192 ret = handleDsColorDepthCapabilities (param->handle,&(param->colorDepthCapability));
1193 __TIMESTAMP();printf(
"dsColorDepthCapabilities returned:%d colorDepthCapability: 0x%x\r\n",
1194 ret, param->colorDepthCapability);
1196 param->colorDepthCapability = (param->colorDepthCapability|dsDISPLAY_COLORDEPTH_AUTO);
1198 param->result = ret;
1199 IARM_BUS_Unlock(lock);
1200 return IARM_RESULT_SUCCESS;
1205 void resetColorDepthOnHdmiReset(intptr_t handle)
1208 dsDisplayColorDepth_t colorDepth = getPersistentColorDepth ();
1209 __TIMESTAMP();printf(
"resetColorDepthOnHdmiReset: resetting colordepth:0x%x \r\n", colorDepth);
1212 colorDepthParam.handle = handle;
1213 colorDepthParam.colorDepth = colorDepth;
1215 colorDepthParam.toPersist =
false;
1218 IARM_Result_t ret = setPreferredColorDepth ((
void*)(&colorDepthParam));
1221 IARM_Result_t _dsVideoPortTerm(
void *arg)
1224 IARM_BUS_Lock(lock);
1226 m_isPlatInitialized--;
1228 if (0 == m_isPlatInitialized)
1233 IARM_BUS_Unlock(lock);
1235 return IARM_RESULT_SUCCESS;
1238 IARM_Result_t _dsEnableHDCP(
void *arg)
1241 IARM_BUS_Lock(lock);
1245 __TIMESTAMP();printf(
"Enable HDCP in Platform !! \r\n");
1248 ret =
dsEnableHDCP(param->handle, param->contentProtect, param->hdcpKey, param->keySize);
1249 param->rpcResult = ret;
1251 IARM_BUS_Unlock(lock);
1253 return IARM_RESULT_SUCCESS;
1261 if (resolution == NULL)
1268 IARM_Bus_CommonAPI_ResChange_Param_t param;
1287 param.height = 1080;
1291 param.height = 2160;
1295 param.height = 2160;
1303 eventData.data.resn.width = param.width;
1304 eventData.data.resn.height = param.height;
1305 IARM_BusDaemon_ResolutionPostchange(param);
1313 if (resolution == NULL)
1320 IARM_Bus_CommonAPI_ResChange_Param_t param;
1339 param.height = 1080;
1343 param.height = 2160;
1347 param.height = 2160;
1355 eventData.data.resn.width = param.width;
1356 eventData.data.resn.height = param.height;
1357 IARM_BusDaemon_ResolutionPrechange(param);
1364 void _dsHdcpCallback (intptr_t handle, dsHdcpStatus_t status)
1369 if (handle == NULL_HANDLE)
1371 printf(
"Err:HDMI Hot plug back has NULL Handle... !!!!!!..\r\n");
1376 __TIMESTAMP();printf(
"DS HDCP Authenticated Event!!!!!!..\r\n");
1378 _hdcpStatus = status;
1382 __TIMESTAMP();printf(
"DS HDCP Failure Event!!!!!!..\r\n");
1384 _hdcpStatus = status;
1391 __TIMESTAMP();printf(
"HDCP Event Status from HAL is ...%d\n",status);
1392 hdcp_eventData.data.hdmi_hdcp.hdcpStatus = _hdcpStatus = status;
1399 IARM_Result_t _dsGetHDCPStatus (
void *arg)
1402 IARM_BUS_Lock(lock);
1406 if (param != NULL) {
1407 param->hdcpStatus = _hdcpStatus;
1410 IARM_BUS_Unlock(lock);
1412 return IARM_RESULT_SUCCESS;
1415 IARM_Result_t _dsGetHDCPProtocol (
void *arg)
1417 #ifndef RDK_DSHAL_NAME
1418 #warning "RDK_DSHAL_NAME is not defined"
1419 #define RDK_DSHAL_NAME "RDK_DSHAL_NAME is not defined"
1423 IARM_BUS_Lock(lock);
1425 typedef dsError_t (*dsGetHDCPProtocol_t)(intptr_t handle, dsHdcpProtocolVersion_t *protocolVersion);
1426 static dsGetHDCPProtocol_t func = 0;
1428 void *dllib = dlopen(RDK_DSHAL_NAME, RTLD_LAZY);
1430 func = (dsGetHDCPProtocol_t) dlsym(dllib,
"dsGetHDCPProtocol");
1432 printf(
"dsGetHDCPProtocol_t(int, dsHdcpProtocolVersion_t *) is defined and loaded\r\n");
1435 printf(
"dsGetHDCPProtocol_t(int, dsHdcpProtocolVersion_t *) is not defined\r\n");
1440 printf(
"Opening RDK_DSHAL_NAME [%s] failed\r\n", RDK_DSHAL_NAME);
1447 dsError_t ret = func(param->handle, ¶m->protocolVersion);
1453 IARM_BUS_Unlock(lock);
1455 return IARM_RESULT_SUCCESS;
1458 IARM_Result_t _dsGetHDCPReceiverProtocol (
void *arg)
1460 #ifndef RDK_DSHAL_NAME
1461 #warning "RDK_DSHAL_NAME is not defined"
1462 #define RDK_DSHAL_NAME "RDK_DSHAL_NAME is not defined"
1466 IARM_BUS_Lock(lock);
1468 typedef dsError_t (*dsGetHDCPReceiverProtocol_t)(intptr_t handle, dsHdcpProtocolVersion_t *protocolVersion);
1469 static dsGetHDCPReceiverProtocol_t func = 0;
1471 void *dllib = dlopen(RDK_DSHAL_NAME, RTLD_LAZY);
1473 func = (dsGetHDCPReceiverProtocol_t) dlsym(dllib,
"dsGetHDCPReceiverProtocol");
1475 printf(
"dsGetHDCPReceiverProtocol_t(int, dsHdcpProtocolVersion_t *) is defined and loaded\r\n");
1478 printf(
"dsGetHDCPReceiverProtocol_t(int, dsHdcpProtocolVersion_t *) is not defined\r\n");
1483 printf(
"Opening RDK_DSHAL_NAME [%s] failed\r\n", RDK_DSHAL_NAME);
1490 dsError_t ret = func(param->handle, ¶m->protocolVersion);
1496 IARM_BUS_Unlock(lock);
1498 return IARM_RESULT_SUCCESS;
1501 IARM_Result_t _dsGetHDCPCurrentProtocol (
void *arg)
1503 #ifndef RDK_DSHAL_NAME
1504 #warning "RDK_DSHAL_NAME is not defined"
1505 #define RDK_DSHAL_NAME "RDK_DSHAL_NAME is not defined"
1509 IARM_BUS_Lock(lock);
1511 typedef dsError_t (*dsGetHDCPCurrentProtocol_t)(intptr_t handle, dsHdcpProtocolVersion_t *protocolVersion);
1512 static dsGetHDCPCurrentProtocol_t func = 0;
1514 void *dllib = dlopen(RDK_DSHAL_NAME, RTLD_LAZY);
1516 func = (dsGetHDCPCurrentProtocol_t) dlsym(dllib,
"dsGetHDCPCurrentProtocol");
1518 printf(
"dsGetHDCPCurrentProtocol_t(int, dsHdcpProtocolVersion_t *) is defined and loaded\r\n");
1521 printf(
"dsGetHDCPCurrentProtocol_t(int, dsHdcpProtocolVersion_t *) is not defined\r\n");
1526 printf(
"Opening RDK_DSHAL_NAME [%s] failed\r\n", RDK_DSHAL_NAME);
1533 dsError_t ret = func(param->handle, ¶m->protocolVersion);
1539 IARM_BUS_Unlock(lock);
1541 return IARM_RESULT_SUCCESS;
1544 IARM_Result_t _dsGetTVHDRCapabilities(
void *arg)
1548 IARM_BUS_Lock(lock);
1550 typedef dsError_t (*dsGetTVHDRCapabilitiesFunc_t)(intptr_t handle,
int *capabilities);
1551 static dsGetTVHDRCapabilitiesFunc_t func = 0;
1553 void *dllib = dlopen(RDK_DSHAL_NAME, RTLD_LAZY);
1555 func = (dsGetTVHDRCapabilitiesFunc_t)dlsym(dllib,
"dsGetTVHDRCapabilities");
1557 printf(
"dsGetTVHDRCapabilities() is defined and loaded\r\n");
1560 printf(
"dsGetTVHDRCapabilities() is not defined\r\n");
1565 printf(
"Opening RDK_DSHAL_NAME [%s] failed\r\n", RDK_DSHAL_NAME);
1570 param->result = func(param->handle, ¶m->capabilities);
1574 printf(
"_dsGetTVHDRCapabilities() DolbyVision Disabled param->capabilities:%x\r\n",param->capabilities);
1581 IARM_BUS_Unlock(lock);
1582 return IARM_RESULT_SUCCESS;
1585 IARM_Result_t _dsSupportedTvResolutions(
void *arg)
1589 IARM_BUS_Lock(lock);
1591 typedef dsError_t (*dsSupportedTvResolutionsFunc_t)(intptr_t handle,
int *resolutions);
1592 static dsSupportedTvResolutionsFunc_t func = 0;
1594 void *dllib = dlopen(RDK_DSHAL_NAME, RTLD_LAZY);
1596 func = (dsSupportedTvResolutionsFunc_t)dlsym(dllib,
"dsSupportedTvResolutions");
1598 printf(
"dsSupportedTvResolutions() is defined and loaded\r\n");
1601 printf(
"dsSupportedTvResolutions() is not defined\r\n");
1606 printf(
"Opening RDK_DSHAL_NAME [%s] failed\r\n", RDK_DSHAL_NAME);
1611 param->result = func(param->handle, ¶m->resolutions);
1614 param->resolutions = 0;
1617 IARM_BUS_Unlock(lock);
1618 return IARM_RESULT_SUCCESS;
1625 intptr_t halhandle = 0;
1627 numPorts =
dsUTL_DIM(kSupportedPortTypes);
1628 for(i=0; i< numPorts; i++)
1630 dsGetVideoPort(kPorts[i].
id.type, kPorts[i].
id.index, &halhandle);
1631 if (handle == halhandle)
1633 return kPorts[i].id.type;
1636 printf(
"Error: The Requested Video Port is not part of Platform Port Configuration \r\n");
1644 std::string resolutionName(resolution.
name);
1652 if(param->toPersist){
1656 __TIMESTAMP();printf(
"Set Resolution on HDMI Port!!!!!!..\r\n");
1657 _dsHDMIResolution = resolutionName;
1659 if (
false == IsCompatibleResolution(resolution.
pixelResolution,getPixelResolution(_dsCompResolution)))
1661 __TIMESTAMP();printf(
"HDMI Resolution is not Compatible with Analog ports..\r\n");
1662 _dsCompResolution = getCompatibleResolution(&resolution);
1663 __TIMESTAMP();printf(
"New Compatible resolution is %s \r\n",_dsCompResolution.c_str());
1665 if(param->forceCompatible)
1667 #ifdef HAS_ONLY_COMPOSITE
1676 __TIMESTAMP();printf(
"HDMI and Analog Ports Resolutions are Compatible \r\n");
1683 if(param->toPersist){
1684 #ifdef HAS_ONLY_COMPOSITE
1691 __TIMESTAMP();printf(
"Set Resolution on Component/Composite Ports!!!!!!..\r\n");
1692 _dsCompResolution = resolutionName;
1693 if (
false == IsCompatibleResolution(resolution.
pixelResolution,getPixelResolution(_dsHDMIResolution)))
1695 __TIMESTAMP();printf(
"HDMI Resolution is not Compatible with Analog ports..\r\n");
1697 _dsHDMIResolution = getCompatibleResolution(&resolution);
1698 if (_dsHDMIResolution.compare(
"480i") == 0)
1699 _dsHDMIResolution =
"480p";
1701 __TIMESTAMP();printf(
"New Compatible resolution is %s \r\n",_dsHDMIResolution.c_str());
1702 if(param->forceCompatible)
1709 __TIMESTAMP();printf(
"HDMI and Analog Ports Resolutions are Compatible \r\n");
1715 if(param->toPersist){
1719 __TIMESTAMP();printf(
"Set Resolution on Composite Ports!!!!!!..\r\n");
1720 _dsBBResolution = resolutionName;
1721 if (
false == IsCompatibleResolution(resolution.
pixelResolution,getPixelResolution(_dsHDMIResolution)))
1723 __TIMESTAMP();printf(
"HDMI Resolution is not Compatible with Analog ports..\r\n");
1725 _dsHDMIResolution = getCompatibleResolution(&resolution);
1726 if (_dsHDMIResolution.compare(
"480i") == 0)
1727 _dsHDMIResolution =
"480p";
1729 __TIMESTAMP();printf(
"New Compatible resolution is %s \r\n",_dsHDMIResolution.c_str());
1733 __TIMESTAMP();printf(
"HDMI and Analog Ports Resolutions are Compatible \r\n");
1739 if(param->toPersist){
1743 __TIMESTAMP();printf(
"Set Resolution on RF Ports!!!!!!..\r\n");
1744 _dsRFResolution = resolutionName;
1745 if (
false == IsCompatibleResolution(resolution.
pixelResolution,getPixelResolution(_dsHDMIResolution)))
1747 __TIMESTAMP();printf(
"HDMI Resolution is not Compatible with Analog ports..\r\n");
1749 _dsHDMIResolution = getCompatibleResolution(&resolution);
1750 if (_dsHDMIResolution.compare(
"480i") == 0)
1751 _dsHDMIResolution =
"480p";
1753 __TIMESTAMP();printf(
"New Compatible resolution is %s \r\n",_dsHDMIResolution.c_str());
1757 __TIMESTAMP();printf(
"HDMI and Analog Ports Resolutions are Compatible \r\n");
1763 printf(
"Error in Persisting the Video Resolution..... \r\n");
1768 #ifdef HAS_INIT_RESN_SETTINGS
1769 IARM_Result_t _dsInitResolution(
void *arg)
1773 IARM_BUS_Lock(lock);
1778 return IARM_RESULT_INVALID_STATE;
1784 persistResolution(param);
1787 IARM_BUS_Unlock(lock);
1788 return IARM_RESULT_SUCCESS;
1796 std::string resolution(
"720p");
1798 if (SrcResn == NULL)
1807 return resolution.assign(SrcResn->
name);
1816 return resolution.assign(kResolutions[kDefaultResIndex].name);
1827 if( pixelResolution1 == pixelResolution2) {
1830 else if((IsHDCompatible(pixelResolution1)) && (IsHDCompatible(pixelResolution2))) {
1840 for (
unsigned int i = 0; i <
dsUTL_DIM(kResolutions); i++)
1842 Resn = &kResolutions[i];
1843 if (resolution.compare(Resn->
name) == 0 )
1852 IARM_Result_t _dsSetForceDisable4K(
void *arg)
1856 IARM_BUS_Lock(lock);
1861 force_disable_4K = param->disable;
1862 if(force_disable_4K)
1871 IARM_BUS_Unlock(lock);
1872 return IARM_RESULT_SUCCESS;
1876 IARM_Result_t _dsSetForceHDRMode(
void *arg)
1879 IARM_BUS_Lock(lock);
1883 static dsSetForceHDRMode_t func = NULL;
1885 void *dllib = dlopen(RDK_DSHAL_NAME, RTLD_LAZY);
1886 if (dllib != NULL) {
1887 func = (dsSetForceHDRMode_t) dlsym(dllib,
"dsSetForceHDRMode");
1889 printf(
"dsSRV: dsSetForceHDRMode(intptr_t handle, dsHDRStandard_t mode ) is defined and loaded\r\n");
1892 printf(
"dsSRV: dsSetForceHDRMode(intptr_t handle, dsHDRStandard_t mode) is not defined\r\n");
1897 printf(
"dsSRV: Opening RDK_DSHAL_NAME [%s] failed\r\n", RDK_DSHAL_NAME);
1901 if (param != NULL) {
1905 param->result = func(param->handle, param->hdrMode);
1909 IARM_BUS_Unlock(lock);
1910 return IARM_RESULT_SUCCESS;
1913 IARM_Result_t _dsGetForceDisable4K(
void *arg)
1917 IARM_BUS_Lock(lock);
1922 param->disable = force_disable_4K;
1923 IARM_BUS_Unlock(lock);
1924 return IARM_RESULT_SUCCESS;
1927 IARM_Result_t _dsSetScartParameter(
void *arg)
1931 IARM_BUS_Lock(lock);
1933 printf(
"dsSRV::_dsSetScartParameter\r\n");
1935 typedef dsError_t (*dsScartParamFunc_t)(intptr_t handle,
const char* parameter_str,
const char* value_str);
1936 static dsScartParamFunc_t func = NULL;
1938 void *dllib = dlopen(RDK_DSHAL_NAME, RTLD_LAZY);
1939 if (dllib != NULL) {
1940 func = (dsScartParamFunc_t) dlsym(dllib,
"dsSetScartParameter");
1942 printf(
"dsSRV: dsSetScartParameter(int,const char*,const char*) is defined and loaded\r\n");
1945 printf(
"dsSRV: dsSetScartParameter(int,const char*,const char*) is not defined\r\n");
1950 printf(
"dsSRV: Opening RDK_DSHAL_NAME [%s] failed\r\n", RDK_DSHAL_NAME);
1954 if (param != NULL) {
1958 param->result = func(param->handle, param->param_bytes, param->value_bytes);
1962 IARM_BUS_Unlock(lock);
1964 return IARM_RESULT_SUCCESS;
1968 IARM_Result_t _dsIsOutputHDR(
void *arg)
1972 IARM_BUS_Lock(lock);
1974 printf(
"dsSRV::_dsIsOutputHDR\r\n");
1976 typedef dsError_t (*dsIsOutputHDR_t)(intptr_t handle,
bool *hdr);
1977 static dsIsOutputHDR_t func = NULL;
1979 void *dllib = dlopen(RDK_DSHAL_NAME, RTLD_LAZY);
1980 if (dllib != NULL) {
1981 func = (dsIsOutputHDR_t) dlsym(dllib,
"dsIsOutputHDR");
1983 printf(
"dsSRV: dsIsOutputHDR(intptr_t handle, bool *hdr) is defined and loaded\r\n");
1986 printf(
"dsSRV: dsIsOutputHDR(intptr_t handle, bool *hdr) is not defined\r\n");
1991 printf(
"dsSRV: Opening RDK_DSHAL_NAME [%s] failed\r\n", RDK_DSHAL_NAME);
1995 if (param != NULL) {
1999 param->result = func(param->handle, ¶m->hdr);
2004 IARM_BUS_Unlock(lock);
2006 return IARM_RESULT_SUCCESS;
2010 IARM_Result_t _dsResetOutputToSDR(
void *arg)
2013 IARM_BUS_Lock(lock);
2015 printf(
"dsSRV::_dsResetOutputToSDR\r\n");
2017 typedef dsError_t (*dsResetOutputToSDR_t)();
2018 static dsResetOutputToSDR_t func = NULL;
2020 void *dllib = dlopen(RDK_DSHAL_NAME, RTLD_LAZY);
2021 if (dllib != NULL) {
2022 func = (dsResetOutputToSDR_t) dlsym(dllib,
"dsResetOutputToSDR");
2024 printf(
"dsSRV: dsResetOutputToSDR() is defined and loaded\r\n");
2027 printf(
"dsSRV: dsResetOutputToSDR() is not defined\r\n");
2032 printf(
"dsSRV: Opening RDK_DSHAL_NAME [%s] failed\r\n", RDK_DSHAL_NAME);
2041 IARM_BUS_Unlock(lock);
2043 return IARM_RESULT_SUCCESS;
2047 IARM_Result_t _dsSetHdmiPreference(
void *arg)
2051 IARM_BUS_Lock(lock);
2053 printf(
"dsSRV::_dsSetHdmiPreference\r\n");
2055 typedef dsError_t (*dsSetHdmiPreference_t)(intptr_t handle, dsHdcpProtocolVersion_t *hdcpCurrentProtocol);
2056 static dsSetHdmiPreference_t func = NULL;
2058 void *dllib = dlopen(RDK_DSHAL_NAME, RTLD_LAZY);
2059 if (dllib != NULL) {
2060 func = (dsSetHdmiPreference_t) dlsym(dllib,
"dsSetHdmiPreference");
2062 printf(
"dsSRV: dsSetHdmiPreference(intptr_t handle, dsHdcpProtocolVersion_t *hdcpCurrentProtocol) is defined and loaded\r\n");
2065 printf(
"dsSRV: dsSetHdmiPreference(intptr_t handle, dsHdcpProtocolVersion_t *hdcpCurrentProtocol) is not defined\r\n");
2070 printf(
"dsSRV: Opening RDK_DSHAL_NAME [%s] failed\r\n", RDK_DSHAL_NAME);
2074 if (param != NULL) {
2078 param->result = func(param->handle, ¶m->hdcpCurrentProtocol);
2083 IARM_BUS_Unlock(lock);
2085 return IARM_RESULT_SUCCESS;
2089 IARM_Result_t _dsGetHdmiPreference(
void *arg)
2093 IARM_BUS_Lock(lock);
2095 printf(
"dsSRV::_dsGetHdmiPreference\r\n");
2097 typedef dsError_t (*dsGetHdmiPreference_t)(intptr_t handle, dsHdcpProtocolVersion_t *hdcpCurrentProtocol);
2098 static dsGetHdmiPreference_t func = NULL;
2100 void *dllib = dlopen(RDK_DSHAL_NAME, RTLD_LAZY);
2101 if (dllib != NULL) {
2102 func = (dsGetHdmiPreference_t) dlsym(dllib,
"dsGetHdmiPreference");
2104 printf(
"dsSRV: dsGetHdmiPreference(intptr_t handle, dsHdcpProtocolVersion_t *hdcpCurrentProtocol) is defined and loaded\r\n");
2107 printf(
"dsSRV: dsGetHdmiPreference(intptr_t handle, dsHdcpProtocolVersion_t *hdcpCurrentProtocol) is not defined\r\n");
2112 printf(
"dsSRV: Opening RDK_DSHAL_NAME [%s] failed\r\n", RDK_DSHAL_NAME);
2116 if (param != NULL) {
2120 param->result = func(param->handle, ¶m->hdcpCurrentProtocol);
2125 IARM_BUS_Unlock(lock);
2127 return IARM_RESULT_SUCCESS;
2131 IARM_Result_t _dsSetBackgroundColor(
void *arg)
2135 IARM_BUS_Lock(lock);
2138 static dsSetBackgroundColor_t func = NULL;
2140 void *dllib = dlopen(RDK_DSHAL_NAME, RTLD_LAZY);
2141 if (dllib != NULL) {
2142 func = (dsSetBackgroundColor_t) dlsym(dllib,
"dsSetBackgroundColor");
2144 printf(
"dsSRV: dsError_t dsSetBackgroundColor(intptr_t handle, dsVideoBackgroundColor_t color) is defined and loaded\r\n");
2147 printf(
"dsSRV: dsError_t dsSetBackgroundColor(intptr_t handle, dsVideoBackgroundColor_t color) is not defined\r\n");
2152 printf(
"dsSRV: Opening RDK_DSHAL_NAME [%s] failed\r\n", RDK_DSHAL_NAME);
2156 if (param != NULL && func != NULL) {
2157 func(param->handle, param->color);
2160 IARM_BUS_Unlock(lock);
2162 return IARM_RESULT_SUCCESS;
2168 printf(
"%s: VideoOutPort format:%d \r\n", __FUNCTION__, videoFormat);
2169 video_format_event_data.data.VideoFormatInfo.videoFormat = videoFormat;
2173 (
void *)&video_format_event_data,
2174 sizeof(video_format_event_data));
2179 printf(
"%s: %d - Inside \n", __FUNCTION__, __LINE__);
2182 static dsVideoFormatUpdateRegisterCB_t dsVideoFormatUpdateRegisterCBFun = 0;
2183 if (dsVideoFormatUpdateRegisterCBFun == 0) {
2184 printf(
"%s: %d - dlerror: %s\n", __FUNCTION__, __LINE__, dlerror());
2185 void *dllib = dlopen(RDK_DSHAL_NAME, RTLD_LAZY);
2187 dsVideoFormatUpdateRegisterCBFun = (dsVideoFormatUpdateRegisterCB_t) dlsym(dllib,
"dsVideoFormatUpdateRegisterCB");
2188 if(dsVideoFormatUpdateRegisterCBFun == 0) {
2189 printf(
"%s: dsVideoFormatUpdateRegisterCB is not defined %s\r\n", __FUNCTION__, dlerror());
2193 printf(
"%s: dsVideoFormatUpdateRegisterCB is loaded\r\n", __FUNCTION__);
2198 printf(
"%s: Opening RDK_DSHAL_NAME [%s] failed %s\r\n",
2199 __FUNCTION__, RDK_DSHAL_NAME, dlerror());
2203 if (0 != dsVideoFormatUpdateRegisterCBFun) {
2204 eRet = dsVideoFormatUpdateRegisterCBFun (cbFun);
2205 printf(
"%s: dsVideoFormatUpdateRegisterCBFun registered\r\n", __FUNCTION__);
2208 printf(
"%s: dsVideoFormatUpdateRegisterCBFun NULL\r\n", __FUNCTION__);
2214 bool isComponentPortPresent()
2216 bool componentPortPresent =
false;
2219 numPorts =
dsUTL_DIM(kSupportedPortTypes);
2220 for(i=0; i< numPorts; i++)
2224 componentPortPresent =
true;;
2227 printf(
" componentPortPresent :%d\n",componentPortPresent);
2228 return componentPortPresent;
2231 IARM_Result_t _dsGetIgnoreEDIDStatus(
void* arg)
2235 IARM_BUS_Lock(lock);
2237 typedef dsError_t (*dsGetIgnoreEDIDStatus_t)(intptr_t handleArg,
bool* statusArg);
2238 static dsGetIgnoreEDIDStatus_t func = NULL;
2240 void *dllib = dlopen(RDK_DSHAL_NAME, RTLD_LAZY);
2241 if (dllib != NULL) {
2242 func = (dsGetIgnoreEDIDStatus_t) dlsym(dllib,
"dsGetIgnoreEDIDStatus");
2244 printf(
"dsSRV: dsError_t dsGetIgnoreEDIDStatus(intptr_t handle, bool* status) is defined and loaded\r\n");
2247 printf(
"dsSRV: dsError_t dsGetIgnoreEDIDStatus(intptr_t handle, bool* status) is not defined\r\n");
2252 printf(
"dsSRV: Opening RDK_DSHAL_NAME [%s] dsGetIgnoreEDIDStatus failed\r\n", RDK_DSHAL_NAME);
2257 func(param->handle, ¶m->ignoreEDID);
2259 printf(
"dsSRV: _dsGetIgnoreEDIDStatus status: %d\r\n", param->ignoreEDID);
2261 IARM_BUS_Unlock(lock);
2263 return IARM_RESULT_SUCCESS;