NV2A : Updates some code, from a comparison with XQemu
This commit is contained in:
parent
290f1f6036
commit
dffbb8bb43
|
@ -1,3 +1,4 @@
|
|||
/* PBUS - bus control */
|
||||
DEVICE_READ32(PBUS)
|
||||
{
|
||||
DEVICE_READ32_SWITCH() {
|
||||
|
|
|
@ -36,6 +36,10 @@ DEVICE_WRITE32(PCRTC)
|
|||
value &= 0x07FFFFFF;
|
||||
// assert(val < memory_region_size(d->vram));
|
||||
d->pcrtc.start = value;
|
||||
|
||||
NV2A_DPRINTF("PCRTC_START - %x %x %x %x\n",
|
||||
d->vram_ptr[value+64], d->vram_ptr[value+64+1],
|
||||
d->vram_ptr[value+64+2], d->vram_ptr[value+64+3]);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -11,6 +11,7 @@ int pfifo_puller_thread(NV2AState *d);
|
|||
static uint32_t ramht_hash(NV2AState *d, uint32_t handle);
|
||||
static RAMHTEntry ramht_lookup(NV2AState *d, uint32_t handle); // forward declaration
|
||||
|
||||
/* PFIFO - MMIO and DMA FIFO submission to PGRAPH and VPE */
|
||||
DEVICE_READ32(PFIFO)
|
||||
{
|
||||
DEVICE_READ32_SWITCH() {
|
||||
|
@ -277,7 +278,6 @@ static void pfifo_run_pusher(NV2AState *d) {
|
|||
if (!state->method_nonincreasing) {
|
||||
state->method += 4;
|
||||
}
|
||||
|
||||
state->method_count--;
|
||||
state->dcount++;
|
||||
} else {
|
||||
|
@ -320,8 +320,7 @@ static void pfifo_run_pusher(NV2AState *d) {
|
|||
state->method_count = (word >> 18) & 0x7ff;
|
||||
state->method_nonincreasing = false;
|
||||
state->dcount = 0;
|
||||
}
|
||||
else if ((word & 0xe0030003) == 0x40000000) {
|
||||
} else if ((word & 0xe0030003) == 0x40000000) {
|
||||
/* non-increasing methods */
|
||||
state->method = word & 0x1fff;
|
||||
state->subchannel = (word >> 13) & 7;
|
||||
|
@ -361,9 +360,14 @@ int pfifo_puller_thread(NV2AState *d)
|
|||
|
||||
while (true) {
|
||||
state->cache_lock.lock();
|
||||
|
||||
while (state->cache.empty() || !state->pull_enabled) {
|
||||
state->cache_cond.wait(state->cache_lock);
|
||||
|
||||
if (d->exiting) {
|
||||
state->cache_lock.unlock();
|
||||
// glo_set_current(NULL);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Copy cache to working_cache
|
||||
|
|
|
@ -2581,12 +2581,12 @@ static void pgraph_context_switch(NV2AState *d, unsigned int channel_id)
|
|||
{
|
||||
bool valid;
|
||||
|
||||
d->pgraph.lock.lock(); // TODO : This isn't in xqemu / OpenXbox?
|
||||
// Cxbx Note : This isn't present in xqemu / OpenXbox : d->pgraph.lock.lock();
|
||||
valid = d->pgraph.channel_valid && d->pgraph.channel_id == channel_id;
|
||||
if (!valid) {
|
||||
d->pgraph.trapped_channel_id = channel_id;
|
||||
}
|
||||
d->pgraph.lock.unlock(); // TODO : This isn't in xqemu / OpenXbox?
|
||||
// Cxbx Note : This isn't present in xqemu / OpenXbox : d->pgraph.lock.unlock();
|
||||
|
||||
if (!valid) {
|
||||
NV2A_DPRINTF("puller needs to switch to ch %d\n", channel_id);
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/* PMC - card master control */
|
||||
DEVICE_READ32(PMC)
|
||||
{
|
||||
DEVICE_READ32_SWITCH() {
|
||||
|
|
|
@ -17,13 +17,15 @@ static inline uint64_t muldiv64(uint64_t a, uint32_t b, uint32_t c)
|
|||
return res.ll;
|
||||
}
|
||||
|
||||
/* PIMTER - time measurement and time-based alarms */
|
||||
static uint32_t ptimer_get_clock(NV2AState * d)
|
||||
/* PTIMER - time measurement and time-based alarms */
|
||||
static uint64_t ptimer_get_clock(NV2AState * d)
|
||||
{
|
||||
// Get time in nanoseconds
|
||||
long int time = static_cast<long int>(std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::high_resolution_clock::now().time_since_epoch()).count());
|
||||
|
||||
return muldiv64(time, d->pramdac.core_clock_freq * d->ptimer.numerator, CLOCKS_PER_SEC * d->ptimer.denominator);
|
||||
return muldiv64(time,
|
||||
d->pramdac.core_clock_freq * d->ptimer.numerator,
|
||||
CLOCKS_PER_SEC * d->ptimer.denominator);
|
||||
}
|
||||
|
||||
DEVICE_READ32(PTIMER)
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/* USER - PFIFO MMIO and DMA submission area */
|
||||
DEVICE_READ32(USER)
|
||||
{
|
||||
unsigned int channel_id = addr >> 16;
|
||||
|
|
|
@ -181,14 +181,14 @@ static void *nv_dma_map(NV2AState *d, xbaddr dma_obj_address, xbaddr *len)
|
|||
DMAObject dma = nv_dma_load(d, dma_obj_address);
|
||||
|
||||
/* TODO: Handle targets and classes properly */
|
||||
printf("dma_map %x, %x, %x %x\n",
|
||||
NV2A_DPRINTF("dma_map %x, %x, %x %x\n",
|
||||
dma.dma_class, dma.dma_target, dma.address, dma.limit);
|
||||
|
||||
dma.address &= 0x07FFFFFF;
|
||||
|
||||
// assert(dma.address + dma.limit < memory_region_size(d->vram));
|
||||
*len = dma.limit;
|
||||
return (void*)(MM_SYSTEM_PHYSICAL_MAP + dma.address);
|
||||
return d->vram_ptr + dma.address;
|
||||
}
|
||||
|
||||
#include "EmuNV2A_PBUS.cpp"
|
||||
|
|
Loading…
Reference in New Issue