From 171c329f401056bdb213e4071ff7f150c6f2e7ee Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Wed, 6 Jun 2012 11:55:35 -0400 Subject: [PATCH] drm: flush pending draw to kernel buffer on vt switch When plymouth's VT is not the foreground VT, we tell the kernel not to scan out from the kernel buffer we manage. Also, we don't bother dispatching rendering to the kernel buffer (since it's not getting scanned out anyway). When plymouth's VT becomes the foreground VT, we tell the kernel to start scanning out from our buffer again. Unfortunately, we neglect to flush all the pending drawing that happens while VT switched away. This means we briefly show stale contents. This commit flushes all pending rendering to the kernel, before resetting the scan out buffer, so we get a current view of the splash shown immediately. --- src/plugins/renderers/drm/plugin.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/plugins/renderers/drm/plugin.c b/src/plugins/renderers/drm/plugin.c index a4fe3bef..db953e68 100644 --- a/src/plugins/renderers/drm/plugin.c +++ b/src/plugins/renderers/drm/plugin.c @@ -136,6 +136,8 @@ static bool open_input_source (ply_renderer_backend_t *backend, ply_renderer_input_source_t *input_source); static bool reset_scan_out_buffer_if_needed (ply_renderer_backend_t *backend, ply_renderer_head_t *head); +static void flush_head (ply_renderer_backend_t *backend, + ply_renderer_head_t *head); static bool ply_renderer_head_add_connector (ply_renderer_head_t *head, @@ -465,8 +467,16 @@ activate (ply_renderer_backend_t *backend) next_node = ply_list_get_next_node (backend->heads, node); if (head->scan_out_buffer_id != 0) - ply_renderer_head_set_scan_out_buffer (backend, head, - head->scan_out_buffer_id); + { + /* Flush out any pending drawing to the buffer + */ + flush_head (backend, head); + + /* Then send the buffer to the monitor + */ + ply_renderer_head_set_scan_out_buffer (backend, head, + head->scan_out_buffer_id); + } node = next_node; }