qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2 03/15] vnc: refresh lossy rect after a given


From: Blue Swirl
Subject: Re: [Qemu-devel] [PATCH v2 03/15] vnc: refresh lossy rect after a given timeout
Date: Thu, 11 Nov 2010 18:44:31 +0000

On Thu, Nov 11, 2010 at 4:56 PM, Corentin Chary <address@hidden> wrote:
> If an adaptive encoding has choosen to send a lossy update
> based on the result of vnc_update_freq(), then it should advertise
> it with vnc_sent_lossy_rect(). This will allow to automatically refresh
> this rect once it's static again.
>
> Signed-off-by: Corentin Chary <address@hidden>
> ---
>  ui/vnc-jobs-async.c |    2 +
>  ui/vnc.c            |   67 +++++++++++++++++++++++++++++++++++++++++++++++---
>  ui/vnc.h            |    3 ++
>  3 files changed, 68 insertions(+), 4 deletions(-)
>
> diff --git a/ui/vnc-jobs-async.c b/ui/vnc-jobs-async.c
> index 6e9cf08..31f8436 100644
> --- a/ui/vnc-jobs-async.c
> +++ b/ui/vnc-jobs-async.c
> @@ -166,6 +166,7 @@ static void vnc_async_encoding_start(VncState *orig, 
> VncState *local)
>     local->features = orig->features;
>     local->ds = orig->ds;
>     local->vd = orig->vd;
> +    local->lossy_rect = orig->lossy_rect;
>     local->write_pixels = orig->write_pixels;
>     local->clientds = orig->clientds;
>     local->tight = orig->tight;
> @@ -182,6 +183,7 @@ static void vnc_async_encoding_end(VncState *orig, 
> VncState *local)
>     orig->tight = local->tight;
>     orig->zlib = local->zlib;
>     orig->hextile = local->hextile;
> +    orig->lossy_rect = local->lossy_rect;
>  }
>
>  static int vnc_worker_thread_loop(VncJobQueue *queue)
> diff --git a/ui/vnc.c b/ui/vnc.c
> index b6e18b3..e1643d1 100644
> --- a/ui/vnc.c
> +++ b/ui/vnc.c
> @@ -1014,6 +1014,8 @@ static void vnc_disconnect_start(VncState *vs)
>
>  static void vnc_disconnect_finish(VncState *vs)
>  {
> +    int i;
> +
>     vnc_jobs_join(vs); /* Wait encoding jobs */
>
>     vnc_lock_output(vs);
> @@ -1050,7 +1052,11 @@ static void vnc_disconnect_finish(VncState *vs)
>  #ifdef CONFIG_VNC_THREAD
>     qemu_mutex_destroy(&vs->output_mutex);
>  #endif
> -    qemu_free(vs);
> +    for (i = 0; i < VNC_STAT_ROWS; ++i) {
> +        qemu_free(vs->lossy_rect[i]);
> +    }
> +    qemu_free(vs->lossy_rect);
> +   qemu_free(vs);

Odd spacing.

>  }
>
>  int vnc_client_io_error(VncState *vs, int ret, int last_errno)
> @@ -2266,10 +2272,55 @@ static VncRectStat *vnc_stat_rect(VncDisplay *vd, int 
> x, int y)
>     return &vs->stats[y / VNC_STAT_RECT][x / VNC_STAT_RECT];
>  }
>
> -static void vnc_update_stats(VncDisplay *vd,  struct timeval * tv)
> +void vnc_sent_lossy_rect(VncState *vs, int x, int y, int w, int h)
> +{
> +    int i, j;
> +
> +    w = (x + w) / VNC_STAT_RECT;
> +    h = (y + h) / VNC_STAT_RECT;
> +    x /= VNC_STAT_RECT;
> +    y /= VNC_STAT_RECT;
> +
> +    for (j = y; j <= y + h; j++) {
> +        for (i = x; i <= x + w; i++) {
> +            vs->lossy_rect[j][i] = 1;
> +        }
> +    }
> +}
> +
> +static int vnc_refresh_lossy_rect(VncDisplay *vd, int x, int y)
> +{
> +    VncState *vs;
> +    int sty = y / VNC_STAT_RECT;
> +    int stx = x / VNC_STAT_RECT;
> +    int has_dirty = 0;
> +
> +    y = y / VNC_STAT_RECT * VNC_STAT_RECT;
> +    x = x / VNC_STAT_RECT * VNC_STAT_RECT;
> +
> +    QTAILQ_FOREACH(vs, &vd->clients, next) {
> +        int j ;

Extra space between identifier and semicolon.

> +
> +        /* kernel send buffers are full -> refresh later */
> +        if (vs->output.offset)

Missing braces.

> +            continue ;

Extra space.

> +
> +        if (!vs->lossy_rect[sty][stx])
> +            continue ;

See above.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]