mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2025-06-21 10:48:16 -05:00
service: vi: Retrieve vsync event once per display
The display vsync event can only be retrieved once per display. Returns VI::ResultPermissionDenied if we attempt to retrieve the vsync event for the same display. Prevents games such as .hack//G.U. Last Recode from consuming all the handles in the handle table by spamming vsync event retrievals and allows it to go in game.
This commit is contained in:
@ -22,6 +22,7 @@
|
||||
#include "core/hle/service/nvflinger/ui/graphic_buffer.h"
|
||||
#include "core/hle/service/vi/display/vi_display.h"
|
||||
#include "core/hle/service/vi/layer/vi_layer.h"
|
||||
#include "core/hle/service/vi/vi_results.h"
|
||||
#include "video_core/gpu.h"
|
||||
|
||||
namespace Service::NVFlinger {
|
||||
@ -163,15 +164,15 @@ std::optional<u32> NVFlinger::FindBufferQueueId(u64 display_id, u64 layer_id) {
|
||||
return layer->GetBinderId();
|
||||
}
|
||||
|
||||
Kernel::KReadableEvent* NVFlinger::FindVsyncEvent(u64 display_id) {
|
||||
ResultVal<Kernel::KReadableEvent*> NVFlinger::FindVsyncEvent(u64 display_id) {
|
||||
const auto lock_guard = Lock();
|
||||
auto* const display = FindDisplay(display_id);
|
||||
|
||||
if (display == nullptr) {
|
||||
return nullptr;
|
||||
return VI::ResultNotFound;
|
||||
}
|
||||
|
||||
return &display->GetVSyncEvent();
|
||||
return display->GetVSyncEvent();
|
||||
}
|
||||
|
||||
VI::Display* NVFlinger::FindDisplay(u64 display_id) {
|
||||
|
Reference in New Issue
Block a user