Changeset View
Changeset View
Standalone View
Standalone View
plugins/platforms/drm/drm_backend.cpp
Show First 20 Lines • Show All 159 Lines • ▼ Show 20 Line(s) | |||||
160 | 160 | | |||
161 | void DrmBackend::reactivate() | 161 | void DrmBackend::reactivate() | ||
162 | { | 162 | { | ||
163 | if (m_active) { | 163 | if (m_active) { | ||
164 | return; | 164 | return; | ||
165 | } | 165 | } | ||
166 | m_active = true; | 166 | m_active = true; | ||
167 | if (!usesSoftwareCursor()) { | 167 | if (!usesSoftwareCursor()) { | ||
168 | DrmBuffer *c = m_cursor[(m_cursorIndex + 1) % 2]; | 168 | DrmDumbBuffer *c = m_cursor[(m_cursorIndex + 1) % 2]; | ||
169 | const QPoint cp = Cursor::pos() - softwareCursorHotspot(); | 169 | const QPoint cp = Cursor::pos() - softwareCursorHotspot(); | ||
170 | for (auto it = m_outputs.constBegin(); it != m_outputs.constEnd(); ++it) { | 170 | for (auto it = m_outputs.constBegin(); it != m_outputs.constEnd(); ++it) { | ||
171 | DrmOutput *o = *it; | 171 | DrmOutput *o = *it; | ||
172 | o->pageFlipped(); | 172 | o->pageFlipped(); | ||
173 | o->m_crtc->blank(); | 173 | o->m_crtc->blank(); | ||
174 | o->showCursor(c); | 174 | o->showCursor(c); | ||
175 | o->moveCursor(cp); | 175 | o->moveCursor(cp); | ||
176 | } | 176 | } | ||
▲ Show 20 Lines • Show All 420 Lines • ▼ Show 20 Line(s) | 557 | { | |||
597 | } | 597 | } | ||
598 | // now we have screens and can set cursors, so start tracking | 598 | // now we have screens and can set cursors, so start tracking | ||
599 | connect(this, &DrmBackend::cursorChanged, this, &DrmBackend::updateCursor); | 599 | connect(this, &DrmBackend::cursorChanged, this, &DrmBackend::updateCursor); | ||
600 | connect(Cursor::self(), &Cursor::posChanged, this, &DrmBackend::moveCursor); | 600 | connect(Cursor::self(), &Cursor::posChanged, this, &DrmBackend::moveCursor); | ||
601 | } | 601 | } | ||
602 | 602 | | |||
603 | void DrmBackend::setCursor() | 603 | void DrmBackend::setCursor() | ||
604 | { | 604 | { | ||
605 | DrmBuffer *c = m_cursor[m_cursorIndex]; | 605 | DrmDumbBuffer *c = m_cursor[m_cursorIndex]; | ||
606 | m_cursorIndex = (m_cursorIndex + 1) % 2; | 606 | m_cursorIndex = (m_cursorIndex + 1) % 2; | ||
607 | if (m_cursorEnabled) { | 607 | if (m_cursorEnabled) { | ||
608 | for (auto it = m_outputs.constBegin(); it != m_outputs.constEnd(); ++it) { | 608 | for (auto it = m_outputs.constBegin(); it != m_outputs.constEnd(); ++it) { | ||
609 | (*it)->showCursor(c); | 609 | (*it)->showCursor(c); | ||
610 | } | 610 | } | ||
611 | } | 611 | } | ||
612 | markCursorAsRendered(); | 612 | markCursorAsRendered(); | ||
613 | } | 613 | } | ||
▲ Show 20 Lines • Show All 50 Lines • ▼ Show 20 Line(s) | |||||
664 | 664 | | |||
665 | Screens *DrmBackend::createScreens(QObject *parent) | 665 | Screens *DrmBackend::createScreens(QObject *parent) | ||
666 | { | 666 | { | ||
667 | return new DrmScreens(this, parent); | 667 | return new DrmScreens(this, parent); | ||
668 | } | 668 | } | ||
669 | 669 | | |||
670 | QPainterBackend *DrmBackend::createQPainterBackend() | 670 | QPainterBackend *DrmBackend::createQPainterBackend() | ||
671 | { | 671 | { | ||
672 | m_deleteBufferAfterPageFlip = false; | ||||
672 | return new DrmQPainterBackend(this); | 673 | return new DrmQPainterBackend(this); | ||
673 | } | 674 | } | ||
674 | 675 | | |||
675 | OpenGLBackend *DrmBackend::createOpenGLBackend() | 676 | OpenGLBackend *DrmBackend::createOpenGLBackend() | ||
676 | { | 677 | { | ||
677 | #if HAVE_GBM | 678 | #if HAVE_GBM | ||
679 | m_deleteBufferAfterPageFlip = true; | ||||
678 | return new EglGbmBackend(this); | 680 | return new EglGbmBackend(this); | ||
679 | #else | 681 | #else | ||
680 | return Platform::createOpenGLBackend(); | 682 | return Platform::createOpenGLBackend(); | ||
681 | #endif | 683 | #endif | ||
682 | } | 684 | } | ||
683 | 685 | | |||
684 | DrmBuffer *DrmBackend::createBuffer(const QSize &size) | 686 | DrmDumbBuffer *DrmBackend::createBuffer(const QSize &size) | ||
685 | { | 687 | { | ||
686 | DrmBuffer *b = new DrmBuffer(this, size); | 688 | DrmDumbBuffer *b = new DrmDumbBuffer(this, size); | ||
687 | m_buffers << b; | | |||
688 | return b; | 689 | return b; | ||
689 | } | 690 | } | ||
690 | 691 | | |||
691 | DrmBuffer *DrmBackend::createBuffer(gbm_surface *surface) | 692 | DrmSurfaceBuffer *DrmBackend::createBuffer(gbm_surface *surface) | ||
692 | { | 693 | { | ||
693 | #if HAVE_GBM | 694 | #if HAVE_GBM | ||
694 | DrmBuffer *b = new DrmBuffer(this, surface); | 695 | DrmSurfaceBuffer *b = new DrmSurfaceBuffer(this, surface); | ||
695 | b->m_deleteAfterPageFlip = true; | | |||
696 | m_buffers << b; | | |||
697 | return b; | 696 | return b; | ||
698 | #else | 697 | #else | ||
699 | return nullptr; | 698 | return nullptr; | ||
700 | #endif | 699 | #endif | ||
701 | } | 700 | } | ||
702 | 701 | | |||
703 | void DrmBackend::bufferDestroyed(DrmBuffer *b) | | |||
704 | { | | |||
705 | m_buffers.removeAll(b); | | |||
706 | } | | |||
707 | | ||||
708 | void DrmBackend::outputDpmsChanged() | 702 | void DrmBackend::outputDpmsChanged() | ||
709 | { | 703 | { | ||
710 | if (m_outputs.isEmpty()) { | 704 | if (m_outputs.isEmpty()) { | ||
711 | return; | 705 | return; | ||
712 | } | 706 | } | ||
713 | bool enabled = false; | 707 | bool enabled = false; | ||
714 | for (auto it = m_outputs.constBegin(); it != m_outputs.constEnd(); ++it) { | 708 | for (auto it = m_outputs.constBegin(); it != m_outputs.constEnd(); ++it) { | ||
715 | enabled = enabled || (*it)->isDpmsEnabled(); | 709 | enabled = enabled || (*it)->isDpmsEnabled(); | ||
716 | } | 710 | } | ||
717 | setOutputsEnabled(enabled); | 711 | setOutputsEnabled(enabled); | ||
718 | } | 712 | } | ||
719 | 713 | | |||
720 | 714 | | |||
721 | } | 715 | } |