Get rid of the unreliable lastMask in the GL backend
REVIEW: 109396
This commit is contained in:
parent
abfc697b97
commit
3a6d55b16e
6 changed files with 13 additions and 34 deletions
|
@ -194,9 +194,9 @@ bool EglOnXBackend::initBufferConfigs()
|
|||
|
||||
void EglOnXBackend::present()
|
||||
{
|
||||
const bool swap = (options->glPreferBufferSwap() && options->glPreferBufferSwap() != Options::ExtendDamage) ||
|
||||
!(lastMask() & Scene::PAINT_SCREEN_REGION && surfaceHasSubPost && eglPostSubBufferNV);
|
||||
if (swap) {
|
||||
const QRegion displayRegion(0, 0, displayWidth(), displayHeight());
|
||||
const bool fullRepaint = (lastDamage() == displayRegion);
|
||||
if (fullRepaint || !(surfaceHasSubPost && eglPostSubBufferNV)) {
|
||||
eglSwapBuffers(dpy, surface);
|
||||
} else {
|
||||
const QRect damageRect = lastDamage().boundingRect();
|
||||
|
@ -226,10 +226,9 @@ void EglOnXBackend::prepareRenderingFrame()
|
|||
startRenderTimer();
|
||||
}
|
||||
|
||||
void EglOnXBackend::endRenderingFrame(int mask, const QRegion &damage)
|
||||
void EglOnXBackend::endRenderingFrame(const QRegion &damage)
|
||||
{
|
||||
setLastDamage(damage);
|
||||
setLastMask(mask);
|
||||
glFlush();
|
||||
|
||||
if (overlayWindow()->window()) // show the window only after the first pass,
|
||||
|
|
|
@ -35,7 +35,7 @@ public:
|
|||
virtual void screenGeometryChanged(const QSize &size);
|
||||
virtual SceneOpenGL::TexturePrivate *createBackendTexture(SceneOpenGL::Texture *texture);
|
||||
virtual void prepareRenderingFrame();
|
||||
virtual void endRenderingFrame(int mask, const QRegion &damage);
|
||||
virtual void endRenderingFrame(const QRegion &damage);
|
||||
|
||||
protected:
|
||||
virtual void present();
|
||||
|
|
|
@ -473,10 +473,9 @@ void GlxBackend::waitSync()
|
|||
|
||||
void GlxBackend::present()
|
||||
{
|
||||
QRegion displayRegion(0, 0, displayWidth(), displayHeight());
|
||||
const bool fullRepaint = (lastDamage() == displayRegion);
|
||||
|
||||
if (isDoubleBuffer()) {
|
||||
const QRegion displayRegion(0, 0, displayWidth(), displayHeight());
|
||||
const bool fullRepaint = (lastDamage() == displayRegion);
|
||||
|
||||
if (fullRepaint) {
|
||||
if (haveSwapInterval) {
|
||||
|
@ -540,11 +539,8 @@ void GlxBackend::present()
|
|||
glXWaitGL();
|
||||
} else {
|
||||
glXWaitGL();
|
||||
if (!fullRepaint)
|
||||
foreach (const QRect & r, lastDamage().rects())
|
||||
XCopyArea(display(), buffer, rootWindow(), gcroot, r.x(), r.y(), r.width(), r.height(), r.x(), r.y());
|
||||
else
|
||||
XCopyArea(display(), buffer, rootWindow(), gcroot, 0, 0, displayWidth(), displayHeight(), 0, 0);
|
||||
foreach (const QRect & r, lastDamage().rects())
|
||||
XCopyArea(display(), buffer, rootWindow(), gcroot, r.x(), r.y(), r.width(), r.height(), r.x(), r.y());
|
||||
}
|
||||
setLastDamage(QRegion());
|
||||
XFlush(display());
|
||||
|
@ -584,10 +580,9 @@ void GlxBackend::prepareRenderingFrame()
|
|||
glXWaitX();
|
||||
}
|
||||
|
||||
void GlxBackend::endRenderingFrame(int mask, const QRegion &damage)
|
||||
void GlxBackend::endRenderingFrame(const QRegion &damage)
|
||||
{
|
||||
setLastDamage(damage);
|
||||
setLastMask(mask);
|
||||
glFlush();
|
||||
|
||||
if (overlayWindow()->window()) // show the window only after the first pass,
|
||||
|
|
|
@ -45,7 +45,7 @@ public:
|
|||
virtual void screenGeometryChanged(const QSize &size);
|
||||
virtual SceneOpenGL::TexturePrivate *createBackendTexture(SceneOpenGL::Texture *texture);
|
||||
virtual void prepareRenderingFrame();
|
||||
virtual void endRenderingFrame(int mask, const QRegion &damage);
|
||||
virtual void endRenderingFrame(const QRegion &damage);
|
||||
|
||||
protected:
|
||||
virtual void present();
|
||||
|
|
|
@ -79,7 +79,6 @@ OpenGLBackend::OpenGLBackend()
|
|||
, m_directRendering(false)
|
||||
, m_doubleBuffer(false)
|
||||
, m_failed(false)
|
||||
, m_lastMask(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -321,7 +320,7 @@ int SceneOpenGL::paint(QRegion damage, ToplevelList toplevels)
|
|||
checkGLError("Paint2");
|
||||
#endif
|
||||
|
||||
m_backend->endRenderingFrame(mask, damage);
|
||||
m_backend->endRenderingFrame(damage);
|
||||
|
||||
// do cleanup
|
||||
stacking_order.clear();
|
||||
|
|
|
@ -408,10 +408,9 @@ public:
|
|||
/**
|
||||
* @brief Backend specific code to handle the end of rendering a frame.
|
||||
*
|
||||
* @param mask The rendering mask of this frame
|
||||
* @param damage The actual updated region in this frame
|
||||
**/
|
||||
virtual void endRenderingFrame(int mask, const QRegion &damage) = 0;
|
||||
virtual void endRenderingFrame(const QRegion &damage) = 0;
|
||||
/**
|
||||
* @brief Compositor is going into idle mode, flushes any pending paints.
|
||||
**/
|
||||
|
@ -532,15 +531,6 @@ protected:
|
|||
void setLastDamage(const QRegion &damage) {
|
||||
m_lastDamage = damage;
|
||||
}
|
||||
/**
|
||||
* @return int Rendering mask of previously rendered frame
|
||||
**/
|
||||
int lastMask() const {
|
||||
return m_lastMask;
|
||||
}
|
||||
void setLastMask(int mask) {
|
||||
m_lastMask = mask;
|
||||
}
|
||||
/**
|
||||
* @brief Starts the timer for how long it takes to render the frame.
|
||||
*
|
||||
|
@ -575,10 +565,6 @@ private:
|
|||
* @brief Damaged region of previously rendered frame.
|
||||
**/
|
||||
QRegion m_lastDamage;
|
||||
/**
|
||||
* @brief Rendering mask of previously rendered frame.
|
||||
**/
|
||||
int m_lastMask;
|
||||
/**
|
||||
* @brief Timer to measure how long a frame renders.
|
||||
**/
|
||||
|
|
Loading…
Reference in a new issue