aboutsummaryrefslogtreecommitdiff
path: root/libdrm/xf86drm.h
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@redhat.com>2009-09-11 13:27:35 -0400
committerJesse Barnes <jbarnes@virtuousgeek.org>2009-10-29 17:14:09 -0700
commitb0b96636dbf93445dd532b09b21fa4fc5ce6bdc7 (patch)
tree651a1d6ea2aff02f9fe43c696401eca1d82fe434 /libdrm/xf86drm.h
parent0d7ad7e43ca212b1e9f16cd18f36493cab455e61 (diff)
Add support for vblank events
The kernel will now write data to the DRM fd for various event types if requested. Currently, the only supported event is a vblank event: it contains the vblank count for the event as well as a timestamp from when the event ocurred. Since the DRM fd is now pollable, it's easy to integrate into existing event loops.
Diffstat (limited to 'libdrm/xf86drm.h')
-rw-r--r--libdrm/xf86drm.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/libdrm/xf86drm.h b/libdrm/xf86drm.h
index c1d173c4..2cb9c9e9 100644
--- a/libdrm/xf86drm.h
+++ b/libdrm/xf86drm.h
@@ -271,6 +271,7 @@ typedef struct _drmTextureRegion {
typedef enum {
DRM_VBLANK_ABSOLUTE = 0x0, /**< Wait for specific vblank sequence number */
DRM_VBLANK_RELATIVE = 0x1, /**< Wait for given number of vblanks */
+ DRM_VBLANK_EVENT = 0x4000000, /**< Send event instead of blocking */
DRM_VBLANK_FLIP = 0x8000000, /**< Scheduled buffer swap should flip */
DRM_VBLANK_NEXTONMISS = 0x10000000, /**< If missed, wait for next vblank */
DRM_VBLANK_SECONDARY = 0x20000000, /**< Secondary display controller */
@@ -667,4 +668,22 @@ extern void drmMsg(const char *format, ...);
extern int drmSetMaster(int fd);
extern int drmDropMaster(int fd);
+#define DRM_EVENT_CONTEXT_VERSION 1
+
+typedef struct _drmEventContext {
+
+ /* This struct is versioned so we can add more pointers if we
+ * add more events. */
+ int version;
+
+ void (*vblank_handler)(int fd,
+ unsigned int sequence,
+ unsigned int tv_sec,
+ unsigned int tv_usec,
+ void *user_data);
+
+} drmEventContext, *drmEventContextPtr;
+
+extern int drmHandleEvent(int fd, drmEventContextPtr evctx);
+
#endif