nv2a: Use new 'q' prefix for atomics

This commit is contained in:
Matt Borgerson 2021-04-18 22:16:10 -07:00
parent b97b053282
commit dc8eab47f6
2 changed files with 16 additions and 16 deletions

View File

@ -96,7 +96,7 @@ void pfifo_kick(NV2AState *d)
}
static bool pgraph_can_fifo_access(NV2AState *d) {
return atomic_read(&d->pgraph.regs[NV_PGRAPH_FIFO]) & NV_PGRAPH_FIFO_ACCESS;
return qatomic_read(&d->pgraph.regs[NV_PGRAPH_FIFO]) & NV_PGRAPH_FIFO_ACCESS;
}
/* If NV097_FLIP_STALL was executed, check if the flip has completed.
@ -124,7 +124,7 @@ static bool pfifo_stall_for_flip(NV2AState *d)
{
bool should_stall = false;
if (atomic_read(&d->pgraph.waiting_for_flip)) {
if (qatomic_read(&d->pgraph.waiting_for_flip)) {
qemu_mutex_lock(&d->pgraph.lock);
if (!pgraph_is_flip_stall_complete(d)) {
should_stall = true;
@ -139,8 +139,8 @@ static bool pfifo_stall_for_flip(NV2AState *d)
static bool pfifo_puller_should_stall(NV2AState *d)
{
return pfifo_stall_for_flip(d) || atomic_read(&d->pgraph.waiting_for_nop) ||
atomic_read(&d->pgraph.waiting_for_context_switch) ||
return pfifo_stall_for_flip(d) || qatomic_read(&d->pgraph.waiting_for_nop) ||
qatomic_read(&d->pgraph.waiting_for_context_switch) ||
!pgraph_can_fifo_access(d);
}
@ -242,7 +242,7 @@ static ssize_t pfifo_run_puller(NV2AState *d, uint32_t method_entry,
static bool pfifo_pusher_should_stall(NV2AState *d)
{
return !pgraph_can_fifo_access(d) ||
atomic_read(&d->pgraph.waiting_for_nop);
qatomic_read(&d->pgraph.waiting_for_nop);
}
static void pfifo_run_pusher(NV2AState *d)
@ -457,14 +457,14 @@ void *pfifo_thread(void *arg)
while (true) {
d->pfifo.fifo_kick = false;
if (atomic_read(&d->pgraph.downloads_pending)) {
if (qatomic_read(&d->pgraph.downloads_pending)) {
pgraph_process_pending_downloads(d);
atomic_set(&d->pgraph.downloads_pending, false);
qatomic_set(&d->pgraph.downloads_pending, false);
}
if (atomic_read(&d->pgraph.gl_sync_pending)) {
if (qatomic_read(&d->pgraph.gl_sync_pending)) {
pgraph_gl_sync(d);
atomic_set(&d->pgraph.gl_sync_pending, false);
qatomic_set(&d->pgraph.gl_sync_pending, false);
}
pfifo_run_pusher(d);

View File

@ -4419,7 +4419,7 @@ int nv2a_get_framebuffer_surface(void)
surface->frame_time = pg->frame_time;
qemu_event_reset(&d->pgraph.gl_sync_complete);
atomic_set(&pg->gl_sync_pending, true);
qatomic_set(&pg->gl_sync_pending, true);
pfifo_kick(d);
qemu_mutex_unlock(&d->pfifo.lock);
qemu_event_wait(&d->pgraph.gl_sync_complete);
@ -4494,11 +4494,11 @@ static void pgraph_wait_for_surface_download(SurfaceBinding *e)
{
NV2AState *d = g_nv2a;
if (atomic_read(&e->draw_dirty)) {
if (qatomic_read(&e->draw_dirty)) {
qemu_mutex_lock(&d->pfifo.lock);
qemu_event_reset(&d->pgraph.downloads_complete);
atomic_set(&e->download_pending, true);
atomic_set(&d->pgraph.downloads_pending, true);
qatomic_set(&e->download_pending, true);
qatomic_set(&d->pgraph.downloads_pending, true);
pfifo_kick(d);
qemu_mutex_unlock(&d->pfifo.lock);
qemu_event_wait(&d->pgraph.downloads_complete);
@ -4517,18 +4517,18 @@ static void pgraph_surface_access_callback(
hwaddr offset = addr - e->vram_addr;
assert(offset < e->size);
if (atomic_read(&e->draw_dirty)) {
if (qatomic_read(&e->draw_dirty)) {
NV2A_XPRINTF(DBG_SURFACE_SYNC,
"Surface accessed at %" HWADDR_PRIx "+%" HWADDR_PRIx "\n",
e->vram_addr, offset);
pgraph_wait_for_surface_download(e);
}
if (write && !atomic_read(&e->upload_pending)) {
if (write && !qatomic_read(&e->upload_pending)) {
NV2A_XPRINTF(DBG_SURFACE_SYNC,
"Surface write at %" HWADDR_PRIx "+%" HWADDR_PRIx "\n",
e->vram_addr, offset);
atomic_set(&e->upload_pending, true);
qatomic_set(&e->upload_pending, true);
}
}