mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-13 02:42:09 +02:00
Display (Windows): adds VRR status detection support
This commit is contained in:
@@ -45,6 +45,7 @@ FFDisplayResult* ffdsAppendDisplay(
|
||||
display->manufactureYear = 0;
|
||||
display->manufactureWeek = 0;
|
||||
display->serial = 0;
|
||||
display->vrrStatus = FF_DISPLAY_VRR_STATUS_UNKNOWN;
|
||||
|
||||
return display;
|
||||
}
|
||||
|
||||
@@ -60,6 +60,13 @@ typedef enum __attribute__((__packed__)) FFDisplayHdrStatus
|
||||
FF_DISPLAY_HDR_STATUS_ENABLED,
|
||||
} FFDisplayHdrStatus;
|
||||
|
||||
typedef enum __attribute__((__packed__)) FFDisplayVrrStatus
|
||||
{
|
||||
FF_DISPLAY_VRR_STATUS_UNKNOWN,
|
||||
FF_DISPLAY_VRR_STATUS_DISABLED,
|
||||
FF_DISPLAY_VRR_STATUS_ENABLED,
|
||||
} FFDisplayVrrStatus;
|
||||
|
||||
typedef struct FFDisplayResult
|
||||
{
|
||||
uint32_t width; // in px
|
||||
@@ -83,6 +90,7 @@ typedef struct FFDisplayResult
|
||||
uint16_t manufactureYear;
|
||||
uint16_t manufactureWeek;
|
||||
uint32_t serial;
|
||||
FFDisplayVrrStatus vrrStatus;
|
||||
} FFDisplayResult;
|
||||
|
||||
typedef struct FFDisplayServerResult
|
||||
|
||||
@@ -229,6 +229,7 @@ static void detectDisplays(FFDisplayServerResult* ds)
|
||||
}
|
||||
if (edidLength > 0)
|
||||
ffEdidGetSerialAndManufactureDate(edidData, &display->serial, &display->manufactureYear, &display->manufactureWeek);
|
||||
display->vrrStatus = path->flags & DISPLAYCONFIG_PATH_BOOST_REFRESH_RATE ? FF_DISPLAY_VRR_STATUS_ENABLED : FF_DISPLAY_VRR_STATUS_DISABLED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -348,6 +348,21 @@ bool ffGenerateDisplayJsonResult(FF_MAYBE_UNUSED FFDisplayOptions* options, yyjs
|
||||
yyjson_mut_obj_add_uint(doc, output, "height", item->height);
|
||||
yyjson_mut_obj_add_real(doc, output, "refreshRate", item->refreshRate);
|
||||
|
||||
if (item->vrrStatus == FF_DISPLAY_VRR_STATUS_UNKNOWN)
|
||||
yyjson_mut_obj_add_null(doc, output, "vrrStatus");
|
||||
else switch (item->vrrStatus)
|
||||
{
|
||||
case FF_DISPLAY_VRR_STATUS_DISABLED:
|
||||
yyjson_mut_obj_add_str(doc, output, "vrrStatus", "Disabled");
|
||||
break;
|
||||
case FF_DISPLAY_VRR_STATUS_ENABLED:
|
||||
yyjson_mut_obj_add_str(doc, output, "vrrStatus", "Enabled");
|
||||
break;
|
||||
default:
|
||||
yyjson_mut_obj_add_str(doc, output, "vrrStatus", "Unknown");
|
||||
break;
|
||||
}
|
||||
|
||||
yyjson_mut_val* scaled = yyjson_mut_obj_add_obj(doc, obj, "scaled");
|
||||
yyjson_mut_obj_add_uint(doc, scaled, "width", item->scaledWidth);
|
||||
yyjson_mut_obj_add_uint(doc, scaled, "height", item->scaledHeight);
|
||||
|
||||
Reference in New Issue
Block a user