Changeset View
Changeset View
Standalone View
Standalone View
plugins/platforms/drm/drm_output.cpp
Show First 20 Lines • Show All 78 Lines • ▼ Show 20 Line(s) | 71 | { | |||
---|---|---|---|---|---|
79 | } | 79 | } | ||
80 | } | 80 | } | ||
81 | 81 | | |||
82 | void DrmOutput::hideCursor() | 82 | void DrmOutput::hideCursor() | ||
83 | { | 83 | { | ||
84 | drmModeSetCursor(m_backend->fd(), m_crtc->id(), 0, 0, 0); | 84 | drmModeSetCursor(m_backend->fd(), m_crtc->id(), 0, 0, 0); | ||
85 | } | 85 | } | ||
86 | 86 | | |||
87 | void DrmOutput::showCursor(DrmBuffer *c) | 87 | void DrmOutput::showCursor(DrmDumbBuffer *c) | ||
88 | { | 88 | { | ||
89 | const QSize &s = c->size(); | 89 | const QSize &s = c->size(); | ||
90 | drmModeSetCursor(m_backend->fd(), m_crtc->id(), c->handle(), s.width(), s.height()); | 90 | drmModeSetCursor(m_backend->fd(), m_crtc->id(), c->handle(), s.width(), s.height()); | ||
91 | } | 91 | } | ||
92 | 92 | | |||
93 | void DrmOutput::moveCursor(const QPoint &globalPos) | 93 | void DrmOutput::moveCursor(const QPoint &globalPos) | ||
94 | { | 94 | { | ||
95 | const QPoint p = globalPos - m_globalPos; | 95 | const QPoint p = globalPos - m_globalPos; | ||
▲ Show 20 Lines • Show All 589 Lines • ▼ Show 20 Line(s) | 680 | if (!m_crtc->next()) { | |||
685 | return; | 685 | return; | ||
686 | } | 686 | } | ||
687 | m_crtc->flipBuffer(); | 687 | m_crtc->flipBuffer(); | ||
688 | } | 688 | } | ||
689 | } | 689 | } | ||
690 | 690 | | |||
691 | void DrmOutput::pageFlippedBufferRemover(DrmBuffer *oldbuffer, DrmBuffer *newbuffer) | 691 | void DrmOutput::pageFlippedBufferRemover(DrmBuffer *oldbuffer, DrmBuffer *newbuffer) | ||
692 | { | 692 | { | ||
693 | if (oldbuffer && oldbuffer->deleteAfterPageFlip() && oldbuffer != newbuffer) { | 693 | if (oldbuffer && m_backend->deleteBufferAfterPageFlip() && oldbuffer != newbuffer) { | ||
694 | delete oldbuffer; | 694 | delete oldbuffer; | ||
695 | } | 695 | } | ||
696 | } | 696 | } | ||
697 | 697 | | |||
698 | bool DrmOutput::present(DrmBuffer *buffer) | 698 | bool DrmOutput::present(DrmBuffer *buffer) | ||
699 | { | 699 | { | ||
700 | if (!buffer || buffer->bufferId() == 0) { | 700 | if (!buffer || buffer->bufferId() == 0) { | ||
701 | return false; | 701 | return false; | ||
▲ Show 20 Lines • Show All 118 Lines • ▼ Show 20 Line(s) | 819 | if (!LogindIntegration::self()->isActiveSession()) { | |||
820 | m_crtc->setNext(buffer); | 820 | m_crtc->setNext(buffer); | ||
821 | return false; | 821 | return false; | ||
822 | } | 822 | } | ||
823 | if (m_dpmsMode != DpmsMode::On) { | 823 | if (m_dpmsMode != DpmsMode::On) { | ||
824 | return false; | 824 | return false; | ||
825 | } | 825 | } | ||
826 | 826 | | |||
827 | // Do we need to set a new mode first? | 827 | // Do we need to set a new mode first? | ||
828 | if (m_lastStride != buffer->stride() || m_lastGbm != buffer->isGbm()){ | 828 | if (!m_crtc->current() || m_crtc->current()->needsModeChange(buffer)) { | ||
829 | if (!setModeLegacy(buffer)) | 829 | if (!setModeLegacy(buffer)) { | ||
830 | return false; | 830 | return false; | ||
831 | } | 831 | } | ||
832 | } | ||||
832 | int errno_save = 0; | 833 | int errno_save = 0; | ||
833 | const bool ok = drmModePageFlip(m_backend->fd(), m_crtc->id(), buffer->bufferId(), DRM_MODE_PAGE_FLIP_EVENT, this) == 0; | 834 | const bool ok = drmModePageFlip(m_backend->fd(), m_crtc->id(), buffer->bufferId(), DRM_MODE_PAGE_FLIP_EVENT, this) == 0; | ||
834 | if (ok) { | 835 | if (ok) { | ||
835 | m_crtc->setNext(buffer); | 836 | m_crtc->setNext(buffer); | ||
836 | } else { | 837 | } else { | ||
837 | errno_save = errno; | 838 | errno_save = errno; | ||
838 | qCWarning(KWIN_DRM) << "Page flip failed:" << strerror(errno); | 839 | qCWarning(KWIN_DRM) << "Page flip failed:" << strerror(errno); | ||
839 | delete buffer; | 840 | delete buffer; | ||
840 | } | 841 | } | ||
841 | return ok; | 842 | return ok; | ||
842 | } | 843 | } | ||
843 | 844 | | |||
844 | bool DrmOutput::setModeLegacy(DrmBuffer *buffer) | 845 | bool DrmOutput::setModeLegacy(DrmBuffer *buffer) | ||
845 | { | 846 | { | ||
846 | uint32_t connId = m_conn->id(); | 847 | uint32_t connId = m_conn->id(); | ||
847 | if (drmModeSetCrtc(m_backend->fd(), m_crtc->id(), buffer->bufferId(), 0, 0, &connId, 1, &m_mode) == 0) { | 848 | if (drmModeSetCrtc(m_backend->fd(), m_crtc->id(), buffer->bufferId(), 0, 0, &connId, 1, &m_mode) == 0) { | ||
848 | m_lastStride = buffer->stride(); | | |||
849 | m_lastGbm = buffer->isGbm(); | | |||
850 | return true; | 849 | return true; | ||
851 | } else { | 850 | } else { | ||
852 | qCWarning(KWIN_DRM) << "Mode setting failed"; | 851 | qCWarning(KWIN_DRM) << "Mode setting failed"; | ||
853 | return false; | 852 | return false; | ||
854 | } | 853 | } | ||
855 | } | 854 | } | ||
856 | 855 | | |||
857 | DrmObject::AtomicReturn DrmOutput::atomicReqModesetPopulate(drmModeAtomicReq *req, bool enable) | 856 | DrmObject::AtomicReturn DrmOutput::atomicReqModesetPopulate(drmModeAtomicReq *req, bool enable) | ||
Show All 33 Lines |