mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-11-02 09:01:38 -05:00
output: add explicit sync API
This commit is contained in:
parent
d2374b3e4e
commit
1ad42bea99
3 changed files with 88 additions and 4 deletions
|
|
@ -563,9 +563,19 @@ static bool output_basic_test(struct wlr_output *output,
|
|||
wlr_log(WLR_DEBUG, "Primary buffer size mismatch");
|
||||
return false;
|
||||
}
|
||||
} else if (state->tearing_page_flip) {
|
||||
wlr_log(WLR_ERROR, "Trying to commit a tearing page flip without a buffer?");
|
||||
return false;
|
||||
} else {
|
||||
if (state->tearing_page_flip) {
|
||||
wlr_log(WLR_ERROR, "Tried to commit a tearing page flip without a buffer");
|
||||
return false;
|
||||
}
|
||||
if (state->committed & WLR_OUTPUT_STATE_WAIT_TIMELINE) {
|
||||
wlr_log(WLR_DEBUG, "Tried to set wait timeline without a buffer");
|
||||
return false;
|
||||
}
|
||||
if (state->committed & WLR_OUTPUT_STATE_SIGNAL_TIMELINE) {
|
||||
wlr_log(WLR_DEBUG, "Tried to set signal timeline without a buffer");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (state->committed & WLR_OUTPUT_STATE_RENDER_FORMAT) {
|
||||
|
|
@ -632,6 +642,12 @@ static bool output_basic_test(struct wlr_output *output,
|
|||
}
|
||||
}
|
||||
|
||||
if ((state->committed & (WLR_OUTPUT_STATE_WAIT_TIMELINE | WLR_OUTPUT_STATE_SIGNAL_TIMELINE)) &&
|
||||
!output->timeline) {
|
||||
wlr_log(WLR_DEBUG, "Wait/signal timelines are not supported for this output");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <wlr/render/drm_syncobj.h>
|
||||
#include <wlr/util/log.h>
|
||||
#include "types/wlr_output.h"
|
||||
|
||||
|
|
@ -16,6 +17,8 @@ void wlr_output_state_finish(struct wlr_output_state *state) {
|
|||
state->buffer = NULL;
|
||||
pixman_region32_fini(&state->damage);
|
||||
free(state->gamma_lut);
|
||||
wlr_drm_syncobj_timeline_unref(state->wait_timeline);
|
||||
wlr_drm_syncobj_timeline_unref(state->signal_timeline);
|
||||
}
|
||||
|
||||
void wlr_output_state_set_enabled(struct wlr_output_state *state,
|
||||
|
|
@ -114,16 +117,36 @@ void wlr_output_state_set_layers(struct wlr_output_state *state,
|
|||
state->layers_len = layers_len;
|
||||
}
|
||||
|
||||
void wlr_output_state_set_wait_timeline(struct wlr_output_state *state,
|
||||
struct wlr_drm_syncobj_timeline *timeline, uint64_t src_point) {
|
||||
state->committed |= WLR_OUTPUT_STATE_WAIT_TIMELINE;
|
||||
wlr_drm_syncobj_timeline_unref(state->wait_timeline);
|
||||
state->wait_timeline = wlr_drm_syncobj_timeline_ref(timeline);
|
||||
state->wait_point = src_point;
|
||||
}
|
||||
|
||||
void wlr_output_state_set_signal_timeline(struct wlr_output_state *state,
|
||||
struct wlr_drm_syncobj_timeline *timeline, uint64_t dst_point) {
|
||||
state->committed |= WLR_OUTPUT_STATE_SIGNAL_TIMELINE;
|
||||
wlr_drm_syncobj_timeline_unref(state->signal_timeline);
|
||||
state->signal_timeline = wlr_drm_syncobj_timeline_ref(timeline);
|
||||
state->signal_point = dst_point;
|
||||
}
|
||||
|
||||
bool wlr_output_state_copy(struct wlr_output_state *dst,
|
||||
const struct wlr_output_state *src) {
|
||||
struct wlr_output_state copy = *src;
|
||||
copy.committed &= ~(WLR_OUTPUT_STATE_BUFFER |
|
||||
WLR_OUTPUT_STATE_DAMAGE |
|
||||
WLR_OUTPUT_STATE_GAMMA_LUT);
|
||||
WLR_OUTPUT_STATE_GAMMA_LUT |
|
||||
WLR_OUTPUT_STATE_WAIT_TIMELINE |
|
||||
WLR_OUTPUT_STATE_SIGNAL_TIMELINE);
|
||||
copy.buffer = NULL;
|
||||
pixman_region32_init(©.damage);
|
||||
copy.gamma_lut = NULL;
|
||||
copy.gamma_lut_size = 0;
|
||||
copy.wait_timeline = NULL;
|
||||
copy.signal_timeline = NULL;
|
||||
|
||||
if (src->committed & WLR_OUTPUT_STATE_BUFFER) {
|
||||
wlr_output_state_set_buffer(©, src->buffer);
|
||||
|
|
@ -142,6 +165,15 @@ bool wlr_output_state_copy(struct wlr_output_state *dst,
|
|||
}
|
||||
}
|
||||
|
||||
if (src->committed & WLR_OUTPUT_STATE_WAIT_TIMELINE) {
|
||||
wlr_output_state_set_wait_timeline(©, src->wait_timeline,
|
||||
src->wait_point);
|
||||
}
|
||||
if (src->committed & WLR_OUTPUT_STATE_SIGNAL_TIMELINE) {
|
||||
wlr_output_state_set_signal_timeline(©, src->signal_timeline,
|
||||
src->signal_point);
|
||||
}
|
||||
|
||||
wlr_output_state_finish(dst);
|
||||
*dst = copy;
|
||||
return true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue