Changeset View
Changeset View
Standalone View
Standalone View
plugins/platforms/x11/common/eglonxbackend.cpp
| Show First 20 Lines • Show All 115 Lines • ▼ Show 20 Line(s) | 115 | if (error != EGL_SUCCESS && error != EGL_BAD_ATTRIBUTE) { | |||
|---|---|---|---|---|---|
| 116 | setFailed(QStringLiteral("query surface failed")); | 116 | setFailed(QStringLiteral("query surface failed")); | ||
| 117 | return; | 117 | return; | ||
| 118 | } else { | 118 | } else { | ||
| 119 | surfaceHasSubPost = EGL_FALSE; | 119 | surfaceHasSubPost = EGL_FALSE; | ||
| 120 | } | 120 | } | ||
| 121 | } | 121 | } | ||
| 122 | } | 122 | } | ||
| 123 | 123 | | |||
| 124 | setBlocksForRetrace(true); | | |||
| 125 | if (surfaceHasSubPost) { | 124 | if (surfaceHasSubPost) { | ||
| 126 | qCDebug(KWIN_CORE) << "EGL implementation and surface support eglPostSubBufferNV, let's use it"; | 125 | qCDebug(KWIN_CORE) << "EGL implementation and surface support eglPostSubBufferNV, let's use it"; | ||
| 127 | 126 | | |||
| 128 | // check if swap interval 1 is supported | 127 | // check if swap interval 1 is supported | ||
| 129 | EGLint val; | 128 | EGLint val; | ||
| 130 | eglGetConfigAttrib(eglDisplay(), config(), EGL_MAX_SWAP_INTERVAL, &val); | 129 | eglGetConfigAttrib(eglDisplay(), config(), EGL_MAX_SWAP_INTERVAL, &val); | ||
| 131 | if (val >= 1) { | 130 | if (val >= 1) { | ||
| 132 | if (eglSwapInterval(eglDisplay(), 1)) { | 131 | if (eglSwapInterval(eglDisplay(), 1)) { | ||
| ▲ Show 20 Lines • Show All 217 Lines • ▼ Show 20 Line(s) | |||||
| 350 | { | 349 | { | ||
| 351 | return new EglTexture(texture, this); | 350 | return new EglTexture(texture, this); | ||
| 352 | } | 351 | } | ||
| 353 | 352 | | |||
| 354 | QRegion EglOnXBackend::prepareRenderingFrame() | 353 | QRegion EglOnXBackend::prepareRenderingFrame() | ||
| 355 | { | 354 | { | ||
| 356 | QRegion repaint; | 355 | QRegion repaint; | ||
| 357 | 356 | | |||
| 358 | present(); | | |||
| 359 | | ||||
| 360 | if (supportsBufferAge()) | 357 | if (supportsBufferAge()) | ||
| 361 | repaint = accumulatedDamageHistory(m_bufferAge); | 358 | repaint = accumulatedDamageHistory(m_bufferAge); | ||
| 362 | 359 | | |||
| 363 | startRenderTimer(); | 360 | startRenderTimer(); | ||
| 364 | eglWaitNative(EGL_CORE_NATIVE_ENGINE); | 361 | eglWaitNative(EGL_CORE_NATIVE_ENGINE); | ||
| 365 | 362 | | |||
| 366 | return repaint; | 363 | return repaint; | ||
| 367 | } | 364 | } | ||
| Show All 13 Lines | 368 | if (damagedRegion.isEmpty()) { | |||
| 381 | if (!renderedRegion.isEmpty()) | 378 | if (!renderedRegion.isEmpty()) | ||
| 382 | glFlush(); | 379 | glFlush(); | ||
| 383 | 380 | | |||
| 384 | m_bufferAge = 1; | 381 | m_bufferAge = 1; | ||
| 385 | return; | 382 | return; | ||
| 386 | } | 383 | } | ||
| 387 | 384 | | |||
| 388 | setLastDamage(renderedRegion); | 385 | setLastDamage(renderedRegion); | ||
| 389 | | ||||
| 390 | if (!blocksForRetrace()) { | | |||
| 391 | // This also sets lastDamage to empty which prevents the frame from | | |||
| 392 | // being posted again when prepareRenderingFrame() is called. | | |||
| 393 | present(); | 386 | present(); | ||
| 394 | } else { | | |||
| 395 | // Make sure that the GPU begins processing the command stream | | |||
| 396 | // now and not the next time prepareRenderingFrame() is called. | | |||
| 397 | glFlush(); | | |||
| 398 | } | | |||
| 399 | 387 | | |||
| 400 | if (m_overlayWindow && overlayWindow()->window()) // show the window only after the first pass, | 388 | if (m_overlayWindow && overlayWindow()->window()) // show the window only after the first pass, | ||
| 401 | overlayWindow()->show(); // since that pass may take long | 389 | overlayWindow()->show(); // since that pass may take long | ||
| 402 | 390 | | |||
| 403 | // Save the damaged region to history | 391 | // Save the damaged region to history | ||
| 404 | if (supportsBufferAge()) | 392 | if (supportsBufferAge()) | ||
| 405 | addToDamageHistory(damagedRegion); | 393 | addToDamageHistory(damagedRegion); | ||
| 406 | } | 394 | } | ||
| ▲ Show 20 Lines • Show All 85 Lines • Show Last 20 Lines | |||||