Skip to content

Commit 6e571a3

Browse files
committed
Display (Windows): prefer DISPLAYCONFIG_DEVICE_INFO_GET_ADVANCED_COLOR_INFO_2
1 parent 01e78e2 commit 6e571a3

File tree

1 file changed

+29
-8
lines changed

1 file changed

+29
-8
lines changed

src/detection/displayserver/displayserver_windows.c

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -189,26 +189,47 @@ static void detectDisplays(FFDisplayServerResult* ds)
189189

190190
if (display)
191191
{
192-
DISPLAYCONFIG_GET_ADVANCED_COLOR_INFO advColorInfo = {
192+
DISPLAYCONFIG_GET_ADVANCED_COLOR_INFO_2 advColorInfo2 = {
193193
.header = {
194-
.type = DISPLAYCONFIG_DEVICE_INFO_GET_ADVANCED_COLOR_INFO,
195-
.size = sizeof(advColorInfo),
194+
.type = DISPLAYCONFIG_DEVICE_INFO_GET_ADVANCED_COLOR_INFO_2,
195+
.size = sizeof(advColorInfo2),
196196
.adapterId = path->targetInfo.adapterId,
197197
.id = path->targetInfo.id,
198198
}
199199
};
200-
if (DisplayConfigGetDeviceInfo(&advColorInfo.header) == ERROR_SUCCESS)
200+
if (DisplayConfigGetDeviceInfo(&advColorInfo2.header) == ERROR_SUCCESS)
201201
{
202-
if (advColorInfo.advancedColorEnabled)
202+
if (advColorInfo2.highDynamicRangeUserEnabled)
203203
display->hdrStatus = FF_DISPLAY_HDR_STATUS_ENABLED;
204-
else if (advColorInfo.advancedColorSupported)
204+
else if (advColorInfo2.highDynamicRangeSupported)
205205
display->hdrStatus = FF_DISPLAY_HDR_STATUS_SUPPORTED;
206206
else
207207
display->hdrStatus = FF_DISPLAY_HDR_STATUS_UNSUPPORTED;
208-
display->bitDepth = (uint8_t) advColorInfo.bitsPerColorChannel;
208+
display->bitDepth = (uint8_t) advColorInfo2.bitsPerColorChannel;
209209
}
210210
else
211-
display->hdrStatus = FF_DISPLAY_HDR_STATUS_UNKNOWN;
211+
{
212+
DISPLAYCONFIG_GET_ADVANCED_COLOR_INFO advColorInfo = {
213+
.header = {
214+
.type = DISPLAYCONFIG_DEVICE_INFO_GET_ADVANCED_COLOR_INFO,
215+
.size = sizeof(advColorInfo),
216+
.adapterId = path->targetInfo.adapterId,
217+
.id = path->targetInfo.id,
218+
}
219+
};
220+
if (DisplayConfigGetDeviceInfo(&advColorInfo.header) == ERROR_SUCCESS)
221+
{
222+
if (advColorInfo.advancedColorEnabled)
223+
display->hdrStatus = FF_DISPLAY_HDR_STATUS_ENABLED;
224+
else if (advColorInfo.advancedColorSupported)
225+
display->hdrStatus = FF_DISPLAY_HDR_STATUS_SUPPORTED;
226+
else
227+
display->hdrStatus = FF_DISPLAY_HDR_STATUS_UNSUPPORTED;
228+
display->bitDepth = (uint8_t) advColorInfo.bitsPerColorChannel;
229+
}
230+
else
231+
display->hdrStatus = FF_DISPLAY_HDR_STATUS_UNKNOWN;
232+
}
212233
if (edidLength > 0)
213234
ffEdidGetSerialAndManufactureDate(edidData, &display->serial, &display->manufactureYear, &display->manufactureWeek);
214235
}

0 commit comments

Comments
 (0)