Skip to content
This repository has been archived by the owner on Nov 1, 2021. It is now read-only.

output: remove wlr_output_impl.schedule_frame #2046

Merged
merged 1 commit into from
Mar 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 0 additions & 42 deletions backend/drm/drm.c
Original file line number Diff line number Diff line change
Expand Up @@ -960,47 +960,6 @@ static bool drm_connector_move_cursor(struct wlr_output *output,
return ok;
}

static bool drm_connector_schedule_frame(struct wlr_output *output) {
struct wlr_drm_connector *conn = get_drm_connector_from_output(output);
struct wlr_drm_backend *drm = get_drm_backend_from_backend(output->backend);
if (!drm->session->active) {
return false;
}

// We need to figure out where we are in the vblank cycle
// TODO: try using drmWaitVBlank and fallback to pageflipping

struct wlr_drm_crtc *crtc = conn->crtc;
if (!crtc) {
return false;
}
struct wlr_drm_plane *plane = crtc->primary;
struct gbm_bo *bo = plane->surf.back;
if (!bo) {
// We haven't swapped buffers yet -- can't do a pageflip
wlr_output_send_frame(output);
return true;
}
if (drm->parent) {
bo = copy_drm_surface_mgpu(&plane->mgpu_surf, bo);
}

if (conn->pageflip_pending) {
wlr_log(WLR_ERROR, "Skipping pageflip on output '%s'",
conn->output.name);
return true;
}

uint32_t fb_id = get_fb_for_bo(bo, plane->drm_format, drm->addfb2_modifiers);
if (!drm->iface->crtc_pageflip(drm, conn, crtc, fb_id, NULL)) {
return false;
}

conn->pageflip_pending = true;
wlr_output_update_enabled(output, true);
return true;
}

static uint32_t strip_alpha_channel(uint32_t format) {
switch (format) {
case DRM_FORMAT_ARGB8888:
Expand Down Expand Up @@ -1070,7 +1029,6 @@ static const struct wlr_output_impl output_impl = {
.set_gamma = set_drm_connector_gamma,
.get_gamma_size = drm_connector_get_gamma_size,
.export_dmabuf = drm_connector_export_dmabuf,
.schedule_frame = drm_connector_schedule_frame,
.attach_buffer = drm_connector_attach_buffer,
};

Expand Down
15 changes: 0 additions & 15 deletions backend/wayland/output.c
Original file line number Diff line number Diff line change
Expand Up @@ -415,28 +415,13 @@ static bool output_move_cursor(struct wlr_output *_output, int x, int y) {
return true;
}

static bool output_schedule_frame(struct wlr_output *wlr_output) {
struct wlr_wl_output *output = get_wl_output_from_output(wlr_output);

if (output->frame_callback != NULL) {
wlr_log(WLR_ERROR, "Skipping frame scheduling");
return true;
}

output->frame_callback = wl_surface_frame(output->surface);
wl_callback_add_listener(output->frame_callback, &frame_listener, output);
wl_surface_commit(output->surface);
return true;
}

static const struct wlr_output_impl output_impl = {
.destroy = output_destroy,
.attach_render = output_attach_render,
.attach_buffer = output_attach_buffer,
.commit = output_commit,
.set_cursor = output_set_cursor,
.move_cursor = output_move_cursor,
.schedule_frame = output_schedule_frame,
};

bool wlr_output_is_wl(struct wlr_output *wlr_output) {
Expand Down
1 change: 0 additions & 1 deletion include/wlr/interfaces/wlr_output.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ struct wlr_output_impl {
size_t (*get_gamma_size)(struct wlr_output *output);
bool (*export_dmabuf)(struct wlr_output *output,
struct wlr_dmabuf_attributes *attribs);
bool (*schedule_frame)(struct wlr_output *output);
bool (*attach_buffer)(struct wlr_output *output, struct wlr_buffer *buffer);
};

Expand Down
7 changes: 2 additions & 5 deletions types/wlr_output.c
Original file line number Diff line number Diff line change
Expand Up @@ -599,11 +599,8 @@ void wlr_output_send_frame(struct wlr_output *output) {
static void schedule_frame_handle_idle_timer(void *data) {
struct wlr_output *output = data;
output->idle_frame = NULL;
if (!output->frame_pending && output->impl->schedule_frame) {
// Ask the backend to send a frame event when appropriate
if (output->impl->schedule_frame(output)) {
output->frame_pending = true;
}
if (!output->frame_pending) {
wlr_output_send_frame(output);
}
}

Expand Down