Changeset View
Changeset View
Standalone View
Standalone View
plugins/platforms/drm/drm_output.cpp
Show First 20 Lines • Show All 58 Lines • ▼ Show 20 Line(s) | |||||
59 | DrmOutput::DrmOutput(DrmBackend *backend) | 59 | DrmOutput::DrmOutput(DrmBackend *backend) | ||
60 | : QObject() | 60 | : QObject() | ||
61 | , m_backend(backend) | 61 | , m_backend(backend) | ||
62 | { | 62 | { | ||
63 | } | 63 | } | ||
64 | 64 | | |||
65 | DrmOutput::~DrmOutput() | 65 | DrmOutput::~DrmOutput() | ||
66 | { | 66 | { | ||
67 | Q_ASSERT(!m_pageFlipPending); | ||||
68 | if (!m_deleted) { | ||||
69 | teardown(); | ||||
70 | } | ||||
71 | } | ||||
72 | | ||||
73 | void DrmOutput::teardown() | ||||
74 | { | ||||
75 | m_deleted = true; | ||||
67 | hideCursor(); | 76 | hideCursor(); | ||
68 | m_crtc->blank(); | 77 | m_crtc->blank(); | ||
69 | 78 | | |||
70 | if (m_primaryPlane) { | 79 | if (m_primaryPlane) { | ||
71 | // TODO: when having multiple planes, also clean up these | 80 | // TODO: when having multiple planes, also clean up these | ||
72 | m_primaryPlane->setOutput(nullptr); | 81 | m_primaryPlane->setOutput(nullptr); | ||
73 | 82 | | |||
74 | if (m_backend->deleteBufferAfterPageFlip()) { | 83 | if (m_backend->deleteBufferAfterPageFlip()) { | ||
75 | delete m_primaryPlane->current(); | 84 | delete m_primaryPlane->current(); | ||
76 | } | 85 | } | ||
77 | m_primaryPlane->setCurrent(nullptr); | 86 | m_primaryPlane->setCurrent(nullptr); | ||
78 | } | 87 | } | ||
79 | 88 | | |||
80 | m_crtc->setOutput(nullptr); | 89 | m_crtc->setOutput(nullptr); | ||
81 | m_conn->setOutput(nullptr); | 90 | m_conn->setOutput(nullptr); | ||
82 | 91 | | |||
83 | delete m_waylandOutput.data(); | 92 | delete m_waylandOutput.data(); | ||
84 | delete m_waylandOutputDevice.data(); | 93 | delete m_waylandOutputDevice.data(); | ||
85 | delete m_cursor[0]; | 94 | delete m_cursor[0]; | ||
86 | delete m_cursor[1]; | 95 | delete m_cursor[1]; | ||
96 | if (!m_pageFlipPending) { | ||||
97 | deleteLater(); | ||||
98 | } //else will be deleted in the page flip handler | ||||
99 | //this is needed so that the pageflipcallback handle isn't deleted | ||||
87 | } | 100 | } | ||
88 | 101 | | |||
89 | void DrmOutput::releaseGbm() | 102 | void DrmOutput::releaseGbm() | ||
90 | { | 103 | { | ||
91 | if (DrmBuffer *b = m_crtc->current()) { | 104 | if (DrmBuffer *b = m_crtc->current()) { | ||
92 | b->releaseGbm(); | 105 | b->releaseGbm(); | ||
93 | } | 106 | } | ||
94 | if (m_primaryPlane && m_primaryPlane->current()) { | 107 | if (m_primaryPlane && m_primaryPlane->current()) { | ||
▲ Show 20 Lines • Show All 830 Lines • ▼ Show 20 Line(s) | 927 | { | |||
925 | m_mode = connector->modes[modeIndex]; | 938 | m_mode = connector->modes[modeIndex]; | ||
926 | m_modesetRequested = true; | 939 | m_modesetRequested = true; | ||
927 | emit modeChanged(); | 940 | emit modeChanged(); | ||
928 | } | 941 | } | ||
929 | 942 | | |||
930 | void DrmOutput::pageFlipped() | 943 | void DrmOutput::pageFlipped() | ||
931 | { | 944 | { | ||
932 | m_pageFlipPending = false; | 945 | m_pageFlipPending = false; | ||
946 | if (m_deleted) { | ||||
947 | deleteLater(); | ||||
948 | return; | ||||
949 | } | ||||
933 | 950 | | |||
934 | if (!m_crtc) { | 951 | if (!m_crtc) { | ||
935 | return; | 952 | return; | ||
936 | } | 953 | } | ||
937 | // Egl based surface buffers get destroyed, QPainter based dumb buffers not | 954 | // Egl based surface buffers get destroyed, QPainter based dumb buffers not | ||
938 | // TODO: split up DrmOutput in two for dumb and egl/gbm surface buffer compatible subclasses completely? | 955 | // TODO: split up DrmOutput in two for dumb and egl/gbm surface buffer compatible subclasses completely? | ||
939 | if (m_backend->deleteBufferAfterPageFlip()) { | 956 | if (m_backend->deleteBufferAfterPageFlip()) { | ||
940 | if (m_backend->atomicModeSetting()) { | 957 | if (m_backend->atomicModeSetting()) { | ||
▲ Show 20 Lines • Show All 364 Lines • Show Last 20 Lines |