From: Alexander Graf Date: Thu, 30 Mar 2017 14:22:55 +0000 (+0200) Subject: input: Add trace event for empty keyboard queue X-Git-Tag: v2.11.1~561^2 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=2222e0a633070f7f3eafcc9d0e95e7f1a4e6fe36;p=mirror_qemu.git input: Add trace event for empty keyboard queue When driving QEMU from the outside, we have basically no chance to determine how quickly the guest OS picks up key events, so we usually have to limit ourselves to very slow keyboard presses to make sure the guest always has enough chance to pick them up. This patch adds a trace events when the keyboarde queue is drained. An external driver can use that as hint that new keys can be pressed. Signed-off-by: Alexander Graf Message-id: 1490883775-94658-1-git-send-email-agraf@suse.de Signed-off-by: Gerd Hoffmann --- diff --git a/hw/input/hid.c b/hw/input/hid.c index fa9cc4c616..93887ecc43 100644 --- a/hw/input/hid.c +++ b/hw/input/hid.c @@ -256,6 +256,10 @@ static void hid_keyboard_process_keycode(HIDState *hs) slot = hs->head & QUEUE_MASK; QUEUE_INCR(hs->head); hs->n--; keycode = hs->kbd.keycodes[slot]; + if (!hs->n) { + trace_hid_kbd_queue_empty(); + } + key = keycode & 0x7f; index = key | ((hs->kbd.modifiers & (1 << 8)) >> 1); hid_code = hid_usage_keys[index]; diff --git a/hw/input/trace-events b/hw/input/trace-events index f3bfbede5c..5a87818b49 100644 --- a/hw/input/trace-events +++ b/hw/input/trace-events @@ -24,6 +24,7 @@ milkymist_softusb_pulse_irq(void) "Pulse IRQ" # hw/input/hid.c hid_kbd_queue_full(void) "queue full" +hid_kbd_queue_empty(void) "queue empty" # hw/input/virtio virtio_input_queue_full(void) "queue full"