Commit d3c644d9 authored by Roman Gilg's avatar Roman Gilg

Commit at least once after frame request

parent fe193049
Pipeline #16971 passed with stages
in 1 minute and 24 seconds
......@@ -232,22 +232,6 @@ xwl_present_timer_callback(OsTimerPtr timer,
return 0;
}
void
xwl_present_handle_frame(struct xwl_present_window *xwl_present_window)
{
if (xwl_present_window->frame_timer_firing) {
/* If the timer is firing, this frame callback is too late */
return;
}
xwl_present_msc_bump(xwl_present_window);
/* we do not need the timer anymore for this frame,
* reset it for potentially the next one
*/
xwl_present_reset_timer(xwl_present_window);
}
static void
xwl_present_sync_callback(void *data,
struct wl_callback *callback,
......@@ -319,8 +303,11 @@ xwl_present_get_ust_msc(WindowPtr present_window, uint64_t *ust, uint64_t *msc)
}
static void
xwl_present_realign_timer(struct xwl_present_window *xwl_present_window)
xwl_present_link_frame(struct xwl_present_window *xwl_present_window, struct xwl_window *xwl_window)
{
assert(xorg_list_is_empty(&xwl_present_window->link));
xorg_list_append(&xwl_present_window->link, &xwl_window->present_window_frame_list);
xwl_present_window->frame_timer_firing = FALSE;
xwl_present_reset_timer(xwl_present_window);
}
......@@ -330,15 +317,14 @@ xwl_present_frame_callback_create(struct xwl_present_window *xwl_present_window,
{
if (xwl_window->frame_callback) {
if (xorg_list_is_empty(&xwl_present_window->link)) {
xorg_list_append(&xwl_present_window->link, &xwl_window->present_window_frame_list);
xwl_present_realign_timer(xwl_present_window);
xwl_present_link_frame(xwl_present_window, xwl_window);
}
return;
}
xwl_present_realign_timer(xwl_present_window);
xwl_window_frame_callback_create(xwl_window);
xwl_present_link_frame(xwl_present_window, xwl_window);
wl_surface_commit(xwl_window->surface);
}
static void
......@@ -351,7 +337,19 @@ xwl_present_frame_callback_create2(struct xwl_present_window *xwl_present_window
return;
xwl_present_frame_callback_create(xwl_present_window, xwl_window);
wl_surface_commit(xwl_window->surface);
}
void
xwl_present_handle_frame(struct xwl_window *xwl_window, struct xwl_present_window *xwl_present_window)
{
xorg_list_del(&xwl_present_window->link);
if (!xwl_present_window->frame_timer_firing) {
/* Only if the timer was _not_ firing, this frame callback came in time. */
xwl_present_msc_bump(xwl_present_window);
}
xwl_present_frame_callback_create(xwl_present_window, xwl_window);
}
/*
......
......@@ -204,10 +204,7 @@ xwl_window_property_allow_commits(struct xwl_window *xwl_window,
* immediately through block_handler() if there is damage to post.
*/
if (!old_allow_commits && xwl_window->allow_commits) {
if (xwl_window->frame_callback) {
wl_callback_destroy(xwl_window->frame_callback);
xwl_window->frame_callback = NULL;
}
xwl_window->damage_posted = FALSE;
}
}
......@@ -629,6 +626,10 @@ xwl_unrealize_window(WindowPtr window)
if (!xwl_window)
return ret;
#ifdef GLAMOR_HAS_GBM
xorg_list_del(&xwl_window->present_window_frame_list);
#endif
wl_surface_destroy(xwl_window->surface);
xorg_list_del(&xwl_window->link_damage);
DamageUnregister(xwl_window->damage);
......@@ -650,8 +651,7 @@ frame_callback_present_windows(struct xwl_window *xwl_window)
xorg_list_for_each_entry_safe(xwl_present_window, tmp,
&xwl_window->present_window_frame_list, link) {
xwl_present_handle_frame(xwl_present_window);
xorg_list_del(&xwl_present_window->link);
xwl_present_handle_frame(xwl_window, xwl_present_window);
}
}
#endif
......@@ -705,6 +705,9 @@ xwl_destroy_window(WindowPtr window)
void
xwl_window_frame_callback_create(struct xwl_window *xwl_window)
{
if (xwl_window->frame_callback)
return;
xwl_window->frame_callback = wl_surface_frame(xwl_window->surface);
wl_callback_add_listener(xwl_window->frame_callback, &frame_listener, xwl_window);
}
......@@ -719,6 +722,8 @@ xwl_window_post_damage(struct xwl_window *xwl_window)
PixmapPtr pixmap;
int i;
assert(!xwl_window->damage_posted);
region = DamageRegion(xwl_window->damage);
pixmap = (*xwl_screen->screen->GetWindowPixmap) (xwl_window->window);
......@@ -752,13 +757,11 @@ xwl_window_post_damage(struct xwl_window *xwl_window)
box->x2 - box->x1, box->y2 - box->y1);
}
if (!xwl_window->frame_callback) {
xwl_window_frame_callback_create(xwl_window);
}
xwl_window->damage_posted = TRUE;
DamageEmpty(xwl_window->damage);
xwl_window_frame_callback_create(xwl_window);
wl_surface_commit(xwl_window->surface);
DamageEmpty(xwl_window->damage);
xorg_list_del(&xwl_window->link_damage);
}
......
......@@ -453,7 +453,7 @@ void xwl_glamor_egl_make_current(struct xwl_screen *xwl_screen);
#ifdef GLAMOR_HAS_GBM
Bool xwl_present_init(ScreenPtr screen);
void xwl_present_handle_frame(struct xwl_present_window *xwl_present_window);
void xwl_present_handle_frame(struct xwl_window *xwl_window, struct xwl_present_window *xwl_present_window);
void xwl_present_cleanup(WindowPtr window);
void xwl_present_unrealize_window(WindowPtr window);
#endif /* GLAMOR_HAS_GBM */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment