[PATCH weston v2 1/1] compositor-drm: Unref current & pending fb when deactivating the session

Miguel A. Vico mvicomoya at nvidia.com
Thu Aug 10 23:55:46 UTC 2017


With

     commit 47224cc9312fef05c1a523ea0da0a1aae66f100d
     Author: Daniel Stone <daniels at collabora.com>
     Date:   Sat Nov 5 08:04:07 2016 +0000

         compositor-drm: Delete drm_backend_set_modes

we stopped forcing a modeset when restoring the session. The motivation
was that we would use a stale fb, so better to let the next repaint
handle it.

However, if drm_output::fb_current != NULL, we won't issue a modeset
upon repaint.

This change unreferences both drm_output::fb_current and
drm_output::fb_pending when deactivating the current session. This
ensures the very first repaint after restoring the session will issue a
modeset.

Signed-off-by: Miguel A Vico Moya <mvicomoya at nvidia.com>
---
 libweston/compositor-drm.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
index 8e1e788f..63153271 100644
--- a/libweston/compositor-drm.c
+++ b/libweston/compositor-drm.c
@@ -3164,6 +3164,14 @@ session_notify(struct wl_listener *listener, void *data)
 		wl_list_for_each(output, &compositor->output_list, base.link) {
 			output->base.repaint_needed = false;
 			drmModeSetCursor(b->drm.fd, output->crtc_id, 0, 0, 0);
+			if (output->fb_current != NULL) {
+				drm_fb_unref(output->fb_current);
+				output->fb_current = NULL;
+			}
+			if (output->fb_pending != NULL) {
+				drm_fb_unref(output->fb_pending);
+				output->fb_pending = NULL;
+			}
 		}
 
 		output = container_of(compositor->output_list.next,
-- 
2.13.3



More information about the wayland-devel mailing list