aboutsummaryrefslogtreecommitdiff
path: root/backend
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2018-10-29 20:38:57 +0100
committeremersion <contact@emersion.fr>2018-10-29 20:38:57 +0100
commit68362b37a890916d4c98aaee9d29497951c28c67 (patch)
treedf29768b645bbeb8b843eca8ab926aa6b920abb0 /backend
parent659d39baaaa51e27c3e078390e3f1b588f390aa3 (diff)
backend/drm: fix frame scheduling on secondary GPUs
There was a missing copy_drm_surface_mgpu call in drm_connector_schedule_frame so we asked for a pageflip with an unknown BO, resulting in ENOENT. Additionally, this commit makes schedule_frame return a bool indicating failures. This allows schedule_frame_handle_idle_timer to only set frame_pending to true if a frame has been successfully scheduled. Thus, if a pageflip fails, rendering won't be blocked forever anymore. In case a pageflip is already pending, true is returned because a frame has already been scheduled and will be sent sometime soon.
Diffstat (limited to 'backend')
-rw-r--r--backend/drm/drm.c16
-rw-r--r--backend/wayland/output.c5
2 files changed, 13 insertions, 8 deletions
diff --git a/backend/drm/drm.c b/backend/drm/drm.c
index 0b624717..9fd5c6a3 100644
--- a/backend/drm/drm.c
+++ b/backend/drm/drm.c
@@ -735,11 +735,11 @@ static bool drm_connector_move_cursor(struct wlr_output *output,
return ok;
}
-static void drm_connector_schedule_frame(struct wlr_output *output) {
+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;
+ return false;
}
// We need to figure out where we are in the vblank cycle
@@ -747,29 +747,33 @@ static void drm_connector_schedule_frame(struct wlr_output *output) {
struct wlr_drm_crtc *crtc = conn->crtc;
if (!crtc) {
- return;
+ 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;
+ return true;
+ }
+ if (drm->parent) {
+ bo = copy_drm_surface_mgpu(&plane->mgpu_surf, bo);
}
uint32_t fb_id = get_fb_for_bo(bo);
if (conn->pageflip_pending) {
wlr_log(WLR_ERROR, "Skipping pageflip on output '%s'",
conn->output.name);
- return;
+ return true;
}
if (!drm->iface->crtc_pageflip(drm, conn, crtc, fb_id, NULL)) {
- return;
+ return false;
}
conn->pageflip_pending = true;
wlr_output_update_enabled(output, true);
+ return true;
}
static void drm_connector_destroy(struct wlr_output *output) {
diff --git a/backend/wayland/output.c b/backend/wayland/output.c
index bc4067ab..f90c6009 100644
--- a/backend/wayland/output.c
+++ b/backend/wayland/output.c
@@ -197,17 +197,18 @@ static bool output_move_cursor(struct wlr_output *_output, int x, int y) {
return true;
}
-static void output_schedule_frame(struct wlr_output *wlr_output) {
+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;
+ 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 = {