summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp1
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp8
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_gpu.h2
-rw-r--r--src/core/hle/service/nvdrv/interface.cpp4
-rw-r--r--src/core/hle/service/nvflinger/buffer_queue.h2
-rw-r--r--src/core/hle/service/nvflinger/nvflinger.cpp16
-rw-r--r--src/video_core/gpu.cpp6
-rw-r--r--src/video_core/gpu_thread.cpp6
8 files changed, 22 insertions, 23 deletions
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp
index ffa6e75c7..a5a4f8c7b 100644
--- a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp
+++ b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp
@@ -174,6 +174,7 @@ u32 nvhost_ctrl::IocCtrlEventSignal(const std::vector<u8>& input, std::vector<u8
174 if (gpu.CancelSyncptInterrupt(events_interface.assigned_syncpt[event_id], 174 if (gpu.CancelSyncptInterrupt(events_interface.assigned_syncpt[event_id],
175 events_interface.assigned_value[event_id])) { 175 events_interface.assigned_value[event_id])) {
176 events_interface.LiberateEvent(event_id); 176 events_interface.LiberateEvent(event_id);
177 events_interface.events[event_id].writable->Signal();
177 } 178 }
178 } 179 }
179 return NvResult::Success; 180 return NvResult::Success;
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp b/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp
index b9e13fae9..241dac881 100644
--- a/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp
+++ b/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp
@@ -122,9 +122,9 @@ u32 nvhost_gpu::AllocGPFIFOEx2(const std::vector<u8>& input, std::vector<u8>& ou
122 params.unk3); 122 params.unk3);
123 123
124 auto& gpu = system.GPU(); 124 auto& gpu = system.GPU();
125 params.fence_out.id = channels; 125 params.fence_out.id = assigned_syncpoints;
126 params.fence_out.value = gpu.GetSyncpointValue(channels); 126 params.fence_out.value = gpu.GetSyncpointValue(assigned_syncpoints);
127 channels++; 127 assigned_syncpoints++;
128 std::memcpy(output.data(), &params, output.size()); 128 std::memcpy(output.data(), &params, output.size());
129 return 0; 129 return 0;
130} 130}
@@ -169,8 +169,6 @@ u32 nvhost_gpu::SubmitGPFIFO(const std::vector<u8>& input, std::vector<u8>& outp
169 } 169 }
170 gpu.PushGPUEntries(std::move(entries)); 170 gpu.PushGPUEntries(std::move(entries));
171 171
172 // TODO(Blinkhawk): Figure how thoios fence is set
173 // params.fence_out.value = 0;
174 std::memcpy(output.data(), &params, sizeof(IoctlSubmitGpfifo)); 172 std::memcpy(output.data(), &params, sizeof(IoctlSubmitGpfifo));
175 return 0; 173 return 0;
176} 174}
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_gpu.h b/src/core/hle/service/nvdrv/devices/nvhost_gpu.h
index edc37ff3a..3ad8e1db1 100644
--- a/src/core/hle/service/nvdrv/devices/nvhost_gpu.h
+++ b/src/core/hle/service/nvdrv/devices/nvhost_gpu.h
@@ -191,7 +191,7 @@ private:
191 u32 ChannelSetTimeout(const std::vector<u8>& input, std::vector<u8>& output); 191 u32 ChannelSetTimeout(const std::vector<u8>& input, std::vector<u8>& output);
192 192
193 std::shared_ptr<nvmap> nvmap_dev; 193 std::shared_ptr<nvmap> nvmap_dev;
194 u32 channels{}; 194 u32 assigned_syncpoints{};
195}; 195};
196 196
197} // namespace Service::Nvidia::Devices 197} // namespace Service::Nvidia::Devices
diff --git a/src/core/hle/service/nvdrv/interface.cpp b/src/core/hle/service/nvdrv/interface.cpp
index 45912153d..6f7c7502a 100644
--- a/src/core/hle/service/nvdrv/interface.cpp
+++ b/src/core/hle/service/nvdrv/interface.cpp
@@ -57,8 +57,8 @@ void NVDRV::Ioctl(Kernel::HLERequestContext& ctx) {
57 ctrl.fresh_call = false; 57 ctrl.fresh_call = false;
58 ctx.SleepClientThread( 58 ctx.SleepClientThread(
59 "NVServices::DelayedResponse", ctrl.timeout, 59 "NVServices::DelayedResponse", ctrl.timeout,
60 [this, ctrl = ctrl](Kernel::SharedPtr<Kernel::Thread> thread, Kernel::HLERequestContext& ctx, 60 [this, ctrl = ctrl](Kernel::SharedPtr<Kernel::Thread> thread,
61 Kernel::ThreadWakeupReason reason) { 61 Kernel::HLERequestContext& ctx, Kernel::ThreadWakeupReason reason) {
62 IPC::RequestParser rp{ctx}; 62 IPC::RequestParser rp{ctx};
63 u32 fd = rp.Pop<u32>(); 63 u32 fd = rp.Pop<u32>();
64 u32 command = rp.Pop<u32>(); 64 u32 command = rp.Pop<u32>();
diff --git a/src/core/hle/service/nvflinger/buffer_queue.h b/src/core/hle/service/nvflinger/buffer_queue.h
index be993ee61..356bedb81 100644
--- a/src/core/hle/service/nvflinger/buffer_queue.h
+++ b/src/core/hle/service/nvflinger/buffer_queue.h
@@ -4,9 +4,9 @@
4 4
5#pragma once 5#pragma once
6 6
7#include <list>
7#include <optional> 8#include <optional>
8#include <vector> 9#include <vector>
9#include <list>
10 10
11#include "common/common_funcs.h" 11#include "common/common_funcs.h"
12#include "common/math_util.h" 12#include "common/math_util.h"
diff --git a/src/core/hle/service/nvflinger/nvflinger.cpp b/src/core/hle/service/nvflinger/nvflinger.cpp
index a7937b490..70441f6a2 100644
--- a/src/core/hle/service/nvflinger/nvflinger.cpp
+++ b/src/core/hle/service/nvflinger/nvflinger.cpp
@@ -37,14 +37,14 @@ NVFlinger::NVFlinger(Core::Timing::CoreTiming& core_timing) : core_timing{core_t
37 displays.emplace_back(4, "Null"); 37 displays.emplace_back(4, "Null");
38 38
39 // Schedule the screen composition events 39 // Schedule the screen composition events
40 //const auto ticks = Settings::values.force_30fps_mode ? frame_ticks_30fps : frame_ticks; 40 // const auto ticks = Settings::values.force_30fps_mode ? frame_ticks_30fps : frame_ticks;
41 41
42 composition_event = core_timing.RegisterEvent( 42 composition_event = core_timing.RegisterEvent("ScreenComposition", [this](u64 userdata,
43 "ScreenComposition", [this](u64 userdata, s64 cycles_late) { 43 s64 cycles_late) {
44 Compose(); 44 Compose();
45 const auto ticks = Settings::values.force_30fps_mode ? frame_ticks_30fps : GetNextTicks(); 45 const auto ticks = Settings::values.force_30fps_mode ? frame_ticks_30fps : GetNextTicks();
46 this->core_timing.ScheduleEvent(std::max(0LL,ticks - cycles_late), composition_event); 46 this->core_timing.ScheduleEvent(std::max<s64>(0LL, ticks - cycles_late), composition_event);
47 }); 47 });
48 48
49 core_timing.ScheduleEvent(frame_ticks, composition_event); 49 core_timing.ScheduleEvent(frame_ticks, composition_event);
50} 50}
diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cpp
index cdb2f804e..278528618 100644
--- a/src/video_core/gpu.cpp
+++ b/src/video_core/gpu.cpp
@@ -69,7 +69,7 @@ const DmaPusher& GPU::DmaPusher() const {
69 69
70void GPU::IncrementSyncPoint(const u32 syncpoint_id) { 70void GPU::IncrementSyncPoint(const u32 syncpoint_id) {
71 syncpoints[syncpoint_id]++; 71 syncpoints[syncpoint_id]++;
72 sync_mutex.lock(); 72 std::lock_guard lock{sync_mutex};
73 if (!syncpt_interrupts[syncpoint_id].empty()) { 73 if (!syncpt_interrupts[syncpoint_id].empty()) {
74 u32 value = syncpoints[syncpoint_id].load(); 74 u32 value = syncpoints[syncpoint_id].load();
75 auto it = syncpt_interrupts[syncpoint_id].begin(); 75 auto it = syncpt_interrupts[syncpoint_id].begin();
@@ -82,7 +82,6 @@ void GPU::IncrementSyncPoint(const u32 syncpoint_id) {
82 it++; 82 it++;
83 } 83 }
84 } 84 }
85 sync_mutex.unlock();
86} 85}
87 86
88u32 GPU::GetSyncpointValue(const u32 syncpoint_id) const { 87u32 GPU::GetSyncpointValue(const u32 syncpoint_id) const {
@@ -98,7 +97,7 @@ void GPU::RegisterSyncptInterrupt(const u32 syncpoint_id, const u32 value) {
98} 97}
99 98
100bool GPU::CancelSyncptInterrupt(const u32 syncpoint_id, const u32 value) { 99bool GPU::CancelSyncptInterrupt(const u32 syncpoint_id, const u32 value) {
101 sync_mutex.lock(); 100 std::lock_guard lock{sync_mutex};
102 auto it = syncpt_interrupts[syncpoint_id].begin(); 101 auto it = syncpt_interrupts[syncpoint_id].begin();
103 while (it != syncpt_interrupts[syncpoint_id].end()) { 102 while (it != syncpt_interrupts[syncpoint_id].end()) {
104 if (value == *it) { 103 if (value == *it) {
@@ -108,7 +107,6 @@ bool GPU::CancelSyncptInterrupt(const u32 syncpoint_id, const u32 value) {
108 it++; 107 it++;
109 } 108 }
110 return false; 109 return false;
111 sync_mutex.unlock();
112} 110}
113 111
114u32 RenderTargetBytesPerPixel(RenderTargetFormat format) { 112u32 RenderTargetBytesPerPixel(RenderTargetFormat format) {
diff --git a/src/video_core/gpu_thread.cpp b/src/video_core/gpu_thread.cpp
index b87938fdd..b441e92b0 100644
--- a/src/video_core/gpu_thread.cpp
+++ b/src/video_core/gpu_thread.cpp
@@ -21,7 +21,8 @@ static void RunThread(VideoCore::RendererBase& renderer, Tegra::DmaPusher& dma_p
21 MicroProfileOnThreadCreate("GpuThread"); 21 MicroProfileOnThreadCreate("GpuThread");
22 22
23 // Wait for first GPU command before acquiring the window context 23 // Wait for first GPU command before acquiring the window context
24 while (state.queue.Empty()); 24 while (state.queue.Empty())
25 ;
25 26
26 // If emulation was stopped during disk shader loading, abort before trying to acquire context 27 // If emulation was stopped during disk shader loading, abort before trying to acquire context
27 if (!state.is_running) { 28 if (!state.is_running) {
@@ -103,7 +104,8 @@ u64 ThreadManager::PushCommand(CommandData&& command_data) {
103 104
104MICROPROFILE_DEFINE(GPU_wait, "GPU", "Wait for the GPU", MP_RGB(128, 128, 192)); 105MICROPROFILE_DEFINE(GPU_wait, "GPU", "Wait for the GPU", MP_RGB(128, 128, 192));
105void SynchState::WaitForSynchronization(u64 fence) { 106void SynchState::WaitForSynchronization(u64 fence) {
106 while (signaled_fence.load() < fence); 107 while (signaled_fence.load() < fence)
108 ;
107} 109}
108 110
109} // namespace VideoCommon::GPUThread 111} // namespace VideoCommon::GPUThread