diff --git a/include/wlr/types/wlr_scene.h b/include/wlr/types/wlr_scene.h index 7f3217baa..df9e93b9c 100644 --- a/include/wlr/types/wlr_scene.h +++ b/include/wlr/types/wlr_scene.h @@ -529,6 +529,12 @@ struct wlr_scene_output_state_options { struct wlr_swapchain *swapchain; }; +/** + * Returns true if scene wants to render a new frame. False, if no new frame + * is needed and an output commit can be skipped for the current frame. + */ +bool wlr_scene_output_needs_frame(struct wlr_scene_output *scene_output); + /** * Render and commit an output. */ diff --git a/types/scene/wlr_scene.c b/types/scene/wlr_scene.c index af9e243fa..1829ce542 100644 --- a/types/scene/wlr_scene.c +++ b/types/scene/wlr_scene.c @@ -1818,10 +1818,14 @@ static bool scene_entry_try_direct_scanout(struct render_list_entry *entry, return true; } +bool wlr_scene_output_needs_frame(struct wlr_scene_output *scene_output) { + return scene_output->output->needs_frame || pixman_region32_not_empty( + &scene_output->pending_commit_damage); +} + bool wlr_scene_output_commit(struct wlr_scene_output *scene_output, const struct wlr_scene_output_state_options *options) { - if (!scene_output->output->needs_frame && !pixman_region32_not_empty( - &scene_output->pending_commit_damage)) { + if (!wlr_scene_output_needs_frame(scene_output)) { return true; }