Skip to content

Commit 4e3673a

Browse files
committed
DisplayServer (Linux): check HDR support with xx_color_manager_v4_interface (WIP)
1 parent 10c8c1b commit 4e3673a

File tree

6 files changed

+2768
-0
lines changed

6 files changed

+2768
-0
lines changed

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,10 +491,12 @@ if(LINUX)
491491
src/detection/displayserver/linux/wayland/global-output.c
492492
src/detection/displayserver/linux/wayland/zwlr-output.c
493493
src/detection/displayserver/linux/wayland/kde-output.c
494+
src/detection/displayserver/linux/wayland/color-manager.c
494495
src/detection/displayserver/linux/wayland/wlr-output-management-unstable-v1-protocol.c
495496
src/detection/displayserver/linux/wayland/kde-output-device-v2-protocol.c
496497
src/detection/displayserver/linux/wayland/kde-output-order-v1-protocol.c
497498
src/detection/displayserver/linux/wayland/xdg-output-unstable-v1-protocol.c
499+
src/detection/displayserver/linux/wayland/xx-color-management-v4-protocol.c
498500
src/detection/displayserver/linux/wmde.c
499501
src/detection/displayserver/linux/xcb.c
500502
src/detection/displayserver/linux/xlib.c
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
#include "wayland.h"
2+
#include "xx-color-management-v4-client-protocol.h"
3+
4+
static void waylandSupportedPrimariesNamed(void* data, FF_MAYBE_UNUSED struct xx_color_manager_v4* manager, uint32_t primaries)
5+
{
6+
WaylandData* wldata = data;
7+
switch (primaries)
8+
{
9+
case XX_COLOR_MANAGER_V4_PRIMARIES_SRGB:
10+
printf("Supported named primaries: SRGB\n");
11+
break;
12+
case XX_COLOR_MANAGER_V4_PRIMARIES_PAL_M:
13+
printf("Supported named primaries: PAL-M\n");
14+
break;
15+
case XX_COLOR_MANAGER_V4_PRIMARIES_PAL:
16+
printf("Supported named primaries: PAL\n");
17+
break;
18+
case XX_COLOR_MANAGER_V4_PRIMARIES_NTSC:
19+
printf("Supported named primaries: NTSC\n");
20+
break;
21+
case XX_COLOR_MANAGER_V4_PRIMARIES_GENERIC_FILM:
22+
printf("Supported named primaries: Generic Film\n");
23+
break;
24+
case XX_COLOR_MANAGER_V4_PRIMARIES_BT2020:
25+
printf("Supported named primaries: BT2020\n");
26+
break;
27+
case XX_COLOR_MANAGER_V4_PRIMARIES_CIE1931_XYZ:
28+
printf("Supported named primaries: CIE1931 XYZ\n");
29+
break;
30+
case XX_COLOR_MANAGER_V4_PRIMARIES_DCI_P3:
31+
printf("Supported named primaries: DCI-P3\n");
32+
break;
33+
case XX_COLOR_MANAGER_V4_PRIMARIES_DISPLAY_P3:
34+
printf("Supported named primaries: Display P3\n");
35+
break;
36+
case XX_COLOR_MANAGER_V4_PRIMARIES_ADOBE_RGB:
37+
printf("Supported named primaries: Adobe RGB\n");
38+
break;
39+
default:
40+
printf("Supported named primaries: Unknown\n");
41+
break;
42+
}
43+
}
44+
45+
static void waylandSupportedTfNamed(void* data, FF_MAYBE_UNUSED struct xx_color_manager_v4* manager, uint32_t tf)
46+
{
47+
WaylandData* wldata = data;
48+
switch (tf)
49+
{
50+
case XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_BT709:
51+
printf("Supported named transfer function: BT709\n");
52+
break;
53+
case XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_GAMMA22:
54+
printf("Supported named transfer function: Gamma 2.2\n");
55+
break;
56+
case XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_GAMMA28:
57+
printf("Supported named transfer function: Gamma 2.8\n");
58+
break;
59+
case XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_ST240:
60+
printf("Supported named transfer function: ST240\n");
61+
break;
62+
case XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_LINEAR:
63+
printf("Supported named transfer function: Linear\n");
64+
break;
65+
case XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_LOG_100:
66+
printf("Supported named transfer function: Log 100\n");
67+
break;
68+
case XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_LOG_316:
69+
printf("Supported named transfer function: Log 316\n");
70+
break;
71+
case XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_XVYCC:
72+
printf("Supported named transfer function: XVYCC\n");
73+
break;
74+
case XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_BT1361:
75+
printf("Supported named transfer function: BT1361\n");
76+
break;
77+
case XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_SRGB:
78+
printf("Supported named transfer function: SRGB\n");
79+
break;
80+
case XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_EXT_SRGB:
81+
printf("Supported named transfer function: Extended SRGB\n");
82+
break;
83+
case XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_ST2084_PQ:
84+
printf("Supported named transfer function: ST2084 PQ\n");
85+
break;
86+
case XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_ST428:
87+
printf("Supported named transfer function: ST428\n");
88+
break;
89+
case XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_HLG:
90+
printf("Supported named transfer function: HLG\n");
91+
break;
92+
default:
93+
printf("Supported named transfer function: Unknown\n");
94+
break;
95+
}
96+
}
97+
98+
void ffWaylandHandleColorManager(WaylandData* wldata, struct wl_registry* registry, uint32_t name, uint32_t version)
99+
{
100+
struct wl_proxy* output = wldata->ffwl_proxy_marshal_constructor_versioned((struct wl_proxy*) registry, WL_REGISTRY_BIND, &xx_color_manager_v4_interface, version, name, xx_color_manager_v4_interface.name, version, NULL);
101+
if(output == NULL)
102+
return;
103+
104+
struct xx_color_manager_v4_listener managerListener = {
105+
.supported_feature = (void*) stubListener,
106+
.supported_intent = (void*) stubListener,
107+
.supported_primaries_named = waylandSupportedPrimariesNamed,
108+
.supported_tf_named = waylandSupportedTfNamed,
109+
};
110+
111+
wldata->ffwl_proxy_add_listener(output, (void(**)(void)) &managerListener, wldata);
112+
wldata->ffwl_display_roundtrip(wldata->display);
113+
wldata->ffwl_proxy_destroy(output);
114+
}

