diff --git a/protocol/gamescope-xwayland.xml b/protocol/gamescope-xwayland.xml index 4b73e05..ebf4cc9 100644 --- a/protocol/gamescope-xwayland.xml +++ b/protocol/gamescope-xwayland.xml @@ -75,5 +75,62 @@ + + + + Forward HDR metadata from Vulkan to the compositor. + + HDR Metadata Infoframe as per CTA 861.G spec. + This is expected to match exactly with the spec. + + display_primary_*: + Color Primaries of the Data. + Specifies X and Y coordinates. + These are coded as unsigned 16-bit values in units of + 0.00002, where 0x0000 represents zero and 0xC350 + represents 1.0000. + + white_point_*: + White Point of Colorspace Data. + Specifies X and Y coordinates. + These are coded as unsigned 16-bit values in units of + 0.00002, where 0x0000 represents zero and 0xC350 + represents 1.0000. + + max_display_mastering_luminance: + Max Mastering Display Luminance. + This value is coded as an unsigned 16-bit value in units of 1 cd/m2, + where 0x0001 represents 1 cd/m2 and 0xFFFF represents 65535 cd/m2. + + max_display_mastering_luminance: + Min Mastering Display Luminance. + This value is coded as an unsigned 16-bit value in units of + 0.0001 cd/m2, where 0x0001 represents 0.0001 cd/m2 and 0xFFFF + represents 6.5535 cd/m2. + + max_cll: + Max Content Light Level. + This value is coded as an unsigned 16-bit value in units of 1 cd/m2, + where 0x0001 represents 1 cd/m2 and 0xFFFF represents 65535 cd/m2. + + max_fall: + Max Frame Average Light Level. + This value is coded as an unsigned 16-bit value in units of 1 cd/m2, + where 0x0001 represents 1 cd/m2 and 0xFFFF represents 65535 cd/m2. + + + + + + + + + + + + + + + diff --git a/src/wlserver.cpp b/src/wlserver.cpp index 6e3bc55..1281632 100644 --- a/src/wlserver.cpp +++ b/src/wlserver.cpp @@ -543,6 +543,29 @@ static void gamescope_xwayland_handle_swapchain_feedback( struct wl_client *clie } } +static void gamescope_xwayland_handle_set_hdr_metadata( struct wl_client *client, struct wl_resource *resource, + struct wl_resource *surface_resource, + uint32_t display_primary_red_x, + uint32_t display_primary_red_y, + uint32_t display_primary_green_x, + uint32_t display_primary_green_y, + uint32_t display_primary_blue_x, + uint32_t display_primary_blue_y, + uint32_t white_point_x, + uint32_t white_point_y, + uint32_t max_display_mastering_luminance, + uint32_t min_display_mastering_luminance, + uint32_t max_cll, + uint32_t max_fall) +{ + struct wlr_surface *surface = wlr_surface_from_resource( surface_resource ); + wlserver_wl_surface_info *wl_info = get_wl_surface_info( surface ); + if ( wl_info ) + { + fprintf(stderr, "GOT HDR METADATA FOR SURFACE!\n"); + } +} + static void gamescope_xwayland_handle_destroy( struct wl_client *client, struct wl_resource *resource ) { wl_resource_destroy( resource ); @@ -552,6 +575,7 @@ static const struct gamescope_xwayland_interface gamescope_xwayland_impl = { .destroy = gamescope_xwayland_handle_destroy, .override_window_content = gamescope_xwayland_handle_override_window_content, .swapchain_feedback = gamescope_xwayland_handle_swapchain_feedback, + .set_hdr_metadata = gamescope_xwayland_handle_set_hdr_metadata, }; static void gamescope_xwayland_bind( struct wl_client *client, void *data, uint32_t version, uint32_t id )