tests: Listen for the presentation clock id

Add a listener and a roundtrip so test clients using presentation have
access to the presentation clock id.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This commit is contained in:
Derek Foreman 2025-10-08 13:02:06 -05:00
parent 0a76cb86ca
commit 37256645d6
2 changed files with 31 additions and 0 deletions

View file

@ -2634,6 +2634,20 @@ client_get_subcompositor(struct client *client)
return sub;
}
static void
presentation_clock_id(void *data, struct wp_presentation *presentation,
uint32_t clk_id)
{
struct client *client = data;
client->presentation_clock = clk_id;
client->has_presentation_clock = true;
}
static const struct wp_presentation_listener presentation_listener = {
presentation_clock_id
};
struct wp_presentation *
client_get_presentation(struct client *client)
{
@ -2657,8 +2671,19 @@ client_get_presentation(struct client *client)
pres = wl_registry_bind(client->wl_registry, global_pres->name,
&wp_presentation_interface, 2);
wp_presentation_add_listener(pres, &presentation_listener, client);
test_assert_ptr_not_null(pres);
client_roundtrip(client);
return pres;
}
clockid_t
client_get_presentation_clock(struct client *client)
{
test_assert_true(client->has_presentation_clock);
return client->presentation_clock;
}

View file

@ -80,6 +80,9 @@ struct client {
struct wl_array drm_formats;
struct wl_list global_list;
struct wl_list output_list; /* struct output::link */
clockid_t presentation_clock;
bool has_presentation_clock;
};
struct global {
@ -431,4 +434,7 @@ client_get_subcompositor(struct client *client);
struct wp_presentation *
client_get_presentation(struct client *client);
clockid_t
client_get_presentation_clock(struct client *client);
#endif