How to create a gbm buffer under X.

To create a GBM buffer you first need to create a drm device and then use its device descriptor to create a gbm device. To do this under X you need a way to tell xserver which device you use to avoid permission issues. Here’s an example where I create a gbm buffer under X and then authenticate to the X server:

[Edited:] To see a complete example (as asked in the comments) you can checkout this code:

7 thoughts on “How to create a gbm buffer under X.”

      1. Really appreciate the help. Just one question, it seems that you create two separate OpenGL contexts. The first one is the GBM context, while the other is the OpenGL context automatically built by the SDL2. Do you assume we share resources between the two contexts?


        1. hmm, I only create the OpenGL context from SDL2 as you say (one context). Maybe you misunderstood something in the example (?). In which line did you think I create the “gbm context”?

Leave a Reply to Elliott Cancel reply

Your email address will not be published. Required fields are marked *