Changeset View
Changeset View
Standalone View
Standalone View
plugins/platforms/virtual/egl_gbm_backend.cpp
Show First 20 Lines • Show All 150 Lines • ▼ Show 20 Line(s) | 132 | { | |||
---|---|---|---|---|---|
151 | } | 151 | } | ||
152 | setConfig(configs[0]); | 152 | setConfig(configs[0]); | ||
153 | 153 | | |||
154 | return true; | 154 | return true; | ||
155 | } | 155 | } | ||
156 | 156 | | |||
157 | void EglGbmBackend::present() | 157 | void EglGbmBackend::present() | ||
158 | { | 158 | { | ||
159 | Compositor::self()->aboutToSwapBuffers(); | ||||
160 | | ||||
161 | eglSwapBuffers(eglDisplay(), surface()); | ||||
162 | setLastDamage(QRegion()); | ||||
163 | | ||||
164 | Compositor::self()->bufferSwapComplete(); | ||||
159 | } | 165 | } | ||
160 | 166 | | |||
161 | void EglGbmBackend::screenGeometryChanged(const QSize &size) | 167 | void EglGbmBackend::screenGeometryChanged(const QSize &size) | ||
162 | { | 168 | { | ||
163 | Q_UNUSED(size) | 169 | Q_UNUSED(size) | ||
164 | // TODO, create new buffer? | 170 | // TODO, create new buffer? | ||
165 | } | 171 | } | ||
166 | 172 | | |||
167 | SceneOpenGLTexturePrivate *EglGbmBackend::createBackendTexture(SceneOpenGLTexture *texture) | 173 | SceneOpenGLTexturePrivate *EglGbmBackend::createBackendTexture(SceneOpenGLTexture *texture) | ||
168 | { | 174 | { | ||
169 | return new EglGbmTexture(texture, this); | 175 | return new EglGbmTexture(texture, this); | ||
170 | } | 176 | } | ||
171 | 177 | | |||
172 | QRegion EglGbmBackend::prepareRenderingFrame() | 178 | QRegion EglGbmBackend::prepareRenderingFrame() | ||
173 | { | 179 | { | ||
180 | if (!lastDamage().isEmpty()) { | ||||
181 | present(); | ||||
182 | } | ||||
174 | startRenderTimer(); | 183 | startRenderTimer(); | ||
175 | if (!GLRenderTarget::isRenderTargetBound()) { | 184 | if (!GLRenderTarget::isRenderTargetBound()) { | ||
176 | GLRenderTarget::pushRenderTarget(m_fbo); | 185 | GLRenderTarget::pushRenderTarget(m_fbo); | ||
177 | } | 186 | } | ||
178 | return QRegion(0, 0, screens()->size().width(), screens()->size().height()); | 187 | return QRegion(0, 0, screens()->size().width(), screens()->size().height()); | ||
179 | } | 188 | } | ||
180 | 189 | | |||
181 | static void convertFromGLImage(QImage &img, int w, int h) | 190 | static void convertFromGLImage(QImage &img, int w, int h) | ||
Show All 24 Lines | 204 | } else { | |||
206 | } | 215 | } | ||
207 | 216 | | |||
208 | } | 217 | } | ||
209 | img = img.mirrored(); | 218 | img = img.mirrored(); | ||
210 | } | 219 | } | ||
211 | 220 | | |||
212 | void EglGbmBackend::endRenderingFrame(const QRegion &renderedRegion, const QRegion &damagedRegion) | 221 | void EglGbmBackend::endRenderingFrame(const QRegion &renderedRegion, const QRegion &damagedRegion) | ||
213 | { | 222 | { | ||
214 | Q_UNUSED(renderedRegion) | | |||
215 | Q_UNUSED(damagedRegion) | 223 | Q_UNUSED(damagedRegion) | ||
216 | glFlush(); | 224 | glFlush(); | ||
217 | if (m_backend->saveFrames()) { | 225 | if (m_backend->saveFrames()) { | ||
218 | QImage img = QImage(QSize(m_backBuffer->width(), m_backBuffer->height()), QImage::Format_ARGB32); | 226 | QImage img = QImage(QSize(m_backBuffer->width(), m_backBuffer->height()), QImage::Format_ARGB32); | ||
219 | glReadnPixels(0, 0, m_backBuffer->width(), m_backBuffer->height(), GL_RGBA, GL_UNSIGNED_BYTE, img.byteCount(), (GLvoid*)img.bits()); | 227 | glReadnPixels(0, 0, m_backBuffer->width(), m_backBuffer->height(), GL_RGBA, GL_UNSIGNED_BYTE, img.byteCount(), (GLvoid*)img.bits()); | ||
220 | convertFromGLImage(img, m_backBuffer->width(), m_backBuffer->height()); | 228 | convertFromGLImage(img, m_backBuffer->width(), m_backBuffer->height()); | ||
221 | img.save(QStringLiteral("%1/%2.png").arg(m_backend->saveFrames()).arg(QString::number(m_frameCounter++))); | 229 | img.save(QStringLiteral("%1/%2.png").arg(m_backend->saveFrames()).arg(QString::number(m_frameCounter++))); | ||
222 | } | 230 | } | ||
223 | GLRenderTarget::popRenderTarget(); | 231 | GLRenderTarget::popRenderTarget(); | ||
232 | setLastDamage(renderedRegion); | ||||
224 | } | 233 | } | ||
225 | 234 | | |||
226 | bool EglGbmBackend::usesOverlayWindow() const | 235 | bool EglGbmBackend::usesOverlayWindow() const | ||
227 | { | 236 | { | ||
228 | return false; | 237 | return false; | ||
229 | } | 238 | } | ||
230 | 239 | | |||
231 | /************************************************ | 240 | /************************************************ | ||
Show All 11 Lines |