[Spice-devel] [PATCH v2] replay: do not wake up loop too much
Pavel Grunt
pgrunt at redhat.com
Tue Jan 26 04:36:23 PST 2016
On Tue, 2016-01-26 at 10:57 +0000, Frediano Ziglio wrote:
> Send wakeups only when a command is available.
> This emulate better what a guest driver should do (append the command
> to the ring and then signal).
>
> Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Pavel Grunt <pgrunt at redhat.com>
> ---
> server/tests/replay.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> Changes from v2:
> - use only one type of boolean.
>
> diff --git a/server/tests/replay.c b/server/tests/replay.c
> index 0c98168..c7f3f00 100644
> --- a/server/tests/replay.c
> +++ b/server/tests/replay.c
> @@ -108,6 +108,7 @@ static void get_init_info(QXLInstance *qin,
> QXLDevInitInfo *info)
> static gboolean fill_queue_idle(gpointer user_data)
> {
> gboolean keep = FALSE;
> + gboolean wakeup = FALSE;
>
> while (g_async_queue_length(aqueue) < 50) {
> QXLCommandExt *cmd = spice_replay_next_cmd(replay,
> qxl_worker);
> @@ -119,6 +120,7 @@ static gboolean fill_queue_idle(gpointer
> user_data)
> if (slow)
> g_usleep(slow);
>
> + wakeup = TRUE;
> g_async_queue_push(aqueue, cmd);
> }
>
> @@ -132,7 +134,8 @@ end:
> }
> pthread_mutex_unlock(&mutex);
> }
> - spice_qxl_wakeup(&display_sin);
> + if (wakeup)
> + spice_qxl_wakeup(&display_sin);
>
> return keep;
> }
More information about the Spice-devel
mailing list