summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/hle/service/nvdrv/devices/nvhost_as_gpu.h')
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_as_gpu.h39
1 files changed, 24 insertions, 15 deletions
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.h b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.h
index 08035fa0e..d86a9cab6 100644
--- a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.h
+++ b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.h
@@ -16,6 +16,9 @@
namespace Service::Nvidia::Devices {
+constexpr u32 DEFAULT_BIG_PAGE_SIZE = 1 << 16;
+constexpr u32 DEFAULT_SMALL_PAGE_SIZE = 1 << 12;
+
class nvmap;
enum class AddressSpaceFlags : u32 {
@@ -30,11 +33,15 @@ public:
explicit nvhost_as_gpu(Core::System& system, std::shared_ptr<nvmap> nvmap_dev);
~nvhost_as_gpu() override;
- NvResult Ioctl1(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override;
- NvResult Ioctl2(Ioctl command, const std::vector<u8>& input,
+ NvResult Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
+ std::vector<u8>& output) override;
+ NvResult Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
const std::vector<u8>& inline_input, std::vector<u8>& output) override;
- NvResult Ioctl3(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output,
- std::vector<u8>& inline_output) override;
+ NvResult Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
+ std::vector<u8>& output, std::vector<u8>& inline_output) override;
+
+ void OnOpen(DeviceFD fd) override;
+ void OnClose(DeviceFD fd) override;
private:
class BufferMap final {
@@ -76,16 +83,16 @@ private:
bool is_allocated{};
};
- struct IoctlInitalizeEx {
- u32_le big_page_size{}; // depends on GPU's available_big_page_sizes; 0=default
- s32_le as_fd{}; // ignored; passes 0
- u32_le flags{}; // passes 0
- u32_le reserved{}; // ignored; passes 0
- u64_le unk0{};
- u64_le unk1{};
- u64_le unk2{};
+ struct IoctlAllocAsEx {
+ u32_le flags{}; // usually passes 1
+ s32_le as_fd{}; // ignored; passes 0
+ u32_le big_page_size{};
+ u32_le reserved{}; // ignored; passes 0
+ u64_le va_range_start{};
+ u64_le va_range_end{};
+ u64_le va_range_split{};
};
- static_assert(sizeof(IoctlInitalizeEx) == 40, "IoctlInitalizeEx is incorrect size");
+ static_assert(sizeof(IoctlAllocAsEx) == 40, "IoctlAllocAsEx is incorrect size");
struct IoctlAllocSpace {
u32_le pages{};
@@ -149,14 +156,16 @@ private:
u64_le buf_addr{}; // (contained output user ptr on linux, ignored)
u32_le buf_size{}; // forced to 2*sizeof(struct va_region)
u32_le reserved{};
- IoctlVaRegion regions[2]{};
+ IoctlVaRegion small{};
+ IoctlVaRegion big{};
};
static_assert(sizeof(IoctlGetVaRegions) == 16 + sizeof(IoctlVaRegion) * 2,
"IoctlGetVaRegions is incorrect size");
s32 channel{};
+ u32 big_page_size{DEFAULT_BIG_PAGE_SIZE};
- NvResult InitalizeEx(const std::vector<u8>& input, std::vector<u8>& output);
+ NvResult AllocAsEx(const std::vector<u8>& input, std::vector<u8>& output);
NvResult AllocateSpace(const std::vector<u8>& input, std::vector<u8>& output);
NvResult Remap(const std::vector<u8>& input, std::vector<u8>& output);
NvResult MapBufferEx(const std::vector<u8>& input, std::vector<u8>& output);