nvdata.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. // Copyright 2019 yuzu Emulator Project
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #pragma once
  5. #include <array>
  6. #include "common/bit_field.h"
  7. #include "common/common_types.h"
  8. namespace Service::Nvidia {
  9. constexpr u32 MaxSyncPoints = 192;
  10. constexpr u32 MaxNvEvents = 64;
  11. using DeviceFD = s32;
  12. constexpr DeviceFD INVALID_NVDRV_FD = -1;
  13. struct Fence {
  14. s32 id;
  15. u32 value;
  16. };
  17. static_assert(sizeof(Fence) == 8, "Fence has wrong size");
  18. struct MultiFence {
  19. u32 num_fences;
  20. std::array<Fence, 4> fences;
  21. };
  22. enum class NvResult : u32 {
  23. Success = 0x0,
  24. NotImplemented = 0x1,
  25. NotSupported = 0x2,
  26. NotInitialized = 0x3,
  27. BadParameter = 0x4,
  28. Timeout = 0x5,
  29. InsufficientMemory = 0x6,
  30. ReadOnlyAttribute = 0x7,
  31. InvalidState = 0x8,
  32. InvalidAddress = 0x9,
  33. InvalidSize = 0xA,
  34. BadValue = 0xB,
  35. AlreadyAllocated = 0xD,
  36. Busy = 0xE,
  37. ResourceError = 0xF,
  38. CountMismatch = 0x10,
  39. OverFlow = 0x11,
  40. InsufficientTransferMemory = 0x1000,
  41. InsufficientVideoMemory = 0x10000,
  42. BadSurfaceColorScheme = 0x10001,
  43. InvalidSurface = 0x10002,
  44. SurfaceNotSupported = 0x10003,
  45. DispInitFailed = 0x20000,
  46. DispAlreadyAttached = 0x20001,
  47. DispTooManyDisplays = 0x20002,
  48. DispNoDisplaysAttached = 0x20003,
  49. DispModeNotSupported = 0x20004,
  50. DispNotFound = 0x20005,
  51. DispAttachDissallowed = 0x20006,
  52. DispTypeNotSupported = 0x20007,
  53. DispAuthenticationFailed = 0x20008,
  54. DispNotAttached = 0x20009,
  55. DispSamePwrState = 0x2000A,
  56. DispEdidFailure = 0x2000B,
  57. DispDsiReadAckError = 0x2000C,
  58. DispDsiReadInvalidResp = 0x2000D,
  59. FileWriteFailed = 0x30000,
  60. FileReadFailed = 0x30001,
  61. EndOfFile = 0x30002,
  62. FileOperationFailed = 0x30003,
  63. DirOperationFailed = 0x30004,
  64. EndOfDirList = 0x30005,
  65. ConfigVarNotFound = 0x30006,
  66. InvalidConfigVar = 0x30007,
  67. LibraryNotFound = 0x30008,
  68. SymbolNotFound = 0x30009,
  69. MemoryMapFailed = 0x3000A,
  70. IoctlFailed = 0x3000F,
  71. AccessDenied = 0x30010,
  72. DeviceNotFound = 0x30011,
  73. KernelDriverNotFound = 0x30012,
  74. FileNotFound = 0x30013,
  75. PathAlreadyExists = 0x30014,
  76. ModuleNotPresent = 0xA000E,
  77. };
  78. enum class EventState {
  79. Free = 0,
  80. Registered = 1,
  81. Waiting = 2,
  82. Busy = 3,
  83. };
  84. union Ioctl {
  85. u32_le raw;
  86. BitField<0, 8, u32> cmd;
  87. BitField<8, 8, u32> group;
  88. BitField<16, 14, u32> length;
  89. BitField<30, 1, u32> is_in;
  90. BitField<31, 1, u32> is_out;
  91. };
  92. } // namespace Service::Nvidia