mirror of
https://github.com/Motorhead1991/qemu.git
synced 2026-02-11 19:39:26 -07:00
hw/display/apple-gfx: Replace QemuSemaphore with QemuEvent
sem in AppleGFXReadMemoryJob is an one-shot event so it can be converted into QemuEvent, which is more specialized for such a use case. Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Link: https://lore.kernel.org/r/20250529-event-v5-10-53b285203794@daynix.com Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
d401b7aed8
commit
23aec0d0e8
1 changed files with 5 additions and 5 deletions
|
|
@ -454,7 +454,7 @@ static void set_cursor_glyph(void *opaque)
|
|||
/* ------ DMA (device reading system memory) ------ */
|
||||
|
||||
typedef struct AppleGFXReadMemoryJob {
|
||||
QemuSemaphore sem;
|
||||
QemuEvent event;
|
||||
hwaddr physical_address;
|
||||
uint64_t length;
|
||||
void *dst;
|
||||
|
|
@ -470,7 +470,7 @@ static void apple_gfx_do_read_memory(void *opaque)
|
|||
job->dst, job->length, MEMTXATTRS_UNSPECIFIED);
|
||||
job->success = (r == MEMTX_OK);
|
||||
|
||||
qemu_sem_post(&job->sem);
|
||||
qemu_event_set(&job->event);
|
||||
}
|
||||
|
||||
static bool apple_gfx_read_memory(AppleGFXState *s, hwaddr physical_address,
|
||||
|
|
@ -483,11 +483,11 @@ static bool apple_gfx_read_memory(AppleGFXState *s, hwaddr physical_address,
|
|||
trace_apple_gfx_read_memory(physical_address, length, dst);
|
||||
|
||||
/* Performing DMA requires BQL, so do it in a BH. */
|
||||
qemu_sem_init(&job.sem, 0);
|
||||
qemu_event_init(&job.event, 0);
|
||||
aio_bh_schedule_oneshot(qemu_get_aio_context(),
|
||||
apple_gfx_do_read_memory, &job);
|
||||
qemu_sem_wait(&job.sem);
|
||||
qemu_sem_destroy(&job.sem);
|
||||
qemu_event_wait(&job.event);
|
||||
qemu_event_destroy(&job.event);
|
||||
return job.success;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue