diff --git a/libweston/surface-state.c b/libweston/surface-state.c index e86c27a74..477009c4f 100644 --- a/libweston/surface-state.c +++ b/libweston/surface-state.c @@ -514,36 +514,23 @@ weston_surface_state_merge_from(struct weston_surface_state *dst, src->status = WESTON_SURFACE_CLEAN; } -static void -weston_subsurface_commit_to_cache(struct weston_subsurface *sub) -{ - struct weston_surface *surface = sub->surface; - - weston_surface_state_merge_from(&sub->cached, - &surface->pending, - surface); -} - -static enum weston_surface_status -weston_subsurface_commit(struct weston_subsurface *sub) -{ - weston_subsurface_commit_to_cache(sub); - if (sub->effectively_synchronized) - return WESTON_SURFACE_CLEAN; - - return weston_surface_apply(sub->surface, &sub->cached); -} - enum weston_surface_status weston_surface_commit(struct weston_surface *surface) { struct weston_subsurface *sub = weston_surface_to_subsurface(surface); enum weston_surface_status status; - if (sub) - status = weston_subsurface_commit(sub); - else + if (sub) { + weston_surface_state_merge_from(&sub->cached, + &surface->pending, + surface); + if (sub->effectively_synchronized) + return WESTON_SURFACE_CLEAN; + + status = weston_surface_apply(sub->surface, &sub->cached); + } else { status = weston_surface_apply(surface, &surface->pending); + } return status; }