aboutsummaryrefslogtreecommitdiff
path: root/backend/drm
diff options
context:
space:
mode:
Diffstat (limited to 'backend/drm')
-rw-r--r--backend/drm/backend.c6
-rw-r--r--backend/drm/drm.c17
2 files changed, 20 insertions, 3 deletions
diff --git a/backend/drm/backend.c b/backend/drm/backend.c
index 8859022f..e5614ae2 100644
--- a/backend/drm/backend.c
+++ b/backend/drm/backend.c
@@ -54,8 +54,10 @@ static void session_signal(struct wl_listener *listener, void *data) {
} else {
wlr_log(L_INFO, "DRM fd paused");
- // TODO: Actually pause the renderer or something.
- // We currently just expect it to fail its next pageflip.
+ for (size_t i = 0; i < drm->outputs->length; ++i) {
+ struct wlr_output_state *output = drm->outputs->items[i];
+ wlr_drm_output_pause_renderer(output);
+ }
}
}
diff --git a/backend/drm/drm.c b/backend/drm/drm.c
index 5afdf3c3..ca4f56c3 100644
--- a/backend/drm/drm.c
+++ b/backend/drm/drm.c
@@ -116,6 +116,21 @@ static void wlr_drm_output_end(struct wlr_output_state *output) {
output->bo[0] = bo;
}
+void wlr_drm_output_pause_renderer(struct wlr_output_state *output) {
+ if (output->state != DRM_OUTPUT_CONNECTED) {
+ return;
+ }
+
+ if (output->bo[1]) {
+ gbm_surface_release_buffer(output->gbm, output->bo[1]);
+ output->bo[1] = NULL;
+ }
+ if (output->bo[0]) {
+ gbm_surface_release_buffer(output->gbm, output->bo[0]);
+ output->bo[0] = NULL;
+ }
+}
+
void wlr_drm_output_start_renderer(struct wlr_output_state *output) {
if (output->state != DRM_OUTPUT_CONNECTED) {
return;
@@ -608,7 +623,7 @@ static void page_flip_handler(int fd, unsigned seq,
}
output->pageflip_pending = false;
- if (output->state == DRM_OUTPUT_CONNECTED) {
+ if (output->state == DRM_OUTPUT_CONNECTED && state->session->active) {
wlr_drm_output_begin(output);
wl_signal_emit(&output->wlr_output->events.frame, output->wlr_output);
wlr_drm_output_end(output);