mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-08 02:03:56 -06:00
hid: Change idle handling to use a timer
This leads to cleaner code in usb-hid, and removes up to a 1000 calls / sec to qemu_get_clock_ns(vm_clock) if idle-time is set to its default value of 0. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
parent
9fdf702727
commit
027c03f732
3 changed files with 43 additions and 13 deletions
5
hw/hid.h
5
hw/hid.h
|
@ -43,7 +43,8 @@ struct HIDState {
|
|||
int kind;
|
||||
int32_t protocol;
|
||||
uint8_t idle;
|
||||
int64_t next_idle_clock;
|
||||
bool idle_pending;
|
||||
QEMUTimer *idle_timer;
|
||||
HIDEventFunc event;
|
||||
};
|
||||
|
||||
|
@ -52,7 +53,7 @@ void hid_reset(HIDState *hs);
|
|||
void hid_free(HIDState *hs);
|
||||
|
||||
bool hid_has_events(HIDState *hs);
|
||||
void hid_set_next_idle(HIDState *hs, int64_t curtime);
|
||||
void hid_set_next_idle(HIDState *hs);
|
||||
void hid_pointer_activate(HIDState *hs);
|
||||
int hid_pointer_poll(HIDState *hs, uint8_t *buf, int len);
|
||||
int hid_keyboard_poll(HIDState *hs, uint8_t *buf, int len);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue