mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-02-19 06:05:46 +01:00
kevent: fix display events
This commit is contained in:
parent
b96cc207bc
commit
47619f1956
|
|
@ -4,6 +4,7 @@
|
|||
#include "orbis-config.hpp"
|
||||
#include "orbis/utils/Rc.hpp"
|
||||
#include "utils/SharedMutex.hpp"
|
||||
#include <limits>
|
||||
#include <set>
|
||||
|
||||
namespace orbis {
|
||||
|
|
@ -90,7 +91,8 @@ struct EventEmitter : orbis::RcBase {
|
|||
shared_mutex mutex;
|
||||
std::set<KNote *, std::less<>, kallocator<KNote *>> notes;
|
||||
|
||||
void emit(sshort filter, uint fflags = 0, intptr_t data = 0);
|
||||
void emit(sshort filter, uint fflags = 0, intptr_t data = 0,
|
||||
uintptr_t ident = std::numeric_limits<uintptr_t>::max());
|
||||
void subscribe(KNote *note);
|
||||
void unsubscribe(KNote *note);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -20,7 +20,8 @@ orbis::KNote::~KNote() {
|
|||
}
|
||||
}
|
||||
|
||||
void orbis::EventEmitter::emit(sshort filter, uint fflags, intptr_t data) {
|
||||
void orbis::EventEmitter::emit(sshort filter, uint fflags, intptr_t data,
|
||||
uintptr_t ident) {
|
||||
std::lock_guard lock(mutex);
|
||||
|
||||
for (auto note : notes) {
|
||||
|
|
@ -35,6 +36,11 @@ void orbis::EventEmitter::emit(sshort filter, uint fflags, intptr_t data) {
|
|||
note->event.fflags = fflags;
|
||||
}
|
||||
|
||||
if (ident != std::numeric_limits<uintptr_t>::max() &&
|
||||
note->event.ident != ident) {
|
||||
continue;
|
||||
}
|
||||
|
||||
std::lock_guard lock(note->mutex);
|
||||
|
||||
if (note->triggered) {
|
||||
|
|
|
|||
|
|
@ -44,9 +44,9 @@ static VKAPI_ATTR VkBool32 VKAPI_CALL debugUtilsMessageCallback(
|
|||
}
|
||||
|
||||
enum class DisplayEvent : std::uint16_t {
|
||||
Flip,
|
||||
VBlank,
|
||||
PreVBlankStart,
|
||||
Flip = 6,
|
||||
VBlank = 7,
|
||||
PreVBlankStart = 0x59,
|
||||
};
|
||||
|
||||
static constexpr std::uint64_t
|
||||
|
|
@ -345,7 +345,7 @@ void Device::start() {
|
|||
std::chrono::duration_cast<std::chrono::nanoseconds>(period);
|
||||
std::this_thread::sleep_until(prevVBlank);
|
||||
orbis::g_context.deviceEventEmitter->emit(
|
||||
orbis::kEvFiltDisplay, 0, makeDisplayEvent(DisplayEvent::VBlank));
|
||||
orbis::kEvFiltDisplay, 0, 0, makeDisplayEvent(DisplayEvent::VBlank));
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -812,7 +812,7 @@ bool Device::flip(std::uint32_t pid, int bufferIndex, std::uint64_t arg,
|
|||
amdgpu::flip(
|
||||
cacheTag, vk::context->swapchainExtent, buffer.address,
|
||||
swapchainImageView, {bufferAttr.width, bufferAttr.height}, flipType,
|
||||
getDefaultTileModes()[bufferAttr.tilingMode == 1 ? 10 : 8], dfmt, nfmt);
|
||||
getDefaultTileModes()[bufferAttr.tilingMode != 0 ? 10 : 8], dfmt, nfmt);
|
||||
|
||||
transitionImageLayout(sched.getCommandBuffer(), swapchainImage,
|
||||
VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,
|
||||
|
|
@ -908,7 +908,8 @@ void Device::flip(std::uint32_t pid, int bufferIndex, std::uint64_t arg) {
|
|||
vk::context->swapchainImageViews[imageIndex]);
|
||||
|
||||
orbis::g_context.deviceEventEmitter->emit(
|
||||
orbis::kEvFiltDisplay, 0, makeDisplayEvent(DisplayEvent::Flip));
|
||||
orbis::kEvFiltDisplay, 0, arg,
|
||||
makeDisplayEvent(DisplayEvent::Flip, 1 << 8, 0));
|
||||
if (!flipComplete) {
|
||||
isImageAcquired = true;
|
||||
return;
|
||||
|
|
|
|||
Loading…
Reference in a new issue