Changeset a9861f3 in buchla-emu for emu


Ignore:
Timestamp:
08/20/2017 08:09:56 PM (7 years ago)
Author:
Thomas Lopatic <thomas@…>
Branches:
master
Children:
657abdf
Parents:
b48c8a5
Message:

Don't double-lock the CPU mutex.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • emu/vid.c

    rb48c8a5 ra9861f3  
    250250        int32_t odtba = mem[REG_ODTBA] & 0xffc0;
    251251
    252         if (SDL_LockMutex(cpu_mutex) < 0) {
    253                 fail("SDL_LockMutex() failed: %s", SDL_GetError());
    254         }
    255 
    256252        n_bm_objs = 0;
    257253
     
    320316        }
    321317
    322         if (SDL_UnlockMutex(cpu_mutex) < 0) {
    323                 fail("SDL_UnlockMutex() failed: %s", SDL_GetError());
    324         }
    325 
    326318        SDL_AtomicAdd(&frame, 1);
    327319        return false;
     
    338330        }
    339331
    340         uint32_t res;
    341 
    342         if (SDL_LockMutex(cpu_mutex) < 0) {
    343                 fail("SDL_LockMutex() failed: %s", SDL_GetError());
    344         }
    345 
    346332        if (off16 >= reg_off && off16 < reg_off + 16) {
    347                 res = mem[off16 - reg_off];
    348         }
    349         else {
    350                 res = mem[bank * WIN_SZ_W + off16];
    351         }
    352 
    353         if (SDL_UnlockMutex(cpu_mutex) < 0) {
    354                 fail("SDL_UnlockMutex() failed: %s", SDL_GetError());
    355         }
    356 
    357         return res;
     333                return mem[off16 - reg_off];
     334        }
     335
     336        return mem[bank * WIN_SZ_W + off16];
    358337}
    359338
     
    366345        if (sz != 2 || bank >= N_BANKS || off % 2 != 0 || (off16 >= WIN_SZ_W && off16 != PAL_OFF)) {
    367346                fail("invalid vid wr %d %u:%d", bank, off, sz * 8);
    368         }
    369 
    370         if (SDL_LockMutex(cpu_mutex) < 0) {
    371                 fail("SDL_LockMutex() failed: %s", SDL_GetError());
    372347        }
    373348
     
    384359
    385360                pal[i_pal] = (r << 24) | (g << 16) | (b << 8) | 0xff;
    386         }
    387         else if (off16 >= reg_off && off16 < reg_off + 16) {
     361                return;
     362        }
     363
     364        if (off16 >= reg_off && off16 < reg_off + 16) {
    388365                mem[off16 - reg_off] = (uint16_t)val;
    389         }
    390         else {
    391                 mem[bank * WIN_SZ_W + off16] = (uint16_t)val;
    392         }
    393 
    394         if (SDL_UnlockMutex(cpu_mutex) < 0) {
    395                 fail("SDL_UnlockMutex() failed: %s", SDL_GetError());
    396         }
    397 }
     366                return;
     367        }
     368
     369        mem[bank * WIN_SZ_W + off16] = (uint16_t)val;
     370}
Note: See TracChangeset for help on using the changeset viewer.