Tag / libdrm

  • I want to use this short article to point out a big problem in code that uses libdrm. This, or a variant of this, is lurking in a shocking amount of software:

    Stop doing this, it has always been a crash waiting to happen. drmEventContext is part of libdrm’s ABI and there are strict promises that the structure won’t be randomly re-ordered. However, it may grow as the need arises when new versions of libdrm offer functionality which didn’t exist before. libdrm 2.4.78 introduces another page flip handler, adding a new function pointer harmlessly at the end of the structure page_flip_handler2. It also bumps DRM_EVENT_CONTEXT_VERSION from 2 to 3, as that’s the current version of the structure in the header file. As a result, the code above crashes… sometimes. What went wrong? The Proper Way to Use drmEventContext DrmEventContext.version is intended to tell the library what version of the […]

    Read More