Code:
#include <stdio.h> #include <fcntl.h> #include <libdrm/drm.h> int main() { unsigned int fd, num[40], objs[40], props[40], val[40]; struct drm_mode_get_plane_res pres = {0}; struct drm_mode_get_plane plane = {0}; struct drm_set_client_cap cap; struct drm_mode_atomic atom = {0}; fd = open("/dev/dri/card0", O_RDWR | O_CLOEXEC | O_NONBLOCK); cap.capability = DRM_CLIENT_CAP_UNIVERSAL_PLANES; cap.value = 1; ioctl(fd, DRM_IOCTL_SET_CLIENT_CAP, &cap); cap.capability = DRM_CLIENT_CAP_ATOMIC; cap.value = 1; ioctl(fd, DRM_IOCTL_SET_CLIENT_CAP, &cap); perror("DRM_IOCTL_SET_CLIENT_CAP"); atom.flags = DRM_MODE_ATOMIC_ALLOW_MODESET; atom.objs_ptr = (long) objs; atom.count_props_ptr = num; atom.props_ptr = props; atom.prop_values_ptr = val; ioctl(fd, DRM_IOCTL_MODE_ATOMIC, &atom); perror("DRM_IOCTL_MODE_ATOMIC"); printf("count_objs :%d\n", atom.count_objs); close(fd); return 0; }
Code:
[email protected] ./test_atomic DRM_IOCTL_SET_CLIENT_CAP: success DRM_IOCTL_MODE_ATOMIC: success count_obj :0 [email protected]
CARD: intel ivybridge mobil linux: 4.5.4
Leave a comment: