Monitor (macOS): test HDR support for external monitors

This commit is contained in:
李通洲
2023-08-11 22:04:26 +08:00
parent 045d7052d1
commit 519f3bfd50
3 changed files with 34 additions and 2 deletions
+4 -2
View File
@@ -106,11 +106,13 @@ static const char* detectWithDdcci(FFlist* results)
if (IOAVServiceCopyEDID(service, &edid) != KERN_SUCCESS)
continue;
if (CFDataGetLength(edid) < 128)
uint32_t edidLength = (uint32_t) CFDataGetLength(edid);
if (edidLength == 0 || edidLength % 128 != 0)
continue;
uint32_t width, height;
const uint8_t* edidData = CFDataGetBytePtr(edid);
ffEdidGetPhysicalResolution(edidData, &width, &height);
if (width == 0 || height == 0) continue;
@@ -120,7 +122,7 @@ static const char* detectWithDdcci(FFlist* results)
ffStrbufInit(&display->name);
ffEdidGetName(edidData, &display->name);
ffEdidGetPhysicalSize(edidData, &display->physicalWidth, &display->physicalHeight);
display->hdrCompatible = false;
display->hdrCompatible = ffEdidGetHdrCompatible(edidData, edidLength);
}
return NULL;
}