backend/headless: remove wlr_output_impl.export_dmabuf

This is now provided by the generic wlr_output implementation.
This commit is contained in:
Simon Ser 2021-06-08 09:44:42 +02:00 committed by Simon Zeni
parent 87e8c60faf
commit aec062d0d3
2 changed files with 4 additions and 34 deletions

View file

@ -18,11 +18,8 @@ static struct wlr_headless_output *headless_output_from_output(
return (struct wlr_headless_output *)wlr_output; return (struct wlr_headless_output *)wlr_output;
} }
static bool output_set_custom_mode(struct wlr_output *wlr_output, int32_t width, static bool output_set_custom_mode(struct wlr_headless_output *output,
int32_t height, int32_t refresh) { int32_t width, int32_t height, int32_t refresh) {
struct wlr_headless_output *output =
headless_output_from_output(wlr_output);
if (refresh <= 0) { if (refresh <= 0) {
refresh = HEADLESS_DEFAULT_REFRESH; 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 (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.width,
wlr_output->pending.custom_mode.height, wlr_output->pending.custom_mode.height,
wlr_output->pending.custom_mode.refresh)) { 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) { 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); wlr_output_send_present(wlr_output, NULL);
} }
return true; 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) { static void output_destroy(struct wlr_output *wlr_output) {
struct wlr_headless_output *output = struct wlr_headless_output *output =
headless_output_from_output(wlr_output); headless_output_from_output(wlr_output);
wl_list_remove(&output->link); wl_list_remove(&output->link);
wl_event_source_remove(output->frame_timer); wl_event_source_remove(output->frame_timer);
wlr_buffer_unlock(output->front_buffer);
free(output); free(output);
} }
static const struct wlr_output_impl output_impl = { static const struct wlr_output_impl output_impl = {
.destroy = output_destroy, .destroy = output_destroy,
.commit = output_commit, .commit = output_commit,
.export_dmabuf = output_export_dmabuf,
}; };
bool wlr_output_is_headless(struct wlr_output *wlr_output) { 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); backend->display);
struct wlr_output *wlr_output = &output->wlr_output; 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->make, "headless", sizeof(wlr_output->make));
strncpy(wlr_output->model, "headless", sizeof(wlr_output->model)); strncpy(wlr_output->model, "headless", sizeof(wlr_output->model));
snprintf(wlr_output->name, sizeof(wlr_output->name), "HEADLESS-%zd", snprintf(wlr_output->name, sizeof(wlr_output->name), "HEADLESS-%zd",

View file

@ -25,8 +25,6 @@ struct wlr_headless_output {
struct wlr_headless_backend *backend; struct wlr_headless_backend *backend;
struct wl_list link; struct wl_list link;
struct wlr_buffer *front_buffer;
struct wl_event_source *frame_timer; struct wl_event_source *frame_timer;
int frame_delay; // ms int frame_delay; // ms
}; };