mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-10-29 05:40:12 -04:00
Support direct scanout with src crop and dst boxes
Enable scene-tree direct scanout of a single buffer with various options for scaling and source crop. This is intended to support direct scanout for fullscreen video with/without scaling, letterboxing/pillarboxing (e.g. 4:3 content on a 16:9 display), and source crop (e.g. when 1920x1088 planes are used for 1920x1080 video). This works by explicitly specifying the source crop and destination box for the primary buffer in the output state. DRM atomic and libliftoff backends will turn this into a crop and scale of the plane (assuming the hardware supports that). For the Wayland/X11/DRM-legacy backends I just reject this so scanout will be disabled. The previous behaviour is preserved if buffer_src_box and buffer_dst_box are unset: the buffer is displayed at native size at the top-left of the output with no crop. The change to `struct wlr_output_state` makes this a binary breaking change (but this works transparently for scene-tree compositors like labwc after a recompile).
This commit is contained in:
parent
47fb00f66d
commit
c87ab6465d
10 changed files with 230 additions and 59 deletions
|
|
@ -129,6 +129,27 @@ static bool output_test(struct wlr_output *wlr_output,
|
|||
return false;
|
||||
}
|
||||
|
||||
if (state->committed & WLR_OUTPUT_STATE_BUFFER) {
|
||||
// If the size doesn't match, reject buffer (scaling is not supported)
|
||||
int pending_width, pending_height;
|
||||
output_pending_resolution(wlr_output, state,
|
||||
&pending_width, &pending_height);
|
||||
if (state->buffer->width != pending_width ||
|
||||
state->buffer->height != pending_height) {
|
||||
wlr_log(WLR_DEBUG, "Primary buffer size mismatch");
|
||||
return false;
|
||||
}
|
||||
// Source crop is not supported
|
||||
struct wlr_fbox src_box;
|
||||
output_state_get_buffer_src_box(state, &src_box);
|
||||
if (src_box.x != 0.0 || src_box.y != 0.0 ||
|
||||
src_box.width != (double)state->buffer->width ||
|
||||
src_box.height != (double)state->buffer->height) {
|
||||
wlr_log(WLR_DEBUG, "Source crop not supported in X11 output");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// All we can do to influence adaptive sync on the X11 backend is set the
|
||||
// _VARIABLE_REFRESH window property like mesa automatically does. We don't
|
||||
// have any control beyond that, so we set the state to enabled on creating
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue