Skip to content

Commit f4c43ab

Browse files
committed
Display (Windows): adds VRR status detection support
1 parent e84739b commit f4c43ab

File tree

4 files changed

+25
-0
lines changed

4 files changed

+25
-0
lines changed

src/detection/displayserver/displayserver.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ FFDisplayResult* ffdsAppendDisplay(
4545
display->manufactureYear = 0;
4646
display->manufactureWeek = 0;
4747
display->serial = 0;
48+
display->vrrStatus = FF_DISPLAY_VRR_STATUS_UNKNOWN;
4849

4950
return display;
5051
}

src/detection/displayserver/displayserver.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,13 @@ typedef enum __attribute__((__packed__)) FFDisplayHdrStatus
6060
FF_DISPLAY_HDR_STATUS_ENABLED,
6161
} FFDisplayHdrStatus;
6262

63+
typedef enum __attribute__((__packed__)) FFDisplayVrrStatus
64+
{
65+
FF_DISPLAY_VRR_STATUS_UNKNOWN,
66+
FF_DISPLAY_VRR_STATUS_DISABLED,
67+
FF_DISPLAY_VRR_STATUS_ENABLED,
68+
} FFDisplayVrrStatus;
69+
6370
typedef struct FFDisplayResult
6471
{
6572
uint32_t width; // in px
@@ -83,6 +90,7 @@ typedef struct FFDisplayResult
8390
uint16_t manufactureYear;
8491
uint16_t manufactureWeek;
8592
uint32_t serial;
93+
FFDisplayVrrStatus vrrStatus;
8694
} FFDisplayResult;
8795

8896
typedef struct FFDisplayServerResult

src/detection/displayserver/displayserver_windows.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ static void detectDisplays(FFDisplayServerResult* ds)
229229
}
230230
if (edidLength > 0)
231231
ffEdidGetSerialAndManufactureDate(edidData, &display->serial, &display->manufactureYear, &display->manufactureWeek);
232+
display->vrrStatus = path->flags & DISPLAYCONFIG_PATH_BOOST_REFRESH_RATE ? FF_DISPLAY_VRR_STATUS_ENABLED : FF_DISPLAY_VRR_STATUS_DISABLED;
232233
}
233234
}
234235
}

src/modules/display/display.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,21 @@ bool ffGenerateDisplayJsonResult(FF_MAYBE_UNUSED FFDisplayOptions* options, yyjs
348348
yyjson_mut_obj_add_uint(doc, output, "height", item->height);
349349
yyjson_mut_obj_add_real(doc, output, "refreshRate", item->refreshRate);
350350

351+
if (item->vrrStatus == FF_DISPLAY_VRR_STATUS_UNKNOWN)
352+
yyjson_mut_obj_add_null(doc, output, "vrrStatus");
353+
else switch (item->vrrStatus)
354+
{
355+
case FF_DISPLAY_VRR_STATUS_DISABLED:
356+
yyjson_mut_obj_add_str(doc, output, "vrrStatus", "Disabled");
357+
break;
358+
case FF_DISPLAY_VRR_STATUS_ENABLED:
359+
yyjson_mut_obj_add_str(doc, output, "vrrStatus", "Enabled");
360+
break;
361+
default:
362+
yyjson_mut_obj_add_str(doc, output, "vrrStatus", "Unknown");
363+
break;
364+
}
365+
351366
yyjson_mut_val* scaled = yyjson_mut_obj_add_obj(doc, obj, "scaled");
352367
yyjson_mut_obj_add_uint(doc, scaled, "width", item->scaledWidth);
353368
yyjson_mut_obj_add_uint(doc, scaled, "height", item->scaledHeight);

0 commit comments

Comments
 (0)