mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-04-13 08:22:16 -04:00
Merge branch 'capture_ds' into 'master'
ext_image_capture_source_v1/scene: allow direct scanout See merge request wlroots/wlroots!5319
This commit is contained in:
commit
7c554eefd3
1 changed files with 21 additions and 4 deletions
|
|
@ -20,6 +20,7 @@ struct scene_node_source {
|
||||||
struct wlr_scene_output *scene_output;
|
struct wlr_scene_output *scene_output;
|
||||||
|
|
||||||
size_t num_started;
|
size_t num_started;
|
||||||
|
bool resizing;
|
||||||
|
|
||||||
struct wl_listener node_destroy;
|
struct wl_listener node_destroy;
|
||||||
struct wl_listener scene_output_destroy;
|
struct wl_listener scene_output_destroy;
|
||||||
|
|
@ -85,13 +86,25 @@ static void source_render(struct scene_node_source *source) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct wlr_output_state state;
|
||||||
|
bool ok = true;
|
||||||
|
if (!source->output.enabled || source->output.current_mode == NULL
|
||||||
|
|| source->output.current_mode->width != extents.width
|
||||||
|
|| source->output.current_mode->height != extents.height) {
|
||||||
|
// Scene cannot attempt direct scanout on a commit that sets the mode
|
||||||
|
source->resizing = true;
|
||||||
|
wlr_output_state_init(&state);
|
||||||
|
wlr_output_state_set_enabled(&state, true);
|
||||||
|
wlr_output_state_set_custom_mode(&state, extents.width, extents.height, 0);
|
||||||
|
ok &= wlr_output_commit_state(scene_output->output, &state);
|
||||||
|
wlr_output_state_finish(&state);
|
||||||
|
source->resizing = false;
|
||||||
|
}
|
||||||
|
|
||||||
wlr_scene_output_set_position(scene_output, extents.x, extents.y);
|
wlr_scene_output_set_position(scene_output, extents.x, extents.y);
|
||||||
|
|
||||||
struct wlr_output_state state;
|
|
||||||
wlr_output_state_init(&state);
|
wlr_output_state_init(&state);
|
||||||
wlr_output_state_set_enabled(&state, true);
|
ok &= wlr_scene_output_build_state(scene_output, &state, NULL) &&
|
||||||
wlr_output_state_set_custom_mode(&state, extents.width, extents.height, 0);
|
|
||||||
bool ok = wlr_scene_output_build_state(scene_output, &state, NULL) &&
|
|
||||||
wlr_output_commit_state(scene_output->output, &state);
|
wlr_output_commit_state(scene_output->output, &state);
|
||||||
wlr_output_state_finish(&state);
|
wlr_output_state_finish(&state);
|
||||||
|
|
||||||
|
|
@ -217,6 +230,10 @@ static bool output_commit(struct wlr_output *output, const struct wlr_output_sta
|
||||||
source_update_buffer_constraints(source, state);
|
source_update_buffer_constraints(source, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (source->resizing) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (!(state->committed & WLR_OUTPUT_STATE_BUFFER)) {
|
if (!(state->committed & WLR_OUTPUT_STATE_BUFFER)) {
|
||||||
wlr_log(WLR_DEBUG, "Failed to commit capture output: missing buffer");
|
wlr_log(WLR_DEBUG, "Failed to commit capture output: missing buffer");
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue