qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [RfC PATCH] hid: handle full ptr queues in post_load


From: Gonglei
Subject: Re: [Qemu-devel] [RfC PATCH] hid: handle full ptr queues in post_load
Date: Thu, 27 Nov 2014 17:25:47 +0800
User-agent: Mozilla/5.0 (Windows NT 6.1; rv:11.0) Gecko/20120327 Thunderbird/11.0.1

On 2014/11/27 17:04, Gerd Hoffmann wrote:

> Cc: Gonglei <address@hidden>
> Cc: Dr. David Alan Gilbert <address@hidden>
> Signed-off-by: Gerd Hoffmann <address@hidden>
> ---
>  hw/input/hid.c | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
> 
> diff --git a/hw/input/hid.c b/hw/input/hid.c
> index 8f6fbb3..6fb963f 100644
> --- a/hw/input/hid.c
> +++ b/hw/input/hid.c
> @@ -519,6 +519,27 @@ static int hid_post_load(void *opaque, int version_id)
>      HIDState *s = opaque;
>  
>      hid_set_next_idle(s);
> +
> +    if (s->n == QUEUE_LENGTH && (s->kind == HID_TABLET ||
> +                                 s->kind == HID_MOUSE)) {
> +        /*
> +         * Handle ptr device migration from old qemu with full queue.
> +         *
> +         * Throw away everything but the last event, so we propagate
> +         * at least the current button state to the guest.  Also keep
> +         * current position for the tablet, signal "no motion" for the
> +         * mouse.
> +         */
> +        HIDPointerEvent evt;
> +        evt = s->ptr.queue[(s->head+s->n) & QUEUE_MASK];

s->n is QUEUE_LENGTH, can we directly delete it?
  evt = s->ptr.queue[s->head & QUEUE_MASK]

Best regards,
-Gonglei

> +        if (s->kind == HID_MOUSE) {
> +            evt.xdx = 0;
> +            evt.ydy = 0;
> +        }
> +        s->ptr.queue[0] = evt;
> +        s->head = 0;
> +        s->n = 1;
> +    }
>      return 0;
>  }
>  






reply via email to

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