src/detection/displayserver/linux/wayland/wayland.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "kde-output-device-v2-client-protocol.h"
1818
#include "kde-output-order-v1-client-protocol.h"
1919
#include "xdg-output-unstable-v1-client-protocol.h"
20+
#include "xx-color-management-v4-client-protocol.h"
2021

2122
#if __FreeBSD__
2223
#include <sys/un.h>
@@ -96,6 +97,10 @@ static void waylandGlobalAddListener(void* data, struct wl_registry* registry, u
9697
{
9798
ffWaylandHandleKdeOutputOrder(wldata, registry, name, version);
9899
}
100+
// else if(ffStrEquals(interface, xx_color_manager_v4_interface.name))
101+
// {
102+
// ffWaylandHandleColorManager(wldata, registry, name, version);
103+
// }
99104
else if((wldata->protocolType == FF_WAYLAND_PROTOCOL_TYPE_GLOBAL || wldata->protocolType == FF_WAYLAND_PROTOCOL_TYPE_NONE) && ffStrEquals(interface, zxdg_output_manager_v1_interface.name))
100105
{
101106
ffWaylandHandleZxdgOutput(wldata, registry, name, version);

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,5 +84,6 @@ void ffWaylandHandleZwlrOutput(WaylandData* wldata, struct wl_registry* registry
8484
void ffWaylandHandleKdeOutput(WaylandData* wldata, struct wl_registry* registry, uint32_t name, uint32_t version);
8585
void ffWaylandHandleKdeOutputOrder(WaylandData* wldata, struct wl_registry* registry, uint32_t name, uint32_t version);
8686
void ffWaylandHandleZxdgOutput(WaylandData* wldata, struct wl_registry* registry, uint32_t name, uint32_t version);
87+
void ffWaylandHandleColorManager(WaylandData* wldata, struct wl_registry* registry, uint32_t name, uint32_t version);
8788

8889
#endif

0 commit comments

Comments
 (0)