mirror of
https://gitlab.freedesktop.org/wayland/weston.git
synced 2025-12-26 03:00:17 +01:00
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:
parent
0a76cb86ca
commit
37256645d6
2 changed files with 31 additions and 0 deletions
|
|
@ -2634,6 +2634,20 @@ client_get_subcompositor(struct client *client)
|
||||||
return sub;
|
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 *
|
struct wp_presentation *
|
||||||
client_get_presentation(struct client *client)
|
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,
|
pres = wl_registry_bind(client->wl_registry, global_pres->name,
|
||||||
&wp_presentation_interface, 2);
|
&wp_presentation_interface, 2);
|
||||||
|
wp_presentation_add_listener(pres, &presentation_listener, client);
|
||||||
|
|
||||||
test_assert_ptr_not_null(pres);
|
test_assert_ptr_not_null(pres);
|
||||||
|
|
||||||
|
client_roundtrip(client);
|
||||||
|
|
||||||
return pres;
|
return pres;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clockid_t
|
||||||
|
client_get_presentation_clock(struct client *client)
|
||||||
|
{
|
||||||
|
test_assert_true(client->has_presentation_clock);
|
||||||
|
|
||||||
|
return client->presentation_clock;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -80,6 +80,9 @@ struct client {
|
||||||
struct wl_array drm_formats;
|
struct wl_array drm_formats;
|
||||||
struct wl_list global_list;
|
struct wl_list global_list;
|
||||||
struct wl_list output_list; /* struct output::link */
|
struct wl_list output_list; /* struct output::link */
|
||||||
|
|
||||||
|
clockid_t presentation_clock;
|
||||||
|
bool has_presentation_clock;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct global {
|
struct global {
|
||||||
|
|
@ -431,4 +434,7 @@ client_get_subcompositor(struct client *client);
|
||||||
struct wp_presentation *
|
struct wp_presentation *
|
||||||
client_get_presentation(struct client *client);
|
client_get_presentation(struct client *client);
|
||||||
|
|
||||||
|
clockid_t
|
||||||
|
client_get_presentation_clock(struct client *client);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue