Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save 3ap/db40f820e42454347361159d27509cd3 to your computer and use it in GitHub Desktop.
Save 3ap/db40f820e42454347361159d27509cd3 to your computer and use it in GitHub Desktop.
Check if DRM_CLIENT_CAP_ATOMIC is supported by your GPU
make CFLAGS=$(pkg-config --cflags libdrm) LDLIBS=$(pkg-config --libs libdrm) check-drm-cap-atomic && ./check-drm-cap-atomic
#include <stdio.h>
#include <assert.h>
#include <errno.h>
#include <fcntl.h>
#include <xf86drm.h>
#define DRI_DEVICE_NODE "/dev/dri/card0"
int main()
{
int drm_fd, rc, err;
drm_fd = open(DRI_DEVICE_NODE, O_RDWR | FD_CLOEXEC);
assert(drm_fd != -1);
rc = drmSetClientCap(drm_fd, DRM_CLIENT_CAP_ATOMIC, 1);
/* Errno can be overwritten so save it immediately */
err = errno;
printf("drmSetClientCap(%d, DRM_CLIENT_CAP_ATOMIC, 1) = %d\n", drm_fd, rc);
if (rc < 0)
{
printf("errno = %d\n", err);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment