mirror of https://github.com/xemu-project/xemu.git
nv2a: Check for PGRAPH FIFO access before context switch
This commit is contained in:
parent
ec4e798426
commit
f2869790d9
|
@ -173,6 +173,13 @@ static void pfifo_run_puller(NV2AState *d)
|
||||||
qemu_mutex_lock(&d->pgraph.lock);
|
qemu_mutex_lock(&d->pgraph.lock);
|
||||||
//make pgraph busy
|
//make pgraph busy
|
||||||
|
|
||||||
|
if (!pgraph_can_fifo_access(d)) {
|
||||||
|
qemu_mutex_unlock(&d->pgraph.lock);
|
||||||
|
qemu_mutex_lock(&d->pfifo.lock);
|
||||||
|
// Wait for event
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Switch contexts if necessary
|
// Switch contexts if necessary
|
||||||
pgraph_context_switch(d, entry.channel_id);
|
pgraph_context_switch(d, entry.channel_id);
|
||||||
if (d->pgraph.waiting_for_context_switch) {
|
if (d->pgraph.waiting_for_context_switch) {
|
||||||
|
@ -181,15 +188,6 @@ static void pfifo_run_puller(NV2AState *d)
|
||||||
// Wait for event
|
// Wait for event
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
pgraph_wait_fifo_access(d);
|
|
||||||
if (!pgraph_is_wait_for_access_complete(d)) {
|
|
||||||
qemu_mutex_unlock(&d->pgraph.lock);
|
|
||||||
qemu_mutex_lock(&d->pfifo.lock);
|
|
||||||
// Wait for event
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
d->pgraph.waiting_for_fifo_access = false;
|
|
||||||
pgraph_method(d, subchannel, 0, entry.instance);
|
pgraph_method(d, subchannel, 0, entry.instance);
|
||||||
|
|
||||||
// make pgraph not busy
|
// make pgraph not busy
|
||||||
|
@ -220,8 +218,7 @@ static void pfifo_run_puller(NV2AState *d)
|
||||||
qemu_mutex_lock(&d->pgraph.lock);
|
qemu_mutex_lock(&d->pgraph.lock);
|
||||||
//make pgraph busy
|
//make pgraph busy
|
||||||
|
|
||||||
pgraph_wait_fifo_access(d);
|
if (!pgraph_can_fifo_access(d)) {
|
||||||
if (!pgraph_is_wait_for_access_complete(d)) {
|
|
||||||
qemu_mutex_unlock(&d->pgraph.lock);
|
qemu_mutex_unlock(&d->pgraph.lock);
|
||||||
qemu_mutex_lock(&d->pfifo.lock);
|
qemu_mutex_lock(&d->pfifo.lock);
|
||||||
// Wait for event
|
// Wait for event
|
||||||
|
|
|
@ -2617,12 +2617,7 @@ static void pgraph_context_switch(NV2AState *d, unsigned int channel_id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pgraph_wait_fifo_access(NV2AState *d)
|
static int pgraph_can_fifo_access(NV2AState *d) {
|
||||||
{
|
|
||||||
d->pgraph.waiting_for_fifo_access = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int pgraph_is_wait_for_access_complete(NV2AState *d) {
|
|
||||||
return !!(d->pgraph.regs[NV_PGRAPH_FIFO] & NV_PGRAPH_FIFO_ACCESS);
|
return !!(d->pgraph.regs[NV_PGRAPH_FIFO] & NV_PGRAPH_FIFO_ACCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue