diff --git a/src/detection/displayserver/displayserver.c b/src/detection/displayserver/displayserver.c index d2499e349..ddc973962 100644 --- a/src/detection/displayserver/displayserver.c +++ b/src/detection/displayserver/displayserver.c @@ -1,6 +1,6 @@ #include "displayserver.h" -bool ffdsAppendDisplay( +FFDisplayResult* ffdsAppendDisplay( FFDisplayServerResult* result, uint32_t width, uint32_t height, @@ -16,7 +16,7 @@ bool ffdsAppendDisplay( uint32_t physicalHeight) { if(width == 0 || height == 0) - return false; + return NULL; FFDisplayResult* display = ffListAdd(&result->displays); display->width = width; @@ -27,12 +27,15 @@ bool ffdsAppendDisplay( display->rotation = rotation; ffStrbufInitMove(&display->name, name); display->type = type; - display->primary = primary; display->id = id; display->physicalWidth = physicalWidth; display->physicalHeight = physicalHeight; + display->primary = primary; - return true; + display->bitDepth = 0; + display->hdrEnabled = false; + + return display; } void ffConnectDisplayServerImpl(FFDisplayServerResult* ds); diff --git a/src/detection/displayserver/displayserver.h b/src/detection/displayserver/displayserver.h index 7467ef56a..127dbc5fe 100644 --- a/src/detection/displayserver/displayserver.h +++ b/src/detection/displayserver/displayserver.h @@ -58,10 +58,12 @@ typedef struct FFDisplayResult FFstrbuf name; FFDisplayType type; uint32_t rotation; - bool primary; uint64_t id; // platform dependent uint32_t physicalWidth; uint32_t physicalHeight; + bool primary; + uint8_t bitDepth; + bool hdrEnabled; } FFDisplayResult; typedef struct FFDisplayServerResult @@ -76,7 +78,7 @@ typedef struct FFDisplayServerResult const FFDisplayServerResult* ffConnectDisplayServer(); -bool ffdsAppendDisplay( +FFDisplayResult* ffdsAppendDisplay( FFDisplayServerResult* result, uint32_t width, uint32_t height, diff --git a/src/detection/displayserver/displayserver_windows.c b/src/detection/displayserver/displayserver_windows.c index 3ccb212fd..3c685e287 100644 --- a/src/detection/displayserver/displayserver_windows.c +++ b/src/detection/displayserver/displayserver_windows.c @@ -146,7 +146,7 @@ static void detectDisplays(FFDisplayServerResult* ds) default: rotation = 0; break; } - ffdsAppendDisplay(ds, + FFDisplayResult* display = ffdsAppendDisplay(ds, width, height, path->targetInfo.refreshRate.Numerator / (double) path->targetInfo.refreshRate.Denominator, @@ -164,6 +164,23 @@ static void detectDisplays(FFDisplayServerResult* ds) physicalWidth, physicalHeight ); + + if (display) + { + DISPLAYCONFIG_GET_ADVANCED_COLOR_INFO advColorInfo = { + .header = { + .type = DISPLAYCONFIG_DEVICE_INFO_GET_ADVANCED_COLOR_INFO, + .size = sizeof(advColorInfo), + .adapterId = path->targetInfo.adapterId, + .id = path->targetInfo.id, + } + }; + if (DisplayConfigGetDeviceInfo(&advColorInfo.header) == ERROR_SUCCESS) + { + display->hdrEnabled = !!advColorInfo.advancedColorEnabled; + display->bitDepth = (uint8_t) advColorInfo.bitsPerColorChannel; + } + } } } }