Skip to content

Commit a4bbf9c

Browse files
authored
Merge pull request #58 from rdkcentral/rdkemw-4577
RDKEMW-4577:Reduce dumpedidinfo logging and fix colorimetry api calls
2 parents 4a96421 + 5aefe62 commit a4bbf9c

File tree

2 files changed

+52
-18
lines changed

2 files changed

+52
-18
lines changed

rpc/cli/dsDisplay.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ dsError_t dsGetEDIDBytes(intptr_t handle, unsigned char *edid, int *length)
180180
if (param.result == dsERR_NONE) {
181181
printf("dsCLI ::getEDIDBytes returns %d bytes\r\n", param.length);
182182
if (edid) {
183-
memcpy_s(edid, *length, param.bytes, param.length);
183+
rc = memcpy_s(edid, *length, param.bytes, param.length);
184184
if(rc!=EOK)
185185
{
186186
ERR_CHK(rc);

rpc/srv/dsDisplay.c

Lines changed: 51 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@
5555

5656
static int m_isInitialized = 0;
5757
static int m_isPlatInitialized = 0;
58+
static bool isEdidCached = false;
59+
static bool isEdidBytesCached = false;
5860
static pthread_mutex_t dsLock = PTHREAD_MUTEX_INITIALIZER;
5961

6062
#define NULL_HANDLE 0
@@ -165,16 +167,32 @@ IARM_Result_t _dsGetDisplayAspectRatio(void *arg)
165167
IARM_Result_t _dsGetEDID(void *arg)
166168
{
167169
_DEBUG_ENTER();
168-
169-
IARM_BUS_Lock(lock);
170-
171-
dsDisplayGetEDIDParam_t *param = (dsDisplayGetEDIDParam_t *)arg;
170+
errno_t rc = -1;
171+
static dsDisplayEDID_t *edidInfo = (dsDisplayEDID_t*)malloc(sizeof(dsDisplayEDID_t));
172+
dsDisplayGetEDIDParam_t *param = (dsDisplayGetEDIDParam_t *)arg;
172173
dsVideoPortType_t _VPortType;
174+
if(isEdidCached && param)
175+
{
176+
rc = memcpy_s(&param->edid,sizeof(param->edid),edidInfo,sizeof(dsDisplayEDID_t));
177+
if(rc!=EOK)
178+
{
179+
ERR_CHK(rc);
180+
}
181+
return IARM_RESULT_SUCCESS;
182+
}
183+
IARM_BUS_Lock(lock);
184+
memset(edidInfo,0,sizeof(*edidInfo));
173185

174186
dsGetEDID(param->handle, &param->edid);
175187

176188
filterEDIDResolution(param->handle, &param->edid);
177189
dumpEDIDInformation( &param->edid);
190+
rc = memcpy_s(edidInfo,sizeof(dsDisplayEDID_t),&param->edid,sizeof(param->edid));
191+
if(rc!=EOK)
192+
{
193+
ERR_CHK(rc);
194+
}
195+
isEdidCached = true;
178196

179197
IARM_BUS_Unlock(lock);
180198

@@ -190,6 +208,22 @@ IARM_Result_t _dsGetEDIDBytes(void *arg)
190208
#endif
191209
errno_t rc = -1;
192210
_DEBUG_ENTER();
211+
static unsigned char edid[1024] = {0};
212+
static int length = 0;
213+
dsDisplayGetEDIDBytesParam_t *param = (dsDisplayGetEDIDBytesParam_t *)arg;
214+
if(isEdidBytesCached && param)
215+
{
216+
rc = memcpy_s(param->bytes,sizeof(param->bytes),edid,length);
217+
if(rc!=EOK)
218+
{
219+
ERR_CHK(rc);
220+
}
221+
param->length = length;
222+
param->result = dsERR_NONE;
223+
return IARM_RESULT_SUCCESS;
224+
225+
}
226+
193227

194228
IARM_BUS_Lock(lock);
195229

@@ -214,11 +248,9 @@ IARM_Result_t _dsGetEDIDBytes(void *arg)
214248
}
215249
}
216250

217-
dsDisplayGetEDIDBytesParam_t *param = (dsDisplayGetEDIDBytesParam_t *)arg;
251+
218252

219253
if (func != 0) {
220-
unsigned char edid[1024] = {0};
221-
int length = 0;
222254
dsError_t ret = func(param->handle, edid, &length);
223255
if (ret == dsERR_NONE && length <= 1024) {
224256
rc = memcpy_s(param->bytes,sizeof(param->bytes),edid,length);
@@ -227,6 +259,7 @@ IARM_Result_t _dsGetEDIDBytes(void *arg)
227259
ERR_CHK(rc);
228260
}
229261
param->length = length;
262+
isEdidBytesCached = true;
230263
}
231264
param->result = ret;
232265
}
@@ -281,6 +314,9 @@ void _dsDisplayEventCallback(intptr_t handle, dsDisplayEvent_t event, void *even
281314
INT_INFO("Disconnecting HDMI from display !!!!!!!! ..\r\n");
282315
_eventData.data.hdmi_hpd.event = dsDISPLAY_EVENT_DISCONNECTED ;
283316
_eventId = IARM_BUS_DSMGR_EVENT_HDMI_HOTPLUG;
317+
isEdidCached = false;
318+
isEdidBytesCached = false;
319+
INT_INFO("isEdidCached & isEdidBytesCached set to false !!!!!!..\r\n");
284320
_dsSyncHdmiStatus(DS_HDMI_TAG_HOTPLUP, dsDISPLAY_EVENT_DISCONNECTED);
285321
break;
286322

@@ -378,19 +414,17 @@ static void filterEDIDResolution(intptr_t handle, dsDisplayEDID_t *edid)
378414

379415
static void dumpEDIDInformation( dsDisplayEDID_t *edid)
380416
{
381-
INT_INFO("[DsMgr] Product Code: %x\r\n",edid->productCode);
382-
INT_INFO("[DsMgr] Serial Number: %x\r\n",edid->serialNumber);
383-
INT_INFO("[DsMgr] Manufacturer Year: %d\r\n",edid->manufactureYear);
384-
INT_INFO("[DsMgr] Manufacturer week: %d\r\n",edid->manufactureWeek);
385-
INT_INFO("[DsMgr] Monitor Name : %s\r\n",edid->monitorName);
386-
INT_INFO("[DsMgr] Hdmi Device Type : %s\r\n",(edid->hdmiDeviceType)?"HDMI":"DVI");
387-
INT_INFO("[DsMgr] Hdmi Device Is Repeater : %x\r\n",edid->isRepeater);
388-
INT_INFO("[DsMgr] No of Resolutions: %x\r\n",edid->numOfSupportedResolution);
389-
for (size_t j = 0; j < edid->numOfSupportedResolution; j++)
417+
printf("[DsMgr]dumpEDIDInformation: Product:%x SN:%x Year:%d Week:%d Monitor:%s Type:%s Repeater:%x\n",
418+
edid->productCode,edid->serialNumber,edid->manufactureYear,edid->manufactureWeek,edid->monitorName,
419+
edid->hdmiDeviceType?"HDMI":"DVI",edid->isRepeater);
420+
printf("Supported resolutions: ");
421+
for (size_t j = 0; j < edid->numOfSupportedResolution; j++)
390422
{
391423
dsVideoPortResolution_t *edidResn = &(edid->suppResolutionList[j]);
392-
INT_INFO("[DsMgr] Resolution Name: %s\r\n",edidResn->name);
424+
printf("%s,",edidResn->name);
425+
393426
}
427+
printf("\n");
394428
}
395429

396430

0 commit comments

Comments
 (0)