wlr_scene: Add option to disable direct scanout

Closes: #3405
Supersedes: !3562

Co-authored-by: Xiao YaoBing <xiaoyaobing@qq.com>
This commit is contained in:
Alexander Orzechowski 2022-08-08 00:40:21 -04:00
parent 3baf2a6bcf
commit f72aeacd6e
3 changed files with 20 additions and 0 deletions

View File

@ -50,6 +50,7 @@ wlroots reads these environment variables
* *WLR_SCENE_DEBUG_DAMAGE*: specifies debug options for screen damage related
tasks for compositors that use scenes (available options: none, rerender,
highlight)
* *WLR_SCENE_DISABLE_DIRECT_SCANOUT*: disables direct scan-out for debugging.
# Generic

View File

@ -93,6 +93,7 @@ struct wlr_scene {
struct wl_listener presentation_destroy;
enum wlr_scene_debug_damage_option debug_damage_option;
bool direct_scanout;
};
/** A scene-graph node displaying a single surface. */

View File

@ -164,6 +164,20 @@ struct wlr_scene *wlr_scene_create(void) {
scene->debug_damage_option = WLR_SCENE_DEBUG_DAMAGE_NONE;
}
char *disable_direct_scanout = getenv("WLR_SCENE_DISABLE_DIRECT_SCANOUT");
if (disable_direct_scanout) {
wlr_log(WLR_INFO, "Loading WLR_SCENE_DISABLE_DIRECT_SCANOUT option: %s", disable_direct_scanout);
}
if (!disable_direct_scanout || strcmp(disable_direct_scanout, "0") == 0) {
scene->direct_scanout = true;
} else if (strcmp(disable_direct_scanout, "1") == 0) {
scene->direct_scanout = false;
} else {
wlr_log(WLR_ERROR, "Unknown WLR_SCENE_DISABLE_DIRECT_SCANOUT option: %s", disable_direct_scanout);
scene->direct_scanout = true;
}
return scene;
}
@ -1140,6 +1154,10 @@ static void check_scanout_iterator(struct wlr_scene_node *node,
}
static bool scene_output_scanout(struct wlr_scene_output *scene_output) {
if (!scene_output->scene->direct_scanout) {
return false;
}
if (scene_output->scene->debug_damage_option ==
WLR_SCENE_DEBUG_DAMAGE_HIGHLIGHT) {
// We don't want to enter direct scan out if we have highlight regions