s/Host1X/Host1x/ as per Nvidia naming

This commit is contained in:
Billy Laws 2021-10-30 19:32:59 +01:00 committed by PixelyIon
parent dbfb1cfe20
commit ad900aba7a
11 changed files with 35 additions and 35 deletions

View File

@ -59,7 +59,7 @@ namespace skyline::service::hosbinder {
/** /**
* @brief Wait on all native fences in this Android fence till they're signalled * @brief Wait on all native fences in this Android fence till they're signalled
*/ */
void Wait(soc::host1x::Host1X &host1x) const { void Wait(soc::host1x::Host1x &host1x) const {
if (fenceCount > fences.size()) if (fenceCount > fences.size())
throw exception("Wait has larger fence count ({}) than storage size ({})", fenceCount, fences.size()); throw exception("Wait has larger fence count ({}) than storage size ({})", fenceCount, fences.size());
for (auto it{fences.begin()}, end{fences.begin() + fenceCount}; it < end; it++) for (auto it{fences.begin()}, end{fences.begin() + fenceCount}; it < end; it++)

View File

@ -17,12 +17,12 @@ namespace skyline::service::nvdrv::device::nvhost {
state = State::Signalled; state = State::Signalled;
} }
void Ctrl::SyncpointEvent::Cancel(soc::host1x::Host1X &host1x) { void Ctrl::SyncpointEvent::Cancel(soc::host1x::Host1x &host1x) {
host1x.syncpoints.at(fence.id).DeregisterWaiter(waiterHandle); host1x.syncpoints.at(fence.id).DeregisterWaiter(waiterHandle);
waiterHandle = {}; waiterHandle = {};
} }
void Ctrl::SyncpointEvent::RegisterWaiter(soc::host1x::Host1X &host1x, const Fence &pFence) { void Ctrl::SyncpointEvent::RegisterWaiter(soc::host1x::Host1x &host1x, const Fence &pFence) {
fence = pFence; fence = pFence;
state = State::Waiting; state = State::Waiting;
waiterHandle = host1x.syncpoints.at(fence.id).RegisterWaiter(fence.threshold, [this] { Signal(); }); waiterHandle = host1x.syncpoints.at(fence.id).RegisterWaiter(fence.threshold, [this] { Signal(); });

View File

@ -63,13 +63,13 @@ namespace skyline::service::nvdrv::device::nvhost {
* @brief Removes any wait requests on a syncpoint event and resets its state * @brief Removes any wait requests on a syncpoint event and resets its state
* @note Accesses to this function for a specific event should be locked * @note Accesses to this function for a specific event should be locked
*/ */
void Cancel(soc::host1x::Host1X &host1x); void Cancel(soc::host1x::Host1x &host1x);
/** /**
* @brief Asynchronously waits on a syncpoint event using the given fence * @brief Asynchronously waits on a syncpoint event using the given fence
* @note Accesses to this function for a specific event should be locked * @note Accesses to this function for a specific event should be locked
*/ */
void RegisterWaiter(soc::host1x::Host1X &host1x, const Fence &fence); void RegisterWaiter(soc::host1x::Host1x &host1x, const Fence &fence);
bool IsInUse(); bool IsInUse();
}; };

View File

@ -6,7 +6,7 @@
#include "host1x_channel.h" #include "host1x_channel.h"
namespace skyline::service::nvdrv::device::nvhost { namespace skyline::service::nvdrv::device::nvhost {
Host1XChannel::Host1XChannel(const DeviceState &state, Host1xChannel::Host1xChannel(const DeviceState &state,
Driver &driver, Driver &driver,
Core &core, Core &core,
const SessionContext &ctx, const SessionContext &ctx,
@ -16,12 +16,12 @@ namespace skyline::service::nvdrv::device::nvhost {
state.soc->host1x.channels[static_cast<size_t>(channelType)].Start(); state.soc->host1x.channels[static_cast<size_t>(channelType)].Start();
} }
PosixResult Host1XChannel::SetNvmapFd(In<FileDescriptor> fd) { PosixResult Host1xChannel::SetNvmapFd(In<FileDescriptor> fd) {
state.logger->Debug("fd: {}", fd); state.logger->Debug("fd: {}", fd);
return PosixResult::Success; return PosixResult::Success;
} }
PosixResult Host1XChannel::Submit(span<SubmitCmdBuf> cmdBufs, PosixResult Host1xChannel::Submit(span<SubmitCmdBuf> cmdBufs,
span<SubmitReloc> relocs, span<u32> relocShifts, span<SubmitReloc> relocs, span<u32> relocShifts,
span<SubmitSyncpointIncr> syncpointIncrs, span<u32> fenceThresholds) { span<SubmitSyncpointIncr> syncpointIncrs, span<u32> fenceThresholds) {
state.logger->Debug("numCmdBufs: {}, numRelocs: {}, numSyncpointIncrs: {}, numFenceThresholds: {}", state.logger->Debug("numCmdBufs: {}, numRelocs: {}, numSyncpointIncrs: {}, numFenceThresholds: {}",
@ -58,7 +58,7 @@ namespace skyline::service::nvdrv::device::nvhost {
return PosixResult::Success; return PosixResult::Success;
} }
PosixResult Host1XChannel::GetSyncpoint(In<u32> channelSyncpointIdx, Out<u32> syncpointId) { PosixResult Host1xChannel::GetSyncpoint(In<u32> channelSyncpointIdx, Out<u32> syncpointId) {
state.logger->Debug("channelSyncpointIdx: {}", channelSyncpointIdx); state.logger->Debug("channelSyncpointIdx: {}", channelSyncpointIdx);
if (channelSyncpointIdx > 0) if (channelSyncpointIdx > 0)
@ -73,18 +73,18 @@ namespace skyline::service::nvdrv::device::nvhost {
return PosixResult::Success; return PosixResult::Success;
} }
PosixResult Host1XChannel::GetWaitBase(In<core::ChannelType> pChannelType, Out<u32> waitBase) { PosixResult Host1xChannel::GetWaitBase(In<core::ChannelType> pChannelType, Out<u32> waitBase) {
state.logger->Debug("channelType: {}", static_cast<u32>(pChannelType)); state.logger->Debug("channelType: {}", static_cast<u32>(pChannelType));
waitBase = 0; waitBase = 0;
return PosixResult::Success; return PosixResult::Success;
} }
PosixResult Host1XChannel::SetSubmitTimeout(In<u32> timeout) { PosixResult Host1xChannel::SetSubmitTimeout(In<u32> timeout) {
state.logger->Debug("timeout: {}", timeout); state.logger->Debug("timeout: {}", timeout);
return PosixResult::Success; return PosixResult::Success;
} }
PosixResult Host1XChannel::MapBuffer(u8 compressed, span<BufferHandle> handles) { PosixResult Host1xChannel::MapBuffer(u8 compressed, span<BufferHandle> handles) {
state.logger->Debug("compressed: {}", compressed); state.logger->Debug("compressed: {}", compressed);
for (auto &bufferHandle : handles) { for (auto &bufferHandle : handles) {
@ -95,7 +95,7 @@ namespace skyline::service::nvdrv::device::nvhost {
return PosixResult::Success; return PosixResult::Success;
} }
PosixResult Host1XChannel::UnmapBuffer(u8 compressed, span<BufferHandle> handles) { PosixResult Host1xChannel::UnmapBuffer(u8 compressed, span<BufferHandle> handles) {
state.logger->Debug("compressed: {}", compressed); state.logger->Debug("compressed: {}", compressed);
for (auto &bufferHandle : handles) { for (auto &bufferHandle : handles) {
@ -106,27 +106,27 @@ namespace skyline::service::nvdrv::device::nvhost {
return PosixResult::Success; return PosixResult::Success;
} }
#include <services/nvdrv/devices/deserialisation/macro_def.inc> #include <services/nvdrv/devices/deserialisation/macro_def.inc>
static constexpr u32 Host1XChannelMagic{0x00}; static constexpr u32 Host1xChannelMagic{0x00};
static constexpr u32 GpuChannelMagic{0x48}; //!< Used for SetNvmapFd which is needed in both GPU and host1x channels static constexpr u32 GpuChannelMagic{0x48}; //!< Used for SetNvmapFd which is needed in both GPU and host1x channels
VARIABLE_IOCTL_HANDLER_FUNC(Host1XChannel, ({ VARIABLE_IOCTL_HANDLER_FUNC(Host1xChannel, ({
IOCTL_CASE_ARGS(IN, SIZE(0x4), MAGIC(GpuChannelMagic), FUNC(0x1), IOCTL_CASE_ARGS(IN, SIZE(0x4), MAGIC(GpuChannelMagic), FUNC(0x1),
SetNvmapFd, ARGS(In<FileDescriptor>)) SetNvmapFd, ARGS(In<FileDescriptor>))
IOCTL_CASE_ARGS(INOUT, SIZE(0x8), MAGIC(Host1XChannelMagic), FUNC(0x2), IOCTL_CASE_ARGS(INOUT, SIZE(0x8), MAGIC(Host1xChannelMagic), FUNC(0x2),
GetSyncpoint, ARGS(In<u32>, Out<u32>)) GetSyncpoint, ARGS(In<u32>, Out<u32>))
IOCTL_CASE_ARGS(INOUT, SIZE(0x8), MAGIC(Host1XChannelMagic), FUNC(0x3), IOCTL_CASE_ARGS(INOUT, SIZE(0x8), MAGIC(Host1xChannelMagic), FUNC(0x3),
GetWaitBase, ARGS(In<core::ChannelType>, Out<u32>)) GetWaitBase, ARGS(In<core::ChannelType>, Out<u32>))
IOCTL_CASE_ARGS(IN, SIZE(0x4), MAGIC(Host1XChannelMagic), FUNC(0x7), IOCTL_CASE_ARGS(IN, SIZE(0x4), MAGIC(Host1xChannelMagic), FUNC(0x7),
SetSubmitTimeout, ARGS(In<u32>)) SetSubmitTimeout, ARGS(In<u32>))
}), ({ }), ({
VARIABLE_IOCTL_CASE_ARGS(INOUT, MAGIC(Host1XChannelMagic), FUNC(0x1), VARIABLE_IOCTL_CASE_ARGS(INOUT, MAGIC(Host1xChannelMagic), FUNC(0x1),
Submit, ARGS(Save<u32, 0>, Save<u32, 1>, Save<u32, 2>, Save<u32, 3>, Submit, ARGS(Save<u32, 0>, Save<u32, 1>, Save<u32, 2>, Save<u32, 3>,
SlotSizeSpan<SubmitCmdBuf, 0>, SlotSizeSpan<SubmitCmdBuf, 0>,
SlotSizeSpan<SubmitReloc, 1>, SlotSizeSpan<u32, 1>, SlotSizeSpan<SubmitReloc, 1>, SlotSizeSpan<u32, 1>,
SlotSizeSpan<SubmitSyncpointIncr, 2>, SlotSizeSpan<u32, 3>)) SlotSizeSpan<SubmitSyncpointIncr, 2>, SlotSizeSpan<u32, 3>))
VARIABLE_IOCTL_CASE_ARGS(INOUT, MAGIC(Host1XChannelMagic), FUNC(0x9), VARIABLE_IOCTL_CASE_ARGS(INOUT, MAGIC(Host1xChannelMagic), FUNC(0x9),
MapBuffer, ARGS(Save<u32, 0>, Pad<u32>, In<u8>, Pad<u8, 3>, SlotSizeSpan<BufferHandle, 0>)) MapBuffer, ARGS(Save<u32, 0>, Pad<u32>, In<u8>, Pad<u8, 3>, SlotSizeSpan<BufferHandle, 0>))
VARIABLE_IOCTL_CASE_ARGS(INOUT, MAGIC(Host1XChannelMagic), FUNC(0xA), VARIABLE_IOCTL_CASE_ARGS(INOUT, MAGIC(Host1xChannelMagic), FUNC(0xA),
UnmapBuffer, ARGS(Save<u32, 0>, Pad<u32>, In<u8>, Pad<u8, 3>, SlotSizeSpan<BufferHandle, 0>)) UnmapBuffer, ARGS(Save<u32, 0>, Pad<u32>, In<u8>, Pad<u8, 3>, SlotSizeSpan<BufferHandle, 0>))
})) }))
#include <services/nvdrv/devices/deserialisation/macro_undef.inc> #include <services/nvdrv/devices/deserialisation/macro_undef.inc>

View File

@ -9,10 +9,10 @@
namespace skyline::service::nvdrv::device::nvhost { namespace skyline::service::nvdrv::device::nvhost {
/** /**
* @brief nvhost::Host1XChannel is used by applications to interface with host1x channels, such as VIC and NVDEC * @brief nvhost::Host1xChannel is used by applications to interface with host1x channels, such as VIC and NVDEC
* @url https://switchbrew.org/wiki/NV_services#Channels * @url https://switchbrew.org/wiki/NV_services#Channels
*/ */
class Host1XChannel : public NvDevice { class Host1xChannel : public NvDevice {
private: private:
core::ChannelType channelType; //!< The specific host1x channel that this instance refers to core::ChannelType channelType; //!< The specific host1x channel that this instance refers to
std::mutex channelMutex; //!< Synchronises submit operations std::mutex channelMutex; //!< Synchronises submit operations
@ -55,7 +55,7 @@ namespace skyline::service::nvdrv::device::nvhost {
u32 address; //!< The output IOVA that the handle was pinned too u32 address; //!< The output IOVA that the handle was pinned too
}; };
Host1XChannel(const DeviceState &state, Host1xChannel(const DeviceState &state,
Driver &driver, Driver &driver,
Core &core, Core &core,
const SessionContext &ctx, const SessionContext &ctx,

View File

@ -45,13 +45,13 @@ namespace skyline::service::nvdrv {
} }
if (ctx.perms.AccessJpeg) if (ctx.perms.AccessJpeg)
DEVICE_SWITCH(DEVICE_CASE("/dev/nvhost-nvjpg", nvhost::Host1XChannel, core::ChannelType::NvJpg)) DEVICE_SWITCH(DEVICE_CASE("/dev/nvhost-nvjpg", nvhost::Host1xChannel, core::ChannelType::NvJpg))
if (ctx.perms.AccessVic) if (ctx.perms.AccessVic)
DEVICE_SWITCH(DEVICE_CASE("/dev/nvhost-vic", nvhost::Host1XChannel, core::ChannelType::Vic)) DEVICE_SWITCH(DEVICE_CASE("/dev/nvhost-vic", nvhost::Host1xChannel, core::ChannelType::Vic))
if (ctx.perms.AccessVideoDecoder) if (ctx.perms.AccessVideoDecoder)
DEVICE_SWITCH(DEVICE_CASE("/dev/nvhost-nvdec", nvhost::Host1XChannel, core::ChannelType::NvDec)) DEVICE_SWITCH(DEVICE_CASE("/dev/nvhost-nvdec", nvhost::Host1xChannel, core::ChannelType::NvDec))
#undef DEVICE_CASE #undef DEVICE_CASE
#undef DEVICE_SWITCH #undef DEVICE_SWITCH

View File

@ -15,7 +15,7 @@ namespace skyline::soc {
class SOC { class SOC {
public: public:
SMMU smmu; SMMU smmu;
host1x::Host1X host1x; host1x::Host1x host1x;
SOC(const DeviceState &state) : host1x(state) {} SOC(const DeviceState &state) : host1x(state) {}
}; };

View File

@ -13,11 +13,11 @@ namespace skyline::soc::host1x {
* @brief An abstraction for the graphics host, this handles DMA on behalf of the CPU when communicating to it's clients alongside handling syncpts * @brief An abstraction for the graphics host, this handles DMA on behalf of the CPU when communicating to it's clients alongside handling syncpts
* @note This is different from the GM20B Host, it serves a similar function and has an interface for accessing host1x syncpts * @note This is different from the GM20B Host, it serves a similar function and has an interface for accessing host1x syncpts
*/ */
class Host1X { class Host1x {
public: public:
SyncpointSet syncpoints; SyncpointSet syncpoints;
std::array<ChannelCommandFifo, ChannelCount> channels; std::array<ChannelCommandFifo, ChannelCount> channels;
Host1X(const DeviceState &state) : channels{util::MakeFilledArray<ChannelCommandFifo, ChannelCount>(state, syncpoints)} {} Host1x(const DeviceState &state) : channels{util::MakeFilledArray<ChannelCommandFifo, ChannelCount>(state, syncpoints)} {}
}; };
} }

View File

@ -6,9 +6,9 @@
#include "host1x.h" #include "host1x.h"
namespace skyline::soc::host1x { namespace skyline::soc::host1x {
Host1XClass::Host1XClass(const DeviceState &state, SyncpointSet &syncpoints) : state(state), syncpoints(syncpoints) {} Host1xClass::Host1xClass(const DeviceState &state, SyncpointSet &syncpoints) : state(state), syncpoints(syncpoints) {}
void Host1XClass::CallMethod(u32 method, u32 argument) { void Host1xClass::CallMethod(u32 method, u32 argument) {
constexpr static u32 LoadSyncpointPayload32MethodId{0x4E}; //!< See '14.3.2.12 32-Bit Sync Point Comparison Methods' in TRM constexpr static u32 LoadSyncpointPayload32MethodId{0x4E}; //!< See '14.3.2.12 32-Bit Sync Point Comparison Methods' in TRM
constexpr static u32 WaitSyncpoint32MethodId{0x50}; //!< As above constexpr static u32 WaitSyncpoint32MethodId{0x50}; //!< As above

View File

@ -10,14 +10,14 @@ namespace skyline::soc::host1x {
/** /**
* @brief A class internal to Host1x, used for performing syncpoint waits and other general operations * @brief A class internal to Host1x, used for performing syncpoint waits and other general operations
*/ */
class Host1XClass { class Host1xClass {
private: private:
const DeviceState &state; const DeviceState &state;
SyncpointSet &syncpoints; SyncpointSet &syncpoints;
u32 syncpointPayload{}; //!< Holds the current payload for the 32-bit syncpoint comparison methods u32 syncpointPayload{}; //!< Holds the current payload for the 32-bit syncpoint comparison methods
public: public:
Host1XClass(const DeviceState &state, SyncpointSet &syncpoints); Host1xClass(const DeviceState &state, SyncpointSet &syncpoints);
void CallMethod(u32 method, u32 argument); void CallMethod(u32 method, u32 argument);
}; };

View File

@ -26,7 +26,7 @@ namespace skyline::soc::host1x {
std::thread thread; //!< The thread that manages processing of pushbuffers within gathers std::thread thread; //!< The thread that manages processing of pushbuffers within gathers
std::mutex threadStartMutex; //!< Protects the thread from being started multiple times std::mutex threadStartMutex; //!< Protects the thread from being started multiple times
Host1XClass host1XClass; //!< The internal Host1x class, used for performing syncpoint waits and other general operations Host1xClass host1XClass; //!< The internal Host1x class, used for performing syncpoint waits and other general operations
TegraHostInterface<NvDecClass> nvDecClass; //!< The THI wrapped NVDEC class for video decoding TegraHostInterface<NvDecClass> nvDecClass; //!< The THI wrapped NVDEC class for video decoding
TegraHostInterface<VicClass> vicClass; //!< The THI wrapped VIC class for acceleration of image operations TegraHostInterface<VicClass> vicClass; //!< The THI wrapped VIC class for acceleration of image operations