summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Bornecrantz <jakob@vmware.com>2009-11-24 18:00:12 +0100
committerJakob Bornecrantz <jakob@vmware.com>2009-11-26 16:47:54 +0100
commit3e48613b482a8ca01ea5719e9cc342a9d4b28db0 (patch)
tree7a946ffccfb4d635454e4b5e4663f91ad789e31e
parent6f66de982ad6ee6967ec61a7399e600bdd9e5887 (diff)
Bring dirty code from old branch
-rw-r--r--include/drm/drm.h1
-rw-r--r--include/drm/drm_mode.h9
-rw-r--r--xf86drmMode.c12
-rw-r--r--xf86drmMode.h20
4 files changed, 42 insertions, 0 deletions
diff --git a/include/drm/drm.h b/include/drm/drm.h
index 649c46f3..8e1ffb86 100644
--- a/include/drm/drm.h
+++ b/include/drm/drm.h
@@ -696,6 +696,7 @@ struct drm_gem_open {
#define DRM_IOCTL_MODE_GETFB DRM_IOWR(0xAD, struct drm_mode_fb_cmd)
#define DRM_IOCTL_MODE_ADDFB DRM_IOWR(0xAE, struct drm_mode_fb_cmd)
#define DRM_IOCTL_MODE_RMFB DRM_IOWR(0xAF, unsigned int)
+#define DRM_IOCTL_MODE_DIRTYFB DRM_IOWR(0xB0, struct drm_mode_fb_dirty_cmd)
/**
* Device specific ioctls should only be in their respective headers
diff --git a/include/drm/drm_mode.h b/include/drm/drm_mode.h
index 852505e7..92526537 100644
--- a/include/drm/drm_mode.h
+++ b/include/drm/drm_mode.h
@@ -222,6 +222,15 @@ struct drm_mode_fb_cmd {
__u32 handle;
};
+struct drm_mode_fb_dirty_cmd {
+ __u32 fb_id;
+ __u32 flags;
+ __u32 num_clips;
+ __u32 reserved1;
+ __u64 reserved2;
+ __u64 clips_ptr;
+};
+
struct drm_mode_mode_cmd {
__u32 connector_id;
struct drm_mode_modeinfo mode;
diff --git a/xf86drmMode.c b/xf86drmMode.c
index 6d85113a..7481ad60 100644
--- a/xf86drmMode.c
+++ b/xf86drmMode.c
@@ -241,6 +241,18 @@ drmModeFBPtr drmModeGetFB(int fd, uint32_t buf)
return r;
}
+int drmModeDirtyFB(int fd, uint32_t bufferId,
+ drmModeClipPtr clips, uint32_t num_clips)
+{
+ struct drm_mode_fb_dirty_cmd dirty = { 0 };
+
+ dirty.fb_id = bufferId;
+ dirty.clips_ptr = VOID2U64(clips);
+ dirty.num_clips = num_clips;
+
+ return drmIoctl(fd, DRM_IOCTL_MODE_DIRTYFB, &dirty);
+}
+
/*
* Crtc functions
diff --git a/xf86drmMode.h b/xf86drmMode.h
index 62304bb9..226d9467 100644
--- a/xf86drmMode.h
+++ b/xf86drmMode.h
@@ -145,6 +145,17 @@
#endif /* _DRM_MODE_H */
+
+/*
+ * Feature defines
+ *
+ * Just because these are defined doesn't mean that the kernel
+ * can do that feature, its just for new code vs old libdrm.
+ */
+#define DRM_MODE_FEATURE_KMS 1
+#define DRM_MODE_FEATURE_DIRTYFB 1
+
+
typedef struct _drmModeRes {
int count_fbs;
@@ -185,6 +196,8 @@ typedef struct _drmModeFB {
uint32_t handle;
} drmModeFB, *drmModeFBPtr;
+typedef struct drm_clip_rect drmModeClip, *drmModeClipPtr;
+
typedef struct _drmModePropertyBlob {
uint32_t id;
uint32_t length;
@@ -293,6 +306,13 @@ extern int drmModeAddFB(int fd, uint32_t width, uint32_t height, uint8_t depth,
*/
extern int drmModeRmFB(int fd, uint32_t bufferId);
+/**
+ * Mark a region of a framebuffer as dirty.
+ */
+extern int drmModeDirtyFB(int fd, uint32_t bufferId,
+ drmModeClipPtr clips, uint32_t num_clips);
+
+
/*
* Crtc functions
*/