Skip to content

Commit 75015e1

Browse files
author
N3xoX1
committed
os: remove including files from yuzu_video_core inside of nxemu-os
1 parent 8337c96 commit 75015e1

6 files changed

Lines changed: 108 additions & 20 deletions

File tree

src/nxemu-os/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@
1515
#include "core/hle/service/nvdrv/devices/nvhost_as_gpu.h"
1616
#include "core/hle/service/nvdrv/devices/nvhost_gpu.h"
1717
#include "core/hle/service/nvdrv/nvdrv.h"
18-
#include "yuzu_video_core/control/channel_state.h"
19-
#include "yuzu_video_core/gpu.h"
20-
#include "yuzu_video_core/memory_manager.h"
21-
#include "yuzu_video_core/rasterizer_interface.h"
2218

2319
namespace Service::Nvidia::Devices {
2420

@@ -172,8 +168,7 @@ NvResult nvhost_as_gpu::UnmapBuffer(IoctlUnmapBuffer& params) {
172168
NvResult nvhost_as_gpu::BindChannel(IoctlBindChannel& params) {
173169
LOG_DEBUG(Service_NVDRV, "called, fd={:X}", params.fd);
174170

175-
auto gpu_channel_device = module.GetDevice<nvhost_gpu>(params.fd);
176-
gpu_channel_device->channel_state->memory_manager = gmmu;
171+
UNIMPLEMENTED();
177172
return NvResult::Success;
178173
}
179174

src/nxemu-os/core/hle/service/nvdrv/devices/nvhost_gpu.cpp

Lines changed: 63 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,70 @@
1313
#include "core/hle/service/nvdrv/devices/nvhost_gpu.h"
1414
#include "core/hle/service/nvdrv/nvdrv.h"
1515
#include "core/memory.h"
16-
#include "yuzu_video_core/control/channel_state.h"
17-
#include "yuzu_video_core/engines/puller.h"
18-
#include "yuzu_video_core/gpu.h"
19-
#include "yuzu_video_core/host1x/host1x.h"
16+
17+
namespace Tegra {
18+
19+
// Note that, traditionally, methods are treated as 4-byte addressable locations, and hence
20+
// their numbers are written down multiplied by 4 in Docs. Here we are not multiply by 4.
21+
// So the values you see in docs might be multiplied by 4.
22+
// Register documentation:
23+
// https://github.com/NVIDIA/open-gpu-doc/blob/ab27fc22db5de0d02a4cabe08e555663b62db4d4/classes/host/cla26f.h
24+
//
25+
// Register Description (approx):
26+
// https://github.com/NVIDIA/open-gpu-doc/blob/ab27fc22db5de0d02a4cabe08e555663b62db4d4/manuals/volta/gv100/dev_pbdma.ref.txt
27+
enum class BufferMethods : u32 {
28+
BindObject = 0x0,
29+
Illegal = 0x1,
30+
Nop = 0x2,
31+
SemaphoreAddressHigh = 0x4,
32+
SemaphoreAddressLow = 0x5,
33+
SemaphoreSequencePayload = 0x6,
34+
SemaphoreOperation = 0x7,
35+
NonStallInterrupt = 0x8,
36+
WrcacheFlush = 0x9,
37+
MemOpA = 0xA,
38+
MemOpB = 0xB,
39+
MemOpC = 0xC,
40+
MemOpD = 0xD,
41+
RefCnt = 0x14,
42+
SemaphoreAcquire = 0x1A,
43+
SemaphoreRelease = 0x1B,
44+
SyncpointPayload = 0x1C,
45+
SyncpointOperation = 0x1D,
46+
WaitForIdle = 0x1E,
47+
CRCCheck = 0x1F,
48+
Yield = 0x20,
49+
NonPullerMethods = 0x40,
50+
};
51+
52+
inline CommandHeader BuildCommandHeader(BufferMethods method, u32 arg_count, SubmissionMode mode) {
53+
CommandHeader result{};
54+
result.method.Assign(static_cast<u32>(method));
55+
result.arg_count.Assign(arg_count);
56+
result.mode.Assign(mode);
57+
return result;
58+
}
59+
} // namespace Tegra
60+
61+
namespace Tegra::Engines {
62+
63+
enum class FenceOperation : u32 {
64+
Acquire = 0,
65+
Increment = 1,
66+
};
67+
68+
union FenceAction {
69+
u32 raw;
70+
BitField<0, 1, FenceOperation> op;
71+
BitField<8, 24, u32> syncpoint_id;
72+
};
73+
74+
} // namespace Tegra::Engines
2075

2176
namespace Service::Nvidia::Devices {
2277
namespace {
23-
Tegra::CommandHeader BuildFenceAction(Tegra::Engines::Puller::FenceOperation op, u32 syncpoint_id) {
24-
Tegra::Engines::Puller::FenceAction result{};
78+
Tegra::CommandHeader BuildFenceAction(Tegra::Engines::FenceOperation op, u32 syncpoint_id) {
79+
Tegra::Engines::FenceAction result{};
2580
result.op.Assign(op);
2681
result.syncpoint_id.Assign(syncpoint_id);
2782
return {result.raw};
@@ -189,7 +244,7 @@ static boost::container::small_vector<Tegra::CommandHeader, 512> BuildWaitComman
189244
{fence.value},
190245
Tegra::BuildCommandHeader(Tegra::BufferMethods::SyncpointOperation, 1,
191246
Tegra::SubmissionMode::Increasing),
192-
BuildFenceAction(Tegra::Engines::Puller::FenceOperation::Acquire, fence.id),
247+
BuildFenceAction(Tegra::Engines::FenceOperation::Acquire, fence.id),
193248
};
194249
}
195250

@@ -204,7 +259,7 @@ static boost::container::small_vector<Tegra::CommandHeader, 512> BuildIncrementC
204259
result.push_back(Tegra::BuildCommandHeader(Tegra::BufferMethods::SyncpointOperation, 1,
205260
Tegra::SubmissionMode::Increasing));
206261
result.push_back(
207-
BuildFenceAction(Tegra::Engines::Puller::FenceOperation::Increment, fence.id));
262+
BuildFenceAction(Tegra::Engines::FenceOperation::Increment, fence.id));
208263
}
209264

210265
return result;

src/nxemu-os/core/hle/service/nvdrv/devices/nvhost_gpu.h

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
#pragma once
55

6+
#include <boost/container/small_vector.hpp>
67
#include <memory>
78
#include <vector>
89
#include "yuzu_common/bit_field.h"
@@ -12,12 +13,54 @@
1213
#include "yuzu_common/nvdata.h"
1314
#include "yuzu_common/swap.h"
1415
#include "core/hle/service/nvdrv/devices/nvdevice.h"
15-
#include "yuzu_video_core/dma_pusher.h"
1616

1717
namespace Tegra {
1818
namespace Control {
1919
struct ChannelState;
2020
}
21+
22+
enum class SubmissionMode : u32 {
23+
IncreasingOld = 0,
24+
Increasing = 1,
25+
NonIncreasingOld = 2,
26+
NonIncreasing = 3,
27+
Inline = 4,
28+
IncreaseOnce = 5
29+
};
30+
31+
union CommandHeader {
32+
u32 argument;
33+
BitField<0, 13, u32> method;
34+
BitField<0, 24, u32> method_count_;
35+
BitField<13, 3, u32> subchannel;
36+
BitField<16, 13, u32> arg_count;
37+
BitField<16, 13, u32> method_count;
38+
BitField<29, 3, SubmissionMode> mode;
39+
};
40+
static_assert(std::is_standard_layout_v<CommandHeader>, "CommandHeader is not standard layout");
41+
static_assert(sizeof(CommandHeader) == sizeof(u32), "CommandHeader has incorrect size!");
42+
43+
struct CommandListHeader {
44+
union {
45+
u64 raw;
46+
BitField<0, 40, GPUVAddr> addr;
47+
BitField<41, 1, u64> is_non_main;
48+
BitField<42, 21, u64> size;
49+
};
50+
};
51+
static_assert(sizeof(CommandListHeader) == sizeof(u64), "CommandListHeader is incorrect size");
52+
53+
struct CommandList final {
54+
CommandList() = default;
55+
explicit CommandList(std::size_t size) : command_lists(size) {}
56+
explicit CommandList(
57+
boost::container::small_vector<CommandHeader, 512>&& prefetch_command_list_)
58+
: prefetch_command_list{ std::move(prefetch_command_list_) } {
59+
}
60+
61+
boost::container::small_vector<CommandListHeader, 512> command_lists;
62+
boost::container::small_vector<CommandHeader, 512> prefetch_command_list;
63+
};
2164
} // namespace Tegra
2265

2366
namespace Service::Nvidia {

src/nxemu-os/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#include "core/hle/service/nvdrv/core/container.h"
88
#include "core/hle/service/nvdrv/devices/ioctl_serialization.h"
99
#include "core/hle/service/nvdrv/devices/nvhost_nvdec.h"
10-
#include "yuzu_video_core/renderer_base.h"
1110

1211
namespace Service::Nvidia::Devices {
1312

src/nxemu-os/core/hle/service/nvdrv/devices/nvhost_nvdec_common.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@
1414
#include "core/hle/service/nvdrv/core/syncpoint_manager.h"
1515
#include "core/hle/service/nvdrv/devices/nvhost_nvdec_common.h"
1616
#include "core/memory.h"
17-
#include "yuzu_video_core/host1x/host1x.h"
18-
#include "yuzu_video_core/memory_manager.h"
19-
#include "yuzu_video_core/renderer_base.h"
2017

2118
namespace Service::Nvidia::Devices {
2219

src/nxemu-os/core/hle/service/nvdrv/devices/nvhost_vic.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#include "core/hle/service/nvdrv/core/container.h"
88
#include "core/hle/service/nvdrv/devices/ioctl_serialization.h"
99
#include "core/hle/service/nvdrv/devices/nvhost_vic.h"
10-
#include "yuzu_video_core/renderer_base.h"
1110

1211
namespace Service::Nvidia::Devices {
1312

0 commit comments

Comments
 (0)