Use glBufferSubData() with the NVIDIA driver

Review Request #111354 - Created July 2, 2013 and submitted

Fredrik Höglund
Someone with an NVIDIA card needs to test this, both with and without __GL_THREADED_OPTIMIZATIONS=1.
It may be necessary to call XInitThreads() in kdemain() for the environment variable to have
any effect.

commit 4c909c642ae765f5bdd84cd86f5c8caf0eff755c
Author: Fredrik Höglund <>
Date:   Fri Jun 28 20:20:45 2013 +0200

    kwin: Use glBufferSubData() when preferred
    Use glBufferData() to reallocate the data store, and glBufferSubData()
    to upload data to unused ranges of vertex buffers.

commit 337f97650de26b1532c3e69daf3e8123b7f1ee10
Author: Fredrik Höglund <>
Date:   Fri Jun 28 20:04:33 2013 +0200

    kwin: Add GLPlatform::preferBufferSubData()
    This method returns true when glMapBufferRange() is likely to perform
    worse than glBufferSubData() when updating an unused range in a buffer
    This is the case with the NVIDIA driver, where glMapBufferRange()
    will force thread serialization. The driver tracks which ranges of
    the buffer are in use, so calls to glBufferSubData() should not
    cause a pipeline stall.

Fredrik Höglund
Fredrik Höglund
Fredrik Höglund
Review request changed

Status: Closed (submitted)