kwin: fix graphical glitches for the nvidia blob
This is a perliminary fix. Should be fixed properly once we have a real statemachine.
This commit is contained in:
parent
1b1e72b753
commit
e81c68fee8
2 changed files with 16 additions and 12 deletions
|
@ -362,13 +362,9 @@ bool SceneOpenGL::Window::bindTexture()
|
||||||
{
|
{
|
||||||
#ifndef KWIN_HAVE_OPENGLES
|
#ifndef KWIN_HAVE_OPENGLES
|
||||||
if (!texture.isNull()) {
|
if (!texture.isNull()) {
|
||||||
if (toplevel->damage().isEmpty()) {
|
if (!toplevel->damage().isEmpty()) {
|
||||||
// texture doesn't need updating, just bind it
|
// mipmaps need to be updated
|
||||||
glBindTexture(texture.target(), texture.texture());
|
texture.setDirty();
|
||||||
} else {
|
|
||||||
// bind() updates the texture automatically e.g. in case the glx pixmap binding
|
|
||||||
// is strict
|
|
||||||
texture.bind();
|
|
||||||
toplevel->resetDamage(QRect(toplevel->clientPos(), toplevel->clientSize()));
|
toplevel->resetDamage(QRect(toplevel->clientPos(), toplevel->clientSize()));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -489,13 +489,18 @@ void SceneOpenGL::flushBuffer(int mask, QRegion damage)
|
||||||
glXCopySubBuffer(display(), glxbuffer, r.x(), y, r.width(), r.height());
|
glXCopySubBuffer(display(), glxbuffer, r.x(), y, r.width(), r.height());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// if a shader is bound, copy pixels results in a black screen
|
// if a shader is bound or the texture unit is enabled, copy pixels results in a black screen
|
||||||
// therefore unbind the shader and restore after copying the pixels
|
// therefore unbind the shader and restore after copying the pixels
|
||||||
GLint shader = 0;
|
GLint shader = 0;
|
||||||
if (ShaderManager::instance()->isShaderBound()) {
|
if (ShaderManager::instance()->isShaderBound()) {
|
||||||
glGetIntegerv(GL_CURRENT_PROGRAM, &shader);
|
glGetIntegerv(GL_CURRENT_PROGRAM, &shader);
|
||||||
glUseProgram(0);
|
glUseProgram(0);
|
||||||
}
|
}
|
||||||
|
bool reenableTexUnit = false;
|
||||||
|
if (glIsEnabled(GL_TEXTURE_2D)) {
|
||||||
|
glDisable(GL_TEXTURE_2D);
|
||||||
|
reenableTexUnit = true;
|
||||||
|
}
|
||||||
// no idea why glScissor() is used, but Compiz has it and it doesn't seem to hurt
|
// no idea why glScissor() is used, but Compiz has it and it doesn't seem to hurt
|
||||||
glEnable(GL_SCISSOR_TEST);
|
glEnable(GL_SCISSOR_TEST);
|
||||||
glDrawBuffer(GL_FRONT);
|
glDrawBuffer(GL_FRONT);
|
||||||
|
@ -517,6 +522,9 @@ void SceneOpenGL::flushBuffer(int mask, QRegion damage)
|
||||||
glBitmap(0, 0, 0, 0, -xpos, -ypos, NULL); // move position back to 0,0
|
glBitmap(0, 0, 0, 0, -xpos, -ypos, NULL); // move position back to 0,0
|
||||||
glDrawBuffer(GL_BACK);
|
glDrawBuffer(GL_BACK);
|
||||||
glDisable(GL_SCISSOR_TEST);
|
glDisable(GL_SCISSOR_TEST);
|
||||||
|
if (reenableTexUnit) {
|
||||||
|
glEnable(GL_TEXTURE_2D);
|
||||||
|
}
|
||||||
// rebind previously bound shader
|
// rebind previously bound shader
|
||||||
if (ShaderManager::instance()->isShaderBound()) {
|
if (ShaderManager::instance()->isShaderBound()) {
|
||||||
glUseProgram(shader);
|
glUseProgram(shader);
|
||||||
|
@ -562,6 +570,7 @@ void SceneOpenGL::TexturePrivate::release()
|
||||||
glXReleaseTexImageEXT(display(), m_glxpixmap, GLX_FRONT_LEFT_EXT);
|
glXReleaseTexImageEXT(display(), m_glxpixmap, GLX_FRONT_LEFT_EXT);
|
||||||
}
|
}
|
||||||
glXDestroyPixmap(display(), m_glxpixmap);
|
glXDestroyPixmap(display(), m_glxpixmap);
|
||||||
|
m_glxpixmap = None;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -617,7 +626,6 @@ bool SceneOpenGL::Texture::load(const Pixmap& pix, const QSize& size,
|
||||||
}
|
}
|
||||||
|
|
||||||
d->m_size = size;
|
d->m_size = size;
|
||||||
d->m_yInverted = true;
|
|
||||||
// new texture, or texture contents changed; mipmaps now invalid
|
// new texture, or texture contents changed; mipmaps now invalid
|
||||||
setDirty();
|
setDirty();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue