early-access version 2432

This commit is contained in:
pineappleEA 2022-01-24 11:11:34 +01:00
parent 2275829335
commit 87def5b55b
7 changed files with 32 additions and 31 deletions

View file

@ -1,7 +1,7 @@
yuzu emulator early access yuzu emulator early access
============= =============
This is the source code for early-access 2431. This is the source code for early-access 2432.
## Legal Notice ## Legal Notice

View file

@ -95,7 +95,8 @@ if (NOT WIN32)
# ffnvenc could load CUDA libraries at the runtime using dlopen/dlsym or LoadLibrary/GetProcAddress # ffnvenc could load CUDA libraries at the runtime using dlopen/dlsym or LoadLibrary/GetProcAddress
# here we handle the hard-linking senario where CUDA is linked during compilation # here we handle the hard-linking senario where CUDA is linked during compilation
if (CUDA_FOUND) if (CUDA_FOUND)
list(APPEND FFmpeg_HWACCEL_FLAGS --extra-cflags=-I${CUDA_INCLUDE_DIRS}) # This line causes build error if CUDA_INCLUDE_DIRS is anything but a single non-empty value
#list(APPEND FFmpeg_HWACCEL_FLAGS --extra-cflags=-I${CUDA_INCLUDE_DIRS})
list(APPEND FFmpeg_HWACCEL_LIBRARIES ${CUDA_LIBRARIES}) list(APPEND FFmpeg_HWACCEL_LIBRARIES ${CUDA_LIBRARIES})
list(APPEND FFmpeg_HWACCEL_INCLUDE_DIRS ${CUDA_INCLUDE_DIRS}) list(APPEND FFmpeg_HWACCEL_INCLUDE_DIRS ${CUDA_INCLUDE_DIRS})
list(APPEND FFmpeg_HWACCEL_LDFLAGS ${CUDA_LDFLAGS}) list(APPEND FFmpeg_HWACCEL_LDFLAGS ${CUDA_LDFLAGS})
@ -119,6 +120,8 @@ if (NOT WIN32)
# `configure` parameters builds only exactly what yuzu needs from FFmpeg # `configure` parameters builds only exactly what yuzu needs from FFmpeg
# `--disable-vdpau` is needed to avoid linking issues # `--disable-vdpau` is needed to avoid linking issues
set(FFmpeg_CC ${CMAKE_C_COMPILER_LAUNCHER} ${CMAKE_C_COMPILER})
set(FFmpeg_CXX ${CMAKE_CXX_COMPILER_LAUNCHER} ${CMAKE_CXX_COMPILER})
add_custom_command( add_custom_command(
OUTPUT OUTPUT
${FFmpeg_MAKEFILE} ${FFmpeg_MAKEFILE}
@ -137,12 +140,14 @@ if (NOT WIN32)
--enable-decoder=h264 --enable-decoder=h264
--enable-decoder=vp8 --enable-decoder=vp8
--enable-decoder=vp9 --enable-decoder=vp9
--cc="${CMAKE_C_COMPILER}" --cc="${FFmpeg_CC}"
--cxx="${CMAKE_CXX_COMPILER}" --cxx="${FFmpeg_CXX}"
${FFmpeg_HWACCEL_FLAGS} ${FFmpeg_HWACCEL_FLAGS}
WORKING_DIRECTORY WORKING_DIRECTORY
${FFmpeg_BUILD_DIR} ${FFmpeg_BUILD_DIR}
) )
unset(FFmpeg_CC)
unset(FFmpeg_CXX)
unset(FFmpeg_HWACCEL_FLAGS) unset(FFmpeg_HWACCEL_FLAGS)
# Workaround for Ubuntu 18.04's older version of make not being able to call make as a child # Workaround for Ubuntu 18.04's older version of make not being able to call make as a child

View file

@ -146,6 +146,13 @@ ResultCode KProcess::Initialize(KProcess* process, Core::System& system, std::st
// Open a reference to the resource limit. // Open a reference to the resource limit.
process->resource_limit->Open(); process->resource_limit->Open();
// Clear remaining fields.
process->num_running_threads = 0;
process->is_signaled = false;
process->exception_thread = nullptr;
process->is_suspended = false;
process->schedule_count = 0;
return ResultSuccess; return ResultSuccess;
} }
@ -157,20 +164,17 @@ KResourceLimit* KProcess::GetResourceLimit() const {
return resource_limit; return resource_limit;
} }
void KProcess::IncrementThreadCount() { void KProcess::IncrementRunningThreadCount() {
ASSERT(num_threads >= 0); ASSERT(num_running_threads.load() >= 0);
num_created_threads++; ++num_running_threads;
if (const auto count = ++num_threads; count > peak_num_threads) {
peak_num_threads = count;
}
} }
void KProcess::DecrementThreadCount() { void KProcess::DecrementRunningThreadCount() {
ASSERT(num_threads > 0); ASSERT(num_running_threads.load() > 0);
if (const auto count = --num_threads; count == 0) { if (const auto prev = num_running_threads--; prev == 1) {
LOG_WARNING(Kernel, "Process termination is not fully implemented."); // TODO(bunnei): Process termination to be implemented when multiprocess is supported.
UNIMPLEMENTED_MSG("KProcess termination is not implemennted!");
} }
} }

View file

@ -235,8 +235,8 @@ public:
++schedule_count; ++schedule_count;
} }
void IncrementThreadCount(); void IncrementRunningThreadCount();
void DecrementThreadCount(); void DecrementRunningThreadCount();
void SetRunningThread(s32 core, KThread* thread, u64 idle_count) { void SetRunningThread(s32 core, KThread* thread, u64 idle_count) {
running_threads[core] = thread; running_threads[core] = thread;
@ -473,9 +473,7 @@ private:
bool is_suspended{}; bool is_suspended{};
bool is_initialized{}; bool is_initialized{};
std::atomic<s32> num_created_threads{}; std::atomic<u16> num_running_threads{};
std::atomic<u16> num_threads{};
u16 peak_num_threads{};
std::array<KThread*, Core::Hardware::NUM_CPU_CORES> running_threads{}; std::array<KThread*, Core::Hardware::NUM_CPU_CORES> running_threads{};
std::array<u64, Core::Hardware::NUM_CPU_CORES> running_thread_idle_counts{}; std::array<u64, Core::Hardware::NUM_CPU_CORES> running_thread_idle_counts{};

View file

@ -215,7 +215,6 @@ ResultCode KThread::Initialize(KThreadFunction func, uintptr_t arg, VAddr user_s
parent = owner; parent = owner;
parent->Open(); parent->Open();
parent->IncrementThreadCount();
} }
// Initialize thread context. // Initialize thread context.
@ -327,11 +326,6 @@ void KThread::Finalize() {
} }
} }
// Decrement the parent process's thread count.
if (parent != nullptr) {
parent->DecrementThreadCount();
}
// Perform inherited finalization. // Perform inherited finalization.
KSynchronizationObject::Finalize(); KSynchronizationObject::Finalize();
} }
@ -1011,7 +1005,7 @@ ResultCode KThread::Run() {
if (IsUserThread() && IsSuspended()) { if (IsUserThread() && IsSuspended()) {
this->UpdateState(); this->UpdateState();
} }
owner->IncrementThreadCount(); owner->IncrementRunningThreadCount();
} }
// Set our state and finish. // Set our state and finish.
@ -1026,10 +1020,11 @@ ResultCode KThread::Run() {
void KThread::Exit() { void KThread::Exit() {
ASSERT(this == GetCurrentThreadPointer(kernel)); ASSERT(this == GetCurrentThreadPointer(kernel));
// Release the thread resource hint from parent. // Release the thread resource hint, running thread count from parent.
if (parent != nullptr) { if (parent != nullptr) {
parent->GetResourceLimit()->Release(Kernel::LimitableResource::Threads, 0, 1); parent->GetResourceLimit()->Release(Kernel::LimitableResource::Threads, 0, 1);
resource_limit_release_hint = true; resource_limit_release_hint = true;
parent->DecrementRunningThreadCount();
} }
// Perform termination. // Perform termination.

View file

@ -29,10 +29,9 @@ private:
static const std::size_t max_number_of_handles = 0x13; static const std::size_t max_number_of_handles = 0x13;
enum class HidBusDeviceId : std::size_t { enum class HidBusDeviceId : std::size_t {
// Verify starlink external device id
Starlink = 0x19,
RingController = 0x20, RingController = 0x20,
FamicomRight = 0x21, FamicomRight = 0x21,
Starlink = 0x28,
}; };
// This is nn::hidbus::detail::StatusManagerType // This is nn::hidbus::detail::StatusManagerType

View file

@ -7,7 +7,7 @@
#include "core/hle/service/hid/hidbus/starlink.h" #include "core/hle/service/hid/hidbus/starlink.h"
namespace Service::HID { namespace Service::HID {
constexpr u8 DEVICE_ID = 0x19; constexpr u8 DEVICE_ID = 0x28;
Starlink::Starlink(Core::HID::HIDCore& hid_core_, KernelHelpers::ServiceContext& service_context_) Starlink::Starlink(Core::HID::HIDCore& hid_core_, KernelHelpers::ServiceContext& service_context_)
: HidbusBase(service_context_) {} : HidbusBase(service_context_) {}