[Mesa-dev] GBM, KMS/DRM, triple buffering

Daniel Stone daniel at fooishbar.org
Mon Feb 12 09:56:17 UTC 2018

Hi Carlos,

On 9 February 2018 at 18:26, Carlos Rafael Giani <dv at pseudoterminal.org> wrote:
> thanks, I got it to work - almost. I am running this on the i.MX6 with
> etnaviv. I do get some flickering, however.

Flickering shouldn't be seen. It's possible that you're calling things
incorrectly, however.

For example:
/* render frame A */
buf_a = gbm_bo_lock_front_buffer(surface);
drmModePageFlip(fd, fb_a, PAGE_FLIP_EVENT);
/* render frame B */
buf_b = gbm_bo_lock_front_buffer(surface);
drmModePageFlip(fd, fb_b, PAGE_FLIP_EVENT);

At this point, you cannot release _either_ fb_b or fb_a since they are
still in use by KMS. The first point at which it is safe to release
fb_a is when you get the event from the flip to fb_b having completed.
Releasing it earlier will likely cause flickering.

> To test if something is wrong with the page flipping, I call drmGetCap()
> with DRM_CAP_ASYNC_PAGE_FLIP , and it returns me 0, indicating that async
> page flipping is not supported. But this is odd - is this really not
> implemented yet for the i.MX6? And why does drmModePageFlip() still work

Ah. Those are asynchronous in different directions. ASYNC_PAGE_FLIP
refers to the display engine not waiting until any rendering is
complete to display that buffer (i.e. asking for tearing as you
display before rendering completes). PAGE_FLIP_EVENT (also known as
nonblocking) refers to drmModePageFlip returning immediately, instead
of waiting until the display engine has completed the flip.


More information about the mesa-dev mailing list