[Intel-gfx] [PATCH] libdrm/intel: add page flip ioctl support
Jesse Barnes
jbarnes at virtuousgeek.org
Wed Apr 15 00:19:57 CEST 2009
Eric suggested moving the ioctl handling into libdrm, which makes
sense. The API prototype could probably be more consistent with the
xf86drmMode stuff, I'm happy to hear suggestions on that.
diff --git a/libdrm/intel/intel_bufmgr.c b/libdrm/intel/intel_bufmgr.c
index 25a6828..3b99b45 100644
--- a/libdrm/intel/intel_bufmgr.c
+++ b/libdrm/intel/intel_bufmgr.c
@@ -36,6 +36,7 @@
#include <errno.h>
#include <drm.h>
#include <i915_drm.h>
+#include <xf86drm.h>
#include "intel_bufmgr.h"
#include "intel_bufmgr_priv.h"
@@ -212,3 +213,14 @@ int drm_intel_bo_get_tiling(drm_intel_bo *bo, uint32_t *tiling_mode,
*swizzle_mode = I915_BIT_6_SWIZZLE_NONE;
return 0;
}
+
+int drm_intel_flip_bufs(int fd, int crtc_id, int fb_id)
+{
+ struct drm_i915_gem_page_flip flip;
+
+ flip.fb_id = fb_id;
+ flip.crtc_id = crtc_id;
+ flip.flags = 0;
+
+ return drmCommandWrite(fd, DRM_I915_GEM_PAGE_FLIP, &flip, sizeof(flip));
+}
diff --git a/libdrm/intel/intel_bufmgr.h b/libdrm/intel/intel_bufmgr.h
index 542dc06..0a0f019 100644
--- a/libdrm/intel/intel_bufmgr.h
+++ b/libdrm/intel/intel_bufmgr.h
@@ -107,6 +107,7 @@ int drm_intel_bo_set_tiling(drm_intel_bo *bo, uint32_t *tiling_mode,
int drm_intel_bo_get_tiling(drm_intel_bo *bo, uint32_t *tiling_mode,
uint32_t *swizzle_mode);
int drm_intel_bo_flink(drm_intel_bo *bo, uint32_t *name);
+int drm_intel_flip_bufs(int fd, int crtc_id, int fb_id);
/* drm_intel_bufmgr_gem.c */
drm_intel_bufmgr *drm_intel_bufmgr_gem_init(int fd, int batch_size);
diff --git a/shared-core/i915_drm.h b/shared-core/i915_drm.h
index 5456e91..a5ffadc 100644
--- a/shared-core/i915_drm.h
+++ b/shared-core/i915_drm.h
@@ -205,6 +205,7 @@ typedef struct drm_i915_sarea {
#define DRM_I915_GEM_GET_TILING 0x22
#define DRM_I915_GEM_GET_APERTURE 0x23
#define DRM_I915_GEM_MMAP_GTT 0x24
+#define DRM_I915_GEM_PAGE_FLIP 0x25
#define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t)
#define DRM_IOCTL_I915_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH)
@@ -769,4 +770,21 @@ struct drm_i915_gem_get_aperture {
uint64_t aper_available_size;
};
+#define I915_PAGE_FLIP_WAIT (1<<0) /* block on page flip completion */
+
+struct drm_i915_gem_page_flip {
+ /** Handle of new front buffer */
+ uint32_t fb_id;
+
+ /**
+ * crtc to flip
+ */
+ uint32_t crtc_id;
+
+ /**
+ * page flip flags (wait on flip only for now)
+ */
+ uint32_t flags;
+};
+
#endif /* _I915_DRM_H_ */
More information about the Intel-gfx
mailing list