diff --git a/backend/drm/drm.c b/backend/drm/drm.c index a97915ec..ebea340e 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -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: @@ -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, }; diff --git a/backend/wayland/output.c b/backend/wayland/output.c index 7a3a08d0..2c80c77f 100644 --- a/backend/wayland/output.c +++ b/backend/wayland/output.c @@ -415,20 +415,6 @@ 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, @@ -436,7 +422,6 @@ static const struct wlr_output_impl output_impl = { .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) { diff --git a/include/wlr/interfaces/wlr_output.h b/include/wlr/interfaces/wlr_output.h index 8d4a3fd8..12980ee5 100644 --- a/include/wlr/interfaces/wlr_output.h +++ b/include/wlr/interfaces/wlr_output.h @@ -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); }; diff --git a/types/wlr_output.c b/types/wlr_output.c index 611309db..51b1fcae 100644 --- a/types/wlr_output.c +++ b/types/wlr_output.c @@ -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); } }