diff mbox

[RfC,00/10] vnc buffer handling

Message ID 56051A42.8050902@kamp.de
State New
Headers show

Commit Message

Peter Lieven Sept. 25, 2015, 9:56 a.m. UTC
Am 24.09.2015 um 10:41 schrieb Gerd Hoffmann:
>   Hi,
>
> Here is a patch series to improve the vnc buffer handling.  It picks up
> the qio_buffer patches from Daniel, adds move calls (move data from one
> buffer to another) and tracing, makes vnc use the new features.  Net
> effect should be that (a) vnc copies less data around and (b) buffers
> don't grow forever.
>
> It's RfC because it depends on wip patches.  My plan is to wait for
> Daniels patch series to be merged (which should obsolete patches #1+#2),
> then rebase and repost the series.
>
> Patches are also available from git:
>   git://git.kraxel.org/qemu rebase/ui-vnc-next
>
> please test & review,
>   Gerd

Looks fine except for the missing output handler due to the drop of vnc_write in vnc_jobs_consume_buffer.

However, I would add the following optimization:


The buffers however still only allowed to grow during the ongoing session.

Peter
diff mbox

Patch

diff --git a/ui/vnc-jobs.c b/ui/vnc-jobs.c
index dfc5139..4b384b0 100644
--- a/ui/vnc-jobs.c
+++ b/ui/vnc-jobs.c
@@ -228,6 +232,11 @@  static int vnc_worker_thread_loop(VncJobQueue *queue)
         vnc_unlock_output(job->vs);
         goto disconnected;
     }
+
+    if (qio_buffer_empty(&job->vs->output)) {
+        qio_buffer_move_empty(&vs.output, &job->vs->output);
+    }
+

The idea is that the vs->output is at the end of the queue and will be dropped by the next qio_buffer_move_empty anyway.
So why not reuse it as worker thread output buffer? This reduces reallocs to zero for me after the initial transmission of the desktop.