summaryrefslogtreecommitdiff
path: root/libdrm
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@sasori.(none)>2009-11-12 14:06:45 -0500
committerJesse Barnes <jbarnes@virtuousgeek.org>2009-11-20 14:53:27 -0800
commitb80bcffba6175c53ebe1f1bd02730de0338cc039 (patch)
tree243823e5ed4ee2779ec7bbce4c1a7ce77e9d80cc /libdrm
parent2577764a5069ca9276e90154915797bcf873adab (diff)
libdrm: add libdrm support for page flip ioctl
Diffstat (limited to 'libdrm')
-rw-r--r--libdrm/xf86drm.h6
-rw-r--r--libdrm/xf86drmMode.c25
-rw-r--r--libdrm/xf86drmMode.h2
3 files changed, 32 insertions, 1 deletions
diff --git a/libdrm/xf86drm.h b/libdrm/xf86drm.h
index 2cb9c9e9..0c1fcbbf 100644
--- a/libdrm/xf86drm.h
+++ b/libdrm/xf86drm.h
@@ -682,6 +682,12 @@ typedef struct _drmEventContext {
unsigned int tv_usec,
void *user_data);
+ void (*page_flip_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);
diff --git a/libdrm/xf86drmMode.c b/libdrm/xf86drmMode.c
index 6d85113a..e9516851 100644
--- a/libdrm/xf86drmMode.c
+++ b/libdrm/xf86drmMode.c
@@ -700,7 +700,17 @@ int drmHandleEvent(int fd, drmEventContextPtr evctx)
vblank->tv_usec,
U642VOID (vblank->user_data));
break;
-
+ case DRM_EVENT_FLIP_COMPLETE:
+ if (evctx->version < 1 ||
+ evctx->page_flip_handler == NULL)
+ break;
+ vblank = (struct drm_event_vblank *) e;
+ evctx->page_flip_handler(fd,
+ vblank->sequence,
+ vblank->tv_sec,
+ vblank->tv_usec,
+ U642VOID (vblank->user_data));
+ break;
default:
break;
}
@@ -710,3 +720,16 @@ int drmHandleEvent(int fd, drmEventContextPtr evctx)
return 0;
}
+int drmModePageFlip(int fd, uint32_t crtc_id, uint32_t fb_id,
+ uint32_t flags, void *user_data)
+{
+ struct drm_mode_crtc_page_flip flip;
+
+ flip.fb_id = fb_id;
+ flip.crtc_id = crtc_id;
+ flip.user_data = VOID2U64(user_data);
+ flip.flags = flags;
+ flip.reserved = 0;
+
+ return drmIoctl(fd, DRM_IOCTL_MODE_PAGE_FLIP, &flip);
+}
diff --git a/libdrm/xf86drmMode.h b/libdrm/xf86drmMode.h
index 62304bb9..705369fe 100644
--- a/libdrm/xf86drmMode.h
+++ b/libdrm/xf86drmMode.h
@@ -362,3 +362,5 @@ extern int drmModeCrtcSetGamma(int fd, uint32_t crtc_id, uint32_t size,
uint16_t *red, uint16_t *green, uint16_t *blue);
extern int drmModeCrtcGetGamma(int fd, uint32_t crtc_id, uint32_t size,
uint16_t *red, uint16_t *green, uint16_t *blue);
+extern int drmModePageFlip(int fd, uint32_t crtc_id, uint32_t fb_id,
+ uint32_t flags, void *user_data);