diff --git a/backend/headless/output.c b/backend/headless/output.c index 9ec6ce50..8c7e57f1 100644 --- a/backend/headless/output.c +++ b/backend/headless/output.c @@ -18,11 +18,8 @@ static struct wlr_headless_output *headless_output_from_output( return (struct wlr_headless_output *)wlr_output; } -static bool output_set_custom_mode(struct wlr_output *wlr_output, int32_t width, - int32_t height, int32_t refresh) { - struct wlr_headless_output *output = - headless_output_from_output(wlr_output); - +static bool output_set_custom_mode(struct wlr_headless_output *output, + int32_t width, int32_t height, int32_t refresh) { if (refresh <= 0) { refresh = HEADLESS_DEFAULT_REFRESH; } @@ -58,7 +55,7 @@ static bool output_commit(struct wlr_output *wlr_output) { } if (wlr_output->pending.committed & WLR_OUTPUT_STATE_MODE) { - if (!output_set_custom_mode(wlr_output, + if (!output_set_custom_mode(output, wlr_output->pending.custom_mode.width, wlr_output->pending.custom_mode.height, wlr_output->pending.custom_mode.refresh)) { @@ -67,48 +64,23 @@ static bool output_commit(struct wlr_output *wlr_output) { } if (wlr_output->pending.committed & WLR_OUTPUT_STATE_BUFFER) { - assert(wlr_output->pending.buffer_type == - WLR_OUTPUT_STATE_BUFFER_SCANOUT); - - wlr_buffer_unlock(output->front_buffer); - output->front_buffer = wlr_buffer_lock(wlr_output->pending.buffer); - wlr_output_send_present(wlr_output, NULL); } return true; } -static bool output_export_dmabuf(struct wlr_output *wlr_output, - struct wlr_dmabuf_attributes *attribs) { - struct wlr_headless_output *output = - headless_output_from_output(wlr_output); - - if (!output->front_buffer) { - return false; - } - - struct wlr_dmabuf_attributes tmp; - if (!wlr_buffer_get_dmabuf(output->front_buffer, &tmp)) { - return false; - } - - return wlr_dmabuf_attributes_copy(attribs, &tmp); -} - static void output_destroy(struct wlr_output *wlr_output) { struct wlr_headless_output *output = headless_output_from_output(wlr_output); wl_list_remove(&output->link); wl_event_source_remove(output->frame_timer); - wlr_buffer_unlock(output->front_buffer); free(output); } static const struct wlr_output_impl output_impl = { .destroy = output_destroy, .commit = output_commit, - .export_dmabuf = output_export_dmabuf, }; bool wlr_output_is_headless(struct wlr_output *wlr_output) { @@ -138,7 +110,7 @@ struct wlr_output *wlr_headless_add_output(struct wlr_backend *wlr_backend, backend->display); struct wlr_output *wlr_output = &output->wlr_output; - output_set_custom_mode(wlr_output, width, height, 0); + output_set_custom_mode(output, width, height, 0); strncpy(wlr_output->make, "headless", sizeof(wlr_output->make)); strncpy(wlr_output->model, "headless", sizeof(wlr_output->model)); snprintf(wlr_output->name, sizeof(wlr_output->name), "HEADLESS-%zd", diff --git a/include/backend/headless.h b/include/backend/headless.h index 2ec53383..42a07db8 100644 --- a/include/backend/headless.h +++ b/include/backend/headless.h @@ -25,8 +25,6 @@ struct wlr_headless_output { struct wlr_headless_backend *backend; struct wl_list link; - struct wlr_buffer *front_buffer; - struct wl_event_source *frame_timer; int frame_delay; // ms };