summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/vi/vi.cpp
diff options
context:
space:
mode:
authorSubv <subv2112@gmail.com>2018-01-09 01:12:28 +0100
committerbunnei <bunneidev@gmail.com>2018-01-11 05:28:22 +0100
commit404149e4751b986b4a9bf895434862236d162fd8 (patch)
treebed2b206c777c90dda9d3b2b3665360fb39bd170 /src/core/hle/service/vi/vi.cpp
parentNV: Give each display its own vsync event. (diff)
downloadyuzu-404149e4751b986b4a9bf895434862236d162fd8.tar
yuzu-404149e4751b986b4a9bf895434862236d162fd8.tar.gz
yuzu-404149e4751b986b4a9bf895434862236d162fd8.tar.bz2
yuzu-404149e4751b986b4a9bf895434862236d162fd8.tar.lz
yuzu-404149e4751b986b4a9bf895434862236d162fd8.tar.xz
yuzu-404149e4751b986b4a9bf895434862236d162fd8.tar.zst
yuzu-404149e4751b986b4a9bf895434862236d162fd8.zip
Diffstat (limited to 'src/core/hle/service/vi/vi.cpp')
-rw-r--r--src/core/hle/service/vi/vi.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp
index 4c9df099e..fab7a12e4 100644
--- a/src/core/hle/service/vi/vi.cpp
+++ b/src/core/hle/service/vi/vi.cpp
@@ -3,6 +3,7 @@
// Refer to the license.txt file included.
#include "common/alignment.h"
+#include "core/core_timing.h"
#include "core/hle/ipc_helpers.h"
#include "core/hle/service/vi/vi.h"
#include "core/hle/service/vi/vi_m.h"
@@ -10,6 +11,9 @@
namespace Service {
namespace VI {
+constexpr size_t SCREEN_REFRESH_RATE = 60;
+constexpr u64 frame_ticks = static_cast<u64>(BASE_CLOCK_RATE / SCREEN_REFRESH_RATE);
+
class Parcel {
public:
// This default size was chosen arbitrarily.
@@ -637,6 +641,19 @@ NVFlinger::NVFlinger() {
displays.emplace_back(external);
displays.emplace_back(edid);
displays.emplace_back(internal);
+
+ // Schedule the screen composition events
+ composition_event =
+ CoreTiming::RegisterEvent("ScreenCompositioin", [this](u64 userdata, int cycles_late) {
+ Compose();
+ CoreTiming::ScheduleEvent(frame_ticks - cycles_late, composition_event);
+ });
+
+ CoreTiming::ScheduleEvent(frame_ticks, composition_event);
+}
+
+NVFlinger::~NVFlinger() {
+ CoreTiming::UnscheduleEvent(composition_event, 0);
}
u64 NVFlinger::OpenDisplay(const std::string& name) {
@@ -702,6 +719,13 @@ Layer& NVFlinger::GetLayer(u64 display_id, u64 layer_id) {
return *itr;
}
+void NVFlinger::Compose() {
+ for (auto& display : displays) {
+ // TODO(Subv): Gather the surfaces and forward them to the GPU for drawing.
+ display.vsync_event->Signal();
+ }
+}
+
BufferQueue::BufferQueue(u32 id, u64 layer_id) : id(id), layer_id(layer_id) {}
void BufferQueue::SetPreallocatedBuffer(u32 slot, IGBPBuffer& igbp_buffer) {