Minor fixes and fixing thread names.
This commit is contained in:
parent
7cabcad69e
commit
e3ddcd44e7
|
@ -109,9 +109,10 @@ X_STATUS AudioSystem::Setup() {
|
||||||
worker_thread_ =
|
worker_thread_ =
|
||||||
kernel::object_ref<kernel::XHostThread>(new kernel::XHostThread(
|
kernel::object_ref<kernel::XHostThread>(new kernel::XHostThread(
|
||||||
emulator()->kernel_state(), 128 * 1024, 0, [this]() {
|
emulator()->kernel_state(), 128 * 1024, 0, [this]() {
|
||||||
this->WorkerThreadMain();
|
WorkerThreadMain();
|
||||||
return 0;
|
return 0;
|
||||||
}));
|
}));
|
||||||
|
worker_thread_->set_name("Audio Worker");
|
||||||
worker_thread_->Create();
|
worker_thread_->Create();
|
||||||
|
|
||||||
decoder_running_ = true;
|
decoder_running_ = true;
|
||||||
|
@ -121,14 +122,13 @@ X_STATUS AudioSystem::Setup() {
|
||||||
DecoderThreadMain();
|
DecoderThreadMain();
|
||||||
return 0;
|
return 0;
|
||||||
}));
|
}));
|
||||||
|
decoder_thread_->set_name("Audio Decoder");
|
||||||
decoder_thread_->Create();
|
decoder_thread_->Create();
|
||||||
|
|
||||||
return X_STATUS_SUCCESS;
|
return X_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioSystem::WorkerThreadMain() {
|
void AudioSystem::WorkerThreadMain() {
|
||||||
xe::threading::set_name("Audio Worker");
|
|
||||||
|
|
||||||
// Initialize driver and ringbuffer.
|
// Initialize driver and ringbuffer.
|
||||||
Initialize();
|
Initialize();
|
||||||
|
|
||||||
|
@ -182,8 +182,6 @@ void AudioSystem::WorkerThreadMain() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioSystem::DecoderThreadMain() {
|
void AudioSystem::DecoderThreadMain() {
|
||||||
xe::threading::set_name("Audio Decoder");
|
|
||||||
|
|
||||||
while (decoder_running_) {
|
while (decoder_running_) {
|
||||||
// Wait for the fence
|
// Wait for the fence
|
||||||
decoder_fence_.Wait();
|
decoder_fence_.Wait();
|
||||||
|
|
|
@ -71,8 +71,8 @@ class mutex {
|
||||||
private:
|
private:
|
||||||
std::aligned_storage<_Mtx_internal_imp_size,
|
std::aligned_storage<_Mtx_internal_imp_size,
|
||||||
_Mtx_internal_imp_alignment>::type _Mtx_storage;
|
_Mtx_internal_imp_alignment>::type _Mtx_storage;
|
||||||
HANDLE holding_thread_;
|
HANDLE holding_thread_ = nullptr;
|
||||||
bool debugger_waiting_;
|
bool debugger_waiting_ = false;
|
||||||
|
|
||||||
_Mtx_t _Mymtx() noexcept { return (reinterpret_cast<_Mtx_t>(&_Mtx_storage)); }
|
_Mtx_t _Mymtx() noexcept { return (reinterpret_cast<_Mtx_t>(&_Mtx_storage)); }
|
||||||
};
|
};
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
#include "xenia/gpu/texture_info.h"
|
#include "xenia/gpu/texture_info.h"
|
||||||
#include "xenia/gpu/xenos.h"
|
#include "xenia/gpu/xenos.h"
|
||||||
#include "xenia/emulator.h"
|
#include "xenia/emulator.h"
|
||||||
#include "xenia/kernel/objects/xthread.h"
|
|
||||||
#include "xenia/profiling.h"
|
#include "xenia/profiling.h"
|
||||||
|
|
||||||
#include "third_party/xxhash/xxhash.h"
|
#include "third_party/xxhash/xxhash.h"
|
||||||
|
@ -107,6 +106,7 @@ bool CommandProcessor::Initialize(std::unique_ptr<GLContext> context) {
|
||||||
WorkerThreadMain();
|
WorkerThreadMain();
|
||||||
return 0;
|
return 0;
|
||||||
}));
|
}));
|
||||||
|
worker_thread_->set_name("GL4 Worker");
|
||||||
worker_thread_->Create();
|
worker_thread_->Create();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -191,8 +191,6 @@ void CommandProcessor::ClearCaches() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommandProcessor::WorkerThreadMain() {
|
void CommandProcessor::WorkerThreadMain() {
|
||||||
xe::threading::set_name("GL4 Worker");
|
|
||||||
|
|
||||||
context_->MakeCurrent();
|
context_->MakeCurrent();
|
||||||
if (!SetupGL()) {
|
if (!SetupGL()) {
|
||||||
XEFATAL("Unable to setup command processor GL state");
|
XEFATAL("Unable to setup command processor GL state");
|
||||||
|
|
|
@ -241,11 +241,6 @@ void GL4GraphicsSystem::ClearCaches() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void GL4GraphicsSystem::MarkVblank() {
|
void GL4GraphicsSystem::MarkVblank() {
|
||||||
static bool thread_name_set = false;
|
|
||||||
if (!thread_name_set) {
|
|
||||||
thread_name_set = true;
|
|
||||||
Profiler::ThreadEnter("GL4 Vsync Timer");
|
|
||||||
}
|
|
||||||
SCOPE_profile_cpu_f("gpu");
|
SCOPE_profile_cpu_f("gpu");
|
||||||
|
|
||||||
// Increment vblank counter (so the game sees us making progress).
|
// Increment vblank counter (so the game sees us making progress).
|
||||||
|
|
|
@ -66,6 +66,10 @@ XThread::XThread(KernelState* kernel_state, uint32_t stack_size,
|
||||||
event_ = object_ref<XEvent>(new XEvent(kernel_state));
|
event_ = object_ref<XEvent>(new XEvent(kernel_state));
|
||||||
event_->Initialize(true, false);
|
event_->Initialize(true, false);
|
||||||
|
|
||||||
|
char thread_name[32];
|
||||||
|
snprintf(thread_name, xe::countof(thread_name), "XThread%04X", handle());
|
||||||
|
set_name(thread_name);
|
||||||
|
|
||||||
// The kernel does not take a reference. We must unregister in the dtor.
|
// The kernel does not take a reference. We must unregister in the dtor.
|
||||||
kernel_state_->RegisterThread(this);
|
kernel_state_->RegisterThread(this);
|
||||||
}
|
}
|
||||||
|
@ -259,10 +263,6 @@ X_STATUS XThread::Create() {
|
||||||
return return_code;
|
return return_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
char thread_name[32];
|
|
||||||
snprintf(thread_name, xe::countof(thread_name), "XThread%04X", handle());
|
|
||||||
set_name(thread_name);
|
|
||||||
|
|
||||||
uint32_t proc_mask = creation_params_.creation_flags >> 24;
|
uint32_t proc_mask = creation_params_.creation_flags >> 24;
|
||||||
if (proc_mask) {
|
if (proc_mask) {
|
||||||
SetAffinity(proc_mask);
|
SetAffinity(proc_mask);
|
||||||
|
|
|
@ -639,7 +639,7 @@ bool BaseHeap::AllocRange(uint32_t low_address, uint32_t high_address,
|
||||||
uint32_t high_page_number = (high_address - heap_base_) / page_size_;
|
uint32_t high_page_number = (high_address - heap_base_) / page_size_;
|
||||||
low_page_number = std::min(uint32_t(page_table_.size()) - 1, low_page_number);
|
low_page_number = std::min(uint32_t(page_table_.size()) - 1, low_page_number);
|
||||||
high_page_number =
|
high_page_number =
|
||||||
std::min(uint32_t(page_table_.size()) - 1, high_page_number) - page_count;
|
std::min(uint32_t(page_table_.size()) - 1, high_page_number);
|
||||||
|
|
||||||
std::lock_guard<xe::recursive_mutex> lock(heap_mutex_);
|
std::lock_guard<xe::recursive_mutex> lock(heap_mutex_);
|
||||||
|
|
||||||
|
@ -683,7 +683,7 @@ bool BaseHeap::AllocRange(uint32_t low_address, uint32_t high_address,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (uint32_t base_page_number = low_page_number;
|
for (uint32_t base_page_number = low_page_number;
|
||||||
base_page_number <= high_page_number;
|
base_page_number <= high_page_number - page_count;
|
||||||
base_page_number += page_scan_stride) {
|
base_page_number += page_scan_stride) {
|
||||||
bool is_free = page_table_[base_page_number].state == 0;
|
bool is_free = page_table_[base_page_number].state == 0;
|
||||||
if (page_table_[base_page_number].state != 0) {
|
if (page_table_[base_page_number].state != 0) {
|
||||||
|
|
Loading…
Reference in New Issue