mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-11-23 07:49:16 +01:00
Add maxwell3d I2M support
This commit is contained in:
parent
8c73b62b2c
commit
ba7111d33a
@ -11,6 +11,7 @@ namespace skyline::soc::gm20b::engine::maxwell3d {
|
|||||||
: MacroEngineBase(macroState),
|
: MacroEngineBase(macroState),
|
||||||
syncpoints(state.soc->host1x.syncpoints),
|
syncpoints(state.soc->host1x.syncpoints),
|
||||||
context(*state.gpu, channelCtx, executor),
|
context(*state.gpu, channelCtx, executor),
|
||||||
|
i2m(channelCtx.asCtx),
|
||||||
channelCtx(channelCtx) {
|
channelCtx(channelCtx) {
|
||||||
InitializeRegisters();
|
InitializeRegisters();
|
||||||
}
|
}
|
||||||
@ -29,15 +30,15 @@ namespace skyline::soc::gm20b::engine::maxwell3d {
|
|||||||
HandleMethod(method, argument);
|
HandleMethod(method, argument);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Maxwell3D::HandleMethod(u32 method, u32 argument) {
|
#define MAXWELL3D_OFFSET(field) (sizeof(typeof(Registers::field)) - sizeof(std::remove_reference_t<decltype(*Registers::field)>)) / sizeof(u32)
|
||||||
#define MAXWELL3D_OFFSET(field) (sizeof(typeof(Registers::field)) - sizeof(std::remove_reference_t<decltype(*Registers::field)>)) / sizeof(u32)
|
#define MAXWELL3D_STRUCT_OFFSET(field, member) MAXWELL3D_OFFSET(field) + U32_OFFSET(std::remove_reference_t<decltype(*Registers::field)>, member)
|
||||||
#define MAXWELL3D_STRUCT_OFFSET(field, member) MAXWELL3D_OFFSET(field) + U32_OFFSET(std::remove_reference_t<decltype(*Registers::field)>, member)
|
#define MAXWELL3D_STRUCT_STRUCT_OFFSET(field, member, submember) MAXWELL3D_STRUCT_OFFSET(field, member) + U32_OFFSET(std::remove_reference_t<decltype(Registers::field->member)>, submember)
|
||||||
#define MAXWELL3D_STRUCT_STRUCT_OFFSET(field, member, submember) MAXWELL3D_STRUCT_OFFSET(field, member) + U32_OFFSET(std::remove_reference_t<decltype(Registers::field->member)>, submember)
|
#define MAXWELL3D_STRUCT_ARRAY_OFFSET(field, member, index) MAXWELL3D_STRUCT_OFFSET(field, member) + ((sizeof(std::remove_reference_t<decltype(Registers::field->member[0])>) / sizeof(u32)) * index)
|
||||||
#define MAXWELL3D_STRUCT_ARRAY_OFFSET(field, member, index) MAXWELL3D_STRUCT_OFFSET(field, member) + ((sizeof(std::remove_reference_t<decltype(Registers::field->member[0])>) / sizeof(u32)) * index)
|
#define MAXWELL3D_ARRAY_OFFSET(field, index) MAXWELL3D_OFFSET(field) + ((sizeof(std::remove_reference_t<decltype(Registers::field[0])>) / sizeof(u32)) * index)
|
||||||
#define MAXWELL3D_ARRAY_OFFSET(field, index) MAXWELL3D_OFFSET(field) + ((sizeof(std::remove_reference_t<decltype(Registers::field[0])>) / sizeof(u32)) * index)
|
#define MAXWELL3D_ARRAY_STRUCT_OFFSET(field, index, member) MAXWELL3D_ARRAY_OFFSET(field, index) + U32_OFFSET(std::remove_reference_t<decltype(Registers::field[0])>, member)
|
||||||
#define MAXWELL3D_ARRAY_STRUCT_OFFSET(field, index, member) MAXWELL3D_ARRAY_OFFSET(field, index) + U32_OFFSET(std::remove_reference_t<decltype(Registers::field[0])>, member)
|
#define MAXWELL3D_ARRAY_STRUCT_STRUCT_OFFSET(field, index, member, submember) MAXWELL3D_ARRAY_STRUCT_OFFSET(field, index, member) + U32_OFFSET(decltype(Registers::field[0].member), submember)
|
||||||
#define MAXWELL3D_ARRAY_STRUCT_STRUCT_OFFSET(field, index, member, submember) MAXWELL3D_ARRAY_STRUCT_OFFSET(field, index, member) + U32_OFFSET(decltype(Registers::field[0].member), submember)
|
|
||||||
|
|
||||||
|
void Maxwell3D::HandleMethod(u32 method, u32 argument) {
|
||||||
#define MAXWELL3D_CASE(field, content) case MAXWELL3D_OFFSET(field): { \
|
#define MAXWELL3D_CASE(field, content) case MAXWELL3D_OFFSET(field): { \
|
||||||
auto field{util::BitCast<std::remove_reference_t<decltype(*registers.field)>>(argument)}; \
|
auto field{util::BitCast<std::remove_reference_t<decltype(*registers.field)>>(argument)}; \
|
||||||
content \
|
content \
|
||||||
@ -598,6 +599,14 @@ namespace skyline::soc::gm20b::engine::maxwell3d {
|
|||||||
macroState.macroPositions[registers.mme->startAddressRamPointer++] = startAddressRamLoad;
|
macroState.macroPositions[registers.mme->startAddressRamPointer++] = startAddressRamLoad;
|
||||||
})
|
})
|
||||||
|
|
||||||
|
MAXWELL3D_STRUCT_CASE(i2m, launchDma, {
|
||||||
|
i2m.LaunchDma(*registers.i2m);
|
||||||
|
})
|
||||||
|
|
||||||
|
MAXWELL3D_STRUCT_CASE(i2m, loadInlineData, {
|
||||||
|
i2m.LoadInlineData(*registers.i2m, loadInlineData);
|
||||||
|
})
|
||||||
|
|
||||||
MAXWELL3D_CASE(syncpointAction, {
|
MAXWELL3D_CASE(syncpointAction, {
|
||||||
Logger::Debug("Increment syncpoint: {}", static_cast<u16>(syncpointAction.id));
|
Logger::Debug("Increment syncpoint: {}", static_cast<u16>(syncpointAction.id));
|
||||||
channelCtx.executor.Execute();
|
channelCtx.executor.Execute();
|
||||||
@ -676,13 +685,6 @@ namespace skyline::soc::gm20b::engine::maxwell3d {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef MAXWELL3D_OFFSET
|
|
||||||
#undef MAXWELL3D_STRUCT_OFFSET
|
|
||||||
#undef MAXWELL3D_STRUCT_ARRAY_OFFSET
|
|
||||||
#undef MAXWELL3D_ARRAY_OFFSET
|
|
||||||
#undef MAXWELL3D_ARRAY_STRUCT_OFFSET
|
|
||||||
#undef MAXWELL3D_ARRAY_STRUCT_STRUCT_OFFSET
|
|
||||||
|
|
||||||
#undef MAXWELL3D_CASE_BASE
|
#undef MAXWELL3D_CASE_BASE
|
||||||
#undef MAXWELL3D_CASE
|
#undef MAXWELL3D_CASE
|
||||||
#undef MAXWELL3D_STRUCT_CASE
|
#undef MAXWELL3D_STRUCT_CASE
|
||||||
@ -693,11 +695,25 @@ namespace skyline::soc::gm20b::engine::maxwell3d {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Maxwell3D::CallMethodBatchNonInc(u32 method, span<u32> arguments) {
|
void Maxwell3D::CallMethodBatchNonInc(u32 method, span<u32> arguments) {
|
||||||
for (u32 argument : arguments) {
|
switch (method) {
|
||||||
CallMethod(method, argument);
|
case MAXWELL3D_STRUCT_OFFSET(i2m, loadInlineData):
|
||||||
|
i2m.LoadInlineData(*registers.i2m, arguments);
|
||||||
|
return;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (u32 argument : arguments)
|
||||||
|
HandleMethod(method, argument);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#undef MAXWELL3D_OFFSET
|
||||||
|
#undef MAXWELL3D_STRUCT_OFFSET
|
||||||
|
#undef MAXWELL3D_STRUCT_ARRAY_OFFSET
|
||||||
|
#undef MAXWELL3D_ARRAY_OFFSET
|
||||||
|
#undef MAXWELL3D_ARRAY_STRUCT_OFFSET
|
||||||
|
#undef MAXWELL3D_ARRAY_STRUCT_STRUCT_OFFSET
|
||||||
|
|
||||||
void Maxwell3D::WriteSemaphoreResult(u64 result) {
|
void Maxwell3D::WriteSemaphoreResult(u64 result) {
|
||||||
struct FourWordResult {
|
struct FourWordResult {
|
||||||
u64 value;
|
u64 value;
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#include <gpu/interconnect/graphics_context.h>
|
#include <gpu/interconnect/graphics_context.h>
|
||||||
#include "engine.h"
|
#include "engine.h"
|
||||||
|
#include "inline2memory.h"
|
||||||
|
|
||||||
namespace skyline::soc::gm20b {
|
namespace skyline::soc::gm20b {
|
||||||
struct ChannelContext;
|
struct ChannelContext;
|
||||||
@ -19,6 +20,7 @@ namespace skyline::soc::gm20b::engine::maxwell3d {
|
|||||||
private:
|
private:
|
||||||
host1x::SyncpointSet &syncpoints;
|
host1x::SyncpointSet &syncpoints;
|
||||||
gpu::interconnect::GraphicsContext context;
|
gpu::interconnect::GraphicsContext context;
|
||||||
|
Inline2MemoryBackend i2m;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Calls the appropriate function corresponding to a certain method with the supplied argument
|
* @brief Calls the appropriate function corresponding to a certain method with the supplied argument
|
||||||
@ -56,6 +58,8 @@ namespace skyline::soc::gm20b::engine::maxwell3d {
|
|||||||
};
|
};
|
||||||
Register<0x45, MME> mme;
|
Register<0x45, MME> mme;
|
||||||
|
|
||||||
|
Register<0x60, Inline2MemoryBackend::RegisterState> i2m;
|
||||||
|
|
||||||
Register<0xB2, type::SyncpointAction> syncpointAction;
|
Register<0xB2, type::SyncpointAction> syncpointAction;
|
||||||
|
|
||||||
Register<0xDF, u32> rasterizerEnable;
|
Register<0xDF, u32> rasterizerEnable;
|
||||||
|
Loading…
Reference in New Issue
Block a user