RDK Documentation (Open Sourced RDK Components)
dsVideoPort.c
1 /*
2  * If not stated otherwise in this file or this component's Licenses.txt file the
3  * following copyright and licenses apply:
4  *
5  * Copyright 2016 RDK Management
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18 */
19 
20 
21 
22 /**
23 * @defgroup devicesettings
24 * @{
25 * @defgroup rpc
26 * @{
27 **/
28 
29 
30 #include "dsVideoPort.h"
31 #include "dsDisplay.h"
32 
33 #include <sys/stat.h>
34 #include <unistd.h>
35 #include <sys/types.h>
36 #include <stdint.h>
37 #include <dlfcn.h>
38 #include "dsError.h"
39 #include "dsUtl.h"
40 #include "dsTypes.h"
41 #include "pthread.h"
42 #include <pthread.h>
43 #include "libIARM.h"
44 #include "iarmUtil.h"
45 #include "libIBusDaemon.h"
46 #include "libIBus.h"
47 #include "dsRpc.h"
48 #include "dsMgr.h"
49 #include <iostream>
50 #include <string.h>
51 #include "hostPersistence.hpp"
52 #include "dsserverlogger.h"
53 #include "dsTypes.h"
54 #include "dsVideoPortSettings.h"
55 
56 #include "safec_lib.h"
57 
58 #ifdef DEVICESETTINGS_DEFAULT_RESOLUTION
59  #define DEFAULT_RESOLUTION DEVICESETTINGS_DEFAULT_RESOLUTION
60 #else
61  #define DEFAULT_RESOLUTION "720p"
62 #endif
63 #define DEFAULT_SD_RESOLUTION "480i"
64 
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);
72 static dsHdcpStatus_t _hdcpStatus = dsHDCP_STATUS_UNAUTHENTICATED;
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;
77 #define NULL_HANDLE 0
78 #define IARM_BUS_Lock(lock) pthread_mutex_lock(&dsLock)
79 #define IARM_BUS_Unlock(lock) pthread_mutex_unlock(&dsLock)
80 
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);
119 
120 
121 void _dsVideoFormatUpdateCB(dsHDRStandard_t videoFormat);
122 static dsVideoPortType_t _GetVideoPortType(intptr_t handle);
123 static int _dsVideoPortPreResolutionCall(dsVideoPortResolution_t *resolution);
124 static int _dsSendVideoPortPostResolutionCall(dsVideoPortResolution_t *resolution);
125 static dsError_t _dsVideoFormatUpdateRegisterCB (dsVideoFormatUpdateCB_t cbFun);
126 void _dsHdcpCallback(intptr_t handle, dsHdcpStatus_t event);
127 static void persistResolution(dsVideoPortSetResolutionParam_t *param);
128 void resetColorDepthOnHdmiReset(intptr_t handle);
129 static dsDisplayColorDepth_t getPersistentColorDepth ();
130 static dsDisplayColorDepth_t getBestSupportedColorDepth (intptr_t handle, dsDisplayColorDepth_t inColorDepth);
131 
132 //Call this functions from locked function calls in srv
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);
137 
138 #define IsHDCompatible(p) (((p) >= dsVIDEO_PIXELRES_1280x720 ) && ((p) < dsVIDEO_PIXELRES_MAX))
139 static std::string getCompatibleResolution(dsVideoPortResolution_t *SrcResn);
140 static bool IsCompatibleResolution(dsVideoResolution_t pixelResolution1,dsVideoResolution_t pixelResolution2);
141 static dsVideoResolution_t getPixelResolution(std::string &resolution);
142 
143 void VideoConfigInit()
144 {
145  intptr_t handle = 0;
147  if (dsERR_NONE == eRet) {
148  resetColorDepthOnHdmiReset(handle);
149  }else {
150  __TIMESTAMP();printf("HDMI get port handle failed %d \r\n", eRet);
151  }
152 }
153 
154 IARM_Result_t dsVideoPortMgr_init()
155 {
156  IARM_BUS_Lock(lock);
157  std::string _Resolution(DEFAULT_RESOLUTION);
158 
159  try
160  {
161  /*TBD - Get the Device type Dynamically*/
162  /*
163  * Read the HDMI,Component or Composite
164  * Next is to browse through all supported ports i.e kPorts to differentiate between
165  * Component and Composite. TBD - Remove HAS_ONLY_COMPOSITE
166  */
167  _dsHDMIResolution = device::HostPersistence::getInstance().getProperty("HDMI0.resolution",_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;
171  _dsCompResolution = device::HostPersistence::getInstance().getProperty("Baseband0.resolution",_Resolution);
172  #else
173  _Resolution = DEFAULT_RESOLUTION;
174  _dsCompResolution = device::HostPersistence::getInstance().getProperty("COMPONENT0.resolution",_Resolution);
175  #endif
176  __TIMESTAMP();printf("The Persistent Component/Composite resolution read is %s \r\n",_dsCompResolution.c_str());
177  _dsRFResolution = device::HostPersistence::getInstance().getProperty("RF0.resolution",_Resolution);
178  __TIMESTAMP();printf("The Persistent RF resolution read is %s \r\n",_dsRFResolution.c_str());
179  _dsBBResolution = device::HostPersistence::getInstance().getProperty("Baseband0.resolution",_Resolution);
180  __TIMESTAMP();printf("The Persistent BB resolution read is %s \r\n",_dsBBResolution.c_str());
181 
182  if (!m_isPlatInitialized)
183  {
184  /*Initialize the Video Ports */
185  dsVideoPortInit();
186  VideoConfigInit();
187  }
188  /*coverity[missing_lock] CID-18497 using Coverity Annotation to ignore error*/
189  m_isPlatInitialized ++;
190  }
191  catch(...)
192  {
193  printf("Error in Getting the Video Resolution on Startup..... \r\n");
194  }
195  try
196  {
197  std::string _4K_setting("false");
198  _4K_setting = device::HostPersistence::getInstance().getProperty("VideoDevice.force4KDisabled", _4K_setting);
199  if (_4K_setting.compare("true") == 0)
200  {
201  force_disable_4K = true;
202  printf("4K support in disabled configuration.\n");
203  }
204  else
205  {
206  force_disable_4K = false;
207  }
208  }
209  catch(...)
210  {
211  printf("Exception in getting force-disable-4K setting at start up.\r\n");
212  }
213  IARM_BUS_Unlock(lock); //CID:136282 - Data race condition
214  IARM_Bus_RegisterCall(IARM_BUS_DSMGR_API_dsVideoPortInit, _dsVideoPortInit);
215  return IARM_RESULT_SUCCESS;
216 }
217 
218 IARM_Result_t dsVideoPortMgr_term()
219 {
220  return IARM_RESULT_SUCCESS;
221 }
222 
223 
224 IARM_Result_t _dsVideoPortInit(void *arg)
225 {
226  IARM_BUS_Lock(lock);
227 
228  if (!m_isInitialized) {
229 
230  #ifdef HAS_HDCP_CALLBACK
231  dsRegisterHdcpStatusCallback(NULL,_dsHdcpCallback);
232  #endif
233 
234  IARM_Bus_RegisterCall(IARM_BUS_DSMGR_API_dsGetVideoPort,_dsGetVideoPort);
235  IARM_Bus_RegisterCall(IARM_BUS_DSMGR_API_dsIsVideoPortEnabled,_dsIsVideoPortEnabled);
236  IARM_Bus_RegisterCall(IARM_BUS_DSMGR_API_dsIsDisplayConnected,_dsIsDisplayConnected);
237  IARM_Bus_RegisterCall(IARM_BUS_DSMGR_API_dsIsDisplaySurround,_dsIsDisplaySurround);
238  IARM_Bus_RegisterCall(IARM_BUS_DSMGR_API_dsGetSurroundMode,_dsGetSurroundMode);
239  IARM_Bus_RegisterCall(IARM_BUS_DSMGR_API_dsEnableVideoPort,_dsEnableVideoPort);
240  IARM_Bus_RegisterCall(IARM_BUS_DSMGR_API_dsSetResolution,_dsSetResolution);
241  IARM_Bus_RegisterCall(IARM_BUS_DSMGR_API_dsGetResolution,_dsGetResolution);
242  IARM_Bus_RegisterCall(IARM_BUS_DSMGR_API_dsVideoPortTerm,_dsVideoPortTerm);
243  IARM_Bus_RegisterCall(IARM_BUS_DSMGR_API_dsEnableHDCP ,_dsEnableHDCP);
244  IARM_Bus_RegisterCall(IARM_BUS_DSMGR_API_dsIsHDCPEnabled,_dsIsHDCPEnabled);
245  IARM_Bus_RegisterCall(IARM_BUS_DSMGR_API_dsGetHDCPStatus ,_dsGetHDCPStatus);
246  IARM_Bus_RegisterCall(IARM_BUS_DSMGR_API_dsGetHDCPProtocol ,_dsGetHDCPProtocol);
247  IARM_Bus_RegisterCall(IARM_BUS_DSMGR_API_dsGetHDCPReceiverProtocol ,_dsGetHDCPReceiverProtocol);
248  IARM_Bus_RegisterCall(IARM_BUS_DSMGR_API_dsGetHDCPCurrentProtocol ,_dsGetHDCPCurrentProtocol);
249  IARM_Bus_RegisterCall(IARM_BUS_DSMGR_API_dsIsVideoPortActive ,_dsIsVideoPortActive);
250  IARM_Bus_RegisterCall(IARM_BUS_DSMGR_API_dsGetTVHDRCapabilities,_dsGetTVHDRCapabilities);
251  IARM_Bus_RegisterCall(IARM_BUS_DSMGR_API_dsGetSupportedTVResolution,_dsSupportedTvResolutions);
252  IARM_Bus_RegisterCall(IARM_BUS_DSMGR_API_dsSetForceDisable4K, _dsSetForceDisable4K);
253  IARM_Bus_RegisterCall(IARM_BUS_DSMGR_API_dsGetForceDisable4K, _dsGetForceDisable4K);
254  IARM_Bus_RegisterCall(IARM_BUS_DSMGR_API_dsSetScartParameter,_dsSetScartParameter);
255  IARM_Bus_RegisterCall(IARM_BUS_DSMGR_API_dsIsOutputHDR,_dsIsOutputHDR);
256  IARM_Bus_RegisterCall(IARM_BUS_DSMGR_API_dsResetOutputToSDR,_dsResetOutputToSDR);
257  IARM_Bus_RegisterCall(IARM_BUS_DSMGR_API_dsSetHdmiPreference,_dsSetHdmiPreference);
258  IARM_Bus_RegisterCall(IARM_BUS_DSMGR_API_dsGetHdmiPreference,_dsGetHdmiPreference);
259  IARM_Bus_RegisterCall(IARM_BUS_DSMGR_API_dsGetVideoEOTF,_dsGetVideoEOTF);
260  IARM_Bus_RegisterCall(IARM_BUS_DSMGR_API_dsGetMatrixCoefficients,_dsGetMatrixCoefficients);
261  IARM_Bus_RegisterCall(IARM_BUS_DSMGR_API_dsGetColorDepth,_dsGetColorDepth);
262  IARM_Bus_RegisterCall(IARM_BUS_DSMGR_API_dsGetColorSpace,_dsGetColorSpace);
263  IARM_Bus_RegisterCall(IARM_BUS_DSMGR_API_dsGetQuantizationRange,_dsGetQuantizationRange);
264  IARM_Bus_RegisterCall(IARM_BUS_DSMGR_API_dsGetCurrentOutputSettings,_dsGetCurrentOutputSettings);
265  IARM_Bus_RegisterCall(IARM_BUS_DSMGR_API_dsSetBackgroundColor,_dsSetBackgroundColor);
266  IARM_Bus_RegisterCall(IARM_BUS_DSMGR_API_dsSetForceHDRMode,_dsSetForceHDRMode);
267  IARM_Bus_RegisterCall(IARM_BUS_DSMGR_API_dsColorDepthCapabilities,_dsColorDepthCapabilities);
268  IARM_Bus_RegisterCall(IARM_BUS_DSMGR_API_dsGetPreferredColorDepth,_dsGetPreferredColorDepth);
269  IARM_Bus_RegisterCall(IARM_BUS_DSMGR_API_dsSetPreferredColorDepth,_dsSetPreferredColorDepth);
270 
271  dsError_t eRet = _dsVideoFormatUpdateRegisterCB (_dsVideoFormatUpdateCB) ;
272  if (dsERR_NONE != eRet) {
273  printf ("%s: _dsVideoFormatUpdateRegisterCB eRet:%04x", __FUNCTION__, eRet);
274  }
275  m_isInitialized = 1;
276  }
277 
278  if (!m_isPlatInitialized) {
279  /* Nexus init, if any here */
280  dsVideoPortInit();
281  VideoConfigInit();
282  }
283  m_isPlatInitialized++;
284 
285  IARM_BUS_Unlock(lock);
286 
287  return IARM_RESULT_SUCCESS;
288 
289 }
290 
291 IARM_Result_t _dsGetVideoPort(void *arg)
292 {
293  _DEBUG_ENTER();
294 
295  IARM_BUS_Lock(lock);
296 
298  dsGetVideoPort(param->type, param->index, &param->handle);
299 
300  IARM_BUS_Unlock(lock);
301  return IARM_RESULT_SUCCESS;
302 }
303 
304 IARM_Result_t _dsIsVideoPortEnabled(void *arg)
305 {
306  _DEBUG_ENTER();
307  IARM_BUS_Lock(lock);
308 
310  dsIsVideoPortEnabled(param->handle, &param->enabled);
311 
312  IARM_BUS_Unlock(lock);
313 
314  return IARM_RESULT_SUCCESS;
315 }
316 
317 IARM_Result_t _dsIsVideoPortActive(void *arg)
318 {
319  _DEBUG_ENTER();
320  IARM_BUS_Lock(lock);
321 
323 
324  dsVideoPortType_t _VPortType = _GetVideoPortType(param->handle);
325 
326  if (_VPortType == dsVIDEOPORT_TYPE_HDMI ||
327  _VPortType == dsVIDEOPORT_TYPE_INTERNAL)
328  {
329  param->result = dsIsVideoPortActive(param->handle, &param->active);
330  }
331  else if (_VPortType == dsVIDEOPORT_TYPE_COMPONENT || _VPortType == dsVIDEOPORT_TYPE_RF)
332  {
333  param->active = true;
334  param->result = dsERR_NONE;
335  }
336  else if (_VPortType == dsVIDEOPORT_TYPE_SCART)
337  {
338  param->active = true;
339  param->result = dsERR_NONE;
340  }
341 
342  IARM_BUS_Unlock(lock);
343 
344  return IARM_RESULT_SUCCESS;
345 }
346 
347 IARM_Result_t _dsGetVideoEOTF(void* arg)
348 {
349 #ifndef RDK_DSHAL_NAME
350 #warning "RDK_DSHAL_NAME is not defined"
351 #define RDK_DSHAL_NAME "RDK_DSHAL_NAME is not defined"
352 #endif
353  _DEBUG_ENTER();
354  IARM_BUS_Lock(lock);
355 
356  typedef dsError_t (*dsGetVideoEOTF_t)(intptr_t handle, dsHDRStandard_t* video_eotf);
357  static dsGetVideoEOTF_t func = 0;
358  if (func == 0) {
359  void *dllib = dlopen(RDK_DSHAL_NAME, RTLD_LAZY);
360  if (dllib) {
361  func = (dsGetVideoEOTF_t) dlsym(dllib, "dsGetVideoEOTF");
362  if (func) {
363  printf("dsGetVideoEOTF_t(int, dsHDRStandard_t*) is defined and loaded\r\n");
364  }
365  else {
366  printf("dsGetVideoEOTF_t(int, dsHDRStandard_t*) is not defined\r\n");
367  }
368  dlclose(dllib);
369  }
370  else {
371  printf("Opening RDK_DSHAL_NAME [%s] failed\r\n", RDK_DSHAL_NAME);
372  }
373  }
374 
375  dsEot_t* param = (dsEot_t*)arg;
376 
377  if (func != 0) {
378  param->result = func(param->handle, &param->video_eotf);
379  }
380  else {
381  param->video_eotf = dsHDRSTANDARD_NONE;
382  }
383 
384  IARM_BUS_Unlock(lock);
385 
386  return IARM_RESULT_SUCCESS;
387 }
388 
389 IARM_Result_t _dsGetMatrixCoefficients(void* arg)
390 {
391 #ifndef RDK_DSHAL_NAME
392 #warning "RDK_DSHAL_NAME is not defined"
393 #define RDK_DSHAL_NAME "RDK_DSHAL_NAME is not defined"
394 #endif
395  _DEBUG_ENTER();
396  IARM_BUS_Lock(lock);
397 
398  typedef dsError_t (*dsGetMatrixCoefficients_t)(intptr_t handle, dsDisplayMatrixCoefficients_t* matrix_coefficients);
399  static dsGetMatrixCoefficients_t func = 0;
400  if (func == 0) {
401  void *dllib = dlopen(RDK_DSHAL_NAME, RTLD_LAZY);
402  if (dllib) {
403  func = (dsGetMatrixCoefficients_t) dlsym(dllib, "dsGetMatrixCoefficients");
404  if (func) {
405  printf("dsGetMatrixCoefficients_t(int, dsDisplayMatrixCoefficients_t*) is defined and loaded\r\n");
406  }
407  else {
408  printf("dsGetMatrixCoefficients_t(int, dsDisplayMatrixCoefficients_t*) is not defined\r\n");
409  }
410  dlclose(dllib);
411  }
412  else {
413  printf("Opening RDK_DSHAL_NAME [%s] failed\r\n", RDK_DSHAL_NAME);
414  }
415  }
416 
418 
419  if (func != 0) {
420  param->result = func(param->handle, &param->matrix_coefficients);
421  }
422  else {
423  param->matrix_coefficients = dsDISPLAY_MATRIXCOEFFICIENT_UNKNOWN;
424  }
425 
426  IARM_BUS_Unlock(lock);
427 
428  return IARM_RESULT_SUCCESS;
429 }
430 
431 IARM_Result_t _dsGetColorDepth(void* arg)
432 {
433 #ifndef RDK_DSHAL_NAME
434 #warning "RDK_DSHAL_NAME is not defined"
435 #define RDK_DSHAL_NAME "RDK_DSHAL_NAME is not defined"
436 #endif
437  _DEBUG_ENTER();
438  IARM_BUS_Lock(lock);
439 
440  typedef dsError_t (*dsGetColorDepth_t)(intptr_t handle, unsigned int* color_depth);
441  static dsGetColorDepth_t func = 0;
442  if (func == 0) {
443  void *dllib = dlopen(RDK_DSHAL_NAME, RTLD_LAZY);
444  if (dllib) {
445  func = (dsGetColorDepth_t) dlsym(dllib, "dsGetColorDepth");
446  if (func) {
447  printf("dsGetColorDepth_t(int, unsigned int*) is defined and loaded\r\n");
448  }
449  else {
450  printf("dsGetColorDepth_t(int, unsigned int*) is not defined\r\n");
451  }
452  dlclose(dllib);
453  }
454  else {
455  printf("Opening RDK_DSHAL_NAME [%s] failed\r\n", RDK_DSHAL_NAME);
456  }
457  }
458 
459  dsColorDepth_t* param = (dsColorDepth_t*)arg;
460 
461  if (func != 0) {
462  param->result = func(param->handle, &param->color_depth);
463  }
464  else {
465  param->color_depth = 0;
466  }
467 
468  IARM_BUS_Unlock(lock);
469 
470  return IARM_RESULT_SUCCESS;
471 }
472 
473 IARM_Result_t _dsGetColorSpace(void* arg)
474 {
475 #ifndef RDK_DSHAL_NAME
476 #warning "RDK_DSHAL_NAME is not defined"
477 #define RDK_DSHAL_NAME "RDK_DSHAL_NAME is not defined"
478 #endif
479  _DEBUG_ENTER();
480  IARM_BUS_Lock(lock);
481 
482  typedef dsError_t (*dsGetColorSpace_t)(intptr_t handle, dsDisplayColorSpace_t* color_space);
483  static dsGetColorSpace_t func = 0;
484  if (func == 0) {
485  void *dllib = dlopen(RDK_DSHAL_NAME, RTLD_LAZY);
486  if (dllib) {
487  func = (dsGetColorSpace_t) dlsym(dllib, "dsGetColorSpace");
488  if (func) {
489  printf("dsGetColorSpace_t(int, dsDisplayColorSpace_t*) is defined and loaded\r\n");
490  }
491  else {
492  printf("dsGetColorSpace_t(int, dsDisplayColorSpace_t*) is not defined\r\n");
493  }
494  dlclose(dllib);
495  }
496  else {
497  printf("Opening RDK_DSHAL_NAME [%s] failed\r\n", RDK_DSHAL_NAME);
498  }
499  }
500 
501  dsColorSpace_t* param = (dsColorSpace_t*)arg;
502 
503  if (func != 0) {
504  param->result = func(param->handle, &param->color_space);
505  }
506  else {
507  param->color_space = dsDISPLAY_COLORSPACE_UNKNOWN;
508  }
509 
510  IARM_BUS_Unlock(lock);
511 
512  return IARM_RESULT_SUCCESS;
513 }
514 
515 IARM_Result_t _dsGetQuantizationRange(void* arg)
516 {
517 #ifndef RDK_DSHAL_NAME
518 #warning "RDK_DSHAL_NAME is not defined"
519 #define RDK_DSHAL_NAME "RDK_DSHAL_NAME is not defined"
520 #endif
521  _DEBUG_ENTER();
522  IARM_BUS_Lock(lock);
523 
524  typedef dsError_t (*dsGetQuantizationRange_t)(intptr_t handle, dsDisplayQuantizationRange_t* quantization_range);
525  static dsGetQuantizationRange_t func = 0;
526  if (func == 0) {
527  void *dllib = dlopen(RDK_DSHAL_NAME, RTLD_LAZY);
528  if (dllib) {
529  func = (dsGetQuantizationRange_t) dlsym(dllib, "dsGetQuantizationRange");
530  if (func) {
531  printf("dsGetQuantizationRange_t(int, dsDisplayQuantizationRange_t*) is defined and loaded\r\n");
532  }
533  else {
534  printf("dsGetQuantizationRange_t(int, dsDisplayQuantizationRange_t*) is not defined\r\n");
535  }
536  dlclose(dllib);
537  }
538  else {
539  printf("Opening RDK_DSHAL_NAME [%s] failed\r\n", RDK_DSHAL_NAME);
540  }
541  }
542 
544 
545  if (func != 0) {
546  param->result = func(param->handle, &param->quantization_range);
547  }
548  else {
549  param->quantization_range = dsDISPLAY_QUANTIZATIONRANGE_UNKNOWN;
550  }
551 
552  IARM_BUS_Unlock(lock);
553 
554  return IARM_RESULT_SUCCESS;
555 }
556 
557 IARM_Result_t _dsGetCurrentOutputSettings(void* arg)
558 {
559 #ifndef RDK_DSHAL_NAME
560 #warning "RDK_DSHAL_NAME is not defined"
561 #define RDK_DSHAL_NAME "RDK_DSHAL_NAME is not defined"
562 #endif
563  _DEBUG_ENTER();
564  IARM_BUS_Lock(lock);
565 
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;
568  if (func == 0) {
569  void *dllib = dlopen(RDK_DSHAL_NAME, RTLD_LAZY);
570  if (dllib) {
571  func = (dsGetCurrentOutputSettings_t) dlsym(dllib, "dsGetCurrentOutputSettings");
572  if (func) {
573  printf("dsGetCurrentOutputSettings_t(int, dsHDRStandard_t*, dsDisplayMatrixCoefficients_t*, dsDisplayColorSpace_t*, unsigned int*, dsDisplayQuantizationRange_t*) is defined and loaded\r\n");
574  }
575  else {
576  printf("dsGetCurrentOutputSettings_t(int, dsHDRStandard_t*, dsDisplayMatrixCoefficients_t*, dsDisplayColorSpace_t*, unsigned int*, dsDisplayQuantizationRange_t*) is not defined\r\n");
577  }
578  dlclose(dllib);
579  }
580  else {
581  printf("Opening RDK_DSHAL_NAME [%s] failed\r\n", RDK_DSHAL_NAME);
582  }
583  }
584 
586 
587  if (func != 0) {
588  param->result = func(param->handle, &param->video_eotf, &param->matrix_coefficients, &param->color_space, &param->color_depth, &param->quantization_range);
589  }
590  else {
591  param->color_space = dsDISPLAY_COLORSPACE_UNKNOWN;
592  param->color_depth = 0;
593  param->matrix_coefficients = dsDISPLAY_MATRIXCOEFFICIENT_UNKNOWN;
594  param->video_eotf = dsHDRSTANDARD_NONE;
595  param->quantization_range = dsDISPLAY_QUANTIZATIONRANGE_UNKNOWN;
596  }
597 
598  IARM_BUS_Unlock(lock);
599 
600  return IARM_RESULT_SUCCESS;
601 }
602 
603 IARM_Result_t _dsIsHDCPEnabled(void *arg)
604 {
605  _DEBUG_ENTER();
606  IARM_BUS_Lock(lock);
607 
609  dsIsHDCPEnabled(param->handle, &param->enabled);
610 
611 #if 0
612  if(param->enabled){
613  __TIMESTAMP();printf("isHDCP =true !!!!!!..\r\n");
614  }
615  else{
616  __TIMESTAMP();printf("isHDCP =false !!!!!!..\r\n");
617  }
618 #endif
619 
620  IARM_BUS_Unlock(lock);
621 
622  return IARM_RESULT_SUCCESS;
623 }
624 
625 IARM_Result_t _dsIsDisplayConnected(void *arg)
626 {
627  _DEBUG_ENTER();
628  IARM_BUS_Lock(lock);
629 
631  dsIsDisplayConnected(param->handle,&param->connected);
632 
633  IARM_BUS_Unlock(lock);
634 
635  return IARM_RESULT_SUCCESS;
636 }
637 
638 IARM_Result_t _dsIsDisplaySurround(void *arg)
639 {
640 
641 #ifndef RDK_DSHAL_NAME
642 #warning "RDK_DSHAL_NAME is not defined"
643 #define RDK_DSHAL_NAME "RDK_DSHAL_NAME is not defined"
644 #endif
645  _DEBUG_ENTER();
646 
647  IARM_BUS_Lock(lock);
648 
649  printf("dsSRV::_dsIsDisplaySurround \r\n");
650 
651  typedef dsError_t (*dsIsDisplaySurround_t)(intptr_t handle, bool *surround);
652  static dsIsDisplaySurround_t func = 0;
653  if (func == 0) {
654  void *dllib = dlopen(RDK_DSHAL_NAME, RTLD_LAZY);
655  if (dllib) {
656  func = (dsIsDisplaySurround_t) dlsym(dllib, "dsIsDisplaySurround");
657  if (func) {
658  printf("dsIsDisplaySurround_t(int, bool*) is defined and loaded\r\n");
659  }
660  else {
661  printf("dsIsDisplaySurround_t(int, bool*) is not defined\r\n");
662  }
663  dlclose(dllib);
664  }
665  else {
666  printf("Opening RDK_DSHAL_NAME [%s] failed\r\n", RDK_DSHAL_NAME);
667  }
668  }
669 
671 
672  if (func != 0) {
673  dsError_t ret = func(param->handle, &param->surround);
674  printf("dsSRV ::isDisplaySurround() returns %d %d\r\n", ret, param->surround);
675  }
676  else {
677  param->surround = false;
678  }
679 
680  IARM_BUS_Unlock(lock);
681 
682  return IARM_RESULT_SUCCESS;
683 }
684 
685 IARM_Result_t _dsGetSurroundMode(void *arg)
686 {
687 
688 #ifndef RDK_DSHAL_NAME
689 #warning "RDK_DSHAL_NAME is not defined"
690 #define RDK_DSHAL_NAME "RDK_DSHAL_NAME is not defined"
691 #endif
692  _DEBUG_ENTER();
693 
694  IARM_BUS_Lock(lock);
695 
696  printf("dsSRV::_dsGetSurroundMode \r\n");
697 
698  typedef dsError_t (*dsGetSurroundMode_t)(intptr_t handle, int *surround);
699  static dsGetSurroundMode_t func = 0;
700  if (func == 0) {
701  void *dllib = dlopen(RDK_DSHAL_NAME, RTLD_LAZY);
702  if (dllib) {
703  func = (dsGetSurroundMode_t) dlsym(dllib, "dsGetSurroundMode");
704  if (func) {
705  printf("dsGetSurroundMode_t(int, int*) is defined and loaded\r\n");
706  }
707  else {
708  printf("dsGetSurroundMode_t(int, int*) is not defined\r\n");
709  }
710  dlclose(dllib);
711  }
712  else {
713  printf("Opening RDK_DSHAL_NAME [%s] failed\r\n", RDK_DSHAL_NAME);
714  }
715  }
716 
718 
719  if (func != 0) {
720  dsError_t ret = func(param->handle, &param->surround);
721  printf("dsSRV ::_dsGetSurroundMode() returns %d %d\r\n", ret, param->surround);
722  }
723  else {
724  param->surround = dsSURROUNDMODE_NONE;
725  }
726 
727  IARM_BUS_Unlock(lock);
728  return IARM_RESULT_SUCCESS;
729 }
730 
731 IARM_Result_t _dsEnableVideoPort(void *arg)
732 {
733  _DEBUG_ENTER();
734  IARM_BUS_Lock(lock);
735 
737  dsEnableVideoPort(param->handle, param->enabled);
738 
739  IARM_BUS_Unlock(lock);
740 
741  return IARM_RESULT_SUCCESS;
742 }
743 
744 IARM_Result_t _dsGetResolution(void *arg)
745 {
746  errno_t rc = -1;
747  _DEBUG_ENTER();
748 
749  IARM_BUS_Lock(lock);
750 
751 
752  std::string _Resolution(DEFAULT_RESOLUTION);
754  dsVideoPortResolution_t *resolution = &param->resolution;
755 
756  dsVideoPortType_t _VPortType = _GetVideoPortType(param->handle);
757 
758  if (_VPortType == dsVIDEOPORT_TYPE_HDMI ||
759  _VPortType == dsVIDEOPORT_TYPE_INTERNAL)
760  {
761  if(param->toPersist)
762  {
763  _Resolution = device::HostPersistence::getInstance().getProperty("HDMI0.resolution",_Resolution);
764  __TIMESTAMP();printf("Reading HDMI persistent resolution %s\r\n",_Resolution.c_str());
765  }
766  else{
767  dsError_t error = dsGetResolution(param->handle,resolution);
768  if(error == dsERR_NONE) {
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());
771  }
772  else {
773  _Resolution = _dsHDMIResolution;
774  }
775  }
776  }
777  else if (_VPortType == dsVIDEOPORT_TYPE_COMPONENT)
778  {
779  if(param->toPersist){
780  #ifdef HAS_ONLY_COMPOSITE
781  _Resolution = device::HostPersistence::getInstance().getProperty("Baseband0.resolution",_Resolution);
782  #else
783  _Resolution = device::HostPersistence::getInstance().getProperty("COMPONENT0.resolution",_Resolution);
784  #endif
785  __TIMESTAMP();printf("Reading Component persistent resolution %s\r\n",_Resolution.c_str());
786  }
787  else{
788  _Resolution = _dsCompResolution;
789  }
790  }
791  else if (_VPortType == dsVIDEOPORT_TYPE_BB )
792  {
793  if(param->toPersist){
794  _Resolution = device::HostPersistence::getInstance().getProperty("Baseband0.resolution",_Resolution);
795  __TIMESTAMP();printf("Reading BB persistent resolution %s\r\n",_Resolution.c_str());
796  }
797  else{
798  _Resolution = _dsBBResolution;
799  }
800  }
801  else if (_VPortType == dsVIDEOPORT_TYPE_RF )
802  {
803  if(param->toPersist){
804  _Resolution = device::HostPersistence::getInstance().getProperty("RF0.resolution",_Resolution);
805  __TIMESTAMP();printf("Reading RF persistent resolution %s\r\n",_Resolution.c_str());
806  }
807  else{
808  _Resolution = _dsRFResolution;
809  }
810  }
811  rc = strcpy_s(resolution->name,sizeof(resolution->name),_Resolution.c_str());
812  if(rc!=EOK)
813  {
814  ERR_CHK(rc);
815  }
816  printf("%s _VPortType:%d resolution::%s \n",__FUNCTION__,_VPortType,resolution->name);
817  IARM_BUS_Unlock(lock);
818 
819  return IARM_RESULT_SUCCESS;
820 }
821 
822 
823 IARM_Result_t _dsSetResolution(void *arg)
824 {
825  _DEBUG_ENTER();
826  dsError_t ret = dsERR_NONE;
827 
828  IARM_BUS_Lock(lock);
829 
831  if (param != NULL) //CID:82753 - Reverse_inull
832  {
833  dsVideoPortType_t _VPortType = _GetVideoPortType(param->handle);
834  bool isConnected = 0;
835  dsIsDisplayConnected(param->handle,&isConnected);
836  if(!isConnected)
837  {
838  printf("Port _VPortType:%d not connected..Ignoring Resolution Request------\r\n",_VPortType);
840  param->result = ret;
841  IARM_BUS_Unlock(lock);
842  return IARM_RESULT_SUCCESS;
843  }
844 
845  dsVideoPortResolution_t resolution = param->resolution;
846  std::string resolutionName(resolution.name);
847  __TIMESTAMP();printf("Resolution Requested ..%s \r\n",resolution.name);
848 
849  if(force_disable_4K)
850  {
851  std::size_t location = resolutionName.find("2160");
852  if(std::string::npos != location)
853  {
854  //Trying to set 4K resolution when it's disabled. This cannot be allowed.
855  printf("Error! Cannot set 4K resolution. Support for 4K is disabled.\n");
857  param->result = ret;
858  IARM_BUS_Unlock(lock);
859  return IARM_RESULT_SUCCESS;
860  }
861  }
862  /* * Check the Platform Resolution
863  * If the platform Resolution is same as requested , Do not set new resolution
864  * Needed to avoid setting resolution during multiple hot plug
865  */
866  IARM_BUS_Unlock(lock);
867  dsEdidIgnoreParam_t ignoreEdidParam;
868  memset(&ignoreEdidParam,0,sizeof(ignoreEdidParam));
869  ignoreEdidParam.handle = _VPortType;
870  _dsGetIgnoreEDIDStatus(&ignoreEdidParam);
871  bool IsIgnoreEdid = ignoreEdidParam.ignoreEDID;
872  IARM_BUS_Lock(lock);
873  __TIMESTAMP();printf("ResOverride _dsSetResolution IsIgnoreEdid:%d\n", IsIgnoreEdid);
874  //IsIgnoreEdid is true platform will take care of current resolution cache.
875  if (!IsIgnoreEdid) {
876  dsVideoPortResolution_t platresolution;
877  memset(platresolution.name,'\0',sizeof(platresolution.name));
878  dsGetResolution(param->handle,&platresolution);
879  __TIMESTAMP();printf("Resolution Requested ..%s Platform Resolution - %s\r\n",resolution.name,platresolution.name);
880  if ((strcmp(resolution.name,platresolution.name) == 0 ))
881  {
882 
883  printf("Same Resolution ..Ignoring Resolution Request------\r\n");
884  _dsHDMIResolution = platresolution.name;
885  /*!< Persist Resolution Settings */
886  persistResolution(param);
887  param->result = ret;
888  IARM_BUS_Unlock(lock);
889  return IARM_RESULT_SUCCESS;
890  }
891  }
892  /*!< Resolution Pre Change Event - IARM_BUS_DSMGR_EVENT_RES_POSTCHANGE */
893  _dsVideoPortPreResolutionCall(&param->resolution);
894 
895  /*!< Set Platform Resolution */
896  ret = dsSetResolution(param->handle, &param->resolution, param->toPersist);
897 
898  /*!< Resolution Post Change Event - IARM_BUS_DSMGR_EVENT_RES_POSTCHANGE */
899  _dsSendVideoPortPostResolutionCall(&param->resolution);
900 
901  if (ret == dsERR_NONE)
902  {
903  /*!< Persist Resolution Settings */
904  persistResolution(param);
905  }
906  param->result = ret;
907  }
908 
909  IARM_BUS_Unlock(lock);
910 
911  return IARM_RESULT_SUCCESS;
912 }
913 
914 dsDisplayColorDepth_t getPersistentColorDepth ()
915 {
916  dsDisplayColorDepth_t _colorDepth = DEFAULT_COLOR_DEPTH;
917  std::string strColorDept = std::to_string (_colorDepth);
918  strColorDept = device::HostPersistence::getInstance().getProperty("HDMI0.colorDepth", strColorDept);
919  try {
920  _colorDepth = (dsDisplayColorDepth_t)stoi (strColorDept);
921  }
922  catch (...) {
923  __TIMESTAMP();printf("Reading HDMI persistent color dept %s conversion failed\r\n", strColorDept.c_str());
924  }
925  __TIMESTAMP();printf("Reading HDMI persistent color dept %d\r\n", _colorDepth);
926  return _colorDepth;
927 }
928 
929 dsError_t handleDsGetPreferredColorDepth(intptr_t handle, dsDisplayColorDepth_t *colorDepth, bool persist)
930 {
931 #ifndef RDK_DSHAL_NAME
932 #warning "RDK_DSHAL_NAME is not defined"
933 #define RDK_DSHAL_NAME "RDK_DSHAL_NAME is not defined"
934 #endif
935 
936  dsError_t ret = dsERR_GENERAL;
937  typedef dsError_t (*dsGetPreferredColorDepth_t)(intptr_t handle, dsDisplayColorDepth_t *colorDepth, bool persist);
938  static dsGetPreferredColorDepth_t func = 0;
939  if (func == 0) {
940  void *dllib = dlopen(RDK_DSHAL_NAME, RTLD_LAZY);
941  if (dllib) {
942  func = (dsGetPreferredColorDepth_t) dlsym(dllib, "dsGetPreferredColorDepth");
943  if (func) {
944  printf("dsGetPreferredColorDepth(intptr_t handle, dsDisplayColorDepth_t *colorDepth, bool persist ) is defined and loaded\r\n");
945  }
946  else {
947  printf("dsGetPreferredColorDepth(intptr_t handle, dsDisplayColorDepth_t *colorDepth, bool persist ) is not defined\r\n");
948  }
949  dlclose(dllib);
950  }
951  else {
952  printf("Opening RDK_DSHAL_NAME [%s] failed\r\n", RDK_DSHAL_NAME);
953  }
954  }
955 
956 
957  if (func != 0) {
958  ret = func(handle, colorDepth, persist);
959  }
960  else {
961  printf("%s:%d not able to load funtion func:%p\r\n", func);
962  ret = dsERR_GENERAL;
963  }
964  return ret;
965 }
966 
967 IARM_Result_t _dsGetPreferredColorDepth(void *arg)
968 {
969  errno_t rc = -1;
970  _DEBUG_ENTER();
971  IARM_BUS_Lock(lock);
972 
973  dsDisplayColorDepth_t _colorDepth = DEFAULT_COLOR_DEPTH;
975  dsDisplayColorDepth_t *pcolorDepth = &param->colorDepth;
976 
977  dsVideoPortType_t _VPortType = _GetVideoPortType(param->handle);
978 
979  if (_VPortType == dsVIDEOPORT_TYPE_HDMI)
980  {
981  if(param->toPersist)
982  {
983  _colorDepth = getPersistentColorDepth ();
984  }
985  else{
986  //Get actual color depth here.
987  dsError_t error = handleDsGetPreferredColorDepth (param->handle, &_colorDepth, false);
988  if(error == dsERR_NONE) {
989  __TIMESTAMP();printf("ColorDepthOverride platform reported color dept is: 0x%x. Cached color dept is: 0x%x\r\n", _colorDepth, hdmiColorDept);
990  }
991  else {
992  _colorDepth = hdmiColorDept;
993  }
994  }
995  }
996  else {
997  __TIMESTAMP();printf("%s:%d not supported for video port: %d\r\n",__FUNCTION__, __LINE__, _VPortType);
998  }
999  *pcolorDepth = _colorDepth;
1000  printf("%s _VPortType:%d color dept::0x%x \n",__FUNCTION__,_VPortType, *pcolorDepth);
1001  param->result = dsERR_NONE;
1002  IARM_BUS_Unlock(lock);
1003 
1004  return IARM_RESULT_SUCCESS;
1005 
1006 }
1007 
1008 dsDisplayColorDepth_t getBestSupportedColorDepth (intptr_t handle, dsDisplayColorDepth_t inColorDepth)
1009 {
1010  unsigned int colorDepthCapability = 0;
1011  //Get sink color depth capabilities.
1012  int ret = handleDsColorDepthCapabilities (handle,&(colorDepthCapability));
1013  __TIMESTAMP();printf("dsColorDepthCapabilities returned: %d colorDepthCapability: 0x%x\r\n",
1014  ret, colorDepthCapability);
1015 
1016  if ((colorDepthCapability & inColorDepth) &&
1017  (inColorDepth!=dsDISPLAY_COLORDEPTH_AUTO)) {
1018  return inColorDepth;
1019  } else {
1020  //This condition happens if inColorDepth not supported by edid
1021  //Or it is in auto mode.
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;
1029  } else {
1030  //Not expecting here.
1031  }
1032  //if none of the edid supported color mode supports RDK defined vaules return
1033  //widely accepted default value.
1034  return dsDISPLAY_COLORDEPTH_8BIT;
1035  }
1036 }
1037 
1038 dsError_t handleDsSetPreferredColorDepth(intptr_t handle,dsDisplayColorDepth_t colorDepth, bool persist)
1039 {
1040 #ifndef RDK_DSHAL_NAME
1041 #warning "RDK_DSHAL_NAME is not defined"
1042 #define RDK_DSHAL_NAME "RDK_DSHAL_NAME is not defined"
1043 #endif
1044 
1045  dsError_t ret = dsERR_GENERAL;
1046  typedef dsError_t (*dsSetPreferredColorDepth_t)(intptr_t handle,dsDisplayColorDepth_t colorDepth, bool persist);
1047  static dsSetPreferredColorDepth_t func = 0;
1048  if (func == 0) {
1049  void *dllib = dlopen(RDK_DSHAL_NAME, RTLD_LAZY);
1050  if (dllib) {
1051  func = (dsSetPreferredColorDepth_t) dlsym(dllib, "dsSetPreferredColorDepth");
1052  if (func) {
1053  printf("dsSetPreferredColorDepth(intptr_t handle,dsDisplayColorDepth_t colorDepth, bool persist) is defined and loaded\r\n");
1054  }
1055  else {
1056  printf("dsSetPreferredColorDepth(intptr_t handle,dsDisplayColorDepth_t colorDepth, bool persist) is not defined\r\n");
1057  }
1058  dlclose(dllib);
1059  }
1060  else {
1061  printf("Opening RDK_DSHAL_NAME [%s] failed\r\n", RDK_DSHAL_NAME);
1062  }
1063  }
1064 
1065 
1066  if (func != 0) {
1067  ret = func(handle, colorDepth, persist);
1068  }
1069  else {
1070  printf("%s:%d not able to load funtion func:%p\r\n", func);
1071  ret = dsERR_GENERAL;
1072  }
1073  return ret;
1074 }
1075 
1076 IARM_Result_t setPreferredColorDepth(void *arg)
1077 {
1078  _DEBUG_ENTER();
1079  dsError_t ret = dsERR_NONE;
1080 
1081 
1083  if (param != NULL)
1084  {
1085  dsVideoPortType_t _VPortType = _GetVideoPortType(param->handle);
1086  bool isConnected = 0;
1087  dsIsDisplayConnected(param->handle,&isConnected);
1088  if(!isConnected)
1089  {
1090  printf("Port _VPortType:%d not connected..Ignoring Set color dept Request------\r\n",_VPortType);
1092  param->result = ret;
1093  return IARM_RESULT_SUCCESS;
1094  }
1095 
1096  dsDisplayColorDepth_t colorDepth = param->colorDepth;
1097 
1098  dsDisplayColorDepth_t platColorDept;
1099 
1100  //Get actual color depth
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)
1104  {
1105  printf("Same color dept ..Ignoring color dept Request------\r\n");
1106  hdmiColorDept = platColorDept;
1107  /*!< Persist Resolution Settings */
1108  if(param->toPersist){
1109  std::string strColorDept = std::to_string (param->colorDepth);
1110  device::HostPersistence::getInstance().persistHostProperty("HDMI0.colorDepth", strColorDept);
1111  }
1112  param->result = ret;
1113  return IARM_RESULT_SUCCESS;
1114  }
1115 
1116  //Getting the best supported color depth based on i/p color depth and edid support.
1117  dsDisplayColorDepth_t colorDepthToSet = getBestSupportedColorDepth (param->handle, param->colorDepth);
1118 
1119  /*!< Set Platform color depth */
1120  ret = handleDsSetPreferredColorDepth (param->handle, colorDepthToSet, param->toPersist);
1121  if (ret == dsERR_NONE)
1122  {
1123  /*!< Persist Resolution Settings */
1124  hdmiColorDept = param->colorDepth;
1125  if(param->toPersist){
1126  //Persist the user selected colordepth
1127  std::string strColorDept = std::to_string (param->colorDepth);
1128  device::HostPersistence::getInstance().persistHostProperty("HDMI0.colorDepth", strColorDept);
1129  }
1130  }
1131  param->result = ret;
1132  }
1133  return IARM_RESULT_SUCCESS;
1134 
1135 }
1136 
1137 IARM_Result_t _dsSetPreferredColorDepth(void *arg)
1138 {
1139  _DEBUG_ENTER();
1140 
1141  IARM_BUS_Lock(lock);
1142  IARM_Result_t ret = setPreferredColorDepth (arg);
1143  IARM_BUS_Unlock(lock);
1144  return ret;
1145 
1146 }
1147 
1148 dsError_t handleDsColorDepthCapabilities(intptr_t handle, unsigned int *colorDepthCapability )
1149 {
1150 #ifndef RDK_DSHAL_NAME
1151 #warning "RDK_DSHAL_NAME is not defined"
1152 #define RDK_DSHAL_NAME "RDK_DSHAL_NAME is not defined"
1153 #endif
1154 
1155  dsError_t ret = dsERR_GENERAL;
1156  typedef dsError_t (*dsColorDepthCapabilities_t)(intptr_t handle, unsigned int *colorDepthCapability);
1157  static dsColorDepthCapabilities_t func = 0;
1158  if (func == 0) {
1159  void *dllib = dlopen(RDK_DSHAL_NAME, RTLD_LAZY);
1160  if (dllib) {
1161  func = (dsColorDepthCapabilities_t) dlsym(dllib, "dsColorDepthCapabilities");
1162  if (func) {
1163  printf("dsColorDepthCapabilities(intptr_t handle, unsigned int *colorDepthCapability ) is defined and loaded\r\n");
1164  }
1165  else {
1166  printf("dsColorDepthCapabilities(intptr_t handle, unsigned int *colorDepthCapability ) is not defined\r\n");
1167  }
1168  dlclose(dllib);
1169  }
1170  else {
1171  printf("Opening RDK_DSHAL_NAME [%s] failed\r\n", RDK_DSHAL_NAME);
1172  }
1173  }
1174 
1175 
1176  if (func != 0) {
1177  ret = func(handle, colorDepthCapability);
1178  }
1179  else {
1180  printf("%s:%d not able to load funtion func:%p\r\n", func);
1181  ret = dsERR_GENERAL;
1182  }
1183  return ret;
1184 }
1185 
1186 IARM_Result_t _dsColorDepthCapabilities(void *arg)
1187 {
1188  _DEBUG_ENTER();
1189  dsError_t ret = dsERR_NONE;
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);
1195  //Add auto by default
1196  param->colorDepthCapability = (param->colorDepthCapability|dsDISPLAY_COLORDEPTH_AUTO);
1197 
1198  param->result = ret;
1199  IARM_BUS_Unlock(lock);
1200  return IARM_RESULT_SUCCESS;
1201 }
1202 
1203 //Call this function on hotplug scenario in dsmgr
1204 //and resume from standby
1205 void resetColorDepthOnHdmiReset(intptr_t handle)
1206 {
1207  //get color from persist location. then set the value
1208  dsDisplayColorDepth_t colorDepth = getPersistentColorDepth ();
1209  __TIMESTAMP();printf("resetColorDepthOnHdmiReset: resetting colordepth:0x%x \r\n", colorDepth);
1210 
1211  dsPreferredColorDepthParam_t colorDepthParam;
1212  colorDepthParam.handle = handle;
1213  colorDepthParam.colorDepth = colorDepth;
1214  //this is just a reset no need to persist
1215  colorDepthParam.toPersist = false;
1216 
1217  //call this function outside the lock
1218  IARM_Result_t ret = setPreferredColorDepth ((void*)(&colorDepthParam));
1219 }
1220 
1221 IARM_Result_t _dsVideoPortTerm(void *arg)
1222 {
1223  _DEBUG_ENTER();
1224  IARM_BUS_Lock(lock);
1225 
1226  m_isPlatInitialized--;
1227 
1228  if (0 == m_isPlatInitialized)
1229  {
1230  dsVideoPortTerm();
1231  }
1232 
1233  IARM_BUS_Unlock(lock);
1234 
1235  return IARM_RESULT_SUCCESS;
1236 }
1237 
1238 IARM_Result_t _dsEnableHDCP(void *arg)
1239 {
1240  _DEBUG_ENTER();
1241  IARM_BUS_Lock(lock);
1242 
1243  dsError_t ret = dsERR_NONE;
1244 
1245  __TIMESTAMP();printf("Enable HDCP in Platform !! \r\n");
1246 
1247  dsEnableHDCPParam_t *param = (dsEnableHDCPParam_t *)arg;
1248  ret = dsEnableHDCP(param->handle, param->contentProtect, param->hdcpKey, param->keySize);
1249  param->rpcResult = ret;
1250 
1251  IARM_BUS_Unlock(lock);
1252 
1253  return IARM_RESULT_SUCCESS;
1254 }
1255 
1256 
1257 static int _dsSendVideoPortPostResolutionCall(dsVideoPortResolution_t *resolution)
1258 {
1259  dsError_t ret = dsERR_NONE;
1260 
1261  if (resolution == NULL)
1262  {
1263  ret = dsERR_INVALID_PARAM;
1264  }
1265 
1266  if (ret == dsERR_NONE){
1267  IARM_Bus_DSMgr_EventData_t eventData;
1268  IARM_Bus_CommonAPI_ResChange_Param_t param;
1269 
1270  switch(resolution->pixelResolution) {
1272  param.width = 720;
1273  param.height = 480;
1274  break;
1276  param.width = 720;
1277  param.height = 576;
1278  break;
1279 
1281  param.width = 1280;
1282  param.height = 720;
1283  break;
1284 
1286  param.width = 1920;
1287  param.height = 1080;
1288  break;
1290  param.width = 3840;
1291  param.height = 2160;
1292  break;
1294  param.width = 4096;
1295  param.height = 2160;
1296  break;
1297  case dsVIDEO_PIXELRES_MAX: //to mute compiler warning
1298  default:
1299  param.width = 1280;
1300  param.height = 720;
1301  break;
1302  }
1303  eventData.data.resn.width = param.width;
1304  eventData.data.resn.height = param.height;
1305  IARM_BusDaemon_ResolutionPostchange(param);
1306  IARM_Bus_BroadcastEvent(IARM_BUS_DSMGR_NAME,(IARM_EventId_t)IARM_BUS_DSMGR_EVENT_RES_POSTCHANGE,(void *)&eventData, sizeof(eventData));
1307  }
1308  return ret;
1309 }
1310 static int _dsVideoPortPreResolutionCall(dsVideoPortResolution_t *resolution)
1311 {
1312  dsError_t ret = dsERR_NONE;
1313  if (resolution == NULL)
1314  {
1315  ret = dsERR_INVALID_PARAM;
1316  }
1317 
1318  if (ret == dsERR_NONE){
1319  IARM_Bus_DSMgr_EventData_t eventData;
1320  IARM_Bus_CommonAPI_ResChange_Param_t param;
1321 
1322  switch(resolution->pixelResolution) {
1324  param.width = 720;
1325  param.height = 480;
1326  break;
1328  param.width = 720;
1329  param.height = 576;
1330  break;
1331 
1333  param.width = 1280;
1334  param.height = 720;
1335  break;
1336 
1338  param.width = 1920;
1339  param.height = 1080;
1340  break;
1342  param.width = 3840;
1343  param.height = 2160;
1344  break;
1346  param.width = 4096;
1347  param.height = 2160;
1348  break;
1349  case dsVIDEO_PIXELRES_MAX: //to mute compiler warning
1350  default:
1351  param.width = 1280;
1352  param.height = 720;
1353  break;
1354  }
1355  eventData.data.resn.width = param.width;
1356  eventData.data.resn.height = param.height;
1357  IARM_BusDaemon_ResolutionPrechange(param);
1358  IARM_Bus_BroadcastEvent(IARM_BUS_DSMGR_NAME,(IARM_EventId_t)IARM_BUS_DSMGR_EVENT_RES_PRECHANGE,(void *)&eventData, sizeof(eventData));
1359  }
1360  return ret;
1361 }
1362 
1363 /*HDCP Status Call back */
1364 void _dsHdcpCallback (intptr_t handle, dsHdcpStatus_t status)
1365 {
1366  IARM_Bus_DSMgr_EventData_t hdcp_eventData;
1367 
1368 
1369  if (handle == NULL_HANDLE)
1370  {
1371  printf("Err:HDMI Hot plug back has NULL Handle... !!!!!!..\r\n");
1372  }
1373  switch(status)
1374  {
1376  __TIMESTAMP();printf("DS HDCP Authenticated Event!!!!!!..\r\n");
1377  hdcp_eventData.data.hdmi_hdcp.hdcpStatus = dsHDCP_STATUS_AUTHENTICATED;
1378  _hdcpStatus = status;
1379  break;
1380 
1382  __TIMESTAMP();printf("DS HDCP Failure Event!!!!!!..\r\n");
1383  hdcp_eventData.data.hdmi_hdcp.hdcpStatus = dsHDCP_STATUS_AUTHENTICATIONFAILURE;
1384  _hdcpStatus = status;
1385  break;
1386  /* Based on discussion with Steve, we may handle the unpowered and unauthenticated
1387  cases in a different manner. Logging this events for now.*/
1390  default:
1391  __TIMESTAMP();printf("HDCP Event Status from HAL is ...%d\n",status);
1392  hdcp_eventData.data.hdmi_hdcp.hdcpStatus = _hdcpStatus = status;
1393  break;
1394  }
1395 
1396  IARM_Bus_BroadcastEvent(IARM_BUS_DSMGR_NAME,(IARM_EventId_t)IARM_BUS_DSMGR_EVENT_HDCP_STATUS,(void *)&hdcp_eventData, sizeof(hdcp_eventData));
1397 }
1398 
1399 IARM_Result_t _dsGetHDCPStatus (void *arg)
1400 {
1401  _DEBUG_ENTER();
1402  IARM_BUS_Lock(lock);
1403 
1405 
1406  if (param != NULL) {
1407  param->hdcpStatus = _hdcpStatus;
1408  }
1409 
1410  IARM_BUS_Unlock(lock);
1411 
1412  return IARM_RESULT_SUCCESS;
1413 }
1414 
1415 IARM_Result_t _dsGetHDCPProtocol (void *arg)
1416 {
1417 #ifndef RDK_DSHAL_NAME
1418 #warning "RDK_DSHAL_NAME is not defined"
1419 #define RDK_DSHAL_NAME "RDK_DSHAL_NAME is not defined"
1420 #endif
1421  _DEBUG_ENTER();
1422 
1423  IARM_BUS_Lock(lock);
1424 
1425  typedef dsError_t (*dsGetHDCPProtocol_t)(intptr_t handle, dsHdcpProtocolVersion_t *protocolVersion);
1426  static dsGetHDCPProtocol_t func = 0;
1427  if (func == 0) {
1428  void *dllib = dlopen(RDK_DSHAL_NAME, RTLD_LAZY);
1429  if (dllib) {
1430  func = (dsGetHDCPProtocol_t) dlsym(dllib, "dsGetHDCPProtocol");
1431  if (func) {
1432  printf("dsGetHDCPProtocol_t(int, dsHdcpProtocolVersion_t *) is defined and loaded\r\n");
1433  }
1434  else {
1435  printf("dsGetHDCPProtocol_t(int, dsHdcpProtocolVersion_t *) is not defined\r\n");
1436  }
1437  dlclose(dllib);
1438  }
1439  else {
1440  printf("Opening RDK_DSHAL_NAME [%s] failed\r\n", RDK_DSHAL_NAME);
1441  }
1442  }
1443 
1445 
1446  if (func != 0) {
1447  dsError_t ret = func(param->handle, &param->protocolVersion);
1448  }
1449  else {
1450  param->protocolVersion = dsHDCP_VERSION_1X;
1451  }
1452 
1453  IARM_BUS_Unlock(lock);
1454 
1455  return IARM_RESULT_SUCCESS;
1456 }
1457 
1458 IARM_Result_t _dsGetHDCPReceiverProtocol (void *arg)
1459 {
1460 #ifndef RDK_DSHAL_NAME
1461 #warning "RDK_DSHAL_NAME is not defined"
1462 #define RDK_DSHAL_NAME "RDK_DSHAL_NAME is not defined"
1463 #endif
1464  _DEBUG_ENTER();
1465 
1466  IARM_BUS_Lock(lock);
1467 
1468  typedef dsError_t (*dsGetHDCPReceiverProtocol_t)(intptr_t handle, dsHdcpProtocolVersion_t *protocolVersion);
1469  static dsGetHDCPReceiverProtocol_t func = 0;
1470  if (func == 0) {
1471  void *dllib = dlopen(RDK_DSHAL_NAME, RTLD_LAZY);
1472  if (dllib) {
1473  func = (dsGetHDCPReceiverProtocol_t) dlsym(dllib, "dsGetHDCPReceiverProtocol");
1474  if (func) {
1475  printf("dsGetHDCPReceiverProtocol_t(int, dsHdcpProtocolVersion_t *) is defined and loaded\r\n");
1476  }
1477  else {
1478  printf("dsGetHDCPReceiverProtocol_t(int, dsHdcpProtocolVersion_t *) is not defined\r\n");
1479  }
1480  dlclose(dllib);
1481  }
1482  else {
1483  printf("Opening RDK_DSHAL_NAME [%s] failed\r\n", RDK_DSHAL_NAME);
1484  }
1485  }
1486 
1488 
1489  if (func != 0) {
1490  dsError_t ret = func(param->handle, &param->protocolVersion);
1491  }
1492  else {
1493  param->protocolVersion = dsHDCP_VERSION_1X;
1494  }
1495 
1496  IARM_BUS_Unlock(lock);
1497 
1498  return IARM_RESULT_SUCCESS;
1499 }
1500 
1501 IARM_Result_t _dsGetHDCPCurrentProtocol (void *arg)
1502 {
1503 #ifndef RDK_DSHAL_NAME
1504 #warning "RDK_DSHAL_NAME is not defined"
1505 #define RDK_DSHAL_NAME "RDK_DSHAL_NAME is not defined"
1506 #endif
1507  _DEBUG_ENTER();
1508 
1509  IARM_BUS_Lock(lock);
1510 
1511  typedef dsError_t (*dsGetHDCPCurrentProtocol_t)(intptr_t handle, dsHdcpProtocolVersion_t *protocolVersion);
1512  static dsGetHDCPCurrentProtocol_t func = 0;
1513  if (func == 0) {
1514  void *dllib = dlopen(RDK_DSHAL_NAME, RTLD_LAZY);
1515  if (dllib) {
1516  func = (dsGetHDCPCurrentProtocol_t) dlsym(dllib, "dsGetHDCPCurrentProtocol");
1517  if (func) {
1518  printf("dsGetHDCPCurrentProtocol_t(int, dsHdcpProtocolVersion_t *) is defined and loaded\r\n");
1519  }
1520  else {
1521  printf("dsGetHDCPCurrentProtocol_t(int, dsHdcpProtocolVersion_t *) is not defined\r\n");
1522  }
1523  dlclose(dllib);
1524  }
1525  else {
1526  printf("Opening RDK_DSHAL_NAME [%s] failed\r\n", RDK_DSHAL_NAME);
1527  }
1528  }
1529 
1531 
1532  if (func != 0) {
1533  dsError_t ret = func(param->handle, &param->protocolVersion);
1534  }
1535  else {
1536  param->protocolVersion = dsHDCP_VERSION_1X;
1537  }
1538 
1539  IARM_BUS_Unlock(lock);
1540 
1541  return IARM_RESULT_SUCCESS;
1542 }
1543 
1544 IARM_Result_t _dsGetTVHDRCapabilities(void *arg)
1545 {
1546  _DEBUG_ENTER();
1547 
1548  IARM_BUS_Lock(lock);
1549 
1550  typedef dsError_t (*dsGetTVHDRCapabilitiesFunc_t)(intptr_t handle, int *capabilities);
1551  static dsGetTVHDRCapabilitiesFunc_t func = 0;
1552  if (func == 0) {
1553  void *dllib = dlopen(RDK_DSHAL_NAME, RTLD_LAZY);
1554  if (dllib) {
1555  func = (dsGetTVHDRCapabilitiesFunc_t)dlsym(dllib, "dsGetTVHDRCapabilities");
1556  if (func) {
1557  printf("dsGetTVHDRCapabilities() is defined and loaded\r\n");
1558  }
1559  else {
1560  printf("dsGetTVHDRCapabilities() is not defined\r\n");
1561  }
1562  dlclose(dllib);
1563  }
1564  else {
1565  printf("Opening RDK_DSHAL_NAME [%s] failed\r\n", RDK_DSHAL_NAME);
1566  }
1567  }
1569  if(0 != func) {
1570  param->result = func(param->handle, &param->capabilities);
1571  if((param->capabilities & dsHDRSTANDARD_DolbyVision) && (enableHDRDVStatus == false))
1572  {
1573  param->capabilities &= ~dsHDRSTANDARD_DolbyVision;
1574  printf("_dsGetTVHDRCapabilities() DolbyVision Disabled param->capabilities:%x\r\n",param->capabilities);
1575  }
1576  }
1577  else {
1578  param->capabilities = dsHDRSTANDARD_NONE;
1579  }
1580 
1581  IARM_BUS_Unlock(lock);
1582  return IARM_RESULT_SUCCESS;
1583 }
1584 
1585 IARM_Result_t _dsSupportedTvResolutions(void *arg)
1586 {
1587  _DEBUG_ENTER();
1588 
1589  IARM_BUS_Lock(lock);
1590 
1591  typedef dsError_t (*dsSupportedTvResolutionsFunc_t)(intptr_t handle,int *resolutions);
1592  static dsSupportedTvResolutionsFunc_t func = 0;
1593  if (func == 0) {
1594  void *dllib = dlopen(RDK_DSHAL_NAME, RTLD_LAZY);
1595  if (dllib) {
1596  func = (dsSupportedTvResolutionsFunc_t)dlsym(dllib, "dsSupportedTvResolutions");
1597  if (func) {
1598  printf("dsSupportedTvResolutions() is defined and loaded\r\n");
1599  }
1600  else {
1601  printf("dsSupportedTvResolutions() is not defined\r\n");
1602  }
1603  dlclose(dllib);
1604  }
1605  else {
1606  printf("Opening RDK_DSHAL_NAME [%s] failed\r\n", RDK_DSHAL_NAME);
1607  }
1608  }
1610  if(0 != func) {
1611  param->result = func(param->handle, &param->resolutions);
1612  }
1613  else {
1614  param->resolutions = 0;
1615  }
1616 
1617  IARM_BUS_Unlock(lock);
1618  return IARM_RESULT_SUCCESS;
1619 }
1620 
1621 
1622 static dsVideoPortType_t _GetVideoPortType(intptr_t handle)
1623 {
1624  int numPorts,i;
1625  intptr_t halhandle = 0;
1626 
1627  numPorts = dsUTL_DIM(kSupportedPortTypes);
1628  for(i=0; i< numPorts; i++)
1629  {
1630  dsGetVideoPort(kPorts[i].id.type, kPorts[i].id.index, &halhandle);
1631  if (handle == halhandle)
1632  {
1633  return kPorts[i].id.type;
1634  }
1635  }
1636  printf("Error: The Requested Video Port is not part of Platform Port Configuration \r\n");
1637  return dsVIDEOPORT_TYPE_MAX;
1638 }
1639 
1640 
1641 static void persistResolution(dsVideoPortSetResolutionParam_t *param)
1642 {
1643  dsVideoPortResolution_t resolution = param->resolution;
1644  std::string resolutionName(resolution.name);
1645 
1646  try
1647  {
1648  dsVideoPortType_t _VPortType = _GetVideoPortType(param->handle);
1649  if (_VPortType == dsVIDEOPORT_TYPE_HDMI ||
1650  _VPortType == dsVIDEOPORT_TYPE_INTERNAL)
1651  {
1652  if(param->toPersist){
1653  device::HostPersistence::getInstance().persistHostProperty("HDMI0.resolution",resolutionName);
1654  }
1655 
1656  __TIMESTAMP();printf("Set Resolution on HDMI Port!!!!!!..\r\n");
1657  _dsHDMIResolution = resolutionName;
1658 
1659  if (false == IsCompatibleResolution(resolution.pixelResolution,getPixelResolution(_dsCompResolution)))
1660  {
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());
1664 
1665  if(param->forceCompatible)
1666  {
1667  #ifdef HAS_ONLY_COMPOSITE
1668  device::HostPersistence::getInstance().persistHostProperty("Baseband0.resolution",_dsCompResolution);
1669  #else
1670  device::HostPersistence::getInstance().persistHostProperty("COMPONENT0.resolution",_dsCompResolution);
1671  #endif
1672  }
1673  }
1674  else
1675  {
1676  __TIMESTAMP();printf("HDMI and Analog Ports Resolutions are Compatible \r\n");
1677  }
1678 
1679  }
1680  else if (_VPortType == dsVIDEOPORT_TYPE_COMPONENT)
1681  {
1682 
1683  if(param->toPersist){
1684  #ifdef HAS_ONLY_COMPOSITE
1685  device::HostPersistence::getInstance().persistHostProperty("Baseband0.resolution",resolutionName);
1686  #else
1687  device::HostPersistence::getInstance().persistHostProperty("COMPONENT0.resolution",resolutionName);
1688  #endif
1689  }
1690 
1691  __TIMESTAMP();printf("Set Resolution on Component/Composite Ports!!!!!!..\r\n");
1692  _dsCompResolution = resolutionName;
1693  if (false == IsCompatibleResolution(resolution.pixelResolution,getPixelResolution(_dsHDMIResolution)))
1694  {
1695  __TIMESTAMP();printf("HDMI Resolution is not Compatible with Analog ports..\r\n");
1696 
1697  _dsHDMIResolution = getCompatibleResolution(&resolution);
1698  if (_dsHDMIResolution.compare("480i") == 0)
1699  _dsHDMIResolution = "480p";
1700 
1701  __TIMESTAMP();printf("New Compatible resolution is %s \r\n",_dsHDMIResolution.c_str());
1702  if(param->forceCompatible)
1703  {
1704  device::HostPersistence::getInstance().persistHostProperty("HDMI0.resolution",_dsHDMIResolution);
1705  }
1706  }
1707  else
1708  {
1709  __TIMESTAMP();printf("HDMI and Analog Ports Resolutions are Compatible \r\n");
1710  }
1711  }
1712  else if (_VPortType == dsVIDEOPORT_TYPE_BB)
1713  {
1714 
1715  if(param->toPersist){
1716  device::HostPersistence::getInstance().persistHostProperty("Baseband0.resolution",resolutionName);
1717  }
1718 
1719  __TIMESTAMP();printf("Set Resolution on Composite Ports!!!!!!..\r\n");
1720  _dsBBResolution = resolutionName;
1721  if (false == IsCompatibleResolution(resolution.pixelResolution,getPixelResolution(_dsHDMIResolution)))
1722  {
1723  __TIMESTAMP();printf("HDMI Resolution is not Compatible with Analog ports..\r\n");
1724 
1725  _dsHDMIResolution = getCompatibleResolution(&resolution);
1726  if (_dsHDMIResolution.compare("480i") == 0)
1727  _dsHDMIResolution = "480p";
1728 
1729  __TIMESTAMP();printf("New Compatible resolution is %s \r\n",_dsHDMIResolution.c_str());
1730  }
1731  else
1732  {
1733  __TIMESTAMP();printf("HDMI and Analog Ports Resolutions are Compatible \r\n");
1734  }
1735  }
1736  else if (_VPortType == dsVIDEOPORT_TYPE_RF)
1737  {
1738 
1739  if(param->toPersist){
1740  device::HostPersistence::getInstance().persistHostProperty("RF0.resolution",resolutionName);
1741  }
1742 
1743  __TIMESTAMP();printf("Set Resolution on RF Ports!!!!!!..\r\n");
1744  _dsRFResolution = resolutionName;
1745  if (false == IsCompatibleResolution(resolution.pixelResolution,getPixelResolution(_dsHDMIResolution)))
1746  {
1747  __TIMESTAMP();printf("HDMI Resolution is not Compatible with Analog ports..\r\n");
1748 
1749  _dsHDMIResolution = getCompatibleResolution(&resolution);
1750  if (_dsHDMIResolution.compare("480i") == 0)
1751  _dsHDMIResolution = "480p";
1752 
1753  __TIMESTAMP();printf("New Compatible resolution is %s \r\n",_dsHDMIResolution.c_str());
1754  }
1755  else
1756  {
1757  __TIMESTAMP();printf("HDMI and Analog Ports Resolutions are Compatible \r\n");
1758  }
1759  }
1760  }
1761  catch(...)
1762  {
1763  printf("Error in Persisting the Video Resolution..... \r\n");
1764  }
1765 }
1766 
1767 
1768 #ifdef HAS_INIT_RESN_SETTINGS
1769 IARM_Result_t _dsInitResolution(void *arg)
1770 {
1771  _DEBUG_ENTER();
1772  dsError_t ret = dsERR_NONE;
1773  IARM_BUS_Lock(lock);
1774 
1776  if (param == NULL)
1777  {
1778  return IARM_RESULT_INVALID_STATE;
1779  }
1780 
1781  ret = dsInitResolution(&param->resolution);
1782  if (ret == dsERR_NONE)
1783  {
1784  persistResolution(param);
1785  }
1786 
1787  IARM_BUS_Unlock(lock);
1788  return IARM_RESULT_SUCCESS;
1789 }
1790 #endif
1791 
1792 
1793 static std::string getCompatibleResolution(dsVideoPortResolution_t *SrcResn)
1794 {
1795  dsError_t ret = dsERR_NONE;
1796  std::string resolution("720p");
1797 
1798  if (SrcResn == NULL)
1799  {
1800  ret = dsERR_INVALID_PARAM;
1801  }
1802 
1803  if (ret == dsERR_NONE){
1804  switch(SrcResn->pixelResolution) {
1805 
1807  return resolution.assign(SrcResn->name);
1808  break;
1809 
1814  case dsVIDEO_PIXELRES_MAX:
1815  default:
1816  return resolution.assign(kResolutions[kDefaultResIndex].name);
1817  break;
1818  }
1819  }
1820  return resolution;
1821 }
1822 
1823 static bool IsCompatibleResolution(dsVideoResolution_t pixelResolution1,dsVideoResolution_t pixelResolution2)
1824 {
1825  bool bret = false;
1826 
1827  if( pixelResolution1 == pixelResolution2) {
1828  bret = true;
1829  }
1830  else if((IsHDCompatible(pixelResolution1)) && (IsHDCompatible(pixelResolution2))) {
1831  bret = true;
1832  }
1833  return bret;
1834 }
1835 
1836 static dsVideoResolution_t getPixelResolution(std::string &resolution )
1837 {
1838  dsVideoPortResolution_t *Resn = &kResolutions[kDefaultResIndex];
1839 
1840  for (unsigned int i = 0; i < dsUTL_DIM(kResolutions); i++)
1841  {
1842  Resn = &kResolutions[i];
1843  if (resolution.compare(Resn->name) == 0 )
1844  {
1845  break;
1846  }
1847  }
1848  return Resn->pixelResolution;
1849 }
1850 
1851 
1852 IARM_Result_t _dsSetForceDisable4K(void *arg)
1853 {
1854  _DEBUG_ENTER();
1855 
1856  IARM_BUS_Lock(lock);
1857 
1859  param->result = dsERR_NONE;
1860 
1861  force_disable_4K = param->disable;
1862  if(force_disable_4K)
1863  {
1864  device::HostPersistence::getInstance().persistHostProperty("VideoDevice.force4KDisabled","true");
1865  }
1866  else
1867  {
1868  device::HostPersistence::getInstance().persistHostProperty("VideoDevice.force4KDisabled","false");
1869  }
1870 
1871  IARM_BUS_Unlock(lock);
1872  return IARM_RESULT_SUCCESS;
1873 }
1874 
1875 
1876 IARM_Result_t _dsSetForceHDRMode(void *arg)
1877 {
1878  _DEBUG_ENTER();
1879  IARM_BUS_Lock(lock);
1881 
1882  typedef dsError_t (*dsSetForceHDRMode_t)(intptr_t handle, dsHDRStandard_t mode);
1883  static dsSetForceHDRMode_t func = NULL;
1884  if (func == NULL) {
1885  void *dllib = dlopen(RDK_DSHAL_NAME, RTLD_LAZY);
1886  if (dllib != NULL) {
1887  func = (dsSetForceHDRMode_t) dlsym(dllib, "dsSetForceHDRMode");
1888  if (func != NULL) {
1889  printf("dsSRV: dsSetForceHDRMode(intptr_t handle, dsHDRStandard_t mode ) is defined and loaded\r\n");
1890  }
1891  else {
1892  printf("dsSRV: dsSetForceHDRMode(intptr_t handle, dsHDRStandard_t mode) is not defined\r\n");
1893  }
1894  dlclose(dllib); //CID:83238 - Resource leak
1895  }
1896  else {
1897  printf("dsSRV: Opening RDK_DSHAL_NAME [%s] failed\r\n", RDK_DSHAL_NAME);
1898  }
1899  }
1900 
1901  if (param != NULL) {
1902  param->result = dsERR_GENERAL;
1903 
1904  if (func != NULL) {
1905  param->result = func(param->handle, param->hdrMode);
1906  }
1907  }
1908 
1909  IARM_BUS_Unlock(lock);
1910  return IARM_RESULT_SUCCESS;
1911 }
1912 
1913 IARM_Result_t _dsGetForceDisable4K(void *arg)
1914 {
1915  _DEBUG_ENTER();
1916 
1917  IARM_BUS_Lock(lock);
1918 
1920  param->result = dsERR_NONE;
1921 
1922  param->disable = force_disable_4K;
1923  IARM_BUS_Unlock(lock);
1924  return IARM_RESULT_SUCCESS;
1925 }
1926 
1927 IARM_Result_t _dsSetScartParameter(void *arg)
1928 {
1929  dsScartParamParam_t *param = (dsScartParamParam_t *)arg;
1930  _DEBUG_ENTER();
1931  IARM_BUS_Lock(lock);
1932 
1933  printf("dsSRV::_dsSetScartParameter\r\n");
1934 
1935  typedef dsError_t (*dsScartParamFunc_t)(intptr_t handle, const char* parameter_str, const char* value_str);
1936  static dsScartParamFunc_t func = NULL;
1937  if (func == NULL) {
1938  void *dllib = dlopen(RDK_DSHAL_NAME, RTLD_LAZY);
1939  if (dllib != NULL) {
1940  func = (dsScartParamFunc_t) dlsym(dllib, "dsSetScartParameter");
1941  if (func != NULL) {
1942  printf("dsSRV: dsSetScartParameter(int,const char*,const char*) is defined and loaded\r\n");
1943  }
1944  else {
1945  printf("dsSRV: dsSetScartParameter(int,const char*,const char*) is not defined\r\n");
1946  }
1947  dlclose(dllib); //CID:87033 - Resource leak
1948  }
1949  else {
1950  printf("dsSRV: Opening RDK_DSHAL_NAME [%s] failed\r\n", RDK_DSHAL_NAME);
1951  }
1952  }
1953 
1954  if (param != NULL) {
1955  param->result = dsERR_GENERAL;
1956 
1957  if (func != NULL) {
1958  param->result = func(param->handle, param->param_bytes, param->value_bytes);
1959  }
1960  }
1961 
1962  IARM_BUS_Unlock(lock);
1963 
1964  return IARM_RESULT_SUCCESS;
1965 
1966 }
1967 
1968 IARM_Result_t _dsIsOutputHDR(void *arg)
1969 {
1971  _DEBUG_ENTER();
1972  IARM_BUS_Lock(lock);
1973 
1974  printf("dsSRV::_dsIsOutputHDR\r\n");
1975 
1976  typedef dsError_t (*dsIsOutputHDR_t)(intptr_t handle, bool *hdr);
1977  static dsIsOutputHDR_t func = NULL;
1978  if (func == NULL) {
1979  void *dllib = dlopen(RDK_DSHAL_NAME, RTLD_LAZY);
1980  if (dllib != NULL) {
1981  func = (dsIsOutputHDR_t) dlsym(dllib, "dsIsOutputHDR");
1982  if (func != NULL) {
1983  printf("dsSRV: dsIsOutputHDR(intptr_t handle, bool *hdr) is defined and loaded\r\n");
1984  }
1985  else {
1986  printf("dsSRV: dsIsOutputHDR(intptr_t handle, bool *hdr) is not defined\r\n");
1987  }
1988  dlclose(dllib); //CID:83623 - Resource leak
1989  }
1990  else {
1991  printf("dsSRV: Opening RDK_DSHAL_NAME [%s] failed\r\n", RDK_DSHAL_NAME);
1992  }
1993  }
1994 
1995  if (param != NULL) {
1996  param->result = dsERR_GENERAL;
1997 
1998  if (func != NULL) {
1999  param->result = func(param->handle, &param->hdr);
2000  }
2001  }
2002 
2003 
2004  IARM_BUS_Unlock(lock);
2005 
2006  return IARM_RESULT_SUCCESS;
2007 
2008 }
2009 
2010 IARM_Result_t _dsResetOutputToSDR(void *arg)
2011 {
2012  _DEBUG_ENTER();
2013  IARM_BUS_Lock(lock);
2014 
2015  printf("dsSRV::_dsResetOutputToSDR\r\n");
2016 
2017  typedef dsError_t (*dsResetOutputToSDR_t)();
2018  static dsResetOutputToSDR_t func = NULL;
2019  if (func == NULL) {
2020  void *dllib = dlopen(RDK_DSHAL_NAME, RTLD_LAZY);
2021  if (dllib != NULL) {
2022  func = (dsResetOutputToSDR_t) dlsym(dllib, "dsResetOutputToSDR");
2023  if (func != NULL) {
2024  printf("dsSRV: dsResetOutputToSDR() is defined and loaded\r\n");
2025  }
2026  else {
2027  printf("dsSRV: dsResetOutputToSDR() is not defined\r\n");
2028  }
2029  dlclose(dllib); //CID:88069 - Resource leak
2030  }
2031  else {
2032  printf("dsSRV: Opening RDK_DSHAL_NAME [%s] failed\r\n", RDK_DSHAL_NAME);
2033  }
2034  }
2035 
2036  if (func != NULL) {
2037  dsError_t result = func();
2038  }
2039 
2040 
2041  IARM_BUS_Unlock(lock);
2042 
2043  return IARM_RESULT_SUCCESS;
2044 
2045 }
2046 
2047 IARM_Result_t _dsSetHdmiPreference(void *arg)
2048 {
2050  _DEBUG_ENTER();
2051  IARM_BUS_Lock(lock);
2052 
2053  printf("dsSRV::_dsSetHdmiPreference\r\n");
2054 
2055  typedef dsError_t (*dsSetHdmiPreference_t)(intptr_t handle, dsHdcpProtocolVersion_t *hdcpCurrentProtocol);
2056  static dsSetHdmiPreference_t func = NULL;
2057  if (func == NULL) {
2058  void *dllib = dlopen(RDK_DSHAL_NAME, RTLD_LAZY);
2059  if (dllib != NULL) {
2060  func = (dsSetHdmiPreference_t) dlsym(dllib, "dsSetHdmiPreference");
2061  if (func != NULL) {
2062  printf("dsSRV: dsSetHdmiPreference(intptr_t handle, dsHdcpProtocolVersion_t *hdcpCurrentProtocol) is defined and loaded\r\n");
2063  }
2064  else {
2065  printf("dsSRV: dsSetHdmiPreference(intptr_t handle, dsHdcpProtocolVersion_t *hdcpCurrentProtocol) is not defined\r\n");
2066  }
2067  dlclose(dllib); //CID:83238 - Resource leak
2068  }
2069  else {
2070  printf("dsSRV: Opening RDK_DSHAL_NAME [%s] failed\r\n", RDK_DSHAL_NAME);
2071  }
2072  }
2073 
2074  if (param != NULL) {
2075  param->result = dsERR_GENERAL;
2076 
2077  if (func != NULL) {
2078  param->result = func(param->handle, &param->hdcpCurrentProtocol);
2079  }
2080  }
2081 
2082 
2083  IARM_BUS_Unlock(lock);
2084 
2085  return IARM_RESULT_SUCCESS;
2086 
2087 }
2088 
2089 IARM_Result_t _dsGetHdmiPreference(void *arg)
2090 {
2092  _DEBUG_ENTER();
2093  IARM_BUS_Lock(lock);
2094 
2095  printf("dsSRV::_dsGetHdmiPreference\r\n");
2096 
2097  typedef dsError_t (*dsGetHdmiPreference_t)(intptr_t handle, dsHdcpProtocolVersion_t *hdcpCurrentProtocol);
2098  static dsGetHdmiPreference_t func = NULL;
2099  if (func == NULL) {
2100  void *dllib = dlopen(RDK_DSHAL_NAME, RTLD_LAZY);
2101  if (dllib != NULL) {
2102  func = (dsGetHdmiPreference_t) dlsym(dllib, "dsGetHdmiPreference");
2103  if (func != NULL) {
2104  printf("dsSRV: dsGetHdmiPreference(intptr_t handle, dsHdcpProtocolVersion_t *hdcpCurrentProtocol) is defined and loaded\r\n");
2105  }
2106  else {
2107  printf("dsSRV: dsGetHdmiPreference(intptr_t handle, dsHdcpProtocolVersion_t *hdcpCurrentProtocol) is not defined\r\n");
2108  }
2109  dlclose(dllib); //CID:82165 - Resource leak
2110  }
2111  else {
2112  printf("dsSRV: Opening RDK_DSHAL_NAME [%s] failed\r\n", RDK_DSHAL_NAME);
2113  }
2114  }
2115 
2116  if (param != NULL) {
2117  param->result = dsERR_GENERAL;
2118 
2119  if (func != NULL) {
2120  param->result = func(param->handle, &param->hdcpCurrentProtocol);
2121  }
2122  }
2123 
2124 
2125  IARM_BUS_Unlock(lock);
2126 
2127  return IARM_RESULT_SUCCESS;
2128 
2129 }
2130 
2131 IARM_Result_t _dsSetBackgroundColor(void *arg)
2132 {
2134  _DEBUG_ENTER();
2135  IARM_BUS_Lock(lock);
2136 
2137  typedef dsError_t (*dsSetBackgroundColor_t)(intptr_t handle, dsVideoBackgroundColor_t color);
2138  static dsSetBackgroundColor_t func = NULL;
2139  if (func == NULL) {
2140  void *dllib = dlopen(RDK_DSHAL_NAME, RTLD_LAZY);
2141  if (dllib != NULL) {
2142  func = (dsSetBackgroundColor_t) dlsym(dllib, "dsSetBackgroundColor");
2143  if (func != NULL) {
2144  printf("dsSRV: dsError_t dsSetBackgroundColor(intptr_t handle, dsVideoBackgroundColor_t color) is defined and loaded\r\n");
2145  }
2146  else {
2147  printf("dsSRV: dsError_t dsSetBackgroundColor(intptr_t handle, dsVideoBackgroundColor_t color) is not defined\r\n");
2148  }
2149  dlclose(dllib); //CID:86640 - Resource leak
2150  }
2151  else {
2152  printf("dsSRV: Opening RDK_DSHAL_NAME [%s] failed\r\n", RDK_DSHAL_NAME);
2153  }
2154  }
2155 
2156  if (param != NULL && func != NULL) {
2157  func(param->handle, param->color);
2158  }
2159 
2160  IARM_BUS_Unlock(lock);
2161 
2162  return IARM_RESULT_SUCCESS;
2163 
2164 }
2165 void _dsVideoFormatUpdateCB(dsHDRStandard_t videoFormat)
2166 {
2167  IARM_Bus_DSMgr_EventData_t video_format_event_data;
2168  printf("%s: VideoOutPort format:%d \r\n", __FUNCTION__, videoFormat);
2169  video_format_event_data.data.VideoFormatInfo.videoFormat = videoFormat;
2170 
2171  IARM_Bus_BroadcastEvent(IARM_BUS_DSMGR_NAME,
2173  (void *)&video_format_event_data,
2174  sizeof(video_format_event_data));
2175 }
2176 
2177 static dsError_t _dsVideoFormatUpdateRegisterCB (dsVideoFormatUpdateCB_t cbFun) {
2178  dsError_t eRet = dsERR_GENERAL;
2179  printf("%s: %d - Inside \n", __FUNCTION__, __LINE__);
2180 
2181  typedef dsError_t (*dsVideoFormatUpdateRegisterCB_t)(dsVideoFormatUpdateCB_t cbFunArg);
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);
2186  if (dllib) {
2187  dsVideoFormatUpdateRegisterCBFun = (dsVideoFormatUpdateRegisterCB_t) dlsym(dllib, "dsVideoFormatUpdateRegisterCB");
2188  if(dsVideoFormatUpdateRegisterCBFun == 0) {
2189  printf("%s: dsVideoFormatUpdateRegisterCB is not defined %s\r\n", __FUNCTION__, dlerror());
2190  eRet = dsERR_GENERAL;
2191  }
2192  else {
2193  printf("%s: dsVideoFormatUpdateRegisterCB is loaded\r\n", __FUNCTION__);
2194  }
2195  dlclose(dllib);
2196  }
2197  else {
2198  printf("%s: Opening RDK_DSHAL_NAME [%s] failed %s\r\n",
2199  __FUNCTION__, RDK_DSHAL_NAME, dlerror());
2200  eRet = dsERR_GENERAL;
2201  }
2202  }
2203  if (0 != dsVideoFormatUpdateRegisterCBFun) {
2204  eRet = dsVideoFormatUpdateRegisterCBFun (cbFun);
2205  printf("%s: dsVideoFormatUpdateRegisterCBFun registered\r\n", __FUNCTION__);
2206  }
2207  else {
2208  printf("%s: dsVideoFormatUpdateRegisterCBFun NULL\r\n", __FUNCTION__);
2209  }
2210 
2211  return eRet;
2212 }
2213 
2214 bool isComponentPortPresent()
2215 {
2216  bool componentPortPresent = false;
2217  int numPorts,i;
2218 
2219  numPorts = dsUTL_DIM(kSupportedPortTypes);
2220  for(i=0; i< numPorts; i++)
2221  {
2222  if (kSupportedPortTypes[i] == dsVIDEOPORT_TYPE_COMPONENT)
2223  {
2224  componentPortPresent = true;;
2225  }
2226  }
2227  printf(" componentPortPresent :%d\n",componentPortPresent);
2228  return componentPortPresent;
2229 }
2230 
2231 IARM_Result_t _dsGetIgnoreEDIDStatus(void* arg)
2232 {
2233  dsEdidIgnoreParam_t *param = (dsEdidIgnoreParam_t*) arg;
2234  _DEBUG_ENTER();
2235  IARM_BUS_Lock(lock);
2236  //Default status is false
2237  typedef dsError_t (*dsGetIgnoreEDIDStatus_t)(intptr_t handleArg, bool* statusArg);
2238  static dsGetIgnoreEDIDStatus_t func = NULL;
2239  if (func == NULL) {
2240  void *dllib = dlopen(RDK_DSHAL_NAME, RTLD_LAZY);
2241  if (dllib != NULL) {
2242  func = (dsGetIgnoreEDIDStatus_t) dlsym(dllib, "dsGetIgnoreEDIDStatus");
2243  if (func != NULL) {
2244  printf("dsSRV: dsError_t dsGetIgnoreEDIDStatus(intptr_t handle, bool* status) is defined and loaded\r\n");
2245  }
2246  else {
2247  printf("dsSRV: dsError_t dsGetIgnoreEDIDStatus(intptr_t handle, bool* status) is not defined\r\n");
2248  }
2249  dlclose(dllib);
2250  }
2251  else {
2252  printf("dsSRV: Opening RDK_DSHAL_NAME [%s] dsGetIgnoreEDIDStatus failed\r\n", RDK_DSHAL_NAME);
2253  }
2254  }
2255 
2256  if (func != NULL) {
2257  func(param->handle, &param->ignoreEDID);
2258  }
2259  printf("dsSRV: _dsGetIgnoreEDIDStatus status: %d\r\n", param->ignoreEDID);
2260 
2261  IARM_BUS_Unlock(lock);
2262 
2263  return IARM_RESULT_SUCCESS;
2264 }
2265 /** @} */
2266 /** @} */
_dsVideoPortIsActiveParam_t
Definition: dsRpc.h:516
_dsVideoPortGetSurroundModeParam_t
Definition: dsRpc.h:547
dsGetResolution
dsError_t dsGetResolution(intptr_t handle, dsVideoPortResolution_t *resolution)
Get the video display resolution.
Definition: dsVideoPort.c:353
dsRegisterHdcpStatusCallback
dsError_t dsRegisterHdcpStatusCallback(intptr_t handle, dsHDCPStatusCallback_t cb)
Register a callback function to listen for HDCP status.
dsGetVideoPort
dsError_t dsGetVideoPort(dsVideoPortType_t type, int index, intptr_t *handle)
Get the video port handle.
Definition: dsVideoPort.c:64
_dsVideoPortIsDisplaySurroundParam_t
Definition: dsRpc.h:542
dsHDCP_STATUS_AUTHENTICATED
@ dsHDCP_STATUS_AUTHENTICATED
Definition: dsTypes.h:416
_dsCurrentOutputSettings_t
Definition: dsRpc.h:922
dsVIDEO_PIXELRES_720x576
@ dsVIDEO_PIXELRES_720x576
Definition: dsTypes.h:460
dsVIDEOPORT_TYPE_HDMI
@ dsVIDEOPORT_TYPE_HDMI
Definition: dsTypes.h:441
_dsVideoPortGetHandleParam_t
Definition: dsRpc.h:503
dsHDRSTANDARD_DolbyVision
@ dsHDRSTANDARD_DolbyVision
Definition: dsTypes.h:696
dsIsDisplayConnected
dsError_t dsIsDisplayConnected(intptr_t handle, bool *connected)
Indicate whether a video port is connected to a display.
Definition: dsVideoPort.c:245
dsVideoFormatUpdateCB_t
void(* dsVideoFormatUpdateCB_t)(dsHDRStandard_t videoFormat)
Callback function used to notify applications of Video Format change.
Definition: dsVideoPort.h:56
dsTypes.h
Device Settings HAL types.
dsVideoPortInit
dsError_t dsVideoPortInit()
Initialize underlying Video Port sub-system.
Definition: dsVideoPort.c:45
dsHDCP_STATUS_UNAUTHENTICATED
@ dsHDCP_STATUS_UNAUTHENTICATED
Definition: dsTypes.h:415
_dsVideoPortSetResolutionParam_t
Definition: dsRpc.h:560
dsColorDepthCapabilitiesParam_t
Definition: dsRpc.h:568
dsVIDEO_PIXELRES_1280x720
@ dsVIDEO_PIXELRES_1280x720
Definition: dsTypes.h:461
_dsMatrixCoefficients_t
Definition: dsRpc.h:898
dsVideoPortType_t
enum _dsVideoPortType_t dsVideoPortType_t
_dsSetHdmiPreferenceParam_t
Definition: dsRpc.h:857
dsVideoPort.h
_dsVideoPortResolution_t::pixelResolution
dsVideoResolution_t pixelResolution
Definition: dsTypes.h:644
device::HostPersistence::persistHostProperty
void persistHostProperty(const std::string &key, const std::string &value)
Definition: hostPersistence.cpp:273
dsError.h
Device Settings HAL error codes.
IARM_Bus_RegisterCall
IARM_Result_t IARM_Bus_RegisterCall(const char *methodName, IARM_BusCall_t handler)
This API is used to register an RPC method that can be invoked by other applications.
dsPreferredColorDepthParam_t
Definition: dsRpc.h:574
_dsVideoPortGetResolutionParam_t
Definition: dsRpc.h:553
_dsVideoPortEnabledParam_t
Definition: dsRpc.h:509
dsUtl.h
Device Settings HAL utilities.
_dsGetHdmiPreferenceParam_t
Definition: dsRpc.h:863
IARM_BUS_DSMGR_EVENT_HDCP_STATUS
@ IARM_BUS_DSMGR_EVENT_HDCP_STATUS
Definition: dsMgr.h:52
dsVIDEOPORT_TYPE_INTERNAL
@ dsVIDEOPORT_TYPE_INTERNAL
Definition: dsTypes.h:443
_dsColorSpace_t
Definition: dsRpc.h:910
dsSetResolution
dsError_t dsSetResolution(intptr_t handle, dsVideoPortResolution_t *resolution, bool persist)
Set video port's display resolution.
Definition: dsVideoPort.c:409
dsERR_GENERAL
@ dsERR_GENERAL
Definition: dsError.h:86
dsVIDEOPORT_TYPE_RF
@ dsVIDEOPORT_TYPE_RF
Definition: dsTypes.h:435
dsEnableHDCP
dsError_t dsEnableHDCP(intptr_t handle, bool contentProtect, char *hdcpKey, size_t keySize)
Toggle HDCP protection of a video port.
Definition: dsVideoPort.c:530
dsIsVideoPortActive
dsError_t dsIsVideoPortActive(intptr_t handle, bool *active)
This function is used to indicate whether a video port is connected to a display.
Definition: dsVideoPort.c:577
dsERR_NONE
@ dsERR_NONE
Definition: dsError.h:85
dsHDCP_STATUS_UNPOWERED
@ dsHDCP_STATUS_UNPOWERED
Definition: dsTypes.h:414
dsVideoResolution_t
enum _dsVideoResolution_t dsVideoResolution_t
dsVIDEOPORT_TYPE_BB
@ dsVIDEOPORT_TYPE_BB
Definition: dsTypes.h:436
_dsEdidIgnoreParam_t
Definition: dsRpc.h:341
dsVideoBackgroundColor_t
enum _dsVideoBackgroundColor_t dsVideoBackgroundColor_t
dsVIDEOPORT_TYPE_SCART
@ dsVIDEOPORT_TYPE_SCART
Definition: dsTypes.h:444
IARM_Bus_BroadcastEvent
IARM_Result_t IARM_Bus_BroadcastEvent(const char *ownerName, IARM_EventId_t eventId, void *data, size_t len)
This API is used to publish an Asynchronous event to all IARM client registered for this perticular e...
_dsVideoPortIsDisplayConnectedParam_t
Definition: dsRpc.h:537
libIBus.h
RDK IARM-Bus API Declarations.
_dsIsOutputHDRParam_t
Definition: dsRpc.h:851
_dsEnableHDCPParam
Definition: dsRpc.h:680
_dsEot_t
Definition: dsRpc.h:892
_dsGetHDRCapabilitiesParam_t
Definition: dsRpc.h:774
IARM_BUS_DSMGR_EVENT_RES_POSTCHANGE
@ IARM_BUS_DSMGR_EVENT_RES_POSTCHANGE
Definition: dsMgr.h:48
dsHDRSTANDARD_NONE
@ dsHDRSTANDARD_NONE
Definition: dsTypes.h:693
dsDisplay.h
IARM_BUS_DSMGR_EVENT_VIDEO_FORMAT_UPDATE
@ IARM_BUS_DSMGR_EVENT_VIDEO_FORMAT_UPDATE
Definition: dsMgr.h:70
dsVIDEO_PIXELRES_720x480
@ dsVIDEO_PIXELRES_720x480
Definition: dsTypes.h:459
dsForceDisable4KParam_t
Definition: dsRpc.h:844
dsHDRStandard_t
enum _dsHDRStandard_t dsHDRStandard_t
_dsVideoPortResolution_t
Structure that defines video port resolution settings of output video device.
Definition: dsTypes.h:642
_dsColorDepth_t
Definition: dsRpc.h:904
_dsSupportedResolutionParam_t
Definition: dsRpc.h:607
IARM_BUS_DSMGR_EVENT_RES_PRECHANGE
@ IARM_BUS_DSMGR_EVENT_RES_PRECHANGE
Definition: dsMgr.h:47
_dsQuantizationRange_t
Definition: dsRpc.h:916
_dsSetBackgroundColorParam_t
Definition: dsRpc.h:532
_dsVideoPortResolution_t::name
char name[32]
Definition: dsTypes.h:643
dsVIDEO_PIXELRES_MAX
@ dsVIDEO_PIXELRES_MAX
Definition: dsTypes.h:467
dsVIDEOPORT_TYPE_MAX
@ dsVIDEOPORT_TYPE_MAX
Definition: dsTypes.h:445
dsERR_OPERATION_NOT_SUPPORTED
@ dsERR_OPERATION_NOT_SUPPORTED
Definition: dsError.h:89
_dsVideoPortGetHDCPStatus_t
Definition: dsRpc.h:522
dsForceHDRModeParam_t
Definition: dsRpc.h:837
dsVIDEOPORT_TYPE_COMPONENT
@ dsVIDEOPORT_TYPE_COMPONENT
Definition: dsTypes.h:440
dsHDCP_STATUS_AUTHENTICATIONFAILURE
@ dsHDCP_STATUS_AUTHENTICATIONFAILURE
Definition: dsTypes.h:417
dsEnableVideoPort
dsError_t dsEnableVideoPort(intptr_t handle, bool enabled)
Enable/disable a video port.
Definition: dsVideoPort.c:328
_dsVideoPortGetHDCPProtocolVersion_t
Definition: dsRpc.h:527
dsVIDEO_PIXELRES_1920x1080
@ dsVIDEO_PIXELRES_1920x1080
Definition: dsTypes.h:462
dsIsHDCPEnabled
dsError_t dsIsHDCPEnabled(intptr_t handle, bool *enabled)
Indicate whether a video port is HDCP protected.
Definition: dsVideoPort.c:96
_dsScartParamParam_t
Definition: dsRpc.h:885
dsVIDEO_PIXELRES_4096x2160
@ dsVIDEO_PIXELRES_4096x2160
Definition: dsTypes.h:465
dsUTL_DIM
#define dsUTL_DIM(arr)
Device Settings general Array dimension calculation inline definition.
Definition: dsUtl.h:85
dsVideoPortTerm
dsError_t dsVideoPortTerm(void)
Terminate the Video Port sub-system.
Definition: dsVideoPort.c:511
dsERR_INVALID_PARAM
@ dsERR_INVALID_PARAM
Definition: dsError.h:87
device::HostPersistence::getInstance
static HostPersistence & getInstance(void)
Definition: hostPersistence.cpp:122
dsError_t
dsError_t
Device Settings API Error return codes.
Definition: dsError.h:84
dsHDCP_VERSION_1X
@ dsHDCP_VERSION_1X
Definition: dsTypes.h:405
dsIsVideoPortEnabled
dsError_t dsIsVideoPortEnabled(intptr_t handle, bool *enabled)
Indicate whether a video port is enabled.
Definition: dsVideoPort.c:125
dsInitResolution
dsError_t dsInitResolution(dsVideoPortResolution_t *)
Initialize the Video Resolution.
_DSMgr_EventData_t
Definition: dsMgr.h:81
dsVIDEO_PIXELRES_3840x2160
@ dsVIDEO_PIXELRES_3840x2160
Definition: dsTypes.h:464