mirror of
https://git.suyu.dev/suyu/suyu
synced 2026-05-01 23:52:52 +00:00
audio: rewrite IAudioRendererManager
This commit is contained in:
@@ -8,13 +8,13 @@
|
||||
|
||||
namespace AudioCore::Renderer {
|
||||
|
||||
PoolMapper::PoolMapper(u32 process_handle_, bool force_map_)
|
||||
PoolMapper::PoolMapper(Kernel::KProcess* process_handle_, bool force_map_)
|
||||
: process_handle{process_handle_}, force_map{force_map_} {}
|
||||
|
||||
PoolMapper::PoolMapper(u32 process_handle_, std::span<MemoryPoolInfo> pool_infos_, u32 pool_count_,
|
||||
bool force_map_)
|
||||
: process_handle{process_handle_}, pool_infos{pool_infos_.data()},
|
||||
pool_count{pool_count_}, force_map{force_map_} {}
|
||||
PoolMapper::PoolMapper(Kernel::KProcess* process_handle_, std::span<MemoryPoolInfo> pool_infos_,
|
||||
u32 pool_count_, bool force_map_)
|
||||
: process_handle{process_handle_}, pool_infos{pool_infos_.data()}, pool_count{pool_count_},
|
||||
force_map{force_map_} {}
|
||||
|
||||
void PoolMapper::ClearUseState(std::span<MemoryPoolInfo> pools, const u32 count) {
|
||||
for (u32 i = 0; i < count; i++) {
|
||||
@@ -106,15 +106,17 @@ bool PoolMapper::IsForceMapEnabled() const {
|
||||
return force_map;
|
||||
}
|
||||
|
||||
u32 PoolMapper::GetProcessHandle(const MemoryPoolInfo* pool) const {
|
||||
Kernel::KProcess* PoolMapper::GetProcessHandle(const MemoryPoolInfo* pool) const {
|
||||
switch (pool->GetLocation()) {
|
||||
case MemoryPoolInfo::Location::CPU:
|
||||
return process_handle;
|
||||
case MemoryPoolInfo::Location::DSP:
|
||||
return Kernel::Svc::CurrentProcess;
|
||||
// return Kernel::Svc::CurrentProcess;
|
||||
return nullptr;
|
||||
}
|
||||
LOG_WARNING(Service_Audio, "Invalid MemoryPoolInfo location!");
|
||||
return Kernel::Svc::CurrentProcess;
|
||||
// return Kernel::Svc::CurrentProcess;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool PoolMapper::Map([[maybe_unused]] const u32 handle, [[maybe_unused]] const CpuAddr cpu_addr,
|
||||
@@ -147,14 +149,14 @@ bool PoolMapper::Unmap([[maybe_unused]] const u32 handle, [[maybe_unused]] const
|
||||
}
|
||||
|
||||
bool PoolMapper::Unmap(MemoryPoolInfo& pool) const {
|
||||
[[maybe_unused]] u32 handle{0};
|
||||
[[maybe_unused]] Kernel::KProcess* handle{};
|
||||
|
||||
switch (pool.GetLocation()) {
|
||||
case MemoryPoolInfo::Location::CPU:
|
||||
handle = process_handle;
|
||||
break;
|
||||
case MemoryPoolInfo::Location::DSP:
|
||||
handle = Kernel::Svc::CurrentProcess;
|
||||
// handle = Kernel::Svc::CurrentProcess;
|
||||
break;
|
||||
}
|
||||
// nn::audio::dsp::UnmapUserPointer(handle, pool->cpu_address, pool->size);
|
||||
|
||||
@@ -10,6 +10,10 @@
|
||||
#include "common/common_types.h"
|
||||
#include "core/hle/service/audio/errors.h"
|
||||
|
||||
namespace Kernel {
|
||||
class KProcess;
|
||||
}
|
||||
|
||||
namespace AudioCore::Renderer {
|
||||
class AddressInfo;
|
||||
|
||||
@@ -18,9 +22,9 @@ class AddressInfo;
|
||||
*/
|
||||
class PoolMapper {
|
||||
public:
|
||||
explicit PoolMapper(u32 process_handle, bool force_map);
|
||||
explicit PoolMapper(u32 process_handle, std::span<MemoryPoolInfo> pool_infos, u32 pool_count,
|
||||
bool force_map);
|
||||
explicit PoolMapper(Kernel::KProcess* process_handle, bool force_map);
|
||||
explicit PoolMapper(Kernel::KProcess* process_handle, std::span<MemoryPoolInfo> pool_infos,
|
||||
u32 pool_count, bool force_map);
|
||||
|
||||
/**
|
||||
* Clear the usage state for all given pools.
|
||||
@@ -98,7 +102,7 @@ public:
|
||||
* @return CurrentProcessHandle if location == DSP,
|
||||
* the PoolMapper's process_handle if location == CPU
|
||||
*/
|
||||
u32 GetProcessHandle(const MemoryPoolInfo* pool) const;
|
||||
Kernel::KProcess* GetProcessHandle(const MemoryPoolInfo* pool) const;
|
||||
|
||||
/**
|
||||
* Map the given region with the given handle. This is a no-op.
|
||||
@@ -167,7 +171,7 @@ public:
|
||||
|
||||
private:
|
||||
/// Process handle for this mapper, used when location == CPU
|
||||
u32 process_handle;
|
||||
Kernel::KProcess* process_handle{};
|
||||
/// List of memory pools assigned to this mapper
|
||||
MemoryPoolInfo* pool_infos{};
|
||||
/// The number of pools
|
||||
|
||||
Reference in New Issue
Block a user