mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-10-29 05:40:12 -04:00
backend/drm: Store viewport with framebuffer
Accessing the output state viewport require a buffer, and that might not have a state with a buffer when preparing the plane properties for an atomic commit. Instead, store the properties at the same time as the fb, and use a similar mechanism to carry the state around.
This commit is contained in:
parent
1520be3c5c
commit
3df1528a8f
3 changed files with 17 additions and 8 deletions
|
|
@ -439,15 +439,9 @@ static void atomic_connector_add(struct atomic *atom,
|
|||
if (crtc->props.vrr_enabled != 0) {
|
||||
atomic_add(atom, crtc->id, crtc->props.vrr_enabled, state->vrr_enabled);
|
||||
}
|
||||
if (state->base->committed & WLR_OUTPUT_STATE_BUFFER) {
|
||||
struct wlr_fbox src_box;
|
||||
struct wlr_box dst_box;
|
||||
output_state_get_buffer_src_box(state->base, &src_box);
|
||||
output_state_get_buffer_dst_box(state->base, &dst_box);
|
||||
|
||||
set_plane_props(atom, drm, crtc->primary, state->primary_fb, crtc->id,
|
||||
&dst_box, &src_box);
|
||||
}
|
||||
set_plane_props(atom, drm, crtc->primary, state->primary_fb, crtc->id,
|
||||
&state->primary_viewport.dst_box, &state->primary_viewport.src_box);
|
||||
if (crtc->primary->props.fb_damage_clips != 0) {
|
||||
atomic_add(atom, crtc->primary->id,
|
||||
crtc->primary->props.fb_damage_clips, state->fb_damage_clips);
|
||||
|
|
|
|||
|
|
@ -557,6 +557,7 @@ static void drm_connector_apply_commit(const struct wlr_drm_connector_state *sta
|
|||
struct wlr_drm_crtc *crtc = conn->crtc;
|
||||
|
||||
drm_fb_copy(&crtc->primary->queued_fb, state->primary_fb);
|
||||
crtc->primary->queued_viewport = state->primary_viewport;
|
||||
if (crtc->cursor != NULL) {
|
||||
drm_fb_copy(&crtc->cursor->queued_fb, state->cursor_fb);
|
||||
}
|
||||
|
|
@ -673,8 +674,10 @@ static void drm_connector_state_init(struct wlr_drm_connector_state *state,
|
|||
struct wlr_drm_plane *primary = conn->crtc->primary;
|
||||
if (primary->queued_fb != NULL) {
|
||||
state->primary_fb = drm_fb_lock(primary->queued_fb);
|
||||
state->primary_viewport = primary->queued_viewport;
|
||||
} else if (primary->current_fb != NULL) {
|
||||
state->primary_fb = drm_fb_lock(primary->current_fb);
|
||||
state->primary_viewport = primary->current_viewport;
|
||||
}
|
||||
|
||||
if (conn->cursor_enabled) {
|
||||
|
|
@ -761,6 +764,9 @@ static bool drm_connector_state_update_primary_fb(struct wlr_drm_connector *conn
|
|||
return false;
|
||||
}
|
||||
|
||||
output_state_get_buffer_src_box(state->base, &state->primary_viewport.src_box);
|
||||
output_state_get_buffer_dst_box(state->base, &state->primary_viewport.dst_box);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -2058,6 +2064,7 @@ static void handle_page_flip(int fd, unsigned seq,
|
|||
struct wlr_drm_plane *plane = conn->crtc->primary;
|
||||
if (plane->queued_fb) {
|
||||
drm_fb_move(&plane->current_fb, &plane->queued_fb);
|
||||
plane->current_viewport = plane->queued_viewport;
|
||||
}
|
||||
if (conn->crtc->cursor && conn->crtc->cursor->queued_fb) {
|
||||
drm_fb_move(&conn->crtc->cursor->current_fb,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue