mirror of https://github.com/mgba-emu/mgba.git
Qt: Pass logging context through to video proxy thread (fixes #3095)
This commit is contained in:
parent
4590dfc68b
commit
7727b6434d
1
CHANGES
1
CHANGES
|
@ -28,6 +28,7 @@ Misc:
|
||||||
- mGUI: Persist fast forwarding after closing menu (fixes mgba.io/i/2414)
|
- mGUI: Persist fast forwarding after closing menu (fixes mgba.io/i/2414)
|
||||||
- Qt: Handle multiple save game files for disparate games separately (fixes mgba.io/i/2887)
|
- Qt: Handle multiple save game files for disparate games separately (fixes mgba.io/i/2887)
|
||||||
- Qt: Remove maligned double-click-to-fullscreen shortcut (closes mgba.io/i/2632)
|
- Qt: Remove maligned double-click-to-fullscreen shortcut (closes mgba.io/i/2632)
|
||||||
|
- Qt: Pass logging context through to video proxy thread (fixes mgba.io/i/3095)
|
||||||
- Scripting: Add `callbacks:oneshot` for single-call callbacks
|
- Scripting: Add `callbacks:oneshot` for single-call callbacks
|
||||||
- Switch: Add bilinear filtering option (closes mgba.io/i/3111)
|
- Switch: Add bilinear filtering option (closes mgba.io/i/3111)
|
||||||
- Vita: Add imc0 and xmc0 mount point support
|
- Vita: Add imc0 and xmc0 mount point support
|
||||||
|
|
|
@ -48,12 +48,14 @@ VideoProxy::~VideoProxy() {
|
||||||
|
|
||||||
void VideoProxy::attach(CoreController* controller) {
|
void VideoProxy::attach(CoreController* controller) {
|
||||||
CoreController::Interrupter interrupter(controller);
|
CoreController::Interrupter interrupter(controller);
|
||||||
|
m_logContext = &controller->thread()->logger.d;
|
||||||
controller->thread()->core->videoLogger = &m_logger;
|
controller->thread()->core->videoLogger = &m_logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoProxy::detach(CoreController* controller) {
|
void VideoProxy::detach(CoreController* controller) {
|
||||||
CoreController::Interrupter interrupter(controller);
|
CoreController::Interrupter interrupter(controller);
|
||||||
if (controller->thread()->core->videoLogger == &m_logger) {
|
if (controller->thread()->core->videoLogger == &m_logger) {
|
||||||
|
m_logContext = nullptr;
|
||||||
controller->thread()->core->videoLogger = nullptr;
|
controller->thread()->core->videoLogger = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -64,11 +66,13 @@ void VideoProxy::setProxiedBackend(VideoBackend* backend) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoProxy::processData() {
|
void VideoProxy::processData() {
|
||||||
|
mLogSetThreadLogger(m_logContext);
|
||||||
mVideoLoggerRendererRun(&m_logger, false);
|
mVideoLoggerRendererRun(&m_logger, false);
|
||||||
m_fromThreadCond.wakeAll();
|
m_fromThreadCond.wakeAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoProxy::processCommands() {
|
void VideoProxy::processCommands() {
|
||||||
|
mLogSetThreadLogger(m_logContext);
|
||||||
mVideoProxyBackendRun(&m_backend, false);
|
mVideoProxyBackendRun(&m_backend, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,6 +92,7 @@ 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()) {
|
if (QThread::currentThread() == thread()) {
|
||||||
// We're on the main thread
|
// We're on the main thread
|
||||||
|
mLogSetThreadLogger(m_logContext);
|
||||||
mVideoLoggerRendererRun(&m_logger, false);
|
mVideoLoggerRendererRun(&m_logger, false);
|
||||||
} else {
|
} else {
|
||||||
emit dataAvailable();
|
emit dataAvailable();
|
||||||
|
@ -124,6 +129,7 @@ void VideoProxy::postEvent(enum mVideoLoggerEvent event) {
|
||||||
|
|
||||||
void VideoProxy::handleEvent(int event) {
|
void VideoProxy::handleEvent(int event) {
|
||||||
QMutexLocker locker(&m_mutex);
|
QMutexLocker locker(&m_mutex);
|
||||||
|
mLogSetThreadLogger(m_logContext);
|
||||||
m_logger.handleEvent(&m_logger, static_cast<enum mVideoLoggerEvent>(event));
|
m_logger.handleEvent(&m_logger, static_cast<enum mVideoLoggerEvent>(event));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,6 +146,7 @@ void VideoProxy::wait() {
|
||||||
while (RingFIFOSize(&m_dirtyQueue)) {
|
while (RingFIFOSize(&m_dirtyQueue)) {
|
||||||
if (QThread::currentThread() == thread()) {
|
if (QThread::currentThread() == thread()) {
|
||||||
// We're on the main thread
|
// We're on the main thread
|
||||||
|
mLogSetThreadLogger(m_logContext);
|
||||||
mVideoLoggerRendererRun(&m_logger, false);
|
mVideoLoggerRendererRun(&m_logger, false);
|
||||||
} else {
|
} else {
|
||||||
emit dataAvailable();
|
emit dataAvailable();
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include <QReadWriteLock>
|
#include <QReadWriteLock>
|
||||||
#include <QWaitCondition>
|
#include <QWaitCondition>
|
||||||
|
|
||||||
|
#include <mgba/core/log.h>
|
||||||
#include <mgba/feature/video-logger.h>
|
#include <mgba/feature/video-logger.h>
|
||||||
#include <mgba/feature/proxy-backend.h>
|
#include <mgba/feature/proxy-backend.h>
|
||||||
#include <mgba-util/ring-fifo.h>
|
#include <mgba-util/ring-fifo.h>
|
||||||
|
@ -72,6 +73,7 @@ private:
|
||||||
} m_logger;
|
} m_logger;
|
||||||
|
|
||||||
struct mVideoProxyBackend m_backend;
|
struct mVideoProxyBackend m_backend;
|
||||||
|
struct mLogger* m_logContext = nullptr;
|
||||||
|
|
||||||
RingFIFO m_dirtyQueue;
|
RingFIFO m_dirtyQueue;
|
||||||
QMutex m_mutex;
|
QMutex m_mutex;
|
||||||
|
|
Loading…
Reference in New Issue