Reserve host1x channel syncpoints

This commit is contained in:
Billy Laws 2021-10-24 16:14:22 +01:00 committed by PixelyIon
parent b0a5dab0f7
commit 5087d3dc2a
2 changed files with 28 additions and 0 deletions

View File

@ -15,6 +15,10 @@ namespace skyline::service::nvdrv::core {
// https://github.com/Jetson-TX1-AndroidTV/android_kernel_jetson_tx1_hdmi_primary/blob/8f74a72394efb871cb3f886a3de2998cd7ff2990/drivers/gpu/host1x/drm/dc.c#L660 // https://github.com/Jetson-TX1-AndroidTV/android_kernel_jetson_tx1_hdmi_primary/blob/8f74a72394efb871cb3f886a3de2998cd7ff2990/drivers/gpu/host1x/drm/dc.c#L660
ReserveSyncpoint(VBlank0SyncpointId, true); ReserveSyncpoint(VBlank0SyncpointId, true);
ReserveSyncpoint(VBlank1SyncpointId, true); ReserveSyncpoint(VBlank1SyncpointId, true);
for (u32 syncpointId : ChannelSyncpoints)
if (syncpointId)
ReserveSyncpoint(syncpointId, false);
} }
u32 SyncpointManager::ReserveSyncpoint(u32 id, bool clientManaged) { u32 SyncpointManager::ReserveSyncpoint(u32 id, bool clientManaged) {

View File

@ -8,6 +8,20 @@
#include <services/common/fence.h> #include <services/common/fence.h>
namespace skyline::service::nvdrv::core { namespace skyline::service::nvdrv::core {
/**
* @brief A unique ID for a specific channel type
*/
enum class ChannelType : u32 {
MsEnc = 0,
Vic = 1,
Gpu = 2,
NvDec = 3,
Display = 4,
NvJpg = 5,
TSec = 6,
Max = 7
};
/** /**
* @brief SyncpointManager handles allocating and accessing host1x syncpoints, these are cached versions of the HW syncpoints which are intermittently synced * @brief SyncpointManager handles allocating and accessing host1x syncpoints, these are cached versions of the HW syncpoints which are intermittently synced
* @note Refer to Chapter 14 of the Tegra X1 TRM for an exhaustive overview of them * @note Refer to Chapter 14 of the Tegra X1 TRM for an exhaustive overview of them
@ -39,6 +53,16 @@ namespace skyline::service::nvdrv::core {
u32 FindFreeSyncpoint(); u32 FindFreeSyncpoint();
public: public:
static constexpr std::array<u32, static_cast<u32>(ChannelType::Max)> ChannelSyncpoints{
0x0, // `MsEnc` is unimplemented
0xC, // `Vic`
0x0, // `Gpu` syncpoints are allocated per-channel instead
0x36, // `NvDec`
0x0, // `Display` is unimplemented
0x37, // `NvJpg`
0x0, // `TSec` is unimplemented
}; //!< Maps each channel ID to a constant syncpoint
SyncpointManager(const DeviceState &state); SyncpointManager(const DeviceState &state);
/** /**