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