MCPcopy Create free account
hub / github.com/InoriRus/Kyty / Flip

Method Flip

source/emulator/src/Graphics/VideoOut.cpp:492–550  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

490}
491
492bool FlipQueue::Flip(uint32_t micros)
493{
494 KYTY_PROFILER_BLOCK("FlipQueue::Flip");
495
496 m_mutex.Lock();
497 if (m_requests.Size() == 0)
498 {
499 m_submit_cond_var.WaitFor(&m_mutex, micros);
500
501 if (m_requests.Size() == 0)
502 {
503 m_mutex.Unlock();
504 return false;
505 }
506 }
507 auto first = m_requests.First();
508 auto r = m_requests.At(first);
509 m_mutex.Unlock();
510
511 auto* buffer = r.cfg->buffers[r.index].buffer_vulkan;
512
513 Graphics::WindowDrawBuffer(buffer);
514
515 m_mutex.Lock();
516
517 r.cfg->mutex.Lock();
518 for (auto& flip_eq: r.cfg->flip_eqs)
519 {
520 if (flip_eq != nullptr)
521 {
522 auto result = EventQueue::KernelTriggerEvent(flip_eq, VIDEO_OUT_EVENT_FLIP, EventQueue::KERNEL_EVFILT_VIDEO_OUT,
523 reinterpret_cast<void*>(r.flip_arg));
524 EXIT_NOT_IMPLEMENTED(result != OK);
525 }
526 }
527 r.cfg->mutex.Unlock();
528
529 printf("Flip done: %d\n", r.index);
530
531 // m_mutex.Lock();
532
533 m_requests.Remove(first);
534 m_done_cond_var.Signal();
535
536 r.cfg->flip_status.count++;
537 r.cfg->flip_status.processTime = LibKernel::KernelGetProcessTime();
538 r.cfg->flip_status.tsc = LibKernel::KernelReadTsc();
539 r.cfg->flip_status.submitTsc = r.submit_tsc;
540 r.cfg->flip_status.flipArg = r.flip_arg;
541 r.cfg->flip_status.currentBuffer = r.index;
542 r.cfg->flip_status.flipPendingNum = static_cast<int>(m_requests.Size());
543
544 m_mutex.Unlock();
545
546 Graphics::GpuMemoryFrameDone();
547 Graphics::GpuMemoryDbgDump();
548
549 return true;

Callers 3

DirectFB_RenderPresentFunction · 0.45
DirectFB_GL_SwapWindowFunction · 0.45
VideoOutFlipWindowFunction · 0.45

Calls 12

WindowDrawBufferFunction · 0.85
printfFunction · 0.85
GpuMemoryFrameDoneFunction · 0.85
GpuMemoryDbgDumpFunction · 0.85
WaitForMethod · 0.80
FirstMethod · 0.80
AtMethod · 0.80
LockMethod · 0.45
SizeMethod · 0.45
UnlockMethod · 0.45
RemoveMethod · 0.45
SignalMethod · 0.45

Tested by

no test coverage detected