mirror of https://github.com/mgba-emu/mgba.git
Qt: Fix running proxied video if it gets pushed to the main thread
This commit is contained in:
parent
a2dc6557e3
commit
e7028e4b29
1
CHANGES
1
CHANGES
|
@ -54,6 +54,7 @@ Other fixes:
|
||||||
- Qt: Fix static compilation in MinGW (fixes mgba.io/i/1769)
|
- Qt: Fix static compilation in MinGW (fixes mgba.io/i/1769)
|
||||||
- Qt: Fix a race condition in the frame inspector
|
- Qt: Fix a race condition in the frame inspector
|
||||||
- Qt: Load/save bytes from memory viewer in the order visible (fixes mgba.io/i/1900)
|
- Qt: Load/save bytes from memory viewer in the order visible (fixes mgba.io/i/1900)
|
||||||
|
- Qt: Fix running proxied video if it gets pushed to the main thread
|
||||||
- SM83: Simplify register pair access on big endian
|
- SM83: Simplify register pair access on big endian
|
||||||
- SM83: Disassemble STOP as one byte
|
- SM83: Disassemble STOP as one byte
|
||||||
Misc:
|
Misc:
|
||||||
|
|
|
@ -58,12 +58,17 @@ void VideoProxy::deinit() {
|
||||||
|
|
||||||
bool VideoProxy::writeData(const void* data, size_t length) {
|
bool VideoProxy::writeData(const void* data, size_t length) {
|
||||||
while (!RingFIFOWrite(&m_dirtyQueue, data, length)) {
|
while (!RingFIFOWrite(&m_dirtyQueue, data, length)) {
|
||||||
|
if (QThread::currentThread() == thread()) {
|
||||||
|
// We're on the main thread
|
||||||
|
mVideoLoggerRendererRun(&m_logger.d, false);
|
||||||
|
} else {
|
||||||
emit dataAvailable();
|
emit dataAvailable();
|
||||||
m_mutex.lock();
|
m_mutex.lock();
|
||||||
m_toThreadCond.wakeAll();
|
m_toThreadCond.wakeAll();
|
||||||
m_fromThreadCond.wait(&m_mutex);
|
m_fromThreadCond.wait(&m_mutex);
|
||||||
m_mutex.unlock();
|
m_mutex.unlock();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,10 +117,15 @@ void VideoProxy::unlock() {
|
||||||
void VideoProxy::wait() {
|
void VideoProxy::wait() {
|
||||||
m_mutex.lock();
|
m_mutex.lock();
|
||||||
while (RingFIFOSize(&m_dirtyQueue)) {
|
while (RingFIFOSize(&m_dirtyQueue)) {
|
||||||
|
if (QThread::currentThread() == thread()) {
|
||||||
|
// We're on the main thread
|
||||||
|
mVideoLoggerRendererRun(&m_logger.d, false);
|
||||||
|
} else {
|
||||||
emit dataAvailable();
|
emit dataAvailable();
|
||||||
m_toThreadCond.wakeAll();
|
m_toThreadCond.wakeAll();
|
||||||
m_fromThreadCond.wait(&m_mutex, 1);
|
m_fromThreadCond.wait(&m_mutex, 1);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
m_mutex.unlock();
|
m_mutex.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue