Commit 212d87a3 authored by David Edmundson's avatar David Edmundson
Browse files

[scenes/opengl] Remove outdated hack to reset vertex buffers

Summary:
Scene opengl has a callback for when we have a GL error. One of the
handlers for an error calls scheduleVboReInit the history shows it was a
forerunner to the GLX_NV_robustness_video_memory_purge but resetting
only one tiny part based on debug output.

When we get here we schedule a reset of the vertex buffer, via a timer.
When the timer is caled we have no idea what GL context was last
current, if it's not the currect context then the main scene
GLVertexBuffer will be deleted but not correctly re-initialised.

We have two very common crashes with a corrupted
GLVertexBuffer::streamingBuffer() which would match up perfectly.

Given that we now have a proper mechanism to reset the entire scene, we
don't need this timer based hack and resolve that problem.

BUG: 399499
BUG: 372305

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D26556
parent 6e910c45
......@@ -363,12 +363,8 @@ SceneOpenGL::SceneOpenGL(OpenGLBackend *backend, QObject *parent)
}
}
static SceneOpenGL *gs_debuggedScene = nullptr;
SceneOpenGL::~SceneOpenGL()
{
// do cleanup after initBuffer()
gs_debuggedScene = nullptr;
if (init_ok) {
makeOpenGLContextCurrent();
}
......@@ -380,23 +376,6 @@ SceneOpenGL::~SceneOpenGL()
delete m_backend;
}
static void scheduleVboReInit()
{
if (!gs_debuggedScene)
return;
static QPointer<QTimer> timer;
if (!timer) {
delete timer;
timer = new QTimer(gs_debuggedScene);
timer->setSingleShot(true);
QObject::connect(timer.data(), &QTimer::timeout, gs_debuggedScene, []() {
GLVertexBuffer::cleanup();
GLVertexBuffer::initStatic();
});
}
timer->start(250);
}
void SceneOpenGL::initDebugOutput()
{
......@@ -424,8 +403,6 @@ void SceneOpenGL::initDebugOutput()
}
}
gs_debuggedScene = this;
// Set the callback function
auto callback = [](GLenum source, GLenum type, GLuint id,
GLenum severity, GLsizei length,
......@@ -444,14 +421,6 @@ void SceneOpenGL::initDebugOutput()
break;
case GL_DEBUG_TYPE_OTHER:
// at least the nvidia driver seems prone to end up with invalid VBOs after
// transferring them between system heap and VRAM
// so we re-init them whenever this happens (typically when switching VT, resuming
// from STR and XRandR events - #344326
if (strstr(message, "Buffer detailed info:") && strstr(message, "has been updated"))
scheduleVboReInit();
// fall through! for general message printing
Q_FALLTHROUGH();
case GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR:
case GL_DEBUG_TYPE_PORTABILITY:
case GL_DEBUG_TYPE_PERFORMANCE:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment