kwin: Don't query GL_VIEWPORT in pushRenderTarget()

Desktop / KDE / KDE Workspace - Fredrik Höglund [kde.org] - 26 June 2013 17:06 UTC

Assume that the default framebuffer has the same dimensions as the screen.

By not quering the dimensions of the viewport we don't risk serialization in drivers that use threaded dispatch.

###

diff --git a/kwin/libkwineffects/kwinglutils.cpp b/kwin/libkwineffects/kwinglutils.cpp
index 048cce7..5792d91 100644
--- a/kwin/libkwineffects/kwinglutils.cpp
+++ b/kwin/libkwineffects/kwinglutils.cpp
@@ -987,7 +987,6 @@ void ShaderManager::resetShader(ShaderType type)
bool GLRenderTarget::sSupported = false;
bool GLRenderTarget::s_blitSupported = false;
QStack GLRenderTarget::s_renderTargets = QStack();
-QSize GLRenderTarget::s_oldViewport;

void GLRenderTarget::initStatic()
{
@@ -1012,12 +1011,6 @@ bool GLRenderTarget::blitSupported()

void GLRenderTarget::pushRenderTarget(GLRenderTarget* target)
{
- if (s_renderTargets.isEmpty()) {
- GLint params[4];
- glGetIntegerv(GL_VIEWPORT, params);
- s_oldViewport = QSize(params[2], params[3]);
- }
-
target->enable();
s_renderTargets.push(target);
}
@@ -1026,11 +1019,13 @@ GLRenderTarget* GLRenderTarget::popRenderTarget()
{
GLRenderTarget* ret = s_renderTargets.pop();
ret->disable();
+
if (!s_renderTargets.isEmpty()) {
s_renderTargets.top()->enable();
- } else if (!s_oldViewport.isEmpty()) {
- glViewport (0, 0, s_oldViewport.width(), s_oldViewport.height());
+ } else {
+ glViewport (0, 0, displayWidth(), displayHeight());
}
+
return ret;
}

diff --git a/kwin/libkwineffects/kwinglutils.h b/kwin/libkwineffects/kwinglutils.h
index 2fdf7a1..20a6601 100644
--- a/kwin/libkwineffects/kwinglutils.h
+++ b/kwin/libkwineffects/kwinglutils.h
@@ -580,7 +580,6 @@ private:
static bool sSupported;
static bool s_blitSupported;
static QStack s_renderTargets;
- static QSize s_oldViewport;

GLTexture mTexture;
bool mValid;

2ee8391 kwin: Don't query GL_VIEWPORT in pushRenderTarget()
kwin/libkwineffects/kwinglutils.cpp | 13 ++++---------
kwin/libkwineffects/kwinglutils.h | 1 -
2 files changed, 4 insertions(+), 10 deletions(-)

Upstream: quickgit.kde.org


  • Share