Buffer Allocation
GBM is commonly used to allocate buffers, which are backed by the dma-buf file descriptor.
This code snippet shows how to allocate a buffer using GBM:
drm_fd = open("/dev/dri/card0", O_RDWR);
device = gbm_create_device(drm_fd);
bo = gbm_bo_create_with_modifiers(device, width, height,
format, modifiers, modifiers_count);
Weston supports the DRM_FORMAT_XRGB8888
and DRM_FORMAT_ARGB8888
formats.
A modifier is an encoding of vendor-specific buffer layout parameters. Weston modifiers are supported by DRM (read the IN_FORMATS
plane property blob) and by EGL (call eglQueryDmaBufModifiersEXT()
).