NV2A : Prevented incorrectly logged "Unknown Graphics Class/Method" messages.

Also some slight optimizations (and one additional, ignored PGRAPH command : SET_FLAT_SHADE_OP)
This commit is contained in:
PatrickvL 2018-02-20 10:44:47 +01:00
parent c0ca099afb
commit 11bcf70d70
3 changed files with 25 additions and 16 deletions

View File

@ -423,7 +423,8 @@ int pfifo_puller_thread(NV2AState *d)
state->bound_engines[command->subchannel] = entry.engine;
state->last_engine = entry.engine;
cache_unique_lock.unlock();
} else if (command->method >= 0x100) {
}
else if (command->method >= 0x100) {
/* method passed to engine */
uint32_t parameter = command->parameter;
@ -458,6 +459,9 @@ int pfifo_puller_thread(NV2AState *d)
state->last_engine = state->bound_engines[command->subchannel];
// state->cache_lock.unlock();
}
else
NV2A_DPRINTF("FIFO: Unknown Method - 0x%08X\n",
command->method);
g_free(command);
}
@ -468,13 +472,16 @@ int pfifo_puller_thread(NV2AState *d)
return 0;
}
unsigned int ramht_size(NV2AState *d)
{
return
1 << (GET_MASK(d->pfifo.regs[NV_PFIFO_RAMHT], NV_PFIFO_RAMHT_SIZE_MASK) + 12);
}
static uint32_t ramht_hash(NV2AState *d, uint32_t handle)
{
unsigned int ramht_size =
1 << (GET_MASK(d->pfifo.regs[NV_PFIFO_RAMHT], NV_PFIFO_RAMHT_SIZE_MASK) + 12);
/* XXX: Think this is different to what nouveau calculates... */
unsigned int bits = ffs(ramht_size) - 2;
unsigned int bits = ffs(ramht_size(d)) - 2;
uint32_t hash = 0;
while (handle) {
@ -488,11 +495,8 @@ static uint32_t ramht_hash(NV2AState *d, uint32_t handle)
static RAMHTEntry ramht_lookup(NV2AState *d, uint32_t handle)
{
unsigned int ramht_size =
1 << (GET_MASK(d->pfifo.regs[NV_PFIFO_RAMHT], NV_PFIFO_RAMHT_SIZE_MASK) + 12);
uint32_t hash = ramht_hash(d, handle);
assert(hash * 8 < ramht_size);
assert(hash * 8 < ramht_size(d));
uint32_t ramht_address =
GET_MASK(d->pfifo.regs[NV_PFIFO_RAMHT],

View File

@ -578,7 +578,7 @@ static void pgraph_method(NV2AState *d,
context_surfaces_2d->dest_offset = parameter & 0x07FFFFFF;
break;
default:
EmuWarning("EmuNV2A: Unknown NV_CONTEXT_SURFACES_2D Method: 0x%08X\n", method);
EmuWarning("NV2A: Unknown NV_CONTEXT_SURFACES_2D Method: 0x%08X\n", method);
}
break;
@ -671,7 +671,7 @@ static void pgraph_method(NV2AState *d,
break;
default:
EmuWarning("EmuNV2A: Unknown NV_IMAGE_BLIT Method: 0x%08X\n", method);
EmuWarning("NV2A: Unknown NV_IMAGE_BLIT Method: 0x%08X\n", method);
}
break;
}
@ -2555,15 +2555,20 @@ static void pgraph_method(NV2AState *d,
NV2A_DPRINTF("load to %d\n", parameter);
break;
case NV097_SET_FLAT_SHADE_OP:
assert(parameter <= 1);
// TODO : value & 1 = first/last? vertex selection for glShaderMode(GL_FLAT)
break;
default:
NV2A_GL_DPRINTF(true, " unhandled (0x%02x 0x%08x)",
object->graphics_class, method);
break;
}
break;
}
default:
NV2A_GL_DPRINTF(true, "EmuNV2A: Unknown Graphics Class/Method 0x%08X/0x%08X\n",
NV2A_GL_DPRINTF(true, "Unknown Graphics Class/Method 0x%08X/0x%08X\n",
object->graphics_class, method);
break;
}

View File

@ -100,10 +100,10 @@ ArraySizeHelper<N> makeArraySizeHelper(T(&)[N]);
// Public Domain ffs Implementation
// See: http://snipplr.com/view/22147/stringsh-implementation/
NV2A_CONSTEXPR int ffs(int v)
NV2A_CONSTEXPR unsigned int ffs(const unsigned int v)
{
unsigned int x = v;
int c = 1;
unsigned int c = 1;
/*
* adapted from from
@ -143,11 +143,11 @@ NV2A_CONSTEXPR int ffs(int v)
return c;
}
inline int GET_MASK(int v, int mask) {
inline int GET_MASK(const unsigned int v, const unsigned int mask) {
return (((v) & (mask)) >> (ffs(mask) - 1));
};
inline int SET_MASK(int v, int mask, int val) {
inline int SET_MASK(unsigned int v, const unsigned int mask, const unsigned int val) {
const unsigned int __val = (val);
const unsigned int __mask = (mask);