diff options
author | David 'Digit' Turner <digit@android.com> | 2011-05-10 07:06:00 +0200 |
---|---|---|
committer | David 'Digit' Turner <digit@android.com> | 2011-06-01 17:08:17 +0200 |
commit | 5973c775c853e26f684de58ad28c267281aaffd6 (patch) | |
tree | a1db31a2a98ec793e396a2de72f1a8858315d7af | |
parent | 317c9d54284844615b33a25834a63248bf1bfa73 (diff) | |
download | external_qemu-5973c775c853e26f684de58ad28c267281aaffd6.zip external_qemu-5973c775c853e26f684de58ad28c267281aaffd6.tar.gz external_qemu-5973c775c853e26f684de58ad28c267281aaffd6.tar.bz2 |
qemu-timer.c: rename qemu_timer_new_scale()
Get rid of qemu_timer_new() implementation, and update all
callers to use qemu_timer_new_ms() or qemu_timer_new_ns()
instead.
Rename qemu_new_timer_scale() to qemu_new_timer() to follow
upstream conventions.
Change-Id: Id2c04f8597ec5026e02f87b3e2c5507920eb688e
-rw-r--r-- | android/hw-sensors.c | 4 | ||||
-rw-r--r-- | android/looper-qemu.c | 6 | ||||
-rw-r--r-- | audio/audio.c | 8 | ||||
-rw-r--r-- | buffered_file.c | 10 | ||||
-rw-r--r-- | console.c | 4 | ||||
-rw-r--r-- | hw/apic.c | 8 | ||||
-rw-r--r-- | hw/armv7m_nvic.c | 4 | ||||
-rw-r--r-- | hw/bt-hci-csr.c | 4 | ||||
-rw-r--r-- | hw/bt-hci.c | 12 | ||||
-rw-r--r-- | hw/goldfish_pipe.c | 2 | ||||
-rw-r--r-- | hw/goldfish_timer.c | 30 | ||||
-rw-r--r-- | hw/i8254.c | 12 | ||||
-rw-r--r-- | hw/mc146818rtc.c | 28 | ||||
-rw-r--r-- | hw/usb-ohci.c | 22 | ||||
-rw-r--r-- | monitor.c | 5 | ||||
-rw-r--r-- | qemu-char-android.c | 8 | ||||
-rw-r--r-- | qemu-char.c | 8 | ||||
-rw-r--r-- | qemu-timer.c | 10 | ||||
-rw-r--r-- | qemu-timer.h | 7 | ||||
-rw-r--r-- | savevm.c | 8 | ||||
-rw-r--r-- | shaper.c | 22 | ||||
-rw-r--r-- | telephony/sysdeps_qemu.c | 6 | ||||
-rw-r--r-- | usb-linux.c | 6 | ||||
-rw-r--r-- | vl-android.c | 12 | ||||
-rw-r--r-- | vl.c | 12 | ||||
-rw-r--r-- | vnc-android.c | 8 | ||||
-rw-r--r-- | vnc.c | 14 |
27 files changed, 130 insertions, 150 deletions
diff --git a/android/hw-sensors.c b/android/hw-sensors.c index c3ab12f..69447a2 100644 --- a/android/hw-sensors.c +++ b/android/hw-sensors.c @@ -212,7 +212,7 @@ _hwSensorClient_new( HwSensors* sensors ) cl->sensors = sensors; cl->enabledMask = 0; cl->delay_ms = 800; - cl->timer = qemu_new_timer(vm_clock, _hwSensorClient_tick, cl); + cl->timer = qemu_new_timer_ns(vm_clock, _hwSensorClient_tick, cl); cl->next = sensors->clients; sensors->clients = cl; @@ -316,7 +316,7 @@ _hwSensorClient_tick( void* opaque ) _hwSensorClient_send(cl, (uint8_t*) buffer, strlen(buffer)); } - now_ns = qemu_get_clock(vm_clock); + now_ns = qemu_get_clock_ns(vm_clock); snprintf(buffer, sizeof buffer, "sync:%lld", now_ns/1000); _hwSensorClient_send(cl, (uint8_t*)buffer, strlen(buffer)); diff --git a/android/looper-qemu.c b/android/looper-qemu.c index 5526f5b..714b48d 100644 --- a/android/looper-qemu.c +++ b/android/looper-qemu.c @@ -36,7 +36,7 @@ qlooptimer_startRelative(void* impl, Duration timeout_ms) if (timeout_ms == DURATION_INFINITE) qemu_del_timer(tt); else - qemu_mod_timer(tt, qemu_get_clock_ns(host_clock) + timeout_ms*1000000); + qemu_mod_timer(tt, qemu_get_clock_ms(host_clock) + timeout_ms); } static void @@ -85,7 +85,7 @@ qlooper_timer_init(Looper* looper, void* opaque) { timer->clazz = (LoopTimerClass*) &qlooptimer_class; - timer->impl = qemu_new_timer(host_clock, callback, opaque); + timer->impl = qemu_new_timer_ms(host_clock, callback, opaque); } /********************************************************************** @@ -370,7 +370,7 @@ qlooper_handle_io_bh(void* opaque) static Duration qlooper_now(Looper* ll) { - return qemu_get_clock_ns(host_clock)/1000000; + return qemu_get_clock_ms(host_clock); } extern void qemu_system_shutdown_request(void); diff --git a/audio/audio.c b/audio/audio.c index 3e60c12..7acd3d7 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -1198,7 +1198,7 @@ static void audio_timer (void *opaque) AudioState *s = opaque; #if 0 #define MAX_DIFFS 100 - int64_t now = qemu_get_clock(vm_clock); + int64_t now = qemu_get_clock_ms(vm_clock); static int64_t last = 0; static float diffs[MAX_DIFFS]; static int num_diffs; @@ -1227,7 +1227,7 @@ static void audio_timer (void *opaque) #endif audio_run ("timer"); - qemu_mod_timer (s->ts, qemu_get_clock (vm_clock) + conf.period.ticks); + qemu_mod_timer (s->ts, qemu_get_clock_ns (vm_clock) + conf.period.ticks); } @@ -1250,7 +1250,7 @@ static void audio_reset_timer (void) AudioState *s = &glob_audio_state; if (audio_is_timer_needed ()) { - qemu_mod_timer (s->ts, qemu_get_clock (vm_clock) + 1); + qemu_mod_timer (s->ts, qemu_get_clock_ns (vm_clock) + 1); } else { qemu_del_timer (s->ts); @@ -1964,7 +1964,7 @@ static void audio_init (void) QLIST_INIT (&s->cap_head); atexit (audio_atexit); - s->ts = qemu_new_timer (vm_clock, audio_timer, s); + s->ts = qemu_new_timer_ns (vm_clock, audio_timer, s); if (!s->ts) { dolog ("Could not create audio timer\n"); return; diff --git a/buffered_file.c b/buffered_file.c index 1836e7e..bdfcea9 100644 --- a/buffered_file.c +++ b/buffered_file.c @@ -214,7 +214,7 @@ static size_t buffered_set_rate_limit(void *opaque, size_t new_rate) goto out; s->xfer_limit = new_rate / 10; - + out: return s->xfer_limit; } @@ -222,7 +222,7 @@ out: static size_t buffered_get_rate_limit(void *opaque) { QEMUFileBuffered *s = opaque; - + return s->xfer_limit; } @@ -235,7 +235,7 @@ static void buffered_rate_tick(void *opaque) return; } - qemu_mod_timer(s->timer, qemu_get_clock(rt_clock) + 100); + qemu_mod_timer(s->timer, qemu_get_clock_ms(rt_clock) + 100); if (s->freeze_output) return; @@ -271,9 +271,9 @@ QEMUFile *qemu_fopen_ops_buffered(void *opaque, buffered_set_rate_limit, buffered_get_rate_limit); - s->timer = qemu_new_timer(rt_clock, buffered_rate_tick, s); + s->timer = qemu_new_timer_ms(rt_clock, buffered_rate_tick, s); - qemu_mod_timer(s->timer, qemu_get_clock(rt_clock) + 100); + qemu_mod_timer(s->timer, qemu_get_clock_ms(rt_clock) + 100); return s->file; } @@ -1141,7 +1141,7 @@ static void kbd_send_chars(void *opaque) /* characters are pending: we send them a bit later (XXX: horrible, should change char device API) */ if (s->out_fifo.count > 0) { - qemu_mod_timer(s->kbd_timer, qemu_get_clock(rt_clock) + 1); + qemu_mod_timer(s->kbd_timer, qemu_get_clock_ms(rt_clock) + 1); } } @@ -1477,7 +1477,7 @@ static void text_console_do_init(CharDriverState *chr, DisplayState *ds, QemuOpt s->chr = chr; s->out_fifo.buf = s->out_fifo_buf; s->out_fifo.buf_size = sizeof(s->out_fifo_buf); - s->kbd_timer = qemu_new_timer(rt_clock, kbd_send_chars, s); + s->kbd_timer = qemu_new_timer_ms(rt_clock, kbd_send_chars, s); s->ds = ds; if (!color_inited) { @@ -599,7 +599,7 @@ static uint32_t apic_get_current_count(APICState *s) { int64_t d; uint32_t val; - d = (qemu_get_clock(vm_clock) - s->initial_count_load_time) >> + d = (qemu_get_clock_ns(vm_clock) - s->initial_count_load_time) >> s->count_shift; if (s->lvt[APIC_LVT_TIMER] & APIC_LVT_TIMER_PERIODIC) { /* periodic */ @@ -806,12 +806,12 @@ static void apic_mem_writel(void *opaque, target_phys_addr_t addr, uint32_t val) int n = index - 0x32; s->lvt[n] = val; if (n == APIC_LVT_TIMER) - apic_timer_update(s, qemu_get_clock(vm_clock)); + apic_timer_update(s, qemu_get_clock_ns(vm_clock)); } break; case 0x38: s->initial_count = val; - s->initial_count_load_time = qemu_get_clock(vm_clock); + s->initial_count_load_time = qemu_get_clock_ns(vm_clock); apic_timer_update(s, s->initial_count_load_time); break; case 0x39: @@ -956,7 +956,7 @@ int apic_init(CPUState *env) cpu_register_physical_memory(s->apicbase & ~0xfff, 0x1000, apic_io_memory); } - s->timer = qemu_new_timer(vm_clock, apic_timer, s); + s->timer = qemu_new_timer_ns(vm_clock, apic_timer, s); register_savevm("apic", s->idx, 2, apic_save, apic_load, s); qemu_register_reset(apic_reset, 0, s); diff --git a/hw/armv7m_nvic.c b/hw/armv7m_nvic.c index f789c78..f732011 100644 --- a/hw/armv7m_nvic.c +++ b/hw/armv7m_nvic.c @@ -64,7 +64,7 @@ static inline int64_t systick_scale(nvic_state *s) static void systick_reload(nvic_state *s, int reset) { if (reset) - s->systick.tick = qemu_get_clock(vm_clock); + s->systick.tick = qemu_get_clock_ns(vm_clock); s->systick.tick += (s->systick.reload + 1) * systick_scale(s); qemu_mod_timer(s->systick.timer, s->systick.tick); } @@ -396,7 +396,7 @@ static void armv7m_nvic_init(SysBusDevice *dev) gic_init(&s->gic); cpu_register_physical_memory(0xe000e000, 0x1000, s->gic.iomemtype); - s->systick.timer = qemu_new_timer(vm_clock, systick_timer_tick, s); + s->systick.timer = qemu_new_timer_ns(vm_clock, systick_timer_tick, s); register_savevm("armv7m_nvic", -1, 1, nvic_save, nvic_load, s); } diff --git a/hw/bt-hci-csr.c b/hw/bt-hci-csr.c index 982577d..65ffa37 100644 --- a/hw/bt-hci-csr.c +++ b/hw/bt-hci-csr.c @@ -88,7 +88,7 @@ static inline void csrhci_fifo_wake(struct csrhci_s *s) } if (s->out_len) - qemu_mod_timer(s->out_tm, qemu_get_clock(vm_clock) + s->baud_delay); + qemu_mod_timer(s->out_tm, qemu_get_clock_ns(vm_clock) + s->baud_delay); } #define csrhci_out_packetz(s, len) memset(csrhci_out_packet(s, len), 0, len) @@ -446,7 +446,7 @@ CharDriverState *uart_hci_init(qemu_irq wakeup) s->hci->evt_recv = csrhci_out_hci_packet_event; s->hci->acl_recv = csrhci_out_hci_packet_acl; - s->out_tm = qemu_new_timer(vm_clock, csrhci_out_tick, s); + s->out_tm = qemu_new_timer_ns(vm_clock, csrhci_out_tick, s); s->pins = qemu_allocate_irqs(csrhci_pins, s, __csrhci_pins); csrhci_reset(s); diff --git a/hw/bt-hci.c b/hw/bt-hci.c index f1ee92c..41df24c 100644 --- a/hw/bt-hci.c +++ b/hw/bt-hci.c @@ -576,7 +576,7 @@ static void bt_hci_inquiry_result(struct bt_hci_s *hci, static void bt_hci_mod_timer_1280ms(QEMUTimer *timer, int period) { - qemu_mod_timer(timer, qemu_get_clock(vm_clock) + + qemu_mod_timer(timer, qemu_get_clock_ns(vm_clock) + muldiv64(period << 7, get_ticks_per_sec(), 100)); } @@ -657,7 +657,7 @@ static void bt_hci_lmp_link_establish(struct bt_hci_s *hci, if (master) { link->acl_mode = acl_active; hci->lm.handle[hci->lm.last_handle].acl_mode_timer = - qemu_new_timer(vm_clock, bt_hci_mode_tick, link); + qemu_new_timer_ns(vm_clock, bt_hci_mode_tick, link); } } @@ -1084,7 +1084,7 @@ static int bt_hci_mode_change(struct bt_hci_s *hci, uint16_t handle, bt_hci_event_status(hci, HCI_SUCCESS); - qemu_mod_timer(link->acl_mode_timer, qemu_get_clock(vm_clock) + + qemu_mod_timer(link->acl_mode_timer, qemu_get_clock_ns(vm_clock) + muldiv64(interval * 625, get_ticks_per_sec(), 1000000)); bt_hci_lmp_mode_change_master(hci, link->link, mode, interval); @@ -2145,10 +2145,10 @@ struct HCIInfo *bt_new_hci(struct bt_scatternet_s *net) { struct bt_hci_s *s = qemu_mallocz(sizeof(struct bt_hci_s)); - s->lm.inquiry_done = qemu_new_timer(vm_clock, bt_hci_inquiry_done, s); - s->lm.inquiry_next = qemu_new_timer(vm_clock, bt_hci_inquiry_next, s); + s->lm.inquiry_done = qemu_new_timer_ns(vm_clock, bt_hci_inquiry_done, s); + s->lm.inquiry_next = qemu_new_timer_ns(vm_clock, bt_hci_inquiry_next, s); s->conn_accept_timer = - qemu_new_timer(vm_clock, bt_hci_conn_accept_timeout, s); + qemu_new_timer_ns(vm_clock, bt_hci_conn_accept_timeout, s); s->evt_packet = bt_hci_evt_packet; s->evt_submit = bt_hci_evt_submit; diff --git a/hw/goldfish_pipe.c b/hw/goldfish_pipe.c index 998ba49..fd31a2b 100644 --- a/hw/goldfish_pipe.c +++ b/hw/goldfish_pipe.c @@ -655,7 +655,7 @@ throttlePipe_init( void* hwpipe, void* svcOpaque, const char* args ) ANEW0(pipe); pingPongPipe_init0(&pipe->pingpong, hwpipe, svcOpaque); - pipe->timer = qemu_new_timer(vm_clock, throttlePipe_timerFunc, pipe); + pipe->timer = qemu_new_timer_ns(vm_clock, throttlePipe_timerFunc, pipe); /* For now, limit to 500 KB/s in both directions */ pipe->sendRate = 1e9 / (500*1024*8); pipe->recvRate = pipe->sendRate; diff --git a/hw/goldfish_timer.c b/hw/goldfish_timer.c index a714b22..567ce2e 100644 --- a/hw/goldfish_timer.c +++ b/hw/goldfish_timer.c @@ -34,16 +34,6 @@ struct timer_state { QEMUTimer *timer; }; -/* Converts nanoseconds into ticks */ -static int64_t ns2tks(int64_t ns) { - return muldiv64(ns, get_ticks_per_sec(), 1000000000); -} - -/* Converts ticks into nanoseconds */ -static int64_t tks2ns(int64_t tks) { - return muldiv64(tks, 1000000000, get_ticks_per_sec()); -} - #define GOLDFISH_TIMER_SAVE_VERSION 1 static void goldfish_timer_save(QEMUFile* f, void* opaque) @@ -53,9 +43,9 @@ static void goldfish_timer_save(QEMUFile* f, void* opaque) qemu_put_be64(f, s->now_ns); /* in case the kernel is in the middle of a timer read */ qemu_put_byte(f, s->armed); if (s->armed) { - int64_t now_tks = qemu_get_clock(vm_clock); - int64_t alarm_tks = ns2tks(s->alarm_low_ns | (int64_t)s->alarm_high_ns << 32); - qemu_put_be64(f, alarm_tks - now_tks); + int64_t now_ns = qemu_get_clock_ns(vm_clock); + int64_t alarm_ns = (s->alarm_low_ns | (int64_t)s->alarm_high_ns << 32); + qemu_put_be64(f, alarm_ns - now_ns); } } @@ -88,7 +78,7 @@ static uint32_t goldfish_timer_read(void *opaque, target_phys_addr_t offset) struct timer_state *s = (struct timer_state *)opaque; switch(offset) { case TIMER_TIME_LOW: - s->now_ns = tks2ns(qemu_get_clock(vm_clock)); + s->now_ns = qemu_get_clock_ns(vm_clock); return s->now_ns; case TIMER_TIME_HIGH: return s->now_ns >> 32; @@ -101,16 +91,16 @@ static uint32_t goldfish_timer_read(void *opaque, target_phys_addr_t offset) static void goldfish_timer_write(void *opaque, target_phys_addr_t offset, uint32_t value_ns) { struct timer_state *s = (struct timer_state *)opaque; - int64_t alarm_tks, now_tks; + int64_t alarm_ns, now_ns; switch(offset) { case TIMER_ALARM_LOW: s->alarm_low_ns = value_ns; - alarm_tks = ns2tks(s->alarm_low_ns | (int64_t)s->alarm_high_ns << 32); - now_tks = qemu_get_clock(vm_clock); - if (alarm_tks <= now_tks) { + alarm_ns = (s->alarm_low_ns | (int64_t)s->alarm_high_ns << 32); + now_ns = qemu_get_clock_ns(vm_clock); + if (alarm_ns <= now_ns) { goldfish_device_set_irq(&s->dev, 0, 1); } else { - qemu_mod_timer(s->timer, alarm_tks); + qemu_mod_timer(s->timer, alarm_ns); s->armed = 1; } break; @@ -251,7 +241,7 @@ void goldfish_timer_and_rtc_init(uint32_t timerbase, int timerirq) { timer_state.dev.base = timerbase; timer_state.dev.irq = timerirq; - timer_state.timer = qemu_new_timer(vm_clock, goldfish_timer_tick, &timer_state); + timer_state.timer = qemu_new_timer_ns(vm_clock, goldfish_timer_tick, &timer_state); goldfish_device_add(&timer_state.dev, goldfish_timer_readfn, goldfish_timer_writefn, &timer_state); register_savevm( "goldfish_timer", 0, GOLDFISH_TIMER_SAVE_VERSION, goldfish_timer_save, goldfish_timer_load, &timer_state); @@ -66,7 +66,7 @@ static int pit_get_count(PITChannelState *s) uint64_t d; int counter; - d = muldiv64(qemu_get_clock(vm_clock) - s->count_load_time, PIT_FREQ, get_ticks_per_sec()); + d = muldiv64(qemu_get_clock_ns(vm_clock) - s->count_load_time, PIT_FREQ, get_ticks_per_sec()); switch(s->mode) { case 0: case 1: @@ -189,7 +189,7 @@ void pit_set_gate(PITState *pit, int channel, int val) case 5: if (s->gate < val) { /* restart counting on rising edge */ - s->count_load_time = qemu_get_clock(vm_clock); + s->count_load_time = qemu_get_clock_ns(vm_clock); pit_irq_timer_update(s, s->count_load_time); } break; @@ -197,7 +197,7 @@ void pit_set_gate(PITState *pit, int channel, int val) case 3: if (s->gate < val) { /* restart counting on rising edge */ - s->count_load_time = qemu_get_clock(vm_clock); + s->count_load_time = qemu_get_clock_ns(vm_clock); pit_irq_timer_update(s, s->count_load_time); } /* XXX: disable/enable counting */ @@ -228,7 +228,7 @@ static inline void pit_load_count(PITChannelState *s, int val) { if (val == 0) val = 0x10000; - s->count_load_time = qemu_get_clock(vm_clock); + s->count_load_time = qemu_get_clock_ns(vm_clock); s->count = val; pit_irq_timer_update(s, s->count_load_time); } @@ -262,7 +262,7 @@ static void pit_ioport_write(void *opaque, uint32_t addr, uint32_t val) if (!(val & 0x10) && !s->status_latched) { /* status latch */ /* XXX: add BCD and null count */ - s->status = (pit_get_out1(s, qemu_get_clock(vm_clock)) << 7) | + s->status = (pit_get_out1(s, qemu_get_clock_ns(vm_clock)) << 7) | (s->rw_mode << 4) | (s->mode << 1) | s->bcd; @@ -492,7 +492,7 @@ PITState *pit_init(int base, qemu_irq irq) s = &pit->channels[0]; /* the timer 0 is connected to an IRQ */ - s->irq_timer = qemu_new_timer(vm_clock, pit_irq_timer, s); + s->irq_timer = qemu_new_timer_ns(vm_clock, pit_irq_timer, s); s->irq = irq; register_savevm("i8254", base, 1, pit_save, pit_load, pit); diff --git a/hw/mc146818rtc.c b/hw/mc146818rtc.c index f93a3cb..9cf880d 100644 --- a/hw/mc146818rtc.c +++ b/hw/mc146818rtc.c @@ -108,8 +108,8 @@ static void rtc_coalesced_timer_update(RTCState *s) qemu_del_timer(s->coalesced_timer); } else { /* divide each RTC interval to 2 - 8 smaller intervals */ - int c = MIN(s->irq_coalesced, 7) + 1; - int64_t next_clock = qemu_get_clock(vm_clock) + + int c = MIN(s->irq_coalesced, 7) + 1; + int64_t next_clock = qemu_get_clock_ns(vm_clock) + muldiv64(s->period / c, get_ticks_per_sec(), 32768); qemu_mod_timer(s->coalesced_timer, next_clock); } @@ -150,7 +150,7 @@ static void rtc_timer_update(RTCState *s, int64_t current_time) #endif #endif enable_pie = 1; - + if (period_code != 0 && (((s->cmos_data[RTC_REG_B] & REG_B_PIE) && enable_pie) || ((s->cmos_data[RTC_REG_B] & REG_B_SQWE) && s->sqw_irq))) { @@ -237,7 +237,7 @@ static void cmos_ioport_write(void *opaque, uint32_t addr, uint32_t data) /* UIP bit is read only */ s->cmos_data[RTC_REG_A] = (data & ~REG_A_UIP) | (s->cmos_data[RTC_REG_A] & REG_A_UIP); - rtc_timer_update(s, qemu_get_clock(vm_clock)); + rtc_timer_update(s, qemu_get_clock_ns(vm_clock)); break; case RTC_REG_B: if (data & REG_B_SET) { @@ -251,7 +251,7 @@ static void cmos_ioport_write(void *opaque, uint32_t addr, uint32_t data) } } s->cmos_data[RTC_REG_B] = data; - rtc_timer_update(s, qemu_get_clock(vm_clock)); + rtc_timer_update(s, qemu_get_clock_ns(vm_clock)); break; case RTC_REG_C: case RTC_REG_D: @@ -610,18 +610,18 @@ RTCState *rtc_init_sqw(int base, qemu_irq irq, qemu_irq sqw_irq, int base_year) s->base_year = base_year; rtc_set_date_from_host(s); - s->periodic_timer = qemu_new_timer(vm_clock, + s->periodic_timer = qemu_new_timer_ns(vm_clock, rtc_periodic_timer, s); #ifdef TARGET_I386 if (rtc_td_hack) - s->coalesced_timer = qemu_new_timer(vm_clock, rtc_coalesced_timer, s); + s->coalesced_timer = qemu_new_timer_ns(vm_clock, rtc_coalesced_timer, s); #endif - s->second_timer = qemu_new_timer(vm_clock, + s->second_timer = qemu_new_timer_ns(vm_clock, rtc_update_second, s); - s->second_timer2 = qemu_new_timer(vm_clock, + s->second_timer2 = qemu_new_timer_ns(vm_clock, rtc_update_second2, s); - s->next_second_time = qemu_get_clock(vm_clock) + (get_ticks_per_sec() * 99) / 100; + s->next_second_time = qemu_get_clock_ns(vm_clock) + (get_ticks_per_sec() * 99) / 100; qemu_mod_timer(s->second_timer2, s->next_second_time); register_ioport_write(base, 2, 1, cmos_ioport_write, s); @@ -731,14 +731,14 @@ RTCState *rtc_mm_init(target_phys_addr_t base, int it_shift, qemu_irq irq, s->base_year = base_year; rtc_set_date_from_host(s); - s->periodic_timer = qemu_new_timer(vm_clock, + s->periodic_timer = qemu_new_timer_ns(vm_clock, rtc_periodic_timer, s); - s->second_timer = qemu_new_timer(vm_clock, + s->second_timer = qemu_new_timer_ns(vm_clock, rtc_update_second, s); - s->second_timer2 = qemu_new_timer(vm_clock, + s->second_timer2 = qemu_new_timer_ns(vm_clock, rtc_update_second2, s); - s->next_second_time = qemu_get_clock(vm_clock) + (get_ticks_per_sec() * 99) / 100; + s->next_second_time = qemu_get_clock_ns(vm_clock) + (get_ticks_per_sec() * 99) / 100; qemu_mod_timer(s->second_timer2, s->next_second_time); io_memory = cpu_register_io_memory(rtc_mm_read, rtc_mm_write, s); diff --git a/hw/usb-ohci.c b/hw/usb-ohci.c index 7dd8ed3..d34b85d 100644 --- a/hw/usb-ohci.c +++ b/hw/usb-ohci.c @@ -626,7 +626,7 @@ static int ohci_service_iso_td(OHCIState *ohci, struct ohci_ed *ed, starting_frame = OHCI_BM(iso_td.flags, TD_SF); frame_count = OHCI_BM(iso_td.flags, TD_FC); - relative_frame_number = USUB(ohci->frame_number, starting_frame); + relative_frame_number = USUB(ohci->frame_number, starting_frame); #ifdef DEBUG_ISOCH printf("--- ISO_TD ED head 0x%.8x tailp 0x%.8x\n" @@ -640,8 +640,8 @@ static int ohci_service_iso_td(OHCIState *ohci, struct ohci_ed *ed, iso_td.flags, iso_td.bp, iso_td.next, iso_td.be, iso_td.offset[0], iso_td.offset[1], iso_td.offset[2], iso_td.offset[3], iso_td.offset[4], iso_td.offset[5], iso_td.offset[6], iso_td.offset[7], - ohci->frame_number, starting_frame, - frame_count, relative_frame_number, + ohci->frame_number, starting_frame, + frame_count, relative_frame_number, OHCI_BM(iso_td.flags, TD_DI), OHCI_BM(iso_td.flags, TD_CC)); #endif @@ -651,7 +651,7 @@ static int ohci_service_iso_td(OHCIState *ohci, struct ohci_ed *ed, } else if (relative_frame_number > frame_count) { /* ISO TD expired - retire the TD to the Done Queue and continue with the next ISO TD of the same ED */ - dprintf("usb-ohci: ISO_TD R=%d > FC=%d\n", relative_frame_number, + dprintf("usb-ohci: ISO_TD R=%d > FC=%d\n", relative_frame_number, frame_count); OHCI_SET_BM(iso_td.flags, TD_CC, OHCI_CC_DATAOVERRUN); ed->head &= ~OHCI_DPTR_MASK; @@ -692,8 +692,8 @@ static int ohci_service_iso_td(OHCIState *ohci, struct ohci_ed *ed, start_offset = iso_td.offset[relative_frame_number]; next_offset = iso_td.offset[relative_frame_number + 1]; - if (!(OHCI_BM(start_offset, TD_PSW_CC) & 0xe) || - ((relative_frame_number < frame_count) && + if (!(OHCI_BM(start_offset, TD_PSW_CC) & 0xe) || + ((relative_frame_number < frame_count) && !(OHCI_BM(next_offset, TD_PSW_CC) & 0xe))) { printf("usb-ohci: ISO_TD cc != not accessed 0x%.8x 0x%.8x\n", start_offset, next_offset); @@ -758,7 +758,7 @@ static int ohci_service_iso_td(OHCIState *ohci, struct ohci_ed *ed, if (ret != USB_RET_NODEV) break; } - + if (ret == USB_RET_ASYNC) { return 1; } @@ -1095,7 +1095,7 @@ static int ohci_service_ed_list(OHCIState *ohci, uint32_t head, int completion) /* Generate a SOF event, and set a timer for EOF */ static void ohci_sof(OHCIState *ohci) { - ohci->sof_time = qemu_get_clock(vm_clock); + ohci->sof_time = qemu_get_clock_ns(vm_clock); qemu_mod_timer(ohci->eof_timer, ohci->sof_time + usb_frame_time); ohci_set_interrupt(ohci, OHCI_INTR_SF); } @@ -1179,12 +1179,12 @@ static void ohci_frame_boundary(void *opaque) */ static int ohci_bus_start(OHCIState *ohci) { - ohci->eof_timer = qemu_new_timer(vm_clock, + ohci->eof_timer = qemu_new_timer_ns(vm_clock, ohci_frame_boundary, ohci); if (ohci->eof_timer == NULL) { - fprintf(stderr, "usb-ohci: %s: qemu_new_timer failed\n", ohci->name); + fprintf(stderr, "usb-ohci: %s: qemu_new_timer_ns failed\n", ohci->name); /* TODO: Signal unrecoverable error */ return 0; } @@ -1304,7 +1304,7 @@ static uint32_t ohci_get_frame_remaining(OHCIState *ohci) /* Being in USB operational state guarnatees sof_time was * set already. */ - tks = qemu_get_clock(vm_clock) - ohci->sof_time; + tks = qemu_get_clock_ns(vm_clock) - ohci->sof_time; /* avoid muldiv if possible */ if (tks >= usb_frame_time) @@ -1120,8 +1120,7 @@ static void do_sendkey(Monitor *mon, const char *string, int has_hold_time, kbd_put_keycode(keycode & 0x7f); } /* delayed key up events */ - qemu_mod_timer(key_timer, qemu_get_clock(vm_clock) + - muldiv64(get_ticks_per_sec(), hold_time, 1000)); + qemu_mod_timer(key_timer, qemu_get_clock_ms(vm_clock) + hold_time); } static int mouse_button_state; @@ -3072,7 +3071,7 @@ void monitor_init(CharDriverState *chr, int flags) Monitor *mon; if (is_first_init) { - key_timer = qemu_new_timer(vm_clock, release_keys, NULL); + key_timer = qemu_new_timer_ms(vm_clock, release_keys, NULL); is_first_init = 0; } diff --git a/qemu-char-android.c b/qemu-char-android.c index 0ecf01c..a49affd 100644 --- a/qemu-char-android.c +++ b/qemu-char-android.c @@ -300,7 +300,7 @@ static int mux_chr_write(CharDriverState *chr, const uint8_t *buf, int len) int64_t ti; int secs; - ti = qemu_get_clock(rt_clock); + ti = qemu_get_clock_ms(rt_clock); if (d->timestamps_start == -1) d->timestamps_start = ti; ti -= d->timestamps_start; @@ -959,7 +959,7 @@ static void pty_chr_update_read_handler(CharDriverState *chr) * timeout to the normal (much longer) poll interval before the * timer triggers. */ - qemu_mod_timer(s->timer, qemu_get_clock(rt_clock) + 10); + qemu_mod_timer(s->timer, qemu_get_clock_ms(rt_clock) + 10); } static void pty_chr_state(CharDriverState *chr, int connected) @@ -973,7 +973,7 @@ static void pty_chr_state(CharDriverState *chr, int connected) /* (re-)connect poll interval for idle guests: once per second. * We check more frequently in case the guests sends data to * the virtual device linked to our pty. */ - qemu_mod_timer(s->timer, qemu_get_clock(rt_clock) + 1000); + qemu_mod_timer(s->timer, qemu_get_clock_ms(rt_clock) + 1000); } else { if (!s->connected) qemu_chr_generic_open(chr); @@ -1049,7 +1049,7 @@ static CharDriverState *qemu_chr_open_pty(void) chr->chr_update_read_handler = pty_chr_update_read_handler; chr->chr_close = pty_chr_close; - s->timer = qemu_new_timer(rt_clock, pty_chr_timer, chr); + s->timer = qemu_new_timer_ms(rt_clock, pty_chr_timer, chr); return chr; } diff --git a/qemu-char.c b/qemu-char.c index f1834a6..a087813 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -291,7 +291,7 @@ static int mux_chr_write(CharDriverState *chr, const uint8_t *buf, int len) int64_t ti; int secs; - ti = qemu_get_clock(rt_clock); + ti = qemu_get_clock_ms(rt_clock); if (d->timestamps_start == -1) d->timestamps_start = ti; ti -= d->timestamps_start; @@ -940,7 +940,7 @@ static void pty_chr_update_read_handler(CharDriverState *chr) * timeout to the normal (much longer) poll interval before the * timer triggers. */ - qemu_mod_timer(s->timer, qemu_get_clock(rt_clock) + 10); + qemu_mod_timer(s->timer, qemu_get_clock_ms(rt_clock) + 10); } static void pty_chr_state(CharDriverState *chr, int connected) @@ -954,7 +954,7 @@ static void pty_chr_state(CharDriverState *chr, int connected) /* (re-)connect poll interval for idle guests: once per second. * We check more frequently in case the guests sends data to * the virtual device linked to our pty. */ - qemu_mod_timer(s->timer, qemu_get_clock(rt_clock) + 1000); + qemu_mod_timer(s->timer, qemu_get_clock_ms(rt_clock) + 1000); } else { if (!s->connected) qemu_chr_generic_open(chr); @@ -1030,7 +1030,7 @@ static CharDriverState *qemu_chr_open_pty(QemuOpts *opts) chr->chr_update_read_handler = pty_chr_update_read_handler; chr->chr_close = pty_chr_close; - s->timer = qemu_new_timer(rt_clock, pty_chr_timer, chr); + s->timer = qemu_new_timer_ms(rt_clock, pty_chr_timer, chr); return chr; } diff --git a/qemu-timer.c b/qemu-timer.c index fce74e6..4e51dd3 100644 --- a/qemu-timer.c +++ b/qemu-timer.c @@ -525,7 +525,7 @@ void qemu_clock_warp(QEMUClock *clock) } } -QEMUTimer *qemu_new_timer_scale(QEMUClock *clock, int scale, +QEMUTimer *qemu_new_timer(QEMUClock *clock, int scale, QEMUTimerCB *cb, void *opaque) { QEMUTimer *ts; @@ -538,14 +538,6 @@ QEMUTimer *qemu_new_timer_scale(QEMUClock *clock, int scale, return ts; } -QEMUTimer *qemu_new_timer(QEMUClock *clock, QEMUTimerCB *cb, void *opaque) -{ - int scale = SCALE_NS; - if (clock == rt_clock) - scale = SCALE_MS; - return qemu_new_timer_scale(clock, scale, cb, opaque); -} - void qemu_free_timer(QEMUTimer *ts) { qemu_free(ts); diff --git a/qemu-timer.h b/qemu-timer.h index 143dcbc..c84673a 100644 --- a/qemu-timer.h +++ b/qemu-timer.h @@ -41,8 +41,7 @@ int64_t qemu_get_clock_ns(QEMUClock *clock); void qemu_clock_enable(QEMUClock *clock, int enabled); void qemu_clock_warp(QEMUClock *clock); -QEMUTimer *qemu_new_timer(QEMUClock *clock, QEMUTimerCB *cb, void *opaque); -QEMUTimer *qemu_new_timer_scale(QEMUClock *clock, int scale, +QEMUTimer *qemu_new_timer(QEMUClock *clock, int scale, QEMUTimerCB *cb, void *opaque); void qemu_free_timer(QEMUTimer *ts); @@ -70,13 +69,13 @@ void cpu_disable_ticks(void); static inline QEMUTimer *qemu_new_timer_ns(QEMUClock *clock, QEMUTimerCB *cb, void *opaque) { - return qemu_new_timer_scale(clock, SCALE_NS, cb, opaque); + return qemu_new_timer(clock, SCALE_NS, cb, opaque); } static inline QEMUTimer *qemu_new_timer_ms(QEMUClock *clock, QEMUTimerCB *cb, void *opaque) { - return qemu_new_timer_scale(clock, SCALE_MS, cb, opaque); + return qemu_new_timer(clock, SCALE_MS, cb, opaque); } static inline int64_t qemu_get_clock_ms(QEMUClock *clock) @@ -93,7 +93,7 @@ //#define ETH_P_EXPERIMENTAL 0x0012 /* make it the size of the packet */ #define EXPERIMENTAL_MAGIC 0xf1f23f4f -static int announce_self_create(uint8_t *buf, +static int announce_self_create(uint8_t *buf, uint8_t *mac_addr) { uint32_t magic = EXPERIMENTAL_MAGIC; @@ -129,7 +129,7 @@ static void qemu_announce_self_once(void *opaque) } } if (count--) { - qemu_mod_timer(timer, qemu_get_clock(rt_clock) + 100); + qemu_mod_timer(timer, qemu_get_clock_ms(rt_clock) + 100); } else { qemu_del_timer(timer); qemu_free_timer(timer); @@ -139,7 +139,7 @@ static void qemu_announce_self_once(void *opaque) void qemu_announce_self(void) { static QEMUTimer *timer; - timer = qemu_new_timer(rt_clock, qemu_announce_self_once, &timer); + timer = qemu_new_timer_ms(rt_clock, qemu_announce_self_once, &timer); qemu_announce_self_once(&timer); } @@ -1218,7 +1218,7 @@ void do_savevm_oc(OutputChannel *err, const char *name) sn->date_sec = tv.tv_sec; sn->date_nsec = tv.tv_usec * 1000; #endif - sn->vm_clock_nsec = qemu_get_clock(vm_clock); + sn->vm_clock_nsec = qemu_get_clock_ns(vm_clock); if (bdrv_get_info(bs, bdi) < 0 || bdi->vm_state_offset <= 0) { output_channel_printf(err, "Device %s does not support VM state snapshots\n", @@ -137,7 +137,7 @@ netshaper_expires( NetShaper shaper ) QueuedPacket packet; while ((packet = shaper->packets) != NULL) { - int64_t now = qemu_get_clock( SHAPER_CLOCK ); + int64_t now = qemu_get_clock_ms( SHAPER_CLOCK ); if (packet->expiration > now) break; @@ -167,9 +167,9 @@ netshaper_create( int do_copy, shaper->active = 0; shaper->packets = NULL; shaper->num_packets = 0; - shaper->timer = qemu_new_timer( SHAPER_CLOCK, - (QEMUTimerCB*) netshaper_expires, - shaper ); + shaper->timer = qemu_new_timer_ms( SHAPER_CLOCK, + (QEMUTimerCB*) netshaper_expires, + shaper ); shaper->send_func = send_func; shaper->max_rate = 1e6; shaper->inv_rate = 0.; @@ -216,7 +216,7 @@ netshaper_send_aux( NetShaper shaper, return; } - now = qemu_get_clock( SHAPER_CLOCK ); + now = qemu_get_clock_ms( SHAPER_CLOCK ); if (now >= shaper->block_until) { shaper->send_func( data, size, opaque ); shaper->block_until = now + size*shaper->inv_rate; @@ -274,7 +274,7 @@ netshaper_can_send( NetShaper shaper ) if (shaper->packets) return 0; - now = qemu_get_clock( SHAPER_CLOCK ); + now = qemu_get_clock_ms( SHAPER_CLOCK ); return (now >= shaper->block_until); } @@ -424,7 +424,7 @@ static void netdelay_expires( NetDelay delay ) { Session session; - int64_t now = qemu_get_clock( SHAPER_CLOCK ); + int64_t now = qemu_get_clock_ms( SHAPER_CLOCK ); int rearm = 0; int64_t rearm_time = 0; @@ -463,9 +463,9 @@ netdelay_create( NetShaperSendFunc send_func ) delay->sessions = NULL; delay->num_sessions = 0; - delay->timer = qemu_new_timer( SHAPER_CLOCK, - (QEMUTimerCB*) netdelay_expires, - delay ); + delay->timer = qemu_new_timer_ms( SHAPER_CLOCK, + (QEMUTimerCB*) netdelay_expires, + delay ); delay->active = 0; delay->min_ms = 0; delay->max_ms = 0; @@ -553,7 +553,7 @@ netdelay_send_aux( NetDelay delay, const void* data, size_t size, void* opaqu delay->sessions = session; delay->num_sessions += 1; - session->expiration = qemu_get_clock( SHAPER_CLOCK ) + latency; + session->expiration = qemu_get_clock_ms( SHAPER_CLOCK ) + latency; session->src_ip = info->src_ip; session->dst_ip = info->dst_ip; diff --git a/telephony/sysdeps_qemu.c b/telephony/sysdeps_qemu.c index e464597..6aa5038 100644 --- a/telephony/sysdeps_qemu.c +++ b/telephony/sysdeps_qemu.c @@ -41,7 +41,7 @@ SysTime sys_time_ms( void ) { - return qemu_get_clock( rt_clock ); + return qemu_get_clock_ms(rt_clock); } /** TIMERS @@ -126,7 +126,7 @@ sys_timer_set( SysTimer timer, SysTime when, SysCallback _callback, void* o qemu_free_timer( timer->timer ); } - timer->timer = qemu_new_timer( rt_clock, callback, opaque ); + timer->timer = qemu_new_timer_ms( rt_clock, callback, opaque ); timer->callback = callback; timer->opaque = opaque; @@ -320,7 +320,7 @@ sys_channel_create_tcp_server( int port ) channel->fd = socket_anyaddr_server( port, SOCKET_STREAM ); if (channel->fd < 0) { - D( "%s: failed to created network socket on TCP:%d\n", + D( "%s: failed to created network socket on TCP:%d\n", __FUNCTION__, port ); sys_channel_free( channel ); return NULL; diff --git a/usb-linux.c b/usb-linux.c index d8610e8..51aee0c 100644 --- a/usb-linux.c +++ b/usb-linux.c @@ -1374,7 +1374,7 @@ static int usb_host_auto_scan(void *opaque, int bus_num, int addr, static void usb_host_auto_timer(void *unused) { usb_host_scan(NULL, usb_host_auto_scan); - qemu_mod_timer(usb_auto_timer, qemu_get_clock(rt_clock) + 2000); + qemu_mod_timer(usb_auto_timer, qemu_get_clock_ms(rt_clock) + 2000); } /* @@ -1452,7 +1452,7 @@ static int usb_host_auto_add(const char *spec) * If this turns out to be too expensive we can move that into a * separate thread. */ - usb_auto_timer = qemu_new_timer(rt_clock, usb_host_auto_timer, NULL); + usb_auto_timer = qemu_new_timer_ms(rt_clock, usb_host_auto_timer, NULL); if (!usb_auto_timer) { fprintf(stderr, "husb: failed to allocate auto scan timer\n"); qemu_free(f); @@ -1460,7 +1460,7 @@ static int usb_host_auto_add(const char *spec) } /* Check for new devices every two seconds */ - qemu_mod_timer(usb_auto_timer, qemu_get_clock(rt_clock) + 2000); + qemu_mod_timer(usb_auto_timer, qemu_get_clock_ms(rt_clock) + 2000); } dprintf("husb: added auto filter: bus_num %d addr %d vid %d pid %d\n", diff --git a/vl-android.c b/vl-android.c index 9f7e65c..08515cb 100644 --- a/vl-android.c +++ b/vl-android.c @@ -2241,14 +2241,14 @@ static void gui_update(void *opaque) interval = dcl->gui_timer_interval; dcl = dcl->next; } - qemu_mod_timer(ds->gui_timer, interval + qemu_get_clock(rt_clock)); + qemu_mod_timer(ds->gui_timer, interval + qemu_get_clock_ms(rt_clock)); } static void nographic_update(void *opaque) { uint64_t interval = GUI_REFRESH_INTERVAL; - qemu_mod_timer(nographic_timer, interval + qemu_get_clock(rt_clock)); + qemu_mod_timer(nographic_timer, interval + qemu_get_clock_ms(rt_clock)); } struct vm_change_state_entry { @@ -5772,15 +5772,15 @@ int main(int argc, char **argv, char **envp) dcl = ds->listeners; while (dcl != NULL) { if (dcl->dpy_refresh != NULL) { - ds->gui_timer = qemu_new_timer(rt_clock, gui_update, ds); - qemu_mod_timer(ds->gui_timer, qemu_get_clock(rt_clock)); + ds->gui_timer = qemu_new_timer_ms(rt_clock, gui_update, ds); + qemu_mod_timer(ds->gui_timer, qemu_get_clock_ms(rt_clock)); } dcl = dcl->next; } if (display_type == DT_NOGRAPHIC || display_type == DT_VNC) { - nographic_timer = qemu_new_timer(rt_clock, nographic_update, NULL); - qemu_mod_timer(nographic_timer, qemu_get_clock(rt_clock)); + nographic_timer = qemu_new_timer_ms(rt_clock, nographic_update, NULL); + qemu_mod_timer(nographic_timer, qemu_get_clock_ms(rt_clock)); } text_consoles_set_display(ds); @@ -2080,14 +2080,14 @@ static void gui_update(void *opaque) interval = dcl->gui_timer_interval; dcl = dcl->next; } - qemu_mod_timer(ds->gui_timer, interval + qemu_get_clock(rt_clock)); + qemu_mod_timer(ds->gui_timer, interval + qemu_get_clock_ms(rt_clock)); } static void nographic_update(void *opaque) { uint64_t interval = GUI_REFRESH_INTERVAL; - qemu_mod_timer(nographic_timer, interval + qemu_get_clock(rt_clock)); + qemu_mod_timer(nographic_timer, interval + qemu_get_clock_ms(rt_clock)); } struct vm_change_state_entry { @@ -4650,15 +4650,15 @@ int main(int argc, char **argv, char **envp) dcl = ds->listeners; while (dcl != NULL) { if (dcl->dpy_refresh != NULL) { - ds->gui_timer = qemu_new_timer(rt_clock, gui_update, ds); - qemu_mod_timer(ds->gui_timer, qemu_get_clock(rt_clock)); + ds->gui_timer = qemu_new_timer_ms(rt_clock, gui_update, ds); + qemu_mod_timer(ds->gui_timer, qemu_get_clock_ms(rt_clock)); } dcl = dcl->next; } if (display_type == DT_NOGRAPHIC || display_type == DT_VNC) { - nographic_timer = qemu_new_timer(rt_clock, nographic_update, NULL); - qemu_mod_timer(nographic_timer, qemu_get_clock(rt_clock)); + nographic_timer = qemu_new_timer_ms(rt_clock, nographic_update, NULL); + qemu_mod_timer(nographic_timer, qemu_get_clock_ms(rt_clock)); } text_consoles_set_display(display_state); diff --git a/vnc-android.c b/vnc-android.c index af39dd2..9b259b2 100644 --- a/vnc-android.c +++ b/vnc-android.c @@ -722,7 +722,7 @@ static void vnc_update_client(void *opaque) if (vs->output.offset && !vs->audio_cap && !vs->force_update) { /* kernel send buffers are full -> drop frames to throttle */ - qemu_mod_timer(vs->timer, qemu_get_clock(rt_clock) + VNC_REFRESH_INTERVAL); + qemu_mod_timer(vs->timer, qemu_get_clock_ms(rt_clock) + VNC_REFRESH_INTERVAL); return; } @@ -763,7 +763,7 @@ static void vnc_update_client(void *opaque) } if (!has_dirty && !vs->audio_cap && !vs->force_update) { - qemu_mod_timer(vs->timer, qemu_get_clock(rt_clock) + VNC_REFRESH_INTERVAL); + qemu_mod_timer(vs->timer, qemu_get_clock_ms(rt_clock) + VNC_REFRESH_INTERVAL); return; } @@ -811,7 +811,7 @@ static void vnc_update_client(void *opaque) } if (vs->csock != -1) { - qemu_mod_timer(vs->timer, qemu_get_clock(rt_clock) + VNC_REFRESH_INTERVAL); + qemu_mod_timer(vs->timer, qemu_get_clock_ms(rt_clock) + VNC_REFRESH_INTERVAL); } else { vnc_disconnect_finish(vs); } @@ -2073,7 +2073,7 @@ static void vnc_connect(VncDisplay *vd, int csock) vs->vd = vd; vs->ds = vd->ds; - vs->timer = qemu_new_timer(rt_clock, vnc_update_client, vs); + vs->timer = qemu_new_timer_ms(rt_clock, vnc_update_client, vs); vs->last_x = -1; vs->last_y = -1; @@ -716,7 +716,7 @@ static void vnc_update_client(void *opaque) if (vs->output.offset && !vs->audio_cap && !vs->force_update) { /* kernel send buffers are full -> drop frames to throttle */ - qemu_mod_timer(vs->timer, qemu_get_clock(rt_clock) + VNC_REFRESH_INTERVAL); + qemu_mod_timer(vs->timer, qemu_get_clock_ms(rt_clock) + VNC_REFRESH_INTERVAL); return; } @@ -757,7 +757,7 @@ static void vnc_update_client(void *opaque) } if (!has_dirty && !vs->audio_cap && !vs->force_update) { - qemu_mod_timer(vs->timer, qemu_get_clock(rt_clock) + VNC_REFRESH_INTERVAL); + qemu_mod_timer(vs->timer, qemu_get_clock_ms(rt_clock) + VNC_REFRESH_INTERVAL); return; } @@ -805,7 +805,7 @@ static void vnc_update_client(void *opaque) } if (vs->csock != -1) { - qemu_mod_timer(vs->timer, qemu_get_clock(rt_clock) + VNC_REFRESH_INTERVAL); + qemu_mod_timer(vs->timer, qemu_get_clock_ms(rt_clock) + VNC_REFRESH_INTERVAL); } else { vnc_disconnect_finish(vs); } @@ -1585,7 +1585,7 @@ static void set_encodings(VncState *vs, int32_t *encodings, size_t n_encodings) static void set_pixel_conversion(VncState *vs) { if ((vs->clientds.flags & QEMU_BIG_ENDIAN_FLAG) == - (vs->ds->surface->flags & QEMU_BIG_ENDIAN_FLAG) && + (vs->ds->surface->flags & QEMU_BIG_ENDIAN_FLAG) && !memcmp(&(vs->clientds.pf), &(vs->ds->surface->pf), sizeof(PixelFormat))) { vs->write_pixels = vnc_write_pixels_copy; switch (vs->ds->surface->pf.bits_per_pixel) { @@ -1693,7 +1693,7 @@ static void vnc_colordepth(VncState *vs) vnc_write_u8(vs, 0); /* msg id */ vnc_write_u8(vs, 0); vnc_write_u16(vs, 1); /* number of rects */ - vnc_framebuffer_update(vs, 0, 0, ds_get_width(vs->ds), + vnc_framebuffer_update(vs, 0, 0, ds_get_width(vs->ds), ds_get_height(vs->ds), VNC_ENCODING_WMVi); pixel_format_message(vs); vnc_flush(vs); @@ -2067,7 +2067,7 @@ static void vnc_connect(VncDisplay *vd, int csock) vs->vd = vd; vs->ds = vd->ds; - vs->timer = qemu_new_timer(rt_clock, vnc_update_client, vs); + vs->timer = qemu_new_timer_ms(rt_clock, vnc_update_client, vs); vs->last_x = -1; vs->last_y = -1; @@ -2175,7 +2175,7 @@ int vnc_display_password(DisplayState *ds, const char *password) char *vnc_display_local_addr(DisplayState *ds) { VncDisplay *vs = ds ? (VncDisplay *)ds->opaque : vnc_display; - + return vnc_socket_local_addr("%s:%s", vs->lsock); } |