MCPcopy Create free account
hub / github.com/SFML/SFML / display

Method display

src/SFML/Window/DRM/DRMContext.cpp:636–690  ·  view source on GitHub ↗

///////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

634
635////////////////////////////////////////////////////////////
636void DRMContext::display()
637{
638 if (m_surface == EGL_NO_SURFACE)
639 return;
640
641 if (!m_scanOut)
642 {
643 eglCheck(eglSwapBuffers(m_display, m_surface));
644 return;
645 }
646
647 // Handle display of buffer to the screen
648 DrmFb* fb = nullptr;
649
650 if (!waitForFlip(-1))
651 return;
652
653 if (m_currentBO)
654 {
655 gbm_surface_release_buffer(m_gbmSurface, m_currentBO);
656 m_currentBO = nullptr;
657 }
658
659 eglCheck(eglSwapBuffers(m_display, m_surface));
660
661 m_currentBO = m_nextBO;
662
663 // This call must be preceded by a single call to eglSwapBuffers()
664 m_nextBO = gbm_surface_lock_front_buffer(m_gbmSurface);
665
666 if (!m_nextBO)
667 return;
668
669 fb = drmFbGetFromBo(*m_nextBO);
670 if (!fb)
671 {
672 err() << "Failed to get FB from buffer object" << std::endl;
673 return;
674 }
675
676 // If first time, need to first call drmModeSetCrtc()
677 if (!m_shown)
678 {
679 if (drmModeSetCrtc(drmNode.fileDescriptor, drmNode.crtcId, fb->fbId, 0, 0, &drmNode.connectorId, 1, drmNode.mode))
680 {
681 err() << "Failed to set mode: " << std::strerror(errno) << std::endl;
682 std::abort();
683 }
684 m_shown = true;
685 }
686
687 // Do page flip
688 if (!drmModePageFlip(drmNode.fileDescriptor, drmNode.crtcId, fb->fbId, DRM_MODE_PAGE_FLIP_EVENT, &waitingForFlip))
689 waitingForFlip = 1;
690}
691
692
693////////////////////////////////////////////////////////////

Callers

nothing calls this directly

Calls 2

waitForFlipFunction · 0.85
drmFbGetFromBoFunction · 0.85

Tested by

no test coverage detected