aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJakob Bornecrantz <jakob@vmware.com>2009-12-03 18:25:47 -0500
committerDave Airlie <airlied@redhat.com>2009-12-03 18:25:47 -0500
commit884840aa3ce3214259e69557be5b4ce0d781ffa4 (patch)
tree98dfd51c879df19428f3f6795fd32a8f2136ccb3 /include
parentc3a73ba13bac7fd96030f39202b2d37fb19c46a6 (diff)
drm: Add dirty ioctl and property
This commit adds a ioctl and property to allow userspace to notify the kernel that a framebuffer has changed. Instead of snooping the command stream this allows finer grained tracking of which areas have changed. The primary user for this functionality is virtual hardware like the vmware svga device, but also Xen hardware likes to be notify. There is also real hardware like DisplayLink and DisplayPort that might take advantage of this ioctl. Signed-off-by: Jakob Bornecrantz <jakob@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/drm/drm.h1
-rw-r--r--include/drm/drm_crtc.h19
-rw-r--r--include/drm/drm_mode.h44
3 files changed, 64 insertions, 0 deletions
diff --git a/include/drm/drm.h b/include/drm/drm.h
index 0114ac94f969..43a35b092f04 100644
--- a/include/drm/drm.h
+++ b/include/drm/drm.h
@@ -697,6 +697,7 @@ struct drm_gem_open {
697#define DRM_IOCTL_MODE_ADDFB DRM_IOWR(0xAE, struct drm_mode_fb_cmd) 697#define DRM_IOCTL_MODE_ADDFB DRM_IOWR(0xAE, struct drm_mode_fb_cmd)
698#define DRM_IOCTL_MODE_RMFB DRM_IOWR(0xAF, unsigned int) 698#define DRM_IOCTL_MODE_RMFB DRM_IOWR(0xAF, unsigned int)
699#define DRM_IOCTL_MODE_PAGE_FLIP DRM_IOWR(0xB0, struct drm_mode_crtc_page_flip) 699#define DRM_IOCTL_MODE_PAGE_FLIP DRM_IOWR(0xB0, struct drm_mode_crtc_page_flip)
700#define DRM_IOCTL_MODE_DIRTYFB DRM_IOWR(0xB1, struct drm_mode_fb_dirty_cmd)
700 701
701/** 702/**
702 * Device specific ioctls should only be in their respective headers 703 * Device specific ioctls should only be in their respective headers
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 938f327a2a3b..219f075d2733 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -242,6 +242,21 @@ struct drm_framebuffer_funcs {
242 int (*create_handle)(struct drm_framebuffer *fb, 242 int (*create_handle)(struct drm_framebuffer *fb,
243 struct drm_file *file_priv, 243 struct drm_file *file_priv,
244 unsigned int *handle); 244 unsigned int *handle);
245 /**
246 * Optinal callback for the dirty fb ioctl.
247 *
248 * Userspace can notify the driver via this callback
249 * that a area of the framebuffer has changed and should
250 * be flushed to the display hardware.
251 *
252 * See documentation in drm_mode.h for the struct
253 * drm_mode_fb_dirty_cmd for more information as all
254 * the semantics and arguments have a one to one mapping
255 * on this function.
256 */
257 int (*dirty)(struct drm_framebuffer *framebuffer, unsigned flags,
258 unsigned color, struct drm_clip_rect *clips,
259 unsigned num_clips);
245}; 260};
246 261
247struct drm_framebuffer { 262struct drm_framebuffer {
@@ -610,6 +625,7 @@ struct drm_mode_config {
610 /* Optional properties */ 625 /* Optional properties */
611 struct drm_property *scaling_mode_property; 626 struct drm_property *scaling_mode_property;
612 struct drm_property *dithering_mode_property; 627 struct drm_property *dithering_mode_property;
628 struct drm_property *dirty_info_property;
613}; 629};
614 630
615#define obj_to_crtc(x) container_of(x, struct drm_crtc, base) 631#define obj_to_crtc(x) container_of(x, struct drm_crtc, base)
@@ -718,6 +734,7 @@ extern int drm_mode_create_tv_properties(struct drm_device *dev, int num_formats
718 char *formats[]); 734 char *formats[]);
719extern int drm_mode_create_scaling_mode_property(struct drm_device *dev); 735extern int drm_mode_create_scaling_mode_property(struct drm_device *dev);
720extern int drm_mode_create_dithering_property(struct drm_device *dev); 736extern int drm_mode_create_dithering_property(struct drm_device *dev);
737extern int drm_mode_create_dirty_info_property(struct drm_device *dev);
721extern char *drm_get_encoder_name(struct drm_encoder *encoder); 738extern char *drm_get_encoder_name(struct drm_encoder *encoder);
722 739
723extern int drm_mode_connector_attach_encoder(struct drm_connector *connector, 740extern int drm_mode_connector_attach_encoder(struct drm_connector *connector,
@@ -745,6 +762,8 @@ extern int drm_mode_rmfb(struct drm_device *dev,
745 void *data, struct drm_file *file_priv); 762 void *data, struct drm_file *file_priv);
746extern int drm_mode_getfb(struct drm_device *dev, 763extern int drm_mode_getfb(struct drm_device *dev,
747 void *data, struct drm_file *file_priv); 764 void *data, struct drm_file *file_priv);
765extern int drm_mode_dirtyfb_ioctl(struct drm_device *dev,
766 void *data, struct drm_file *file_priv);
748extern int drm_mode_addmode_ioctl(struct drm_device *dev, 767extern int drm_mode_addmode_ioctl(struct drm_device *dev,
749 void *data, struct drm_file *file_priv); 768 void *data, struct drm_file *file_priv);
750extern int drm_mode_rmmode_ioctl(struct drm_device *dev, 769extern int drm_mode_rmmode_ioctl(struct drm_device *dev,
diff --git a/include/drm/drm_mode.h b/include/drm/drm_mode.h
index 09ca6adf4dd5..43009bc2e757 100644
--- a/include/drm/drm_mode.h
+++ b/include/drm/drm_mode.h
@@ -75,6 +75,11 @@
75#define DRM_MODE_DITHERING_OFF 0 75#define DRM_MODE_DITHERING_OFF 0
76#define DRM_MODE_DITHERING_ON 1 76#define DRM_MODE_DITHERING_ON 1
77 77
78/* Dirty info options */
79#define DRM_MODE_DIRTY_OFF 0
80#define DRM_MODE_DIRTY_ON 1
81#define DRM_MODE_DIRTY_ANNOTATE 2
82
78struct drm_mode_modeinfo { 83struct drm_mode_modeinfo {
79 __u32 clock; 84 __u32 clock;
80 __u16 hdisplay, hsync_start, hsync_end, htotal, hskew; 85 __u16 hdisplay, hsync_start, hsync_end, htotal, hskew;
@@ -222,6 +227,45 @@ struct drm_mode_fb_cmd {
222 __u32 handle; 227 __u32 handle;
223}; 228};
224 229
230#define DRM_MODE_FB_DIRTY_ANNOTATE_COPY 0x01
231#define DRM_MODE_FB_DIRTY_ANNOTATE_FILL 0x02
232#define DRM_MODE_FB_DIRTY_FLAGS 0x03
233
234/*
235 * Mark a region of a framebuffer as dirty.
236 *
237 * Some hardware does not automatically update display contents
238 * as a hardware or software draw to a framebuffer. This ioctl
239 * allows userspace to tell the kernel and the hardware what
240 * regions of the framebuffer have changed.
241 *
242 * The kernel or hardware is free to update more then just the
243 * region specified by the clip rects. The kernel or hardware
244 * may also delay and/or coalesce several calls to dirty into a
245 * single update.
246 *
247 * Userspace may annotate the updates, the annotates are a
248 * promise made by the caller that the change is either a copy
249 * of pixels or a fill of a single color in the region specified.
250 *
251 * If the DRM_MODE_FB_DIRTY_ANNOTATE_COPY flag is given then
252 * the number of updated regions are half of num_clips given,
253 * where the clip rects are paired in src and dst. The width and
254 * height of each one of the pairs must match.
255 *
256 * If the DRM_MODE_FB_DIRTY_ANNOTATE_FILL flag is given the caller
257 * promises that the region specified of the clip rects is filled
258 * completely with a single color as given in the color argument.
259 */
260
261struct drm_mode_fb_dirty_cmd {
262 __u32 fb_id;
263 __u32 flags;
264 __u32 color;
265 __u32 num_clips;
266 __u64 clips_ptr;
267};
268
225struct drm_mode_mode_cmd { 269struct drm_mode_mode_cmd {
226 __u32 connector_id; 270 __u32 connector_id;
227 struct drm_mode_modeinfo mode; 271 struct drm_mode_modeinfo mode;