Last active
April 30, 2024 00:37
-
-
Save 3ap/db40f820e42454347361159d27509cd3 to your computer and use it in GitHub Desktop.
Check if DRM_CLIENT_CAP_ATOMIC is supported by your GPU
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
make CFLAGS=$(pkg-config --cflags libdrm) LDLIBS=$(pkg-config --libs libdrm) check-drm-cap-atomic && ./check-drm-cap-atomic |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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