early-access version 1825
This commit is contained in:
parent
74b225f6fc
commit
32d1754726
@ -1,7 +1,7 @@
|
|||||||
yuzu emulator early access
|
yuzu emulator early access
|
||||||
=============
|
=============
|
||||||
|
|
||||||
This is the source code for early-access 1824.
|
This is the source code for early-access 1825.
|
||||||
|
|
||||||
## Legal Notice
|
## Legal Notice
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ constexpr ResultCode ERR_INVALID_PARAMETERS{ErrorModule::Audio, 41};
|
|||||||
constexpr ResultCode ERR_SPLITTER_SORT_FAILED{ErrorModule::Audio, 43};
|
constexpr ResultCode ERR_SPLITTER_SORT_FAILED{ErrorModule::Audio, 43};
|
||||||
} // namespace Audren
|
} // namespace Audren
|
||||||
|
|
||||||
constexpr u32_le CURRENT_PROCESS_REVISION = Common::MakeMagic('R', 'E', 'V', '8');
|
constexpr u32_le CURRENT_PROCESS_REVISION = Common::MakeMagic('R', 'E', 'V', '9');
|
||||||
constexpr std::size_t MAX_MIX_BUFFERS = 24;
|
constexpr std::size_t MAX_MIX_BUFFERS = 24;
|
||||||
constexpr std::size_t MAX_BIQUAD_FILTERS = 2;
|
constexpr std::size_t MAX_BIQUAD_FILTERS = 2;
|
||||||
constexpr std::size_t MAX_CHANNEL_COUNT = 6;
|
constexpr std::size_t MAX_CHANNEL_COUNT = 6;
|
||||||
|
@ -168,8 +168,7 @@ bool InfoUpdater::UpdateVoices(VoiceContext& voice_context,
|
|||||||
auto& voice_in_params = voice_in[i];
|
auto& voice_in_params = voice_in[i];
|
||||||
const auto channel_count = static_cast<std::size_t>(voice_in_params.channel_count);
|
const auto channel_count = static_cast<std::size_t>(voice_in_params.channel_count);
|
||||||
// Skip if it's not currently in use
|
// Skip if it's not currently in use
|
||||||
// TODO: in-use voices shouldn't have 0 channels, investigate why this happens
|
if (!voice_in_params.is_in_use) {
|
||||||
if (!voice_in_params.is_in_use || channel_count == 0) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// Voice states for each channel
|
// Voice states for each channel
|
||||||
|
@ -110,7 +110,6 @@ add_library(common STATIC
|
|||||||
cityhash.cpp
|
cityhash.cpp
|
||||||
cityhash.h
|
cityhash.h
|
||||||
common_funcs.h
|
common_funcs.h
|
||||||
common_sizes.h
|
|
||||||
common_types.h
|
common_types.h
|
||||||
concepts.h
|
concepts.h
|
||||||
div_ceil.h
|
div_ceil.h
|
||||||
@ -134,6 +133,7 @@ add_library(common STATIC
|
|||||||
host_memory.cpp
|
host_memory.cpp
|
||||||
host_memory.h
|
host_memory.h
|
||||||
intrusive_red_black_tree.h
|
intrusive_red_black_tree.h
|
||||||
|
literals.h
|
||||||
logging/backend.cpp
|
logging/backend.cpp
|
||||||
logging/backend.h
|
logging/backend.h
|
||||||
logging/filter.cpp
|
logging/filter.cpp
|
||||||
|
31
src/common/literals.h
Executable file
31
src/common/literals.h
Executable file
@ -0,0 +1,31 @@
|
|||||||
|
// Copyright 2021 yuzu emulator team
|
||||||
|
// Licensed under GPLv2 or any later version
|
||||||
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "common/common_types.h"
|
||||||
|
|
||||||
|
namespace Common::Literals {
|
||||||
|
|
||||||
|
constexpr u64 operator""_KiB(unsigned long long int x) {
|
||||||
|
return 1024ULL * x;
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr u64 operator""_MiB(unsigned long long int x) {
|
||||||
|
return 1024_KiB * x;
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr u64 operator""_GiB(unsigned long long int x) {
|
||||||
|
return 1024_MiB * x;
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr u64 operator""_TiB(unsigned long long int x) {
|
||||||
|
return 1024_GiB * x;
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr u64 operator""_PiB(unsigned long long int x) {
|
||||||
|
return 1024_TiB * x;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Common::Literals
|
@ -19,6 +19,8 @@
|
|||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
#include "common/fs/file.h"
|
#include "common/fs/file.h"
|
||||||
#include "common/fs/fs.h"
|
#include "common/fs/fs.h"
|
||||||
|
#include "common/literals.h"
|
||||||
|
|
||||||
#include "common/logging/backend.h"
|
#include "common/logging/backend.h"
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
#include "common/logging/text_formatter.h"
|
#include "common/logging/text_formatter.h"
|
||||||
@ -98,8 +100,8 @@ private:
|
|||||||
write_logs(entry);
|
write_logs(entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Drain the logging queue. Only writes out up to MAX_LOGS_TO_WRITE to prevent a case
|
// Drain the logging queue. Only writes out up to MAX_LOGS_TO_WRITE to prevent a
|
||||||
// where a system is repeatedly spamming logs even on close.
|
// case where a system is repeatedly spamming logs even on close.
|
||||||
const int MAX_LOGS_TO_WRITE = filter.IsDebug() ? INT_MAX : 100;
|
const int MAX_LOGS_TO_WRITE = filter.IsDebug() ? INT_MAX : 100;
|
||||||
int logs_written = 0;
|
int logs_written = 0;
|
||||||
while (logs_written++ < MAX_LOGS_TO_WRITE && message_queue.Pop(entry)) {
|
while (logs_written++ < MAX_LOGS_TO_WRITE && message_queue.Pop(entry)) {
|
||||||
@ -169,10 +171,11 @@ FileBackend::FileBackend(const std::filesystem::path& filename) {
|
|||||||
FileBackend::~FileBackend() = default;
|
FileBackend::~FileBackend() = default;
|
||||||
|
|
||||||
void FileBackend::Write(const Entry& entry) {
|
void FileBackend::Write(const Entry& entry) {
|
||||||
|
using namespace Common::Literals;
|
||||||
// prevent logs from going over the maximum size (in case its spamming and the user doesn't
|
// prevent logs from going over the maximum size (in case its spamming and the user doesn't
|
||||||
// know)
|
// know)
|
||||||
constexpr std::size_t MAX_BYTES_WRITTEN = 100 * 1024 * 1024;
|
constexpr std::size_t MAX_BYTES_WRITTEN = 100_MiB;
|
||||||
constexpr std::size_t MAX_BYTES_WRITTEN_EXTENDED = 1024 * 1024 * 1024;
|
constexpr std::size_t MAX_BYTES_WRITTEN_EXTENDED = 1_GiB;
|
||||||
|
|
||||||
if (!file->IsOpen()) {
|
if (!file->IsOpen()) {
|
||||||
return;
|
return;
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#include <dynarmic/interface/A32/config.h>
|
#include <dynarmic/interface/A32/config.h>
|
||||||
#include <dynarmic/interface/A32/context.h>
|
#include <dynarmic/interface/A32/context.h>
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
|
#include "common/literals.h"
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
#include "common/page_table.h"
|
#include "common/page_table.h"
|
||||||
#include "common/settings.h"
|
#include "common/settings.h"
|
||||||
@ -22,6 +23,8 @@
|
|||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
|
|
||||||
|
using namespace Common::Literals;
|
||||||
|
|
||||||
class DynarmicCallbacks32 : public Dynarmic::A32::UserCallbacks {
|
class DynarmicCallbacks32 : public Dynarmic::A32::UserCallbacks {
|
||||||
public:
|
public:
|
||||||
explicit DynarmicCallbacks32(ARM_Dynarmic_32& parent_)
|
explicit DynarmicCallbacks32(ARM_Dynarmic_32& parent_)
|
||||||
@ -143,8 +146,8 @@ std::shared_ptr<Dynarmic::A32::Jit> ARM_Dynarmic_32::MakeJit(Common::PageTable*
|
|||||||
config.wall_clock_cntpct = uses_wall_clock;
|
config.wall_clock_cntpct = uses_wall_clock;
|
||||||
|
|
||||||
// Code cache size
|
// Code cache size
|
||||||
config.code_cache_size = 512 * 1024 * 1024;
|
config.code_cache_size = 512_MiB;
|
||||||
config.far_code_offset = 400 * 1024 * 1024;
|
config.far_code_offset = 400_MiB;
|
||||||
|
|
||||||
// Safe optimizations
|
// Safe optimizations
|
||||||
if (Settings::values.cpu_accuracy.GetValue() == Settings::CPUAccuracy::DebugMode) {
|
if (Settings::values.cpu_accuracy.GetValue() == Settings::CPUAccuracy::DebugMode) {
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include <dynarmic/interface/A64/a64.h>
|
#include <dynarmic/interface/A64/a64.h>
|
||||||
#include <dynarmic/interface/A64/config.h>
|
#include <dynarmic/interface/A64/config.h>
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
|
#include "common/literals.h"
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
#include "common/page_table.h"
|
#include "common/page_table.h"
|
||||||
#include "common/settings.h"
|
#include "common/settings.h"
|
||||||
@ -24,6 +25,7 @@
|
|||||||
namespace Core {
|
namespace Core {
|
||||||
|
|
||||||
using Vector = Dynarmic::A64::Vector;
|
using Vector = Dynarmic::A64::Vector;
|
||||||
|
using namespace Common::Literals;
|
||||||
|
|
||||||
class DynarmicCallbacks64 : public Dynarmic::A64::UserCallbacks {
|
class DynarmicCallbacks64 : public Dynarmic::A64::UserCallbacks {
|
||||||
public:
|
public:
|
||||||
@ -184,8 +186,8 @@ std::shared_ptr<Dynarmic::A64::Jit> ARM_Dynarmic_64::MakeJit(Common::PageTable*
|
|||||||
config.wall_clock_cntpct = uses_wall_clock;
|
config.wall_clock_cntpct = uses_wall_clock;
|
||||||
|
|
||||||
// Code cache size
|
// Code cache size
|
||||||
config.code_cache_size = 512 * 1024 * 1024;
|
config.code_cache_size = 512_MiB;
|
||||||
config.far_code_offset = 400 * 1024 * 1024;
|
config.far_code_offset = 400_MiB;
|
||||||
|
|
||||||
// Safe optimizations
|
// Safe optimizations
|
||||||
if (Settings::values.cpu_accuracy.GetValue() == Settings::CPUAccuracy::DebugMode) {
|
if (Settings::values.cpu_accuracy.GetValue() == Settings::CPUAccuracy::DebugMode) {
|
||||||
|
@ -345,8 +345,12 @@ public:
|
|||||||
explicit RequestParser(u32* command_buffer) : RequestHelperBase(command_buffer) {}
|
explicit RequestParser(u32* command_buffer) : RequestHelperBase(command_buffer) {}
|
||||||
|
|
||||||
explicit RequestParser(Kernel::HLERequestContext& ctx) : RequestHelperBase(ctx) {
|
explicit RequestParser(Kernel::HLERequestContext& ctx) : RequestHelperBase(ctx) {
|
||||||
ASSERT_MSG(ctx.GetDataPayloadOffset(), "context is incomplete");
|
// TIPC does not have data payload offset
|
||||||
Skip(ctx.GetDataPayloadOffset(), false);
|
if (!ctx.IsTipc()) {
|
||||||
|
ASSERT_MSG(ctx.GetDataPayloadOffset(), "context is incomplete");
|
||||||
|
Skip(ctx.GetDataPayloadOffset(), false);
|
||||||
|
}
|
||||||
|
|
||||||
// Skip the u64 command id, it's already stored in the context
|
// Skip the u64 command id, it's already stored in the context
|
||||||
static constexpr u32 CommandIdSize = 2;
|
static constexpr u32 CommandIdSize = 2;
|
||||||
Skip(CommandIdSize, false);
|
Skip(CommandIdSize, false);
|
||||||
|
@ -4,7 +4,8 @@
|
|||||||
|
|
||||||
#include <random>
|
#include <random>
|
||||||
|
|
||||||
#include "common/common_sizes.h"
|
#include "common/literals.h"
|
||||||
|
|
||||||
#include "core/hle/kernel/board/nintendo/nx/k_system_control.h"
|
#include "core/hle/kernel/board/nintendo/nx/k_system_control.h"
|
||||||
#include "core/hle/kernel/board/nintendo/nx/secure_monitor.h"
|
#include "core/hle/kernel/board/nintendo/nx/secure_monitor.h"
|
||||||
#include "core/hle/kernel/k_trace.h"
|
#include "core/hle/kernel/k_trace.h"
|
||||||
@ -25,6 +26,8 @@ constexpr const std::size_t RequiredNonSecureSystemMemorySize =
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
using namespace Common::Literals;
|
||||||
|
|
||||||
u32 GetMemoryModeForInit() {
|
u32 GetMemoryModeForInit() {
|
||||||
return 0x01;
|
return 0x01;
|
||||||
}
|
}
|
||||||
@ -57,11 +60,11 @@ size_t KSystemControl::Init::GetIntendedMemorySize() {
|
|||||||
switch (GetMemorySizeForInit()) {
|
switch (GetMemorySizeForInit()) {
|
||||||
case Smc::MemorySize_4GB:
|
case Smc::MemorySize_4GB:
|
||||||
default: // All invalid modes should go to 4GB.
|
default: // All invalid modes should go to 4GB.
|
||||||
return Common::Size_4_GB;
|
return 4_GiB;
|
||||||
case Smc::MemorySize_6GB:
|
case Smc::MemorySize_6GB:
|
||||||
return Common::Size_6_GB;
|
return 6_GiB;
|
||||||
case Smc::MemorySize_8GB:
|
case Smc::MemorySize_8GB:
|
||||||
return Common::Size_8_GB;
|
return 8_GiB;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,17 +82,17 @@ std::size_t KSystemControl::Init::GetApplicationPoolSize() {
|
|||||||
switch (GetMemoryArrangeForInit()) {
|
switch (GetMemoryArrangeForInit()) {
|
||||||
case Smc::MemoryArrangement_4GB:
|
case Smc::MemoryArrangement_4GB:
|
||||||
default:
|
default:
|
||||||
return Common::Size_3285_MB;
|
return 3285_MiB;
|
||||||
case Smc::MemoryArrangement_4GBForAppletDev:
|
case Smc::MemoryArrangement_4GBForAppletDev:
|
||||||
return Common::Size_2048_MB;
|
return 2048_MiB;
|
||||||
case Smc::MemoryArrangement_4GBForSystemDev:
|
case Smc::MemoryArrangement_4GBForSystemDev:
|
||||||
return Common::Size_3285_MB;
|
return 3285_MiB;
|
||||||
case Smc::MemoryArrangement_6GB:
|
case Smc::MemoryArrangement_6GB:
|
||||||
return Common::Size_4916_MB;
|
return 4916_MiB;
|
||||||
case Smc::MemoryArrangement_6GBForAppletDev:
|
case Smc::MemoryArrangement_6GBForAppletDev:
|
||||||
return Common::Size_3285_MB;
|
return 3285_MiB;
|
||||||
case Smc::MemoryArrangement_8GB:
|
case Smc::MemoryArrangement_8GB:
|
||||||
return Common::Size_4916_MB;
|
return 4916_MiB;
|
||||||
}
|
}
|
||||||
}();
|
}();
|
||||||
|
|
||||||
@ -103,22 +106,22 @@ size_t KSystemControl::Init::GetAppletPoolSize() {
|
|||||||
switch (GetMemoryArrangeForInit()) {
|
switch (GetMemoryArrangeForInit()) {
|
||||||
case Smc::MemoryArrangement_4GB:
|
case Smc::MemoryArrangement_4GB:
|
||||||
default:
|
default:
|
||||||
return Common::Size_507_MB;
|
return 507_MiB;
|
||||||
case Smc::MemoryArrangement_4GBForAppletDev:
|
case Smc::MemoryArrangement_4GBForAppletDev:
|
||||||
return Common::Size_1554_MB;
|
return 1554_MiB;
|
||||||
case Smc::MemoryArrangement_4GBForSystemDev:
|
case Smc::MemoryArrangement_4GBForSystemDev:
|
||||||
return Common::Size_448_MB;
|
return 448_MiB;
|
||||||
case Smc::MemoryArrangement_6GB:
|
case Smc::MemoryArrangement_6GB:
|
||||||
return Common::Size_562_MB;
|
return 562_MiB;
|
||||||
case Smc::MemoryArrangement_6GBForAppletDev:
|
case Smc::MemoryArrangement_6GBForAppletDev:
|
||||||
return Common::Size_2193_MB;
|
return 2193_MiB;
|
||||||
case Smc::MemoryArrangement_8GB:
|
case Smc::MemoryArrangement_8GB:
|
||||||
return Common::Size_2193_MB;
|
return 2193_MiB;
|
||||||
}
|
}
|
||||||
}();
|
}();
|
||||||
|
|
||||||
// Return (possibly) adjusted size.
|
// Return (possibly) adjusted size.
|
||||||
constexpr size_t ExtraSystemMemoryForAtmosphere = Common::Size_33_MB;
|
constexpr size_t ExtraSystemMemoryForAtmosphere = 33_MiB;
|
||||||
return base_pool_size - ExtraSystemMemoryForAtmosphere - KTraceBufferSize;
|
return base_pool_size - ExtraSystemMemoryForAtmosphere - KTraceBufferSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,34 +5,37 @@
|
|||||||
#include <array>
|
#include <array>
|
||||||
|
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
#include "common/common_sizes.h"
|
#include "common/literals.h"
|
||||||
#include "core/hle/kernel/k_address_space_info.h"
|
#include "core/hle/kernel/k_address_space_info.h"
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
using namespace Common::Literals;
|
||||||
|
|
||||||
|
constexpr u64 Size_Invalid = UINT64_MAX;
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
constexpr std::array<KAddressSpaceInfo, 13> AddressSpaceInfos{{
|
constexpr std::array<KAddressSpaceInfo, 13> AddressSpaceInfos{{
|
||||||
{ .bit_width = 32, .address = Common::Size_2_MB , .size = Common::Size_1_GB - Common::Size_2_MB , .type = KAddressSpaceInfo::Type::MapSmall, },
|
{ .bit_width = 32, .address = 2_MiB , .size = 1_GiB - 2_MiB , .type = KAddressSpaceInfo::Type::MapSmall, },
|
||||||
{ .bit_width = 32, .address = Common::Size_1_GB , .size = Common::Size_4_GB - Common::Size_1_GB , .type = KAddressSpaceInfo::Type::MapLarge, },
|
{ .bit_width = 32, .address = 1_GiB , .size = 4_GiB - 1_GiB , .type = KAddressSpaceInfo::Type::MapLarge, },
|
||||||
{ .bit_width = 32, .address = Common::Size_Invalid, .size = Common::Size_1_GB , .type = KAddressSpaceInfo::Type::Alias, },
|
{ .bit_width = 32, .address = Size_Invalid, .size = 1_GiB , .type = KAddressSpaceInfo::Type::Alias, },
|
||||||
{ .bit_width = 32, .address = Common::Size_Invalid, .size = Common::Size_1_GB , .type = KAddressSpaceInfo::Type::Heap, },
|
{ .bit_width = 32, .address = Size_Invalid, .size = 1_GiB , .type = KAddressSpaceInfo::Type::Heap, },
|
||||||
{ .bit_width = 36, .address = Common::Size_128_MB , .size = Common::Size_2_GB - Common::Size_128_MB, .type = KAddressSpaceInfo::Type::MapSmall, },
|
{ .bit_width = 36, .address = 128_MiB , .size = 2_GiB - 128_MiB, .type = KAddressSpaceInfo::Type::MapSmall, },
|
||||||
{ .bit_width = 36, .address = Common::Size_2_GB , .size = Common::Size_64_GB - Common::Size_2_GB , .type = KAddressSpaceInfo::Type::MapLarge, },
|
{ .bit_width = 36, .address = 2_GiB , .size = 64_GiB - 2_GiB , .type = KAddressSpaceInfo::Type::MapLarge, },
|
||||||
{ .bit_width = 36, .address = Common::Size_Invalid, .size = Common::Size_6_GB , .type = KAddressSpaceInfo::Type::Heap, },
|
{ .bit_width = 36, .address = Size_Invalid, .size = 6_GiB , .type = KAddressSpaceInfo::Type::Heap, },
|
||||||
{ .bit_width = 36, .address = Common::Size_Invalid, .size = Common::Size_6_GB , .type = KAddressSpaceInfo::Type::Alias, },
|
{ .bit_width = 36, .address = Size_Invalid, .size = 6_GiB , .type = KAddressSpaceInfo::Type::Alias, },
|
||||||
{ .bit_width = 39, .address = Common::Size_128_MB , .size = Common::Size_512_GB - Common::Size_128_MB, .type = KAddressSpaceInfo::Type::Map39Bit, },
|
{ .bit_width = 39, .address = 128_MiB , .size = 512_GiB - 128_MiB, .type = KAddressSpaceInfo::Type::Map39Bit, },
|
||||||
{ .bit_width = 39, .address = Common::Size_Invalid, .size = Common::Size_64_GB , .type = KAddressSpaceInfo::Type::MapSmall },
|
{ .bit_width = 39, .address = Size_Invalid, .size = 64_GiB , .type = KAddressSpaceInfo::Type::MapSmall },
|
||||||
{ .bit_width = 39, .address = Common::Size_Invalid, .size = Common::Size_6_GB , .type = KAddressSpaceInfo::Type::Heap, },
|
{ .bit_width = 39, .address = Size_Invalid, .size = 6_GiB , .type = KAddressSpaceInfo::Type::Heap, },
|
||||||
{ .bit_width = 39, .address = Common::Size_Invalid, .size = Common::Size_64_GB , .type = KAddressSpaceInfo::Type::Alias, },
|
{ .bit_width = 39, .address = Size_Invalid, .size = 64_GiB , .type = KAddressSpaceInfo::Type::Alias, },
|
||||||
{ .bit_width = 39, .address = Common::Size_Invalid, .size = Common::Size_2_GB , .type = KAddressSpaceInfo::Type::Stack, },
|
{ .bit_width = 39, .address = Size_Invalid, .size = 2_GiB , .type = KAddressSpaceInfo::Type::Stack, },
|
||||||
}};
|
}};
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
constexpr bool IsAllowedIndexForAddress(std::size_t index) {
|
constexpr bool IsAllowedIndexForAddress(std::size_t index) {
|
||||||
return index < AddressSpaceInfos.size() &&
|
return index < AddressSpaceInfos.size() && AddressSpaceInfos[index].address != Size_Invalid;
|
||||||
AddressSpaceInfos[index].address != Common::Size_Invalid;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
using IndexArray =
|
using IndexArray =
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include "common/alignment.h"
|
#include "common/alignment.h"
|
||||||
|
#include "common/literals.h"
|
||||||
#include "core/hle/kernel/k_memory_layout.h"
|
#include "core/hle/kernel/k_memory_layout.h"
|
||||||
#include "core/hle/kernel/k_memory_manager.h"
|
#include "core/hle/kernel/k_memory_manager.h"
|
||||||
#include "core/hle/kernel/k_system_control.h"
|
#include "core/hle/kernel/k_system_control.h"
|
||||||
@ -12,8 +13,10 @@ namespace Kernel {
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
using namespace Common::Literals;
|
||||||
|
|
||||||
constexpr size_t CarveoutAlignment = 0x20000;
|
constexpr size_t CarveoutAlignment = 0x20000;
|
||||||
constexpr size_t CarveoutSizeMax = (512ULL * 1024 * 1024) - CarveoutAlignment;
|
constexpr size_t CarveoutSizeMax = (512_MiB) - CarveoutAlignment;
|
||||||
|
|
||||||
bool SetupPowerManagementControllerMemoryRegion(KMemoryLayout& memory_layout) {
|
bool SetupPowerManagementControllerMemoryRegion(KMemoryLayout& memory_layout) {
|
||||||
// Above firmware 2.0.0, the PMC is not mappable.
|
// Above firmware 2.0.0, the PMC is not mappable.
|
||||||
|
@ -7,8 +7,7 @@
|
|||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include "common/alignment.h"
|
#include "common/alignment.h"
|
||||||
#include "common/common_sizes.h"
|
#include "common/literals.h"
|
||||||
#include "common/common_types.h"
|
|
||||||
#include "core/device_memory.h"
|
#include "core/device_memory.h"
|
||||||
#include "core/hle/kernel/k_memory_region.h"
|
#include "core/hle/kernel/k_memory_region.h"
|
||||||
#include "core/hle/kernel/k_memory_region_type.h"
|
#include "core/hle/kernel/k_memory_region_type.h"
|
||||||
@ -16,20 +15,22 @@
|
|||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
|
|
||||||
constexpr std::size_t L1BlockSize = Common::Size_1_GB;
|
using namespace Common::Literals;
|
||||||
constexpr std::size_t L2BlockSize = Common::Size_2_MB;
|
|
||||||
|
constexpr std::size_t L1BlockSize = 1_GiB;
|
||||||
|
constexpr std::size_t L2BlockSize = 2_MiB;
|
||||||
|
|
||||||
constexpr std::size_t GetMaximumOverheadSize(std::size_t size) {
|
constexpr std::size_t GetMaximumOverheadSize(std::size_t size) {
|
||||||
return (Common::DivideUp(size, L1BlockSize) + Common::DivideUp(size, L2BlockSize)) * PageSize;
|
return (Common::DivideUp(size, L1BlockSize) + Common::DivideUp(size, L2BlockSize)) * PageSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr std::size_t MainMemorySize = Common::Size_4_GB;
|
constexpr std::size_t MainMemorySize = 4_GiB;
|
||||||
constexpr std::size_t MainMemorySizeMax = Common::Size_8_GB;
|
constexpr std::size_t MainMemorySizeMax = 8_GiB;
|
||||||
|
|
||||||
constexpr std::size_t ReservedEarlyDramSize = 0x60000;
|
constexpr std::size_t ReservedEarlyDramSize = 384_KiB;
|
||||||
constexpr std::size_t DramPhysicalAddress = 0x80000000;
|
constexpr std::size_t DramPhysicalAddress = 0x80000000;
|
||||||
|
|
||||||
constexpr std::size_t KernelAslrAlignment = Common::Size_2_MB;
|
constexpr std::size_t KernelAslrAlignment = 2_MiB;
|
||||||
constexpr std::size_t KernelVirtualAddressSpaceWidth = 1ULL << 39;
|
constexpr std::size_t KernelVirtualAddressSpaceWidth = 1ULL << 39;
|
||||||
constexpr std::size_t KernelPhysicalAddressSpaceWidth = 1ULL << 48;
|
constexpr std::size_t KernelPhysicalAddressSpaceWidth = 1ULL << 48;
|
||||||
|
|
||||||
@ -40,7 +41,7 @@ constexpr std::size_t KernelVirtualAddressSpaceLast = KernelVirtualAddressSpaceE
|
|||||||
constexpr std::size_t KernelVirtualAddressSpaceSize =
|
constexpr std::size_t KernelVirtualAddressSpaceSize =
|
||||||
KernelVirtualAddressSpaceEnd - KernelVirtualAddressSpaceBase;
|
KernelVirtualAddressSpaceEnd - KernelVirtualAddressSpaceBase;
|
||||||
constexpr std::size_t KernelVirtualAddressCodeBase = KernelVirtualAddressSpaceBase;
|
constexpr std::size_t KernelVirtualAddressCodeBase = KernelVirtualAddressSpaceBase;
|
||||||
constexpr std::size_t KernelVirtualAddressCodeSize = 0x62000;
|
constexpr std::size_t KernelVirtualAddressCodeSize = 392_KiB;
|
||||||
constexpr std::size_t KernelVirtualAddressCodeEnd =
|
constexpr std::size_t KernelVirtualAddressCodeEnd =
|
||||||
KernelVirtualAddressCodeBase + KernelVirtualAddressCodeSize;
|
KernelVirtualAddressCodeBase + KernelVirtualAddressCodeSize;
|
||||||
|
|
||||||
@ -53,14 +54,14 @@ constexpr std::size_t KernelPhysicalAddressSpaceSize =
|
|||||||
constexpr std::size_t KernelPhysicalAddressCodeBase = DramPhysicalAddress + ReservedEarlyDramSize;
|
constexpr std::size_t KernelPhysicalAddressCodeBase = DramPhysicalAddress + ReservedEarlyDramSize;
|
||||||
|
|
||||||
constexpr std::size_t KernelPageTableHeapSize = GetMaximumOverheadSize(MainMemorySizeMax);
|
constexpr std::size_t KernelPageTableHeapSize = GetMaximumOverheadSize(MainMemorySizeMax);
|
||||||
constexpr std::size_t KernelInitialPageHeapSize = Common::Size_128_KB;
|
constexpr std::size_t KernelInitialPageHeapSize = 128_KiB;
|
||||||
|
|
||||||
constexpr std::size_t KernelSlabHeapDataSize = Common::Size_5_MB;
|
constexpr std::size_t KernelSlabHeapDataSize = 5_MiB;
|
||||||
constexpr std::size_t KernelSlabHeapGapsSize = Common::Size_2_MB - Common::Size_64_KB;
|
constexpr std::size_t KernelSlabHeapGapsSize = 2_MiB - 64_KiB;
|
||||||
constexpr std::size_t KernelSlabHeapSize = KernelSlabHeapDataSize + KernelSlabHeapGapsSize;
|
constexpr std::size_t KernelSlabHeapSize = KernelSlabHeapDataSize + KernelSlabHeapGapsSize;
|
||||||
|
|
||||||
// NOTE: This is calculated from KThread slab counts, assuming KThread size <= 0x860.
|
// NOTE: This is calculated from KThread slab counts, assuming KThread size <= 0x860.
|
||||||
constexpr std::size_t KernelSlabHeapAdditionalSize = 0x68000ULL;
|
constexpr std::size_t KernelSlabHeapAdditionalSize = 416_KiB;
|
||||||
|
|
||||||
constexpr std::size_t KernelResourceSize =
|
constexpr std::size_t KernelResourceSize =
|
||||||
KernelPageTableHeapSize + KernelInitialPageHeapSize + KernelSlabHeapSize;
|
KernelPageTableHeapSize + KernelInitialPageHeapSize + KernelSlabHeapSize;
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
#include "common/alignment.h"
|
#include "common/alignment.h"
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
|
#include "common/literals.h"
|
||||||
#include "common/scope_exit.h"
|
#include "common/scope_exit.h"
|
||||||
#include "core/core.h"
|
#include "core/core.h"
|
||||||
#include "core/hle/kernel/k_address_space_info.h"
|
#include "core/hle/kernel/k_address_space_info.h"
|
||||||
@ -23,6 +24,8 @@ namespace Kernel {
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
using namespace Common::Literals;
|
||||||
|
|
||||||
constexpr std::size_t GetAddressSpaceWidthFromType(FileSys::ProgramAddressSpaceType as_type) {
|
constexpr std::size_t GetAddressSpaceWidthFromType(FileSys::ProgramAddressSpaceType as_type) {
|
||||||
switch (as_type) {
|
switch (as_type) {
|
||||||
case FileSys::ProgramAddressSpaceType::Is32Bit:
|
case FileSys::ProgramAddressSpaceType::Is32Bit:
|
||||||
@ -89,7 +92,7 @@ ResultCode KPageTable::InitializeForProcess(FileSys::ProgramAddressSpaceType as_
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set code regions and determine remaining
|
// Set code regions and determine remaining
|
||||||
constexpr std::size_t RegionAlignment{2 * 1024 * 1024};
|
constexpr std::size_t RegionAlignment{2_MiB};
|
||||||
VAddr process_code_start{};
|
VAddr process_code_start{};
|
||||||
VAddr process_code_end{};
|
VAddr process_code_end{};
|
||||||
std::size_t stack_region_size{};
|
std::size_t stack_region_size{};
|
||||||
|
@ -4,9 +4,13 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "common/common_funcs.h"
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
|
|
||||||
|
using namespace Common::Literals;
|
||||||
|
|
||||||
constexpr bool IsKTraceEnabled = false;
|
constexpr bool IsKTraceEnabled = false;
|
||||||
constexpr std::size_t KTraceBufferSize = IsKTraceEnabled ? 16 * 1024 * 1024 : 0;
|
constexpr std::size_t KTraceBufferSize = IsKTraceEnabled ? 16_MiB : 0;
|
||||||
|
|
||||||
} // namespace Kernel
|
} // namespace Kernel
|
||||||
|
@ -12,7 +12,6 @@
|
|||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
#include "common/common_sizes.h"
|
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
#include "common/microprofile.h"
|
#include "common/microprofile.h"
|
||||||
#include "common/thread.h"
|
#include "common/thread.h"
|
||||||
@ -180,7 +179,7 @@ struct KernelCore::Impl {
|
|||||||
system_resource_limit->Reserve(LimitableResource::PhysicalMemory, kernel_size);
|
system_resource_limit->Reserve(LimitableResource::PhysicalMemory, kernel_size);
|
||||||
|
|
||||||
// Reserve secure applet memory, introduced in firmware 5.0.0
|
// Reserve secure applet memory, introduced in firmware 5.0.0
|
||||||
constexpr u64 secure_applet_memory_size{Common::Size_4_MB};
|
constexpr u64 secure_applet_memory_size{4_MiB};
|
||||||
ASSERT(system_resource_limit->Reserve(LimitableResource::PhysicalMemory,
|
ASSERT(system_resource_limit->Reserve(LimitableResource::PhysicalMemory,
|
||||||
secure_applet_memory_size));
|
secure_applet_memory_size));
|
||||||
|
|
||||||
@ -320,8 +319,8 @@ struct KernelCore::Impl {
|
|||||||
const VAddr code_end_virt_addr = KernelVirtualAddressCodeEnd;
|
const VAddr code_end_virt_addr = KernelVirtualAddressCodeEnd;
|
||||||
|
|
||||||
// Setup the containing kernel region.
|
// Setup the containing kernel region.
|
||||||
constexpr size_t KernelRegionSize = Common::Size_1_GB;
|
constexpr size_t KernelRegionSize = 1_GiB;
|
||||||
constexpr size_t KernelRegionAlign = Common::Size_1_GB;
|
constexpr size_t KernelRegionAlign = 1_GiB;
|
||||||
constexpr VAddr kernel_region_start =
|
constexpr VAddr kernel_region_start =
|
||||||
Common::AlignDown(code_start_virt_addr, KernelRegionAlign);
|
Common::AlignDown(code_start_virt_addr, KernelRegionAlign);
|
||||||
size_t kernel_region_size = KernelRegionSize;
|
size_t kernel_region_size = KernelRegionSize;
|
||||||
@ -368,7 +367,7 @@ struct KernelCore::Impl {
|
|||||||
|
|
||||||
// Decide on the actual size for the misc region.
|
// Decide on the actual size for the misc region.
|
||||||
constexpr size_t MiscRegionAlign = KernelAslrAlignment;
|
constexpr size_t MiscRegionAlign = KernelAslrAlignment;
|
||||||
constexpr size_t MiscRegionMinimumSize = Common::Size_32_MB;
|
constexpr size_t MiscRegionMinimumSize = 32_MiB;
|
||||||
const size_t misc_region_size = Common::AlignUp(
|
const size_t misc_region_size = Common::AlignUp(
|
||||||
std::max(misc_region_needed_size, MiscRegionMinimumSize), MiscRegionAlign);
|
std::max(misc_region_needed_size, MiscRegionMinimumSize), MiscRegionAlign);
|
||||||
ASSERT(misc_region_size > 0);
|
ASSERT(misc_region_size > 0);
|
||||||
@ -381,7 +380,7 @@ struct KernelCore::Impl {
|
|||||||
misc_region_start, misc_region_size, KMemoryRegionType_KernelMisc));
|
misc_region_start, misc_region_size, KMemoryRegionType_KernelMisc));
|
||||||
|
|
||||||
// Setup the stack region.
|
// Setup the stack region.
|
||||||
constexpr size_t StackRegionSize = Common::Size_14_MB;
|
constexpr size_t StackRegionSize = 14_MiB;
|
||||||
constexpr size_t StackRegionAlign = KernelAslrAlignment;
|
constexpr size_t StackRegionAlign = KernelAslrAlignment;
|
||||||
const VAddr stack_region_start =
|
const VAddr stack_region_start =
|
||||||
memory_layout.GetVirtualMemoryRegionTree().GetRandomAlignedRegion(
|
memory_layout.GetVirtualMemoryRegionTree().GetRandomAlignedRegion(
|
||||||
@ -414,7 +413,7 @@ struct KernelCore::Impl {
|
|||||||
slab_region_start, slab_region_size, KMemoryRegionType_KernelSlab));
|
slab_region_start, slab_region_size, KMemoryRegionType_KernelSlab));
|
||||||
|
|
||||||
// Setup the temp region.
|
// Setup the temp region.
|
||||||
constexpr size_t TempRegionSize = Common::Size_128_MB;
|
constexpr size_t TempRegionSize = 128_MiB;
|
||||||
constexpr size_t TempRegionAlign = KernelAslrAlignment;
|
constexpr size_t TempRegionAlign = KernelAslrAlignment;
|
||||||
const VAddr temp_region_start =
|
const VAddr temp_region_start =
|
||||||
memory_layout.GetVirtualMemoryRegionTree().GetRandomAlignedRegion(
|
memory_layout.GetVirtualMemoryRegionTree().GetRandomAlignedRegion(
|
||||||
@ -470,7 +469,7 @@ struct KernelCore::Impl {
|
|||||||
// Determine size available for kernel page table heaps, requiring > 8 MB.
|
// Determine size available for kernel page table heaps, requiring > 8 MB.
|
||||||
const PAddr resource_end_phys_addr = slab_start_phys_addr + resource_region_size;
|
const PAddr resource_end_phys_addr = slab_start_phys_addr + resource_region_size;
|
||||||
const size_t page_table_heap_size = resource_end_phys_addr - slab_end_phys_addr;
|
const size_t page_table_heap_size = resource_end_phys_addr - slab_end_phys_addr;
|
||||||
ASSERT(page_table_heap_size / Common::Size_4_MB > 2);
|
ASSERT(page_table_heap_size / 4_MiB > 2);
|
||||||
|
|
||||||
// Insert a physical region for the kernel page table heap region
|
// Insert a physical region for the kernel page table heap region
|
||||||
ASSERT(memory_layout.GetPhysicalMemoryRegionTree().Insert(
|
ASSERT(memory_layout.GetPhysicalMemoryRegionTree().Insert(
|
||||||
@ -495,7 +494,7 @@ struct KernelCore::Impl {
|
|||||||
ASSERT(linear_extents.GetEndAddress() != 0);
|
ASSERT(linear_extents.GetEndAddress() != 0);
|
||||||
|
|
||||||
// Setup the linear mapping region.
|
// Setup the linear mapping region.
|
||||||
constexpr size_t LinearRegionAlign = Common::Size_1_GB;
|
constexpr size_t LinearRegionAlign = 1_GiB;
|
||||||
const PAddr aligned_linear_phys_start =
|
const PAddr aligned_linear_phys_start =
|
||||||
Common::AlignDown(linear_extents.GetAddress(), LinearRegionAlign);
|
Common::AlignDown(linear_extents.GetAddress(), LinearRegionAlign);
|
||||||
const size_t linear_region_size =
|
const size_t linear_region_size =
|
||||||
|
@ -117,7 +117,7 @@ AOC_U::AOC_U(Core::System& system_)
|
|||||||
{7, &AOC_U::PrepareAddOnContent, "PrepareAddOnContent"},
|
{7, &AOC_U::PrepareAddOnContent, "PrepareAddOnContent"},
|
||||||
{8, &AOC_U::GetAddOnContentListChangedEvent, "GetAddOnContentListChangedEvent"},
|
{8, &AOC_U::GetAddOnContentListChangedEvent, "GetAddOnContentListChangedEvent"},
|
||||||
{9, nullptr, "GetAddOnContentLostErrorCode"},
|
{9, nullptr, "GetAddOnContentLostErrorCode"},
|
||||||
{10, nullptr, "GetAddOnContentListChangedEventWithProcessId"},
|
{10, &AOC_U::GetAddOnContentListChangedEventWithProcessId, "GetAddOnContentListChangedEventWithProcessId"},
|
||||||
{100, &AOC_U::CreateEcPurchasedEventManager, "CreateEcPurchasedEventManager"},
|
{100, &AOC_U::CreateEcPurchasedEventManager, "CreateEcPurchasedEventManager"},
|
||||||
{101, &AOC_U::CreatePermanentEcPurchasedEventManager, "CreatePermanentEcPurchasedEventManager"},
|
{101, &AOC_U::CreatePermanentEcPurchasedEventManager, "CreatePermanentEcPurchasedEventManager"},
|
||||||
{110, nullptr, "CreateContentsServiceManager"},
|
{110, nullptr, "CreateContentsServiceManager"},
|
||||||
@ -257,6 +257,14 @@ void AOC_U::GetAddOnContentListChangedEvent(Kernel::HLERequestContext& ctx) {
|
|||||||
rb.PushCopyObjects(aoc_change_event.GetReadableEvent());
|
rb.PushCopyObjects(aoc_change_event.GetReadableEvent());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AOC_U::GetAddOnContentListChangedEventWithProcessId(Kernel::HLERequestContext& ctx) {
|
||||||
|
LOG_WARNING(Service_AOC, "(STUBBED) called");
|
||||||
|
|
||||||
|
IPC::ResponseBuilder rb{ctx, 2, 1};
|
||||||
|
rb.Push(ResultSuccess);
|
||||||
|
rb.PushCopyObjects(aoc_change_event.GetReadableEvent());
|
||||||
|
}
|
||||||
|
|
||||||
void AOC_U::CreateEcPurchasedEventManager(Kernel::HLERequestContext& ctx) {
|
void AOC_U::CreateEcPurchasedEventManager(Kernel::HLERequestContext& ctx) {
|
||||||
LOG_WARNING(Service_AOC, "(STUBBED) called");
|
LOG_WARNING(Service_AOC, "(STUBBED) called");
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@ private:
|
|||||||
void GetAddOnContentBaseId(Kernel::HLERequestContext& ctx);
|
void GetAddOnContentBaseId(Kernel::HLERequestContext& ctx);
|
||||||
void PrepareAddOnContent(Kernel::HLERequestContext& ctx);
|
void PrepareAddOnContent(Kernel::HLERequestContext& ctx);
|
||||||
void GetAddOnContentListChangedEvent(Kernel::HLERequestContext& ctx);
|
void GetAddOnContentListChangedEvent(Kernel::HLERequestContext& ctx);
|
||||||
|
void GetAddOnContentListChangedEventWithProcessId(Kernel::HLERequestContext& ctx);
|
||||||
void CreateEcPurchasedEventManager(Kernel::HLERequestContext& ctx);
|
void CreateEcPurchasedEventManager(Kernel::HLERequestContext& ctx);
|
||||||
void CreatePermanentEcPurchasedEventManager(Kernel::HLERequestContext& ctx);
|
void CreatePermanentEcPurchasedEventManager(Kernel::HLERequestContext& ctx);
|
||||||
|
|
||||||
|
@ -253,7 +253,11 @@ void HwOpus::GetWorkBufferSize(Kernel::HLERequestContext& ctx) {
|
|||||||
rb.Push<u32>(worker_buffer_sz);
|
rb.Push<u32>(worker_buffer_sz);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HwOpus::OpenOpusDecoder(Kernel::HLERequestContext& ctx) {
|
void HwOpus::GetWorkBufferSizeEx(Kernel::HLERequestContext& ctx) {
|
||||||
|
GetWorkBufferSize(ctx);
|
||||||
|
}
|
||||||
|
|
||||||
|
void HwOpus::OpenHardwareOpusDecoder(Kernel::HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp{ctx};
|
IPC::RequestParser rp{ctx};
|
||||||
const auto sample_rate = rp.Pop<u32>();
|
const auto sample_rate = rp.Pop<u32>();
|
||||||
const auto channel_count = rp.Pop<u32>();
|
const auto channel_count = rp.Pop<u32>();
|
||||||
@ -291,14 +295,18 @@ void HwOpus::OpenOpusDecoder(Kernel::HLERequestContext& ctx) {
|
|||||||
system, OpusDecoderState{std::move(decoder), sample_rate, channel_count});
|
system, OpusDecoderState{std::move(decoder), sample_rate, channel_count});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HwOpus::OpenHardwareOpusDecoderEx(Kernel::HLERequestContext& ctx) {
|
||||||
|
OpenHardwareOpusDecoder(ctx);
|
||||||
|
}
|
||||||
|
|
||||||
HwOpus::HwOpus(Core::System& system_) : ServiceFramework{system_, "hwopus"} {
|
HwOpus::HwOpus(Core::System& system_) : ServiceFramework{system_, "hwopus"} {
|
||||||
static const FunctionInfo functions[] = {
|
static const FunctionInfo functions[] = {
|
||||||
{0, &HwOpus::OpenOpusDecoder, "OpenOpusDecoder"},
|
{0, &HwOpus::OpenHardwareOpusDecoder, "OpenHardwareOpusDecoder"},
|
||||||
{1, &HwOpus::GetWorkBufferSize, "GetWorkBufferSize"},
|
{1, &HwOpus::GetWorkBufferSize, "GetWorkBufferSize"},
|
||||||
{2, nullptr, "OpenOpusDecoderForMultiStream"},
|
{2, nullptr, "OpenOpusDecoderForMultiStream"},
|
||||||
{3, nullptr, "GetWorkBufferSizeForMultiStream"},
|
{3, nullptr, "GetWorkBufferSizeForMultiStream"},
|
||||||
{4, nullptr, "OpenHardwareOpusDecoderEx"},
|
{4, &HwOpus::OpenHardwareOpusDecoderEx, "OpenHardwareOpusDecoderEx"},
|
||||||
{5, nullptr, "GetWorkBufferSizeEx"},
|
{5, &HwOpus::GetWorkBufferSizeEx, "GetWorkBufferSizeEx"},
|
||||||
{6, nullptr, "OpenHardwareOpusDecoderForMultiStreamEx"},
|
{6, nullptr, "OpenHardwareOpusDecoderForMultiStreamEx"},
|
||||||
{7, nullptr, "GetWorkBufferSizeForMultiStreamEx"},
|
{7, nullptr, "GetWorkBufferSizeForMultiStreamEx"},
|
||||||
};
|
};
|
||||||
|
@ -18,8 +18,10 @@ public:
|
|||||||
~HwOpus() override;
|
~HwOpus() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void OpenOpusDecoder(Kernel::HLERequestContext& ctx);
|
void OpenHardwareOpusDecoder(Kernel::HLERequestContext& ctx);
|
||||||
|
void OpenHardwareOpusDecoderEx(Kernel::HLERequestContext& ctx);
|
||||||
void GetWorkBufferSize(Kernel::HLERequestContext& ctx);
|
void GetWorkBufferSize(Kernel::HLERequestContext& ctx);
|
||||||
|
void GetWorkBufferSizeEx(Kernel::HLERequestContext& ctx);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Service::Audio
|
} // namespace Service::Audio
|
||||||
|
@ -5,11 +5,13 @@
|
|||||||
#include <catch2/catch.hpp>
|
#include <catch2/catch.hpp>
|
||||||
|
|
||||||
#include "common/host_memory.h"
|
#include "common/host_memory.h"
|
||||||
|
#include "common/literals.h"
|
||||||
|
|
||||||
using Common::HostMemory;
|
using Common::HostMemory;
|
||||||
|
using namespace Common::Literals;
|
||||||
|
|
||||||
static constexpr size_t VIRTUAL_SIZE = 1ULL << 39;
|
static constexpr size_t VIRTUAL_SIZE = 1ULL << 39;
|
||||||
static constexpr size_t BACKING_SIZE = 4ULL * 1024 * 1024 * 1024;
|
static constexpr size_t BACKING_SIZE = 4_GiB;
|
||||||
|
|
||||||
TEST_CASE("HostMemory: Initialize and deinitialize", "[common]") {
|
TEST_CASE("HostMemory: Initialize and deinitialize", "[common]") {
|
||||||
{ HostMemory mem(BACKING_SIZE, VIRTUAL_SIZE); }
|
{ HostMemory mem(BACKING_SIZE, VIRTUAL_SIZE); }
|
||||||
|
@ -16,9 +16,9 @@
|
|||||||
|
|
||||||
#include <boost/container/small_vector.hpp>
|
#include <boost/container/small_vector.hpp>
|
||||||
|
|
||||||
#include "common/common_sizes.h"
|
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "common/div_ceil.h"
|
#include "common/div_ceil.h"
|
||||||
|
#include "common/literals.h"
|
||||||
#include "common/microprofile.h"
|
#include "common/microprofile.h"
|
||||||
#include "common/scope_exit.h"
|
#include "common/scope_exit.h"
|
||||||
#include "common/settings.h"
|
#include "common/settings.h"
|
||||||
@ -48,8 +48,11 @@ constexpr u32 NUM_COMPUTE_UNIFORM_BUFFERS = 8;
|
|||||||
constexpr u32 NUM_STORAGE_BUFFERS = 16;
|
constexpr u32 NUM_STORAGE_BUFFERS = 16;
|
||||||
constexpr u32 NUM_STAGES = 5;
|
constexpr u32 NUM_STAGES = 5;
|
||||||
|
|
||||||
|
using namespace Common::Literals;
|
||||||
|
|
||||||
template <typename P>
|
template <typename P>
|
||||||
class BufferCache {
|
class BufferCache {
|
||||||
|
|
||||||
// Page size for caching purposes.
|
// Page size for caching purposes.
|
||||||
// This is unrelated to the CPU page size and it can be changed as it seems optimal.
|
// This is unrelated to the CPU page size and it can be changed as it seems optimal.
|
||||||
static constexpr u32 PAGE_BITS = 16;
|
static constexpr u32 PAGE_BITS = 16;
|
||||||
@ -66,8 +69,8 @@ class BufferCache {
|
|||||||
|
|
||||||
static constexpr BufferId NULL_BUFFER_ID{0};
|
static constexpr BufferId NULL_BUFFER_ID{0};
|
||||||
|
|
||||||
static constexpr u64 EXPECTED_MEMORY = Common::Size_512_MB;
|
static constexpr u64 EXPECTED_MEMORY = 512_MiB;
|
||||||
static constexpr u64 CRITICAL_MEMORY = Common::Size_1_GB;
|
static constexpr u64 CRITICAL_MEMORY = 1_GiB;
|
||||||
|
|
||||||
using Maxwell = Tegra::Engines::Maxwell3D::Regs;
|
using Maxwell = Tegra::Engines::Maxwell3D::Regs;
|
||||||
|
|
||||||
@ -96,7 +99,7 @@ class BufferCache {
|
|||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static constexpr u32 DEFAULT_SKIP_CACHE_SIZE = 4096;
|
static constexpr u32 DEFAULT_SKIP_CACHE_SIZE = 4_KiB;
|
||||||
|
|
||||||
explicit BufferCache(VideoCore::RasterizerInterface& rasterizer_,
|
explicit BufferCache(VideoCore::RasterizerInterface& rasterizer_,
|
||||||
Tegra::Engines::Maxwell3D& maxwell3d_,
|
Tegra::Engines::Maxwell3D& maxwell3d_,
|
||||||
|
@ -12,12 +12,15 @@
|
|||||||
#include <glad/glad.h>
|
#include <glad/glad.h>
|
||||||
|
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
|
#include "common/literals.h"
|
||||||
#include "video_core/renderer_opengl/gl_resource_manager.h"
|
#include "video_core/renderer_opengl/gl_resource_manager.h"
|
||||||
|
|
||||||
namespace OpenGL {
|
namespace OpenGL {
|
||||||
|
|
||||||
|
using namespace Common::Literals;
|
||||||
|
|
||||||
class StreamBuffer {
|
class StreamBuffer {
|
||||||
static constexpr size_t STREAM_BUFFER_SIZE = 64 * 1024 * 1024;
|
static constexpr size_t STREAM_BUFFER_SIZE = 64_MiB;
|
||||||
static constexpr size_t NUM_SYNCS = 16;
|
static constexpr size_t NUM_SYNCS = 16;
|
||||||
static constexpr size_t REGION_SIZE = STREAM_BUFFER_SIZE / NUM_SYNCS;
|
static constexpr size_t REGION_SIZE = STREAM_BUFFER_SIZE / NUM_SYNCS;
|
||||||
static constexpr size_t MAX_ALIGNMENT = 256;
|
static constexpr size_t MAX_ALIGNMENT = 256;
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
#include "common/bit_util.h"
|
#include "common/bit_util.h"
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
|
#include "common/literals.h"
|
||||||
#include "video_core/renderer_vulkan/vk_scheduler.h"
|
#include "video_core/renderer_vulkan/vk_scheduler.h"
|
||||||
#include "video_core/renderer_vulkan/vk_staging_buffer_pool.h"
|
#include "video_core/renderer_vulkan/vk_staging_buffer_pool.h"
|
||||||
#include "video_core/vulkan_common/vulkan_device.h"
|
#include "video_core/vulkan_common/vulkan_device.h"
|
||||||
@ -19,12 +20,15 @@
|
|||||||
|
|
||||||
namespace Vulkan {
|
namespace Vulkan {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
using namespace Common::Literals;
|
||||||
|
|
||||||
// Maximum potential alignment of a Vulkan buffer
|
// Maximum potential alignment of a Vulkan buffer
|
||||||
constexpr VkDeviceSize MAX_ALIGNMENT = 256;
|
constexpr VkDeviceSize MAX_ALIGNMENT = 256;
|
||||||
// Maximum size to put elements in the stream buffer
|
// Maximum size to put elements in the stream buffer
|
||||||
constexpr VkDeviceSize MAX_STREAM_BUFFER_REQUEST_SIZE = 8 * 1024 * 1024;
|
constexpr VkDeviceSize MAX_STREAM_BUFFER_REQUEST_SIZE = 8_MiB;
|
||||||
// Stream buffer size in bytes
|
// Stream buffer size in bytes
|
||||||
constexpr VkDeviceSize STREAM_BUFFER_SIZE = 128 * 1024 * 1024;
|
constexpr VkDeviceSize STREAM_BUFFER_SIZE = 128_MiB;
|
||||||
constexpr VkDeviceSize REGION_SIZE = STREAM_BUFFER_SIZE / StagingBufferPool::NUM_SYNCS;
|
constexpr VkDeviceSize REGION_SIZE = STREAM_BUFFER_SIZE / StagingBufferPool::NUM_SYNCS;
|
||||||
|
|
||||||
constexpr VkMemoryPropertyFlags HOST_FLAGS =
|
constexpr VkMemoryPropertyFlags HOST_FLAGS =
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
#include "common/alignment.h"
|
#include "common/alignment.h"
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
|
#include "common/literals.h"
|
||||||
#include "video_core/renderer_vulkan/vk_scheduler.h"
|
#include "video_core/renderer_vulkan/vk_scheduler.h"
|
||||||
#include "video_core/renderer_vulkan/vk_stream_buffer.h"
|
#include "video_core/renderer_vulkan/vk_stream_buffer.h"
|
||||||
#include "video_core/vulkan_common/vulkan_device.h"
|
#include "video_core/vulkan_common/vulkan_device.h"
|
||||||
@ -19,6 +20,8 @@ namespace Vulkan {
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
using namespace Common::Literals;
|
||||||
|
|
||||||
constexpr VkBufferUsageFlags BUFFER_USAGE =
|
constexpr VkBufferUsageFlags BUFFER_USAGE =
|
||||||
VK_BUFFER_USAGE_VERTEX_BUFFER_BIT | VK_BUFFER_USAGE_INDEX_BUFFER_BIT |
|
VK_BUFFER_USAGE_VERTEX_BUFFER_BIT | VK_BUFFER_USAGE_INDEX_BUFFER_BIT |
|
||||||
VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT | VK_BUFFER_USAGE_STORAGE_BUFFER_BIT;
|
VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT | VK_BUFFER_USAGE_STORAGE_BUFFER_BIT;
|
||||||
@ -26,7 +29,7 @@ constexpr VkBufferUsageFlags BUFFER_USAGE =
|
|||||||
constexpr u64 WATCHES_INITIAL_RESERVE = 0x4000;
|
constexpr u64 WATCHES_INITIAL_RESERVE = 0x4000;
|
||||||
constexpr u64 WATCHES_RESERVE_CHUNK = 0x1000;
|
constexpr u64 WATCHES_RESERVE_CHUNK = 0x1000;
|
||||||
|
|
||||||
constexpr u64 PREFERRED_STREAM_BUFFER_SIZE = 256 * 1024 * 1024;
|
constexpr u64 PREFERRED_STREAM_BUFFER_SIZE = 256_MiB;
|
||||||
|
|
||||||
/// Find a memory type with the passed requirements
|
/// Find a memory type with the passed requirements
|
||||||
std::optional<u32> FindMemoryType(const VkPhysicalDeviceMemoryProperties& properties,
|
std::optional<u32> FindMemoryType(const VkPhysicalDeviceMemoryProperties& properties,
|
||||||
|
@ -20,9 +20,8 @@
|
|||||||
#include <boost/container/small_vector.hpp>
|
#include <boost/container/small_vector.hpp>
|
||||||
|
|
||||||
#include "common/alignment.h"
|
#include "common/alignment.h"
|
||||||
#include "common/common_funcs.h"
|
|
||||||
#include "common/common_sizes.h"
|
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
|
#include "common/literals.h"
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
#include "common/settings.h"
|
#include "common/settings.h"
|
||||||
#include "video_core/compatible_formats.h"
|
#include "video_core/compatible_formats.h"
|
||||||
@ -60,6 +59,7 @@ using VideoCore::Surface::PixelFormat;
|
|||||||
using VideoCore::Surface::PixelFormatFromDepthFormat;
|
using VideoCore::Surface::PixelFormatFromDepthFormat;
|
||||||
using VideoCore::Surface::PixelFormatFromRenderTargetFormat;
|
using VideoCore::Surface::PixelFormatFromRenderTargetFormat;
|
||||||
using VideoCore::Surface::SurfaceType;
|
using VideoCore::Surface::SurfaceType;
|
||||||
|
using namespace Common::Literals;
|
||||||
|
|
||||||
template <class P>
|
template <class P>
|
||||||
class TextureCache {
|
class TextureCache {
|
||||||
@ -80,8 +80,8 @@ class TextureCache {
|
|||||||
/// Sampler ID for bugged sampler ids
|
/// Sampler ID for bugged sampler ids
|
||||||
static constexpr SamplerId NULL_SAMPLER_ID{0};
|
static constexpr SamplerId NULL_SAMPLER_ID{0};
|
||||||
|
|
||||||
static constexpr u64 DEFAULT_EXPECTED_MEMORY = Common::Size_1_GB;
|
static constexpr u64 DEFAULT_EXPECTED_MEMORY = 1_GiB;
|
||||||
static constexpr u64 DEFAULT_CRITICAL_MEMORY = Common::Size_2_GB;
|
static constexpr u64 DEFAULT_CRITICAL_MEMORY = 2_GiB;
|
||||||
|
|
||||||
using Runtime = typename P::Runtime;
|
using Runtime = typename P::Runtime;
|
||||||
using Image = typename P::Image;
|
using Image = typename P::Image;
|
||||||
@ -436,8 +436,8 @@ TextureCache<P>::TextureCache(Runtime& runtime_, VideoCore::RasterizerInterface&
|
|||||||
minimum_memory = 0;
|
minimum_memory = 0;
|
||||||
} else {
|
} else {
|
||||||
// on OGL we can be more conservatives as the driver takes care.
|
// on OGL we can be more conservatives as the driver takes care.
|
||||||
expected_memory = DEFAULT_EXPECTED_MEMORY + Common::Size_512_MB;
|
expected_memory = DEFAULT_EXPECTED_MEMORY + 512_MiB;
|
||||||
critical_memory = DEFAULT_CRITICAL_MEMORY + Common::Size_1_GB;
|
critical_memory = DEFAULT_CRITICAL_MEMORY + 1_GiB;
|
||||||
minimum_memory = expected_memory;
|
minimum_memory = expected_memory;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user