Skip to content

Commit 4fe1bb0

Browse files
committed
Display: detect if WCG enabled
1 parent 2f26045 commit 4fe1bb0

File tree

6 files changed

+15
-1
lines changed

6 files changed

+15
-1
lines changed

src/detection/displayserver/displayserver.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ FFDisplayResult* ffdsAppendDisplay(
3434

3535
display->bitDepth = 0;
3636
display->hdrEnabled = false;
37+
display->wcgEnabled = false;
3738

3839
return display;
3940
}

src/detection/displayserver/displayserver.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ typedef struct FFDisplayResult
6464
bool primary;
6565
uint8_t bitDepth;
6666
bool hdrEnabled;
67+
bool wcgEnabled;
6768
} FFDisplayResult;
6869

6970
typedef struct FFDisplayServerResult

src/detection/displayserver/displayserver_windows.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ static void detectDisplays(FFDisplayServerResult* ds)
178178
if (DisplayConfigGetDeviceInfo(&advColorInfo.header) == ERROR_SUCCESS)
179179
{
180180
display->hdrEnabled = !!advColorInfo.advancedColorEnabled;
181+
display->wcgEnabled = !!advColorInfo.wideColorEnforced;
181182
display->bitDepth = (uint8_t) advColorInfo.bitsPerColorChannel;
182183
}
183184
}

src/detection/displayserver/linux/wayland/kde-output.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,12 @@ static void waylandKdeHdrListener(void *data, FF_MAYBE_UNUSED struct kde_output_
119119
display->hdrEnabled = !!hdr_enabled;
120120
}
121121

122+
static void waylandKdeWcgListener(void *data, FF_MAYBE_UNUSED struct kde_output_device_v2 *kde_output_device_v2, uint32_t wcg_enabled)
123+
{
124+
WaylandDisplay* display = data;
125+
display->wcgEnabled = !!wcg_enabled;
126+
}
127+
122128
static struct kde_output_device_v2_listener outputListener = {
123129
.geometry = waylandKdeGeometryListener,
124130
.current_mode = waylandKdeCurrentModeListener,
@@ -137,7 +143,7 @@ static struct kde_output_device_v2_listener outputListener = {
137143
.name = waylandKdeNameListener,
138144
.high_dynamic_range = waylandKdeHdrListener,
139145
.sdr_brightness = (void*) stubListener,
140-
.wide_color_gamut = (void*) stubListener,
146+
.wide_color_gamut = waylandKdeWcgListener,
141147
.auto_rotate_policy = (void*) stubListener,
142148
.icc_profile_path = (void*) stubListener,
143149
.brightness_metadata = (void*) stubListener,
@@ -194,7 +200,10 @@ void ffWaylandHandleKdeOutput(WaylandData* wldata, struct wl_registry* registry,
194200
(uint32_t) display.physicalHeight
195201
);
196202
if (item)
203+
{
197204
item->hdrEnabled = display.hdrEnabled;
205+
item->wcgEnabled = display.wcgEnabled;
206+
}
198207

199208
ffStrbufDestroy(&display.description);
200209
ffStrbufDestroy(&display.name);

src/detection/displayserver/linux/wayland/wayland.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ typedef struct WaylandDisplay
4747
FFstrbuf edidName;
4848
uint64_t id;
4949
bool hdrEnabled;
50+
bool wcgEnabled;
5051
void* internal;
5152
} WaylandDisplay;
5253

src/modules/display/display.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,7 @@ void ffGenerateDisplayJsonResult(FF_MAYBE_UNUSED FFDisplayOptions* options, yyjs
319319
yyjson_mut_obj_add_uint(doc, obj, "rotation", item->rotation);
320320
yyjson_mut_obj_add_uint(doc, obj, "bitDepth", item->bitDepth);
321321
yyjson_mut_obj_add_bool(doc, obj, "hdrEnabled", item->hdrEnabled);
322+
yyjson_mut_obj_add_bool(doc, obj, "wcgEnabled", item->wcgEnabled);
322323

323324
switch (item->type)
324325
{

0 commit comments

Comments
 (0)