diff --git a/include/drm/drm.h b/include/drm/drm.h index c5bd3e9a..f10f956e 100644 --- a/include/drm/drm.h +++ b/include/drm/drm.h @@ -775,6 +775,13 @@ struct drm_gem_open { * commits. */ #define DRM_CAP_ATOMIC_ASYNC_PAGE_FLIP 0x15 +/** + * DRM_CAP_ATOMIC_HW_DONE_EVENT + * + * If set to 1, the kernel supports &DRM_MODE_ATOMIC_HW_DONE_EVENT for atomic + * commits. + */ +#define DRM_CAP_ATOMIC_HW_DONE_EVENT 0x16 /* DRM_IOCTL_GET_CAP ioctl argument type */ struct drm_get_cap { @@ -1326,7 +1333,7 @@ extern "C" { * * Event types 0 - 0x7fffffff are generic DRM events, 0x80000000 and * up are chipset specific. Generic DRM events include &DRM_EVENT_VBLANK, - * &DRM_EVENT_FLIP_COMPLETE and &DRM_EVENT_CRTC_SEQUENCE. + * &DRM_EVENT_FLIP_COMPLETE, &DRM_EVENT_CRTC_SEQUENCE and &DRM_EVENT_ATOMIC_HW_DONE. */ struct drm_event { __u32 type; @@ -1359,6 +1366,17 @@ struct drm_event { * The event payload is a struct drm_event_crtc_sequence. */ #define DRM_EVENT_CRTC_SEQUENCE 0x03 +/** + * DRM_EVENT_ATOMIC_HW_DONE - atomic commit HW done event + * + * This event is sent in response to an atomic commit with the + * &DRM_MODE_ATOMIC_HW_DONE_EVENT flag set. + * + * One event is sent per commit. + * + * The event payload is a struct drm_event_atomic_hw_done. + */ +#define DRM_EVENT_ATOMIC_HW_DONE 0x04 struct drm_event_vblank { struct drm_event base; @@ -1369,6 +1387,17 @@ struct drm_event_vblank { __u32 crtc_id; /* 0 on older kernels that do not support this */ }; +struct drm_event_atomic_hw_done { + struct drm_event base; + __u64 user_data; + + /** + * Timestamp corresponding to when programming the commit to HW completed. + */ + __u32 tv_sec; + __u32 tv_usec; +}; + /* Event delivered at sequence. Time stamp marks when the first pixel * of the refresh cycle leaves the display engine for the display */ diff --git a/include/drm/drm_mode.h b/include/drm/drm_mode.h index c082810c..463e3291 100644 --- a/include/drm/drm_mode.h +++ b/include/drm/drm_mode.h @@ -1136,6 +1136,15 @@ struct drm_mode_destroy_dumb { */ #define DRM_MODE_ATOMIC_ALLOW_MODESET 0x0400 +/** + * DRM_MODE_ATOMIC_HW_DONE_EVENT + * + * Request that the kernel sends back an atomic commit HW done event (see + * struct drm_event_atomic_hw_done) with the &DRM_EVENT_ATOMIC_HW_DONE type when + * programming the atomic commit to HW completes. + */ +#define DRM_MODE_ATOMIC_HW_DONE_EVENT 0x0800 + /** * DRM_MODE_ATOMIC_FLAGS * @@ -1147,7 +1156,8 @@ struct drm_mode_destroy_dumb { DRM_MODE_PAGE_FLIP_ASYNC |\ DRM_MODE_ATOMIC_TEST_ONLY |\ DRM_MODE_ATOMIC_NONBLOCK |\ - DRM_MODE_ATOMIC_ALLOW_MODESET) + DRM_MODE_ATOMIC_ALLOW_MODESET |\ + DRM_MODE_ATOMIC_HW_DONE_EVENT) struct drm_mode_atomic { __u32 flags;