NV2A : Renamed all unique_lock's around cache_lock to cache_unique_lock, to avoid confusion between the two

This commit is contained in:
PatrickvL 2018-02-09 16:54:10 +01:00
parent dc12ee3119
commit 8d8c9db930
1 changed files with 17 additions and 15 deletions

View File

@ -38,7 +38,7 @@ DEVICE_READ32(PFIFO)
SET_MASK(result, NV_PFIFO_CACHE1_PUSH1_MODE, d->pfifo.cache1.mode); SET_MASK(result, NV_PFIFO_CACHE1_PUSH1_MODE, d->pfifo.cache1.mode);
break; break;
case NV_PFIFO_CACHE1_STATUS: { case NV_PFIFO_CACHE1_STATUS: {
std::unique_lock<std::mutex> cache_lock(d->pfifo.cache1.cache_lock); std::unique_lock<std::mutex> cache_unique_lock(d->pfifo.cache1.cache_lock); // UNTESTED
if (d->pfifo.cache1.cache.empty()) { if (d->pfifo.cache1.cache.empty()) {
result |= NV_PFIFO_CACHE1_STATUS_LOW_MARK; /* low mark empty */ result |= NV_PFIFO_CACHE1_STATUS_LOW_MARK; /* low mark empty */
@ -79,12 +79,12 @@ DEVICE_READ32(PFIFO)
| d->pfifo.cache1.subroutine_active; | d->pfifo.cache1.subroutine_active;
break; break;
case NV_PFIFO_CACHE1_PULL0: { case NV_PFIFO_CACHE1_PULL0: {
std::unique_lock<std::mutex> cache_lock(d->pfifo.cache1.cache_lock); std::unique_lock<std::mutex> cache_unique_lock(d->pfifo.cache1.cache_lock); // UNTESTED
result = d->pfifo.cache1.pull_enabled; result = d->pfifo.cache1.pull_enabled;
break; break;
} }
case NV_PFIFO_CACHE1_ENGINE: { case NV_PFIFO_CACHE1_ENGINE: {
std::unique_lock<std::mutex> cache_lock(d->pfifo.cache1.cache_lock); std::unique_lock<std::mutex> cache_unique_lock(d->pfifo.cache1.cache_lock); // UNTESTED
for (int i = 0; i < NV2A_NUM_SUBCHANNELS; i++) { for (int i = 0; i < NV2A_NUM_SUBCHANNELS; i++) {
result |= d->pfifo.cache1.bound_engines[i] << (i * 2); result |= d->pfifo.cache1.bound_engines[i] << (i * 2);
} }
@ -171,7 +171,7 @@ DEVICE_WRITE32(PFIFO)
(value & NV_PFIFO_CACHE1_DMA_SUBROUTINE_STATE); (value & NV_PFIFO_CACHE1_DMA_SUBROUTINE_STATE);
break; break;
case NV_PFIFO_CACHE1_PULL0: { case NV_PFIFO_CACHE1_PULL0: {
std::unique_lock<std::mutex> cache_lock(d->pfifo.cache1.cache_lock); std::unique_lock<std::mutex> cache_unique_lock(d->pfifo.cache1.cache_lock); // UNTESTED
if ((value & NV_PFIFO_CACHE1_PULL0_ACCESS) if ((value & NV_PFIFO_CACHE1_PULL0_ACCESS)
&& !d->pfifo.cache1.pull_enabled) { && !d->pfifo.cache1.pull_enabled) {
@ -188,7 +188,7 @@ DEVICE_WRITE32(PFIFO)
break; break;
} }
case NV_PFIFO_CACHE1_ENGINE: { case NV_PFIFO_CACHE1_ENGINE: {
std::unique_lock<std::mutex> cache_lock(d->pfifo.cache1.cache_lock); std::unique_lock<std::mutex> cache_unique_lock(d->pfifo.cache1.cache_lock); // UNTESTED
for (i = 0; i < NV2A_NUM_SUBCHANNELS; i++) { for (i = 0; i < NV2A_NUM_SUBCHANNELS; i++) {
d->pfifo.cache1.bound_engines[i] = (FIFOEngine)((value >> (i * 2)) & 3); d->pfifo.cache1.bound_engines[i] = (FIFOEngine)((value >> (i * 2)) & 3);
@ -276,9 +276,11 @@ static void pfifo_run_pusher(NV2AState *d) {
command->nonincreasing = state->method_nonincreasing; command->nonincreasing = state->method_nonincreasing;
command->parameter = word; command->parameter = word;
std::unique_lock<std::mutex> cache_lock(d->pfifo.cache1.cache_lock); {
std::unique_lock<std::mutex> cache_unique_lock(d->pfifo.cache1.cache_lock); // UNTESTED
state->cache.push(command); state->cache.push(command);
state->cache_cond.notify_all(); state->cache_cond.notify_all();
} // end of cache_unique_lock scope
if (!state->method_nonincreasing) { if (!state->method_nonincreasing) {
state->method += 4; state->method += 4;
@ -365,14 +367,14 @@ int pfifo_puller_thread(NV2AState *d)
glo_set_current(d->pgraph.gl_context); glo_set_current(d->pgraph.gl_context);
#endif #endif
std::unique_lock<std::mutex> cache_lock(d->pfifo.cache1.cache_lock, std::defer_lock); std::unique_lock<std::mutex> cache_unique_lock(d->pfifo.cache1.cache_lock, std::defer_lock);
while (true) { while (true) {
while (state->cache.empty() || !state->pull_enabled) { while (state->cache.empty() || !state->pull_enabled) {
state->cache_cond.wait(cache_lock); state->cache_cond.wait(cache_unique_lock); // UNTESTED
if (d->exiting) { if (d->exiting) {
cache_lock.unlock(); cache_unique_lock.unlock(); // UNTESTED
#ifdef COMPILE_OPENGL #ifdef COMPILE_OPENGL
glo_set_current(NULL); glo_set_current(NULL);
#endif #endif
@ -385,9 +387,9 @@ int pfifo_puller_thread(NV2AState *d)
state->working_cache.push(state->cache.front()); state->working_cache.push(state->cache.front());
state->cache.pop(); state->cache.pop();
} }
cache_lock.unlock(); cache_unique_lock.unlock(); // UNTESTED
d->pgraph.pgraph_lock.lock(); d->pgraph.pgraph_lock.lock(); // UNTESTED
while (!state->working_cache.empty()) { while (!state->working_cache.empty()) {
CacheEntry* command = state->working_cache.front(); CacheEntry* command = state->working_cache.front();
@ -413,10 +415,10 @@ int pfifo_puller_thread(NV2AState *d)
} }
/* the engine is bound to the subchannel */ /* the engine is bound to the subchannel */
cache_lock.lock(); cache_unique_lock.lock(); // UNTESTED
state->bound_engines[command->subchannel] = entry.engine; state->bound_engines[command->subchannel] = entry.engine;
state->last_engine = entry.engine; state->last_engine = entry.engine;
cache_lock.unlock(); cache_unique_lock.unlock(); // UNTESTED
} else if (command->method >= 0x100) { } else if (command->method >= 0x100) {
/* method passed to engine */ /* method passed to engine */