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 422 Lines • ▼ Show 20 Line(s) | 559 | { | |||
599 | } | 599 | } | ||
600 | // now we have screens and can set cursors, so start tracking | 600 | // now we have screens and can set cursors, so start tracking | ||
601 | connect(this, &DrmBackend::cursorChanged, this, &DrmBackend::updateCursor); | 601 | connect(this, &DrmBackend::cursorChanged, this, &DrmBackend::updateCursor); | ||
602 | connect(Cursor::self(), &Cursor::posChanged, this, &DrmBackend::moveCursor); | 602 | connect(Cursor::self(), &Cursor::posChanged, this, &DrmBackend::moveCursor); | ||
603 | } | 603 | } | ||
604 | 604 | | |||
605 | void DrmBackend::setCursor() | 605 | void DrmBackend::setCursor() | ||
606 | { | 606 | { | ||
607 | DrmBuffer *c = m_cursor[m_cursorIndex]; | 607 | DrmDumbBuffer *c = m_cursor[m_cursorIndex]; | ||
608 | m_cursorIndex = (m_cursorIndex + 1) % 2; | 608 | m_cursorIndex = (m_cursorIndex + 1) % 2; | ||
609 | if (m_cursorEnabled) { | 609 | if (m_cursorEnabled) { | ||
610 | for (auto it = m_outputs.constBegin(); it != m_outputs.constEnd(); ++it) { | 610 | for (auto it = m_outputs.constBegin(); it != m_outputs.constEnd(); ++it) { | ||
611 | (*it)->showCursor(c); | 611 | (*it)->showCursor(c); | ||
612 | } | 612 | } | ||
613 | } | 613 | } | ||
614 | markCursorAsRendered(); | 614 | markCursorAsRendered(); | ||
615 | } | 615 | } | ||
▲ Show 20 Lines • Show All 50 Lines • ▼ Show 20 Line(s) | |||||
666 | 666 | | |||
667 | Screens *DrmBackend::createScreens(QObject *parent) | 667 | Screens *DrmBackend::createScreens(QObject *parent) | ||
668 | { | 668 | { | ||
669 | return new DrmScreens(this, parent); | 669 | return new DrmScreens(this, parent); | ||
670 | } | 670 | } | ||
671 | 671 | | |||
672 | QPainterBackend *DrmBackend::createQPainterBackend() | 672 | QPainterBackend *DrmBackend::createQPainterBackend() | ||
673 | { | 673 | { | ||
674 | m_deleteBufferAfterPageFlip = false; | ||||
674 | return new DrmQPainterBackend(this); | 675 | return new DrmQPainterBackend(this); | ||
675 | } | 676 | } | ||
676 | 677 | | |||
677 | OpenGLBackend *DrmBackend::createOpenGLBackend() | 678 | OpenGLBackend *DrmBackend::createOpenGLBackend() | ||
678 | { | 679 | { | ||
679 | #if HAVE_GBM | 680 | #if HAVE_GBM | ||
681 | m_deleteBufferAfterPageFlip = true; | ||||
680 | return new EglGbmBackend(this); | 682 | return new EglGbmBackend(this); | ||
681 | #else | 683 | #else | ||
682 | return Platform::createOpenGLBackend(); | 684 | return Platform::createOpenGLBackend(); | ||
683 | #endif | 685 | #endif | ||
684 | } | 686 | } | ||
685 | 687 | | |||
686 | DrmBuffer *DrmBackend::createBuffer(const QSize &size) | 688 | DrmDumbBuffer *DrmBackend::createBuffer(const QSize &size) | ||
687 | { | 689 | { | ||
688 | DrmBuffer *b = new DrmBuffer(this, size); | 690 | DrmDumbBuffer *b = new DrmDumbBuffer(this, size); | ||
689 | m_buffers << b; | | |||
690 | return b; | 691 | return b; | ||
691 | } | 692 | } | ||
692 | 693 | | |||
693 | DrmBuffer *DrmBackend::createBuffer(gbm_surface *surface) | 694 | DrmSurfaceBuffer *DrmBackend::createBuffer(gbm_surface *surface) | ||
694 | { | 695 | { | ||
695 | #if HAVE_GBM | 696 | #if HAVE_GBM | ||
696 | DrmBuffer *b = new DrmBuffer(this, surface); | 697 | DrmSurfaceBuffer *b = new DrmSurfaceBuffer(this, surface); | ||
697 | b->m_deleteAfterPageFlip = true; | | |||
698 | m_buffers << b; | | |||
699 | return b; | 698 | return b; | ||
700 | #else | 699 | #else | ||
701 | return nullptr; | 700 | return nullptr; | ||
702 | #endif | 701 | #endif | ||
703 | } | 702 | } | ||
704 | 703 | | |||
705 | void DrmBackend::bufferDestroyed(DrmBuffer *b) | | |||
706 | { | | |||
707 | m_buffers.removeAll(b); | | |||
708 | } | | |||
709 | | ||||
710 | void DrmBackend::outputDpmsChanged() | 704 | void DrmBackend::outputDpmsChanged() | ||
711 | { | 705 | { | ||
712 | if (m_outputs.isEmpty()) { | 706 | if (m_outputs.isEmpty()) { | ||
713 | return; | 707 | return; | ||
714 | } | 708 | } | ||
715 | bool enabled = false; | 709 | bool enabled = false; | ||
716 | for (auto it = m_outputs.constBegin(); it != m_outputs.constEnd(); ++it) { | 710 | for (auto it = m_outputs.constBegin(); it != m_outputs.constEnd(); ++it) { | ||
717 | enabled = enabled || (*it)->isDpmsEnabled(); | 711 | enabled = enabled || (*it)->isDpmsEnabled(); | ||
718 | } | 712 | } | ||
719 | setOutputsEnabled(enabled); | 713 | setOutputsEnabled(enabled); | ||
720 | } | 714 | } | ||
721 | 715 | | |||
722 | 716 | | |||
723 | } | 717 | } |