video_out: added vblank event
This commit is contained in:
parent
8455574615
commit
133acdc120
|
@ -243,6 +243,13 @@ void VideoOutDriver::Vblank() {
|
||||||
vblank_status.count++;
|
vblank_status.count++;
|
||||||
vblank_status.processTime = Libraries::Kernel::sceKernelGetProcessTime();
|
vblank_status.processTime = Libraries::Kernel::sceKernelGetProcessTime();
|
||||||
vblank_status.tsc = Libraries::Kernel::sceKernelReadTsc();
|
vblank_status.tsc = Libraries::Kernel::sceKernelReadTsc();
|
||||||
|
|
||||||
|
// Trigger flip events for the port.
|
||||||
|
for (auto& event : main_port.vblank_events) {
|
||||||
|
if (event != nullptr) {
|
||||||
|
event->triggerEvent(SCE_VIDEO_OUT_EVENT_VBLANK, Kernel::EVFILT_VIDEO_OUT, nullptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Libraries::VideoOut
|
} // namespace Libraries::VideoOut
|
||||||
|
|
|
@ -25,6 +25,7 @@ struct VideoOutPort {
|
||||||
FlipStatus flip_status;
|
FlipStatus flip_status;
|
||||||
SceVideoOutVblankStatus vblank_status;
|
SceVideoOutVblankStatus vblank_status;
|
||||||
std::vector<Kernel::SceKernelEqueue> flip_events;
|
std::vector<Kernel::SceKernelEqueue> flip_events;
|
||||||
|
std::vector<Kernel::SceKernelEqueue> vblank_events;
|
||||||
int flip_rate = 0;
|
int flip_rate = 0;
|
||||||
|
|
||||||
s32 FindFreeGroup() const {
|
s32 FindFreeGroup() const {
|
||||||
|
|
|
@ -60,6 +60,31 @@ s32 PS4_SYSV_ABI sceVideoOutAddFlipEvent(Kernel::SceKernelEqueue eq, s32 handle,
|
||||||
return eq->addEvent(event);
|
return eq->addEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
s32 PS4_SYSV_ABI sceVideoOutAddVblankEvent(Kernel::SceKernelEqueue eq, s32 handle, void* udata) {
|
||||||
|
LOG_INFO(Lib_VideoOut, "handle = {}", handle);
|
||||||
|
|
||||||
|
auto* port = driver->GetPort(handle);
|
||||||
|
if (port == nullptr) {
|
||||||
|
return ORBIS_VIDEO_OUT_ERROR_INVALID_HANDLE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (eq == nullptr) {
|
||||||
|
return ORBIS_VIDEO_OUT_ERROR_INVALID_EVENT_QUEUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
Kernel::EqueueEvent event{};
|
||||||
|
event.isTriggered = false;
|
||||||
|
event.event.ident = SCE_VIDEO_OUT_EVENT_VBLANK;
|
||||||
|
event.event.filter = Kernel::EVFILT_VIDEO_OUT;
|
||||||
|
event.event.udata = udata;
|
||||||
|
event.event.fflags = 0;
|
||||||
|
event.event.data = 0;
|
||||||
|
event.filter.data = port;
|
||||||
|
|
||||||
|
port->vblank_events.push_back(eq);
|
||||||
|
return eq->addEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
s32 PS4_SYSV_ABI sceVideoOutRegisterBuffers(s32 handle, s32 startIndex, void* const* addresses,
|
s32 PS4_SYSV_ABI sceVideoOutRegisterBuffers(s32 handle, s32 startIndex, void* const* addresses,
|
||||||
s32 bufferNum, const BufferAttribute* attribute) {
|
s32 bufferNum, const BufferAttribute* attribute) {
|
||||||
if (!addresses || !attribute) {
|
if (!addresses || !attribute) {
|
||||||
|
@ -243,6 +268,8 @@ void RegisterLib(Core::Loader::SymbolsResolver* sym) {
|
||||||
sceVideoOutRegisterBuffers);
|
sceVideoOutRegisterBuffers);
|
||||||
LIB_FUNCTION("HXzjK9yI30k", "libSceVideoOut", 1, "libSceVideoOut", 0, 0,
|
LIB_FUNCTION("HXzjK9yI30k", "libSceVideoOut", 1, "libSceVideoOut", 0, 0,
|
||||||
sceVideoOutAddFlipEvent);
|
sceVideoOutAddFlipEvent);
|
||||||
|
LIB_FUNCTION("Xru92wHJRmg", "libSceVideoOut", 1, "libSceVideoOut", 0, 0,
|
||||||
|
sceVideoOutAddVblankEvent);
|
||||||
LIB_FUNCTION("CBiu4mCE1DA", "libSceVideoOut", 1, "libSceVideoOut", 0, 0,
|
LIB_FUNCTION("CBiu4mCE1DA", "libSceVideoOut", 1, "libSceVideoOut", 0, 0,
|
||||||
sceVideoOutSetFlipRate);
|
sceVideoOutSetFlipRate);
|
||||||
LIB_FUNCTION("i6-sR91Wt-4", "libSceVideoOut", 1, "libSceVideoOut", 0, 0,
|
LIB_FUNCTION("i6-sR91Wt-4", "libSceVideoOut", 1, "libSceVideoOut", 0, 0,
|
||||||
|
|
|
@ -88,6 +88,7 @@ void PS4_SYSV_ABI sceVideoOutSetBufferAttribute(BufferAttribute* attribute, Pixe
|
||||||
u32 tilingMode, u32 aspectRatio, u32 width,
|
u32 tilingMode, u32 aspectRatio, u32 width,
|
||||||
u32 height, u32 pitchInPixel);
|
u32 height, u32 pitchInPixel);
|
||||||
s32 PS4_SYSV_ABI sceVideoOutAddFlipEvent(Kernel::SceKernelEqueue eq, s32 handle, void* udata);
|
s32 PS4_SYSV_ABI sceVideoOutAddFlipEvent(Kernel::SceKernelEqueue eq, s32 handle, void* udata);
|
||||||
|
s32 PS4_SYSV_ABI sceVideoOutAddVBlankEvent(Kernel::SceKernelEqueue eq, s32 handle, void* udata);
|
||||||
s32 PS4_SYSV_ABI sceVideoOutRegisterBuffers(s32 handle, s32 startIndex, void* const* addresses,
|
s32 PS4_SYSV_ABI sceVideoOutRegisterBuffers(s32 handle, s32 startIndex, void* const* addresses,
|
||||||
s32 bufferNum, const BufferAttribute* attribute);
|
s32 bufferNum, const BufferAttribute* attribute);
|
||||||
s32 PS4_SYSV_ABI sceVideoOutSetFlipRate(s32 handle, s32 rate);
|
s32 PS4_SYSV_ABI sceVideoOutSetFlipRate(s32 handle, s32 rate);
|
||||||
|
|
Loading…
Reference in New Issue