backend/drm: add basic support for direct scan-out

This commit is contained in:
emersion 2019-03-29 21:27:12 +02:00 committed by Drew DeVault
parent 3dec88e455
commit 96d6fde5dc
7 changed files with 105 additions and 7 deletions

View file

@ -478,6 +478,30 @@ bool wlr_output_commit(struct wlr_output *output) {
return true;
}
bool wlr_output_set_dmabuf(struct wlr_output *output,
struct wlr_dmabuf_attributes *attribs) {
if (output->frame_pending) {
wlr_log(WLR_ERROR, "Tried to swap buffers when a frame is pending");
return false;
}
if (output->idle_frame != NULL) {
wl_event_source_remove(output->idle_frame);
output->idle_frame = NULL;
}
if (!output->impl->set_dmabuf) {
return false;
}
if (!output->impl->set_dmabuf(output, attribs)) {
return false;
}
output->frame_pending = true;
output->needs_swap = false;
pixman_region32_clear(&output->damage);
return true;
}
void wlr_output_send_frame(struct wlr_output *output) {
output->frame_pending = false;
wlr_signal_emit_safe(&output->events.frame, output);