summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Subv2018-02-13 22:12:46 -0500
committerGravatar Subv2018-02-14 22:57:54 -0500
commit8dee5663b3b2ae5dd1b5a4b9eeacf030caa0de9a (patch)
treeccd2b68ceaf5cae472304344cca3ab156a512d14 /src
parentMerge pull request #188 from bunnei/refactor-buffer-descriptor (diff)
downloadyuzu-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.h7
-rw-r--r--src/core/hle/service/vi/vi.cpp39
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 {
17class nvdevice; 17class nvdevice;
18} 18}
19 19
20struct IoctlFence {
21 u32 id;
22 u32 value;
23};
24
25static_assert(sizeof(IoctlFence) == 8, "IoctlFence has wrong size");
26
20class Module final { 27class Module final {
21public: 28public:
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. 275struct 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;
268static constexpr u32 FENCE_HACK = 0; 278};
279static_assert(sizeof(BufferProducerFence) == 36, "BufferProducerFence has wrong size");
269 280
270class IGBPDequeueBufferResponseParcel : public Parcel { 281class IGBPDequeueBufferResponseParcel : public Parcel {
271public: 282public:
@@ -274,20 +285,12 @@ public:
274 285
275protected: 286protected:
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;