diff options
| author | 2018-02-13 22:12:46 -0500 | |
|---|---|---|
| committer | 2018-02-14 22:57:54 -0500 | |
| commit | 8dee5663b3b2ae5dd1b5a4b9eeacf030caa0de9a (patch) | |
| tree | ccd2b68ceaf5cae472304344cca3ab156a512d14 /src | |
| parent | Merge pull request #188 from bunnei/refactor-buffer-descriptor (diff) | |
| download | yuzu-8dee5663b3b2ae5dd1b5a4b9eeacf030caa0de9a.tar.gz yuzu-8dee5663b3b2ae5dd1b5a4b9eeacf030caa0de9a.tar.xz yuzu-8dee5663b3b2ae5dd1b5a4b9eeacf030caa0de9a.zip | |
Vi: Properly write the BufferProducerFence object in the DequeueBuffer response parcel.
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/service/nvdrv/nvdrv.h | 7 | ||||
| -rw-r--r-- | src/core/hle/service/vi/vi.cpp | 39 |
2 files changed, 28 insertions, 18 deletions
diff --git a/src/core/hle/service/nvdrv/nvdrv.h b/src/core/hle/service/nvdrv/nvdrv.h index e44644624..6a55ff96d 100644 --- a/src/core/hle/service/nvdrv/nvdrv.h +++ b/src/core/hle/service/nvdrv/nvdrv.h | |||
| @@ -17,6 +17,13 @@ namespace Devices { | |||
| 17 | class nvdevice; | 17 | class nvdevice; |
| 18 | } | 18 | } |
| 19 | 19 | ||
| 20 | struct IoctlFence { | ||
| 21 | u32 id; | ||
| 22 | u32 value; | ||
| 23 | }; | ||
| 24 | |||
| 25 | static_assert(sizeof(IoctlFence) == 8, "IoctlFence has wrong size"); | ||
| 26 | |||
| 20 | class Module final { | 27 | class Module final { |
| 21 | public: | 28 | public: |
| 22 | Module(); | 29 | Module(); |
diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp index ff5005f71..9394a06a7 100644 --- a/src/core/hle/service/vi/vi.cpp +++ b/src/core/hle/service/vi/vi.cpp | |||
| @@ -8,6 +8,7 @@ | |||
| 8 | #include "common/scope_exit.h" | 8 | #include "common/scope_exit.h" |
| 9 | #include "core/core_timing.h" | 9 | #include "core/core_timing.h" |
| 10 | #include "core/hle/ipc_helpers.h" | 10 | #include "core/hle/ipc_helpers.h" |
| 11 | #include "core/hle/service/nvdrv/nvdrv.h" | ||
| 11 | #include "core/hle/service/nvflinger/buffer_queue.h" | 12 | #include "core/hle/service/nvflinger/buffer_queue.h" |
| 12 | #include "core/hle/service/vi/vi.h" | 13 | #include "core/hle/service/vi/vi.h" |
| 13 | #include "core/hle/service/vi/vi_m.h" | 14 | #include "core/hle/service/vi/vi_m.h" |
| @@ -86,6 +87,15 @@ public: | |||
| 86 | write_index = Common::AlignUp(write_index, 4); | 87 | write_index = Common::AlignUp(write_index, 4); |
| 87 | } | 88 | } |
| 88 | 89 | ||
| 90 | template <typename T> | ||
| 91 | void WriteObject(const T& val) { | ||
| 92 | u32_le size = static_cast<u32>(sizeof(val)); | ||
| 93 | Write(size); | ||
| 94 | // TODO(Subv): Support file descriptors. | ||
| 95 | Write<u32_le>(0); // Fd count. | ||
| 96 | Write(val); | ||
| 97 | } | ||
| 98 | |||
| 89 | void Deserialize() { | 99 | void Deserialize() { |
| 90 | Header header{}; | 100 | Header header{}; |
| 91 | std::memcpy(&header, buffer.data(), sizeof(Header)); | 101 | std::memcpy(&header, buffer.data(), sizeof(Header)); |
| @@ -262,10 +272,11 @@ public: | |||
| 262 | Data data; | 272 | Data data; |
| 263 | }; | 273 | }; |
| 264 | 274 | ||
| 265 | // TODO(bunnei): Remove this. When set to 1, games will think a fence is valid and boot further. | 275 | struct BufferProducerFence { |
| 266 | // This will break libnx and potentially other apps that more stringently check this. This is here | 276 | u32 is_valid; |
| 267 | // purely as a convenience, and should go away once we implement fences. | 277 | std::array<Nvidia::IoctlFence, 4> fences; |
| 268 | static constexpr u32 FENCE_HACK = 0; | 278 | }; |
| 279 | static_assert(sizeof(BufferProducerFence) == 36, "BufferProducerFence has wrong size"); | ||
| 269 | 280 | ||
| 270 | class IGBPDequeueBufferResponseParcel : public Parcel { | 281 | class IGBPDequeueBufferResponseParcel : public Parcel { |
| 271 | public: | 282 | public: |
| @@ -274,20 +285,12 @@ public: | |||
| 274 | 285 | ||
| 275 | protected: | 286 | protected: |
| 276 | void SerializeData() override { | 287 | void SerializeData() override { |
| 277 | // TODO(bunnei): Find out what this all means. Writing anything non-zero here breaks libnx. | 288 | // TODO(Subv): Find out how this Fence is used. |
| 278 | Write<u32>(0); | 289 | BufferProducerFence fence = {}; |
| 279 | Write<u32>(FENCE_HACK); | 290 | |
| 280 | Write<u32>(0); | 291 | Write(slot); |
| 281 | Write<u32>(0); | 292 | WriteObject(fence); |
| 282 | Write<u32>(0); | 293 | Write<u32_le>(0); |
| 283 | Write<u32>(0); | ||
| 284 | Write<u32>(0); | ||
| 285 | Write<u32>(0); | ||
| 286 | Write<u32>(0); | ||
| 287 | Write<u32>(0); | ||
| 288 | Write<u32>(0); | ||
| 289 | Write<u32>(0); | ||
| 290 | Write<u32>(0); | ||
| 291 | } | 294 | } |
| 292 | 295 | ||
| 293 | u32_le slot; | 296 | u32_le slot; |