summaryrefslogtreecommitdiff
path: root/shared-core/drm.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 /shared-core/drm.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 'shared-core/drm.h')
-rw-r--r--shared-core/drm.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/shared-core/drm.h b/shared-core/drm.h
index d97844f8..089e184a 100644
--- a/shared-core/drm.h
+++ b/shared-core/drm.h
@@ -809,6 +809,34 @@ struct drm_gem_open {
#define DRM_COMMAND_BASE 0x40
#define DRM_COMMAND_END 0xA0
+/**
+ * Header for events written back to userspace on the drm fd. The
+ * type defines the type of event, the length specifies the total
+ * length of the event (including the header), and user_data is
+ * typically a 64 bit value passed with the ioctl that triggered the
+ * event. A read on the drm fd will always only return complete
+ * events, that is, if for example the read buffer is 100 bytes, and
+ * there are two 64 byte events pending, only one will be returned.
+ *
+ * Event types 0 - 0x7fffffff are generic drm events, 0x80000000 and
+ * up are chipset specific.
+ */
+struct drm_event {
+ uint32_t type;
+ uint32_t length;
+};
+
+#define DRM_EVENT_VBLANK 0x01
+
+struct drm_event_vblank {
+ struct drm_event base;
+ uint64_t user_data;
+ uint32_t tv_sec;
+ uint32_t tv_usec;
+ uint32_t sequence;
+ uint32_t reserved;
+};
+
/* typedef area */
#ifndef __KERNEL__
typedef struct drm_clip_rect drm_clip_rect_t;