Display: detect if WCG enabled

This commit is contained in:
李通洲
2024-07-20 01:41:24 +08:00
parent 2f26045d30
commit 4fe1bb0b7e
6 changed files with 15 additions and 1 deletions
@@ -34,6 +34,7 @@ FFDisplayResult* ffdsAppendDisplay(
display->bitDepth = 0;
display->hdrEnabled = false;
display->wcgEnabled = false;
return display;
}
@@ -64,6 +64,7 @@ typedef struct FFDisplayResult
bool primary;
uint8_t bitDepth;
bool hdrEnabled;
bool wcgEnabled;
} FFDisplayResult;
typedef struct FFDisplayServerResult
@@ -178,6 +178,7 @@ static void detectDisplays(FFDisplayServerResult* ds)
if (DisplayConfigGetDeviceInfo(&advColorInfo.header) == ERROR_SUCCESS)
{
display->hdrEnabled = !!advColorInfo.advancedColorEnabled;
display->wcgEnabled = !!advColorInfo.wideColorEnforced;
display->bitDepth = (uint8_t) advColorInfo.bitsPerColorChannel;
}
}
@@ -119,6 +119,12 @@ static void waylandKdeHdrListener(void *data, FF_MAYBE_UNUSED struct kde_output_
display->hdrEnabled = !!hdr_enabled;
}
static void waylandKdeWcgListener(void *data, FF_MAYBE_UNUSED struct kde_output_device_v2 *kde_output_device_v2, uint32_t wcg_enabled)
{
WaylandDisplay* display = data;
display->wcgEnabled = !!wcg_enabled;
}
static struct kde_output_device_v2_listener outputListener = {
.geometry = waylandKdeGeometryListener,
.current_mode = waylandKdeCurrentModeListener,
@@ -137,7 +143,7 @@ static struct kde_output_device_v2_listener outputListener = {
.name = waylandKdeNameListener,
.high_dynamic_range = waylandKdeHdrListener,
.sdr_brightness = (void*) stubListener,
.wide_color_gamut = (void*) stubListener,
.wide_color_gamut = waylandKdeWcgListener,
.auto_rotate_policy = (void*) stubListener,
.icc_profile_path = (void*) stubListener,
.brightness_metadata = (void*) stubListener,
@@ -194,7 +200,10 @@ void ffWaylandHandleKdeOutput(WaylandData* wldata, struct wl_registry* registry,
(uint32_t) display.physicalHeight
);
if (item)
{
item->hdrEnabled = display.hdrEnabled;
item->wcgEnabled = display.wcgEnabled;
}
ffStrbufDestroy(&display.description);
ffStrbufDestroy(&display.name);
@@ -47,6 +47,7 @@ typedef struct WaylandDisplay
FFstrbuf edidName;
uint64_t id;
bool hdrEnabled;
bool wcgEnabled;
void* internal;
} WaylandDisplay;
+1
View File
@@ -319,6 +319,7 @@ void ffGenerateDisplayJsonResult(FF_MAYBE_UNUSED FFDisplayOptions* options, yyjs
yyjson_mut_obj_add_uint(doc, obj, "rotation", item->rotation);
yyjson_mut_obj_add_uint(doc, obj, "bitDepth", item->bitDepth);
yyjson_mut_obj_add_bool(doc, obj, "hdrEnabled", item->hdrEnabled);
yyjson_mut_obj_add_bool(doc, obj, "wcgEnabled", item->wcgEnabled);
switch (item->type)
{