protocol: Add set_hdr_metadata to gamescope_xwayland

This commit is contained in:
Joshua Ashton 2022-12-17 15:18:29 +00:00 committed by Joshie
parent 384cd9ad7d
commit 87b75026f8
2 changed files with 81 additions and 0 deletions

View file

@ -75,5 +75,62 @@
<arg name="vk_present_mode" type="uint" summary="VkPresentModeKHR of swapchain"/>
<arg name="vk_clipped" type="uint" summary="clipped (VkBool32) of swapchain"/>
</request>
<request name="set_hdr_metadata" since="2">
<description summary="set HDR metadata for a surface">
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.
</description>
<arg name="surface" type="object" interface="wl_surface" summary="Wayland surface"/>
<arg name="display_primary_red_x" type="uint" summary="red primary x coordinate"/>
<arg name="display_primary_red_y" type="uint" summary="red primary y coordinate"/>
<arg name="display_primary_green_x" type="uint" summary="green primary x coordinate"/>
<arg name="display_primary_green_y" type="uint" summary="green primary y coordinate"/>
<arg name="display_primary_blue_x" type="uint" summary="blue primary x coordinate"/>
<arg name="display_primary_blue_y" type="uint" summary="blue primary y coordinate"/>
<arg name="white_point_x" type="uint" summary="white point x coordinate"/>
<arg name="white_point_y" type="uint" summary="white point y coordinate"/>
<arg name="max_display_mastering_luminance" type="uint" summary="max display mastering luminance"/>
<arg name="min_display_mastering_luminance" type="uint" summary="min display mastering luminance"/>
<arg name="max_cll" type="uint" summary="max content light level"/>
<arg name="max_fall" type="uint" summary="max frame average light level"/>
</request>
</interface>
</protocol>

View file

@ -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 )