Changeset View
Changeset View
Standalone View
Standalone View
plugins/platforms/drm/drm_backend.cpp
Show First 20 Lines • Show All 157 Lines • ▼ Show 20 Line(s) | |||||
158 | 158 | | |||
159 | void DrmBackend::reactivate() | 159 | void DrmBackend::reactivate() | ||
160 | { | 160 | { | ||
161 | if (m_active) { | 161 | if (m_active) { | ||
162 | return; | 162 | return; | ||
163 | } | 163 | } | ||
164 | m_active = true; | 164 | m_active = true; | ||
165 | if (!usesSoftwareCursor()) { | 165 | if (!usesSoftwareCursor()) { | ||
166 | DrmBuffer *c = m_cursor[(m_cursorIndex + 1) % 2]; | 166 | DrmDumbBuffer *c = m_cursor[(m_cursorIndex + 1) % 2]; | ||
graesslin: no need to change the type. It's still a DrmBuffer* | |||||
The cursor is always a dumb buffer. So I'm not really seeing the advantage of using the abstract type (using DrmDumbBuffer in contrast gives this information directly to the reader). Also in showCursor(..) we call the function DrmDumbBuffer::handle() only known to DrmDumbBuffer. So we would either need to define this function also in DrmBuffer or do a dynamic_cast in showCursor(..). romangg: The cursor is always a dumb buffer. So I'm not really seeing the advantage of using the… | |||||
167 | const QPoint cp = Cursor::pos() - softwareCursorHotspot(); | 167 | const QPoint cp = Cursor::pos() - softwareCursorHotspot(); | ||
168 | for (auto it = m_outputs.constBegin(); it != m_outputs.constEnd(); ++it) { | 168 | for (auto it = m_outputs.constBegin(); it != m_outputs.constEnd(); ++it) { | ||
169 | DrmOutput *o = *it; | 169 | DrmOutput *o = *it; | ||
170 | o->pageFlipped(); | 170 | o->pageFlipped(); | ||
171 | o->blank(); | 171 | o->blank(); | ||
172 | o->showCursor(c); | 172 | o->showCursor(c); | ||
173 | o->moveCursor(cp); | 173 | o->moveCursor(cp); | ||
174 | } | 174 | } | ||
▲ Show 20 Lines • Show All 424 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]; | ||
graesslin: same here | |||||
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 | { | ||
680 | m_deleteBufferAfterPageFlip = true; | ||||
graesslin: shouldn't we move that into the HAVE_GBM part? | |||||
What happens in the other case? Does it fallback to QPainter when Platform::createOpenGLBackend() is called? romangg: What happens in the other case? Does it fallback to QPainter when `Platform… | |||||
it more or less terminates. Without the else part calls the Platform default impl which returns a nullptr. If createOpenGLBackend returns a nullptr, the Scene cannot be created which means compositing is not possible and KWin terminates. graesslin: it more or less terminates. Without the else part calls the Platform default impl which returns… | |||||
679 | #if HAVE_GBM | 681 | #if HAVE_GBM | ||
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; | 691 | m_buffers << b; | ||
690 | return b; | 692 | return b; | ||
691 | } | 693 | } | ||
692 | 694 | | |||
693 | DrmBuffer *DrmBackend::createBuffer(gbm_surface *surface) | 695 | DrmSurfaceBuffer *DrmBackend::createBuffer(gbm_surface *surface) | ||
694 | { | 696 | { | ||
695 | #if HAVE_GBM | 697 | #if HAVE_GBM | ||
696 | DrmBuffer *b = new DrmBuffer(this, surface); | 698 | DrmSurfaceBuffer *b = new DrmSurfaceBuffer(this, surface); | ||
697 | b->m_deleteAfterPageFlip = true; | | |||
698 | m_buffers << b; | 699 | m_buffers << b; | ||
699 | return b; | 700 | return b; | ||
700 | #else | 701 | #else | ||
701 | return nullptr; | 702 | return nullptr; | ||
702 | #endif | 703 | #endif | ||
703 | } | 704 | } | ||
704 | 705 | | |||
705 | void DrmBackend::bufferDestroyed(DrmBuffer *b) | 706 | void DrmBackend::bufferDestroyed(DrmBuffer *b) | ||
Show All 18 Lines |
no need to change the type. It's still a DrmBuffer*