]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
drm: flush pending draw to kernel buffer on vt switch
authorRay Strode <rstrode@redhat.com>
Wed, 6 Jun 2012 15:55:35 +0000 (11:55 -0400)
committerRay Strode <rstrode@redhat.com>
Wed, 6 Jun 2012 14:13:00 +0000 (10:13 -0400)
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

index a4fe3befd192ce1030fa0cd37afcc67a1846e769..db953e68120eb0c4a00240de6d861795f42efaef 100644 (file)
@@ -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;
     }