aboutsummaryrefslogtreecommitdiffstats
path: root/include/drm
diff options
context:
space:
mode:
Diffstat (limited to 'include/drm')
-rw-r--r--include/drm/Kbuild1
-rw-r--r--include/drm/drm.h17
-rw-r--r--include/drm/drmP.h324
-rw-r--r--include/drm/drm_crtc.h46
-rw-r--r--include/drm/drm_crtc_helper.h8
-rw-r--r--include/drm/drm_dp_helper.h8
-rw-r--r--include/drm/drm_edid.h25
-rw-r--r--include/drm/drm_fb_helper.h19
-rw-r--r--include/drm/drm_hashtab.h6
-rw-r--r--include/drm/drm_mm.h56
-rw-r--r--include/drm/drm_mode.h31
-rw-r--r--include/drm/drm_pciids.h75
-rw-r--r--include/drm/drm_usb.h15
-rw-r--r--include/drm/i830_drm.h342
-rw-r--r--include/drm/i915_drm.h21
-rw-r--r--include/drm/intel-gtt.h41
-rw-r--r--include/drm/mga_drm.h2
-rw-r--r--include/drm/nouveau_drm.h13
-rw-r--r--include/drm/radeon_drm.h7
-rw-r--r--include/drm/savage_drm.h2
-rw-r--r--include/drm/ttm/ttm_bo_api.h83
-rw-r--r--include/drm/ttm/ttm_bo_driver.h224
-rw-r--r--include/drm/ttm/ttm_execbuf_util.h11
-rw-r--r--include/drm/ttm/ttm_page_alloc.h8
-rw-r--r--include/drm/vmwgfx_drm.h3
25 files changed, 810 insertions, 578 deletions
diff --git a/include/drm/Kbuild b/include/drm/Kbuild
index ffec177f3481..3a60ac889520 100644
--- a/include/drm/Kbuild
+++ b/include/drm/Kbuild
@@ -2,7 +2,6 @@ header-y += drm.h
2header-y += drm_mode.h 2header-y += drm_mode.h
3header-y += drm_sarea.h 3header-y += drm_sarea.h
4header-y += i810_drm.h 4header-y += i810_drm.h
5header-y += i830_drm.h
6header-y += i915_drm.h 5header-y += i915_drm.h
7header-y += mga_drm.h 6header-y += mga_drm.h
8header-y += nouveau_drm.h 7header-y += nouveau_drm.h
diff --git a/include/drm/drm.h b/include/drm/drm.h
index e5f70617dec5..4be33b4ca2f8 100644
--- a/include/drm/drm.h
+++ b/include/drm/drm.h
@@ -463,12 +463,15 @@ struct drm_irq_busid {
463enum drm_vblank_seq_type { 463enum drm_vblank_seq_type {
464 _DRM_VBLANK_ABSOLUTE = 0x0, /**< Wait for specific vblank sequence number */ 464 _DRM_VBLANK_ABSOLUTE = 0x0, /**< Wait for specific vblank sequence number */
465 _DRM_VBLANK_RELATIVE = 0x1, /**< Wait for given number of vblanks */ 465 _DRM_VBLANK_RELATIVE = 0x1, /**< Wait for given number of vblanks */
466 /* bits 1-6 are reserved for high crtcs */
467 _DRM_VBLANK_HIGH_CRTC_MASK = 0x0000003e,
466 _DRM_VBLANK_EVENT = 0x4000000, /**< Send event instead of blocking */ 468 _DRM_VBLANK_EVENT = 0x4000000, /**< Send event instead of blocking */
467 _DRM_VBLANK_FLIP = 0x8000000, /**< Scheduled buffer swap should flip */ 469 _DRM_VBLANK_FLIP = 0x8000000, /**< Scheduled buffer swap should flip */
468 _DRM_VBLANK_NEXTONMISS = 0x10000000, /**< If missed, wait for next vblank */ 470 _DRM_VBLANK_NEXTONMISS = 0x10000000, /**< If missed, wait for next vblank */
469 _DRM_VBLANK_SECONDARY = 0x20000000, /**< Secondary display controller */ 471 _DRM_VBLANK_SECONDARY = 0x20000000, /**< Secondary display controller */
470 _DRM_VBLANK_SIGNAL = 0x40000000 /**< Send signal instead of blocking, unsupported */ 472 _DRM_VBLANK_SIGNAL = 0x40000000 /**< Send signal instead of blocking, unsupported */
471}; 473};
474#define _DRM_VBLANK_HIGH_CRTC_SHIFT 1
472 475
473#define _DRM_VBLANK_TYPES_MASK (_DRM_VBLANK_ABSOLUTE | _DRM_VBLANK_RELATIVE) 476#define _DRM_VBLANK_TYPES_MASK (_DRM_VBLANK_ABSOLUTE | _DRM_VBLANK_RELATIVE)
474#define _DRM_VBLANK_FLAGS_MASK (_DRM_VBLANK_EVENT | _DRM_VBLANK_SIGNAL | \ 477#define _DRM_VBLANK_FLAGS_MASK (_DRM_VBLANK_EVENT | _DRM_VBLANK_SIGNAL | \
@@ -608,6 +611,12 @@ struct drm_gem_open {
608 __u64 size; 611 __u64 size;
609}; 612};
610 613
614/** DRM_IOCTL_GET_CAP ioctl argument type */
615struct drm_get_cap {
616 __u64 capability;
617 __u64 value;
618};
619
611#include "drm_mode.h" 620#include "drm_mode.h"
612 621
613#define DRM_IOCTL_BASE 'd' 622#define DRM_IOCTL_BASE 'd'
@@ -628,6 +637,7 @@ struct drm_gem_open {
628#define DRM_IOCTL_GEM_CLOSE DRM_IOW (0x09, struct drm_gem_close) 637#define DRM_IOCTL_GEM_CLOSE DRM_IOW (0x09, struct drm_gem_close)
629#define DRM_IOCTL_GEM_FLINK DRM_IOWR(0x0a, struct drm_gem_flink) 638#define DRM_IOCTL_GEM_FLINK DRM_IOWR(0x0a, struct drm_gem_flink)
630#define DRM_IOCTL_GEM_OPEN DRM_IOWR(0x0b, struct drm_gem_open) 639#define DRM_IOCTL_GEM_OPEN DRM_IOWR(0x0b, struct drm_gem_open)
640#define DRM_IOCTL_GET_CAP DRM_IOWR(0x0c, struct drm_get_cap)
631 641
632#define DRM_IOCTL_SET_UNIQUE DRM_IOW( 0x10, struct drm_unique) 642#define DRM_IOCTL_SET_UNIQUE DRM_IOW( 0x10, struct drm_unique)
633#define DRM_IOCTL_AUTH_MAGIC DRM_IOW( 0x11, struct drm_auth) 643#define DRM_IOCTL_AUTH_MAGIC DRM_IOW( 0x11, struct drm_auth)
@@ -701,6 +711,10 @@ struct drm_gem_open {
701#define DRM_IOCTL_MODE_PAGE_FLIP DRM_IOWR(0xB0, struct drm_mode_crtc_page_flip) 711#define DRM_IOCTL_MODE_PAGE_FLIP DRM_IOWR(0xB0, struct drm_mode_crtc_page_flip)
702#define DRM_IOCTL_MODE_DIRTYFB DRM_IOWR(0xB1, struct drm_mode_fb_dirty_cmd) 712#define DRM_IOCTL_MODE_DIRTYFB DRM_IOWR(0xB1, struct drm_mode_fb_dirty_cmd)
703 713
714#define DRM_IOCTL_MODE_CREATE_DUMB DRM_IOWR(0xB2, struct drm_mode_create_dumb)
715#define DRM_IOCTL_MODE_MAP_DUMB DRM_IOWR(0xB3, struct drm_mode_map_dumb)
716#define DRM_IOCTL_MODE_DESTROY_DUMB DRM_IOWR(0xB4, struct drm_mode_destroy_dumb)
717
704/** 718/**
705 * Device specific ioctls should only be in their respective headers 719 * Device specific ioctls should only be in their respective headers
706 * The device specific ioctl range is from 0x40 to 0x99. 720 * The device specific ioctl range is from 0x40 to 0x99.
@@ -741,6 +755,9 @@ struct drm_event_vblank {
741 __u32 reserved; 755 __u32 reserved;
742}; 756};
743 757
758#define DRM_CAP_DUMB_BUFFER 0x1
759#define DRM_CAP_VBLANK_HIGH_CRTC 0x2
760
744/* typedef area */ 761/* typedef area */
745#ifndef __KERNEL__ 762#ifndef __KERNEL__
746typedef struct drm_clip_rect drm_clip_rect_t; 763typedef struct drm_clip_rect drm_clip_rect_t;
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 4c9461a4f9e6..738b3a5faa12 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -95,7 +95,7 @@ struct drm_device;
95 * drm_core, drm_driver, drm_kms 95 * drm_core, drm_driver, drm_kms
96 * drm_core level can be used in the generic drm code. For example: 96 * drm_core level can be used in the generic drm code. For example:
97 * drm_ioctl, drm_mm, drm_memory 97 * drm_ioctl, drm_mm, drm_memory
98 * The macro definiton of DRM_DEBUG is used. 98 * The macro definition of DRM_DEBUG is used.
99 * DRM_DEBUG(fmt, args...) 99 * DRM_DEBUG(fmt, args...)
100 * The debug info by using the DRM_DEBUG can be obtained by adding 100 * The debug info by using the DRM_DEBUG can be obtained by adding
101 * the boot option of "drm.debug=1". 101 * the boot option of "drm.debug=1".
@@ -122,10 +122,14 @@ struct drm_device;
122 * using the DRM_DEBUG_KMS and DRM_DEBUG. 122 * using the DRM_DEBUG_KMS and DRM_DEBUG.
123 */ 123 */
124 124
125extern void drm_ut_debug_printk(unsigned int request_level, 125extern __attribute__((format (printf, 4, 5)))
126void drm_ut_debug_printk(unsigned int request_level,
126 const char *prefix, 127 const char *prefix,
127 const char *function_name, 128 const char *function_name,
128 const char *format, ...); 129 const char *format, ...);
130extern __attribute__((format (printf, 2, 3)))
131int drm_err(const char *func, const char *format, ...);
132
129/***********************************************************************/ 133/***********************************************************************/
130/** \name DRM template customization defaults */ 134/** \name DRM template customization defaults */
131/*@{*/ 135/*@{*/
@@ -145,7 +149,10 @@ extern void drm_ut_debug_printk(unsigned int request_level,
145#define DRIVER_IRQ_VBL2 0x800 149#define DRIVER_IRQ_VBL2 0x800
146#define DRIVER_GEM 0x1000 150#define DRIVER_GEM 0x1000
147#define DRIVER_MODESET 0x2000 151#define DRIVER_MODESET 0x2000
148#define DRIVER_USE_PLATFORM_DEVICE 0x4000 152
153#define DRIVER_BUS_PCI 0x1
154#define DRIVER_BUS_PLATFORM 0x2
155#define DRIVER_BUS_USB 0x3
149 156
150/***********************************************************************/ 157/***********************************************************************/
151/** \name Begin the DRM... */ 158/** \name Begin the DRM... */
@@ -178,21 +185,11 @@ extern void drm_ut_debug_printk(unsigned int request_level,
178 * \param fmt printf() like format string. 185 * \param fmt printf() like format string.
179 * \param arg arguments 186 * \param arg arguments
180 */ 187 */
181#define DRM_ERROR(fmt, arg...) \ 188#define DRM_ERROR(fmt, ...) \
182 printk(KERN_ERR "[" DRM_NAME ":%s] *ERROR* " fmt , __func__ , ##arg) 189 drm_err(__func__, fmt, ##__VA_ARGS__)
183 190
184/** 191#define DRM_INFO(fmt, ...) \
185 * Memory error output. 192 printk(KERN_INFO "[" DRM_NAME "] " fmt, ##__VA_ARGS__)
186 *
187 * \param area memory area where the error occurred.
188 * \param fmt printf() like format string.
189 * \param arg arguments
190 */
191#define DRM_MEM_ERROR(area, fmt, arg...) \
192 printk(KERN_ERR "[" DRM_NAME ":%s:%s] *ERROR* " fmt , __func__, \
193 drm_mem_stats[area].name , ##arg)
194
195#define DRM_INFO(fmt, arg...) printk(KERN_INFO "[" DRM_NAME "] " fmt , ##arg)
196 193
197/** 194/**
198 * Debug output. 195 * Debug output.
@@ -683,6 +680,34 @@ struct drm_master {
683 void *driver_priv; /**< Private structure for driver to use */ 680 void *driver_priv; /**< Private structure for driver to use */
684}; 681};
685 682
683/* Size of ringbuffer for vblank timestamps. Just double-buffer
684 * in initial implementation.
685 */
686#define DRM_VBLANKTIME_RBSIZE 2
687
688/* Flags and return codes for get_vblank_timestamp() driver function. */
689#define DRM_CALLED_FROM_VBLIRQ 1
690#define DRM_VBLANKTIME_SCANOUTPOS_METHOD (1 << 0)
691#define DRM_VBLANKTIME_INVBL (1 << 1)
692
693/* get_scanout_position() return flags */
694#define DRM_SCANOUTPOS_VALID (1 << 0)
695#define DRM_SCANOUTPOS_INVBL (1 << 1)
696#define DRM_SCANOUTPOS_ACCURATE (1 << 2)
697
698struct drm_bus {
699 int bus_type;
700 int (*get_irq)(struct drm_device *dev);
701 const char *(*get_name)(struct drm_device *dev);
702 int (*set_busid)(struct drm_device *dev, struct drm_master *master);
703 int (*set_unique)(struct drm_device *dev, struct drm_master *master,
704 struct drm_unique *unique);
705 int (*irq_by_busid)(struct drm_device *dev, struct drm_irq_busid *p);
706 /* hooks that are for PCI */
707 int (*agp_init)(struct drm_device *dev);
708
709};
710
686/** 711/**
687 * DRM driver structure. This structure represent the common code for 712 * DRM driver structure. This structure represent the common code for
688 * a family of cards. There will one drm_device for each card present 713 * a family of cards. There will one drm_device for each card present
@@ -699,13 +724,8 @@ struct drm_driver {
699 int (*suspend) (struct drm_device *, pm_message_t state); 724 int (*suspend) (struct drm_device *, pm_message_t state);
700 int (*resume) (struct drm_device *); 725 int (*resume) (struct drm_device *);
701 int (*dma_ioctl) (struct drm_device *dev, void *data, struct drm_file *file_priv); 726 int (*dma_ioctl) (struct drm_device *dev, void *data, struct drm_file *file_priv);
702 void (*dma_ready) (struct drm_device *);
703 int (*dma_quiescent) (struct drm_device *); 727 int (*dma_quiescent) (struct drm_device *);
704 int (*context_ctor) (struct drm_device *dev, int context);
705 int (*context_dtor) (struct drm_device *dev, int context); 728 int (*context_dtor) (struct drm_device *dev, int context);
706 int (*kernel_context_switch) (struct drm_device *dev, int old,
707 int new);
708 void (*kernel_context_switch_unlock) (struct drm_device *dev);
709 729
710 /** 730 /**
711 * get_vblank_counter - get raw hardware vblank counter 731 * get_vblank_counter - get raw hardware vblank counter
@@ -765,6 +785,68 @@ struct drm_driver {
765 */ 785 */
766 int (*device_is_agp) (struct drm_device *dev); 786 int (*device_is_agp) (struct drm_device *dev);
767 787
788 /**
789 * Called by vblank timestamping code.
790 *
791 * Return the current display scanout position from a crtc.
792 *
793 * \param dev DRM device.
794 * \param crtc Id of the crtc to query.
795 * \param *vpos Target location for current vertical scanout position.
796 * \param *hpos Target location for current horizontal scanout position.
797 *
798 * Returns vpos as a positive number while in active scanout area.
799 * Returns vpos as a negative number inside vblank, counting the number
800 * of scanlines to go until end of vblank, e.g., -1 means "one scanline
801 * until start of active scanout / end of vblank."
802 *
803 * \return Flags, or'ed together as follows:
804 *
805 * DRM_SCANOUTPOS_VALID = Query successful.
806 * DRM_SCANOUTPOS_INVBL = Inside vblank.
807 * DRM_SCANOUTPOS_ACCURATE = Returned position is accurate. A lack of
808 * this flag means that returned position may be offset by a constant
809 * but unknown small number of scanlines wrt. real scanout position.
810 *
811 */
812 int (*get_scanout_position) (struct drm_device *dev, int crtc,
813 int *vpos, int *hpos);
814
815 /**
816 * Called by \c drm_get_last_vbltimestamp. Should return a precise
817 * timestamp when the most recent VBLANK interval ended or will end.
818 *
819 * Specifically, the timestamp in @vblank_time should correspond as
820 * closely as possible to the time when the first video scanline of
821 * the video frame after the end of VBLANK will start scanning out,
822 * the time immmediately after end of the VBLANK interval. If the
823 * @crtc is currently inside VBLANK, this will be a time in the future.
824 * If the @crtc is currently scanning out a frame, this will be the
825 * past start time of the current scanout. This is meant to adhere
826 * to the OpenML OML_sync_control extension specification.
827 *
828 * \param dev dev DRM device handle.
829 * \param crtc crtc for which timestamp should be returned.
830 * \param *max_error Maximum allowable timestamp error in nanoseconds.
831 * Implementation should strive to provide timestamp
832 * with an error of at most *max_error nanoseconds.
833 * Returns true upper bound on error for timestamp.
834 * \param *vblank_time Target location for returned vblank timestamp.
835 * \param flags 0 = Defaults, no special treatment needed.
836 * \param DRM_CALLED_FROM_VBLIRQ = Function is called from vblank
837 * irq handler. Some drivers need to apply some workarounds
838 * for gpu-specific vblank irq quirks if flag is set.
839 *
840 * \returns
841 * Zero if timestamping isn't supported in current display mode or a
842 * negative number on failure. A positive status code on success,
843 * which describes how the vblank_time timestamp was computed.
844 */
845 int (*get_vblank_timestamp) (struct drm_device *dev, int crtc,
846 int *max_error,
847 struct timeval *vblank_time,
848 unsigned flags);
849
768 /* these have to be filled in */ 850 /* these have to be filled in */
769 851
770 irqreturn_t(*irq_handler) (DRM_IRQ_ARGS); 852 irqreturn_t(*irq_handler) (DRM_IRQ_ARGS);
@@ -777,8 +859,6 @@ struct drm_driver {
777 struct drm_file *file_priv); 859 struct drm_file *file_priv);
778 void (*reclaim_buffers_idlelocked) (struct drm_device *dev, 860 void (*reclaim_buffers_idlelocked) (struct drm_device *dev,
779 struct drm_file *file_priv); 861 struct drm_file *file_priv);
780 resource_size_t (*get_map_ofs) (struct drm_local_map * map);
781 resource_size_t (*get_reg_ofs) (struct drm_device *dev);
782 void (*set_version) (struct drm_device *dev, 862 void (*set_version) (struct drm_device *dev,
783 struct drm_set_version *sv); 863 struct drm_set_version *sv);
784 864
@@ -795,8 +875,6 @@ struct drm_driver {
795 void (*master_drop)(struct drm_device *dev, struct drm_file *file_priv, 875 void (*master_drop)(struct drm_device *dev, struct drm_file *file_priv,
796 bool from_release); 876 bool from_release);
797 877
798 int (*proc_init)(struct drm_minor *minor);
799 void (*proc_cleanup)(struct drm_minor *minor);
800 int (*debugfs_init)(struct drm_minor *minor); 878 int (*debugfs_init)(struct drm_minor *minor);
801 void (*debugfs_cleanup)(struct drm_minor *minor); 879 void (*debugfs_cleanup)(struct drm_minor *minor);
802 880
@@ -812,6 +890,17 @@ struct drm_driver {
812 /* vga arb irq handler */ 890 /* vga arb irq handler */
813 void (*vgaarb_irq)(struct drm_device *dev, bool state); 891 void (*vgaarb_irq)(struct drm_device *dev, bool state);
814 892
893 /* dumb alloc support */
894 int (*dumb_create)(struct drm_file *file_priv,
895 struct drm_device *dev,
896 struct drm_mode_create_dumb *args);
897 int (*dumb_map_offset)(struct drm_file *file_priv,
898 struct drm_device *dev, uint32_t handle,
899 uint64_t *offset);
900 int (*dumb_destroy)(struct drm_file *file_priv,
901 struct drm_device *dev,
902 uint32_t handle);
903
815 /* Driver private ops for this object */ 904 /* Driver private ops for this object */
816 struct vm_operations_struct *gem_vm_ops; 905 struct vm_operations_struct *gem_vm_ops;
817 906
@@ -827,8 +916,13 @@ struct drm_driver {
827 struct drm_ioctl_desc *ioctls; 916 struct drm_ioctl_desc *ioctls;
828 int num_ioctls; 917 int num_ioctls;
829 struct file_operations fops; 918 struct file_operations fops;
830 struct pci_driver pci_driver; 919 union {
831 struct platform_device *platform_device; 920 struct pci_driver *pci;
921 struct platform_device *platform_device;
922 struct usb_driver *usb;
923 } kdriver;
924 struct drm_bus *bus;
925
832 /* List of devices hanging off this driver */ 926 /* List of devices hanging off this driver */
833 struct list_head device_list; 927 struct list_head device_list;
834}; 928};
@@ -900,6 +994,22 @@ struct drm_minor {
900 struct drm_mode_group mode_group; 994 struct drm_mode_group mode_group;
901}; 995};
902 996
997/* mode specified on the command line */
998struct drm_cmdline_mode {
999 bool specified;
1000 bool refresh_specified;
1001 bool bpp_specified;
1002 int xres, yres;
1003 int bpp;
1004 int refresh;
1005 bool rb;
1006 bool interlace;
1007 bool cvt;
1008 bool margins;
1009 enum drm_connector_force force;
1010};
1011
1012
903struct drm_pending_vblank_event { 1013struct drm_pending_vblank_event {
904 struct drm_pending_event base; 1014 struct drm_pending_event base;
905 int pipe; 1015 int pipe;
@@ -972,7 +1082,6 @@ struct drm_device {
972 __volatile__ long context_flag; /**< Context swapping flag */ 1082 __volatile__ long context_flag; /**< Context swapping flag */
973 __volatile__ long interrupt_flag; /**< Interruption handler flag */ 1083 __volatile__ long interrupt_flag; /**< Interruption handler flag */
974 __volatile__ long dma_flag; /**< DMA dispatch flag */ 1084 __volatile__ long dma_flag; /**< DMA dispatch flag */
975 struct timer_list timer; /**< Timer for delaying ctx switch */
976 wait_queue_head_t context_wait; /**< Processes waiting on ctx switch */ 1085 wait_queue_head_t context_wait; /**< Processes waiting on ctx switch */
977 int last_checked; /**< Last context checked for DMA */ 1086 int last_checked; /**< Last context checked for DMA */
978 int last_context; /**< Last current context */ 1087 int last_context; /**< Last current context */
@@ -993,6 +1102,8 @@ struct drm_device {
993 1102
994 wait_queue_head_t *vbl_queue; /**< VBLANK wait queue */ 1103 wait_queue_head_t *vbl_queue; /**< VBLANK wait queue */
995 atomic_t *_vblank_count; /**< number of VBLANK interrupts (driver must alloc the right number of counters) */ 1104 atomic_t *_vblank_count; /**< number of VBLANK interrupts (driver must alloc the right number of counters) */
1105 struct timeval *_vblank_time; /**< timestamp of current vblank_count (drivers must alloc right number of fields) */
1106 spinlock_t vblank_time_lock; /**< Protects vblank count and time updates during vblank enable/disable */
996 spinlock_t vbl_lock; 1107 spinlock_t vbl_lock;
997 atomic_t *vblank_refcount; /* number of users of vblank interruptsper crtc */ 1108 atomic_t *vblank_refcount; /* number of users of vblank interruptsper crtc */
998 u32 *last_vblank; /* protected by dev->vbl_lock, used */ 1109 u32 *last_vblank; /* protected by dev->vbl_lock, used */
@@ -1030,9 +1141,10 @@ struct drm_device {
1030#endif 1141#endif
1031 1142
1032 struct platform_device *platformdev; /**< Platform device struture */ 1143 struct platform_device *platformdev; /**< Platform device struture */
1144 struct usb_device *usbdev;
1033 1145
1034 struct drm_sg_mem *sg; /**< Scatter gather memory */ 1146 struct drm_sg_mem *sg; /**< Scatter gather memory */
1035 int num_crtcs; /**< Number of CRTCs on this device */ 1147 unsigned int num_crtcs; /**< Number of CRTCs on this device */
1036 void *dev_private; /**< device private data */ 1148 void *dev_private; /**< device private data */
1037 void *mm_private; 1149 void *mm_private;
1038 struct address_space *dev_mapping; 1150 struct address_space *dev_mapping;
@@ -1045,31 +1157,20 @@ struct drm_device {
1045 struct drm_minor *control; /**< Control node for card */ 1157 struct drm_minor *control; /**< Control node for card */
1046 struct drm_minor *primary; /**< render type primary screen head */ 1158 struct drm_minor *primary; /**< render type primary screen head */
1047 1159
1048 /** \name Drawable information */
1049 /*@{ */
1050 spinlock_t drw_lock;
1051 struct idr drw_idr;
1052 /*@} */
1053
1054 struct drm_mode_config mode_config; /**< Current mode config */ 1160 struct drm_mode_config mode_config; /**< Current mode config */
1055 1161
1056 /** \name GEM information */ 1162 /** \name GEM information */
1057 /*@{ */ 1163 /*@{ */
1058 spinlock_t object_name_lock; 1164 spinlock_t object_name_lock;
1059 struct idr object_name_idr; 1165 struct idr object_name_idr;
1060 atomic_t object_count;
1061 atomic_t object_memory;
1062 atomic_t pin_count;
1063 atomic_t pin_memory;
1064 atomic_t gtt_count;
1065 atomic_t gtt_memory;
1066 uint32_t gtt_total;
1067 uint32_t invalidate_domains; /* domains pending invalidation */
1068 uint32_t flush_domains; /* domains pending flush */
1069 /*@} */ 1166 /*@} */
1070 1167 int switch_power_state;
1071}; 1168};
1072 1169
1170#define DRM_SWITCH_POWER_ON 0
1171#define DRM_SWITCH_POWER_OFF 1
1172#define DRM_SWITCH_POWER_CHANGING 2
1173
1073static __inline__ int drm_core_check_feature(struct drm_device *dev, 1174static __inline__ int drm_core_check_feature(struct drm_device *dev,
1074 int feature) 1175 int feature)
1075{ 1176{
@@ -1078,28 +1179,9 @@ static __inline__ int drm_core_check_feature(struct drm_device *dev,
1078 1179
1079static inline int drm_dev_to_irq(struct drm_device *dev) 1180static inline int drm_dev_to_irq(struct drm_device *dev)
1080{ 1181{
1081 if (drm_core_check_feature(dev, DRIVER_USE_PLATFORM_DEVICE)) 1182 return dev->driver->bus->get_irq(dev);
1082 return platform_get_irq(dev->platformdev, 0);
1083 else
1084 return dev->pdev->irq;
1085} 1183}
1086 1184
1087static inline int drm_get_pci_domain(struct drm_device *dev)
1088{
1089 if (drm_core_check_feature(dev, DRIVER_USE_PLATFORM_DEVICE))
1090 return 0;
1091
1092#ifndef __alpha__
1093 /* For historical reasons, drm_get_pci_domain() is busticated
1094 * on most archs and has to remain so for userspace interface
1095 * < 1.4, except on alpha which was right from the beginning
1096 */
1097 if (dev->if_version < 0x10004)
1098 return 0;
1099#endif /* __alpha__ */
1100
1101 return pci_domain_nr(dev->pdev->bus);
1102}
1103 1185
1104#if __OS_HAS_AGP 1186#if __OS_HAS_AGP
1105static inline int drm_core_has_AGP(struct drm_device *dev) 1187static inline int drm_core_has_AGP(struct drm_device *dev)
@@ -1153,8 +1235,6 @@ static inline int drm_mtrr_del(int handle, unsigned long offset,
1153/*@{*/ 1235/*@{*/
1154 1236
1155 /* Driver support (drm_drv.h) */ 1237 /* Driver support (drm_drv.h) */
1156extern int drm_init(struct drm_driver *driver);
1157extern void drm_exit(struct drm_driver *driver);
1158extern long drm_ioctl(struct file *filp, 1238extern long drm_ioctl(struct file *filp,
1159 unsigned int cmd, unsigned long arg); 1239 unsigned int cmd, unsigned long arg);
1160extern long drm_compat_ioctl(struct file *filp, 1240extern long drm_compat_ioctl(struct file *filp,
@@ -1175,8 +1255,6 @@ extern int drm_mmap(struct file *filp, struct vm_area_struct *vma);
1175extern int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma); 1255extern int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma);
1176extern void drm_vm_open_locked(struct vm_area_struct *vma); 1256extern void drm_vm_open_locked(struct vm_area_struct *vma);
1177extern void drm_vm_close_locked(struct vm_area_struct *vma); 1257extern void drm_vm_close_locked(struct vm_area_struct *vma);
1178extern resource_size_t drm_core_get_map_ofs(struct drm_local_map * map);
1179extern resource_size_t drm_core_get_reg_ofs(struct drm_device *dev);
1180extern unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait); 1258extern unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait);
1181 1259
1182 /* Memory management support (drm_memory.h) */ 1260 /* Memory management support (drm_memory.h) */
@@ -1186,8 +1264,7 @@ extern int drm_mem_info(char *buf, char **start, off_t offset,
1186 int request, int *eof, void *data); 1264 int request, int *eof, void *data);
1187extern void *drm_realloc(void *oldpt, size_t oldsize, size_t size, int area); 1265extern void *drm_realloc(void *oldpt, size_t oldsize, size_t size, int area);
1188 1266
1189extern DRM_AGP_MEM *drm_alloc_agp(struct drm_device *dev, int pages, u32 type); 1267extern void drm_free_agp(DRM_AGP_MEM * handle, int pages);
1190extern int drm_free_agp(DRM_AGP_MEM * handle, int pages);
1191extern int drm_bind_agp(DRM_AGP_MEM * handle, unsigned int start); 1268extern int drm_bind_agp(DRM_AGP_MEM * handle, unsigned int start);
1192extern DRM_AGP_MEM *drm_agp_bind_pages(struct drm_device *dev, 1269extern DRM_AGP_MEM *drm_agp_bind_pages(struct drm_device *dev,
1193 struct page **pages, 1270 struct page **pages,
@@ -1209,6 +1286,8 @@ extern int drm_getclient(struct drm_device *dev, void *data,
1209 struct drm_file *file_priv); 1286 struct drm_file *file_priv);
1210extern int drm_getstats(struct drm_device *dev, void *data, 1287extern int drm_getstats(struct drm_device *dev, void *data,
1211 struct drm_file *file_priv); 1288 struct drm_file *file_priv);
1289extern int drm_getcap(struct drm_device *dev, void *data,
1290 struct drm_file *file_priv);
1212extern int drm_setversion(struct drm_device *dev, void *data, 1291extern int drm_setversion(struct drm_device *dev, void *data,
1213 struct drm_file *file_priv); 1292 struct drm_file *file_priv);
1214extern int drm_noop(struct drm_device *dev, void *data, 1293extern int drm_noop(struct drm_device *dev, void *data,
@@ -1239,17 +1318,6 @@ extern int drm_setsareactx(struct drm_device *dev, void *data,
1239extern int drm_getsareactx(struct drm_device *dev, void *data, 1318extern int drm_getsareactx(struct drm_device *dev, void *data,
1240 struct drm_file *file_priv); 1319 struct drm_file *file_priv);
1241 1320
1242 /* Drawable IOCTL support (drm_drawable.h) */
1243extern int drm_adddraw(struct drm_device *dev, void *data,
1244 struct drm_file *file_priv);
1245extern int drm_rmdraw(struct drm_device *dev, void *data,
1246 struct drm_file *file_priv);
1247extern int drm_update_drawable_info(struct drm_device *dev, void *data,
1248 struct drm_file *file_priv);
1249extern struct drm_drawable_info *drm_get_drawable_info(struct drm_device *dev,
1250 drm_drawable_t id);
1251extern void drm_drawable_free_all(struct drm_device *dev);
1252
1253 /* Authentication IOCTL support (drm_auth.h) */ 1321 /* Authentication IOCTL support (drm_auth.h) */
1254extern int drm_getmagic(struct drm_device *dev, void *data, 1322extern int drm_getmagic(struct drm_device *dev, void *data,
1255 struct drm_file *file_priv); 1323 struct drm_file *file_priv);
@@ -1264,7 +1332,6 @@ extern int drm_lock(struct drm_device *dev, void *data,
1264 struct drm_file *file_priv); 1332 struct drm_file *file_priv);
1265extern int drm_unlock(struct drm_device *dev, void *data, 1333extern int drm_unlock(struct drm_device *dev, void *data,
1266 struct drm_file *file_priv); 1334 struct drm_file *file_priv);
1267extern int drm_lock_take(struct drm_lock_data *lock_data, unsigned int context);
1268extern int drm_lock_free(struct drm_lock_data *lock_data, unsigned int context); 1335extern int drm_lock_free(struct drm_lock_data *lock_data, unsigned int context);
1269extern void drm_idlelock_take(struct drm_lock_data *lock_data); 1336extern void drm_idlelock_take(struct drm_lock_data *lock_data);
1270extern void drm_idlelock_release(struct drm_lock_data *lock_data); 1337extern void drm_idlelock_release(struct drm_lock_data *lock_data);
@@ -1322,11 +1389,31 @@ extern int drm_wait_vblank(struct drm_device *dev, void *data,
1322 struct drm_file *filp); 1389 struct drm_file *filp);
1323extern int drm_vblank_wait(struct drm_device *dev, unsigned int *vbl_seq); 1390extern int drm_vblank_wait(struct drm_device *dev, unsigned int *vbl_seq);
1324extern u32 drm_vblank_count(struct drm_device *dev, int crtc); 1391extern u32 drm_vblank_count(struct drm_device *dev, int crtc);
1325extern void drm_handle_vblank(struct drm_device *dev, int crtc); 1392extern u32 drm_vblank_count_and_time(struct drm_device *dev, int crtc,
1393 struct timeval *vblanktime);
1394extern bool drm_handle_vblank(struct drm_device *dev, int crtc);
1326extern int drm_vblank_get(struct drm_device *dev, int crtc); 1395extern int drm_vblank_get(struct drm_device *dev, int crtc);
1327extern void drm_vblank_put(struct drm_device *dev, int crtc); 1396extern void drm_vblank_put(struct drm_device *dev, int crtc);
1328extern void drm_vblank_off(struct drm_device *dev, int crtc); 1397extern void drm_vblank_off(struct drm_device *dev, int crtc);
1329extern void drm_vblank_cleanup(struct drm_device *dev); 1398extern void drm_vblank_cleanup(struct drm_device *dev);
1399extern u32 drm_get_last_vbltimestamp(struct drm_device *dev, int crtc,
1400 struct timeval *tvblank, unsigned flags);
1401extern int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
1402 int crtc, int *max_error,
1403 struct timeval *vblank_time,
1404 unsigned flags,
1405 struct drm_crtc *refcrtc);
1406extern void drm_calc_timestamping_constants(struct drm_crtc *crtc);
1407
1408extern bool
1409drm_mode_parse_command_line_for_connector(const char *mode_option,
1410 struct drm_connector *connector,
1411 struct drm_cmdline_mode *mode);
1412
1413extern struct drm_display_mode *
1414drm_mode_create_from_cmdline_mode(struct drm_device *dev,
1415 struct drm_cmdline_mode *cmd);
1416
1330/* Modesetting support */ 1417/* Modesetting support */
1331extern void drm_vblank_pre_modeset(struct drm_device *dev, int crtc); 1418extern void drm_vblank_pre_modeset(struct drm_device *dev, int crtc);
1332extern void drm_vblank_post_modeset(struct drm_device *dev, int crtc); 1419extern void drm_vblank_post_modeset(struct drm_device *dev, int crtc);
@@ -1359,11 +1446,6 @@ extern int drm_agp_unbind_ioctl(struct drm_device *dev, void *data,
1359extern int drm_agp_bind(struct drm_device *dev, struct drm_agp_binding *request); 1446extern int drm_agp_bind(struct drm_device *dev, struct drm_agp_binding *request);
1360extern int drm_agp_bind_ioctl(struct drm_device *dev, void *data, 1447extern int drm_agp_bind_ioctl(struct drm_device *dev, void *data,
1361 struct drm_file *file_priv); 1448 struct drm_file *file_priv);
1362extern DRM_AGP_MEM *drm_agp_allocate_memory(struct agp_bridge_data *bridge, size_t pages, u32 type);
1363extern int drm_agp_free_memory(DRM_AGP_MEM * handle);
1364extern int drm_agp_bind_memory(DRM_AGP_MEM * handle, off_t start);
1365extern int drm_agp_unbind_memory(DRM_AGP_MEM * handle);
1366extern void drm_agp_chipset_flush(struct drm_device *dev);
1367 1449
1368 /* Stub support (drm_stub.h) */ 1450 /* Stub support (drm_stub.h) */
1369extern int drm_setmaster_ioctl(struct drm_device *dev, void *data, 1451extern int drm_setmaster_ioctl(struct drm_device *dev, void *data,
@@ -1373,15 +1455,14 @@ extern int drm_dropmaster_ioctl(struct drm_device *dev, void *data,
1373struct drm_master *drm_master_create(struct drm_minor *minor); 1455struct drm_master *drm_master_create(struct drm_minor *minor);
1374extern struct drm_master *drm_master_get(struct drm_master *master); 1456extern struct drm_master *drm_master_get(struct drm_master *master);
1375extern void drm_master_put(struct drm_master **master); 1457extern void drm_master_put(struct drm_master **master);
1376extern int drm_get_pci_dev(struct pci_dev *pdev, 1458
1377 const struct pci_device_id *ent,
1378 struct drm_driver *driver);
1379extern int drm_get_platform_dev(struct platform_device *pdev,
1380 struct drm_driver *driver);
1381extern void drm_put_dev(struct drm_device *dev); 1459extern void drm_put_dev(struct drm_device *dev);
1382extern int drm_put_minor(struct drm_minor **minor); 1460extern int drm_put_minor(struct drm_minor **minor);
1383extern unsigned int drm_debug; 1461extern unsigned int drm_debug;
1384 1462
1463extern unsigned int drm_vblank_offdelay;
1464extern unsigned int drm_timestamp_precision;
1465
1385extern struct class *drm_class; 1466extern struct class *drm_class;
1386extern struct proc_dir_entry *drm_proc_root; 1467extern struct proc_dir_entry *drm_proc_root;
1387extern struct dentry *drm_debugfs_root; 1468extern struct dentry *drm_debugfs_root;
@@ -1414,7 +1495,6 @@ extern int drm_bufs_info(struct seq_file *m, void *data);
1414extern int drm_vblank_info(struct seq_file *m, void *data); 1495extern int drm_vblank_info(struct seq_file *m, void *data);
1415extern int drm_clients_info(struct seq_file *m, void* data); 1496extern int drm_clients_info(struct seq_file *m, void* data);
1416extern int drm_gem_name_info(struct seq_file *m, void *data); 1497extern int drm_gem_name_info(struct seq_file *m, void *data);
1417extern int drm_gem_object_info(struct seq_file *m, void* data);
1418 1498
1419#if DRM_DEBUG_CODE 1499#if DRM_DEBUG_CODE
1420extern int drm_vma_info(struct seq_file *m, void *data); 1500extern int drm_vma_info(struct seq_file *m, void *data);
@@ -1493,6 +1573,7 @@ drm_gem_object_unreference_unlocked(struct drm_gem_object *obj)
1493int drm_gem_handle_create(struct drm_file *file_priv, 1573int drm_gem_handle_create(struct drm_file *file_priv,
1494 struct drm_gem_object *obj, 1574 struct drm_gem_object *obj,
1495 u32 *handlep); 1575 u32 *handlep);
1576int drm_gem_handle_delete(struct drm_file *filp, u32 handle);
1496 1577
1497static inline void 1578static inline void
1498drm_gem_object_handle_reference(struct drm_gem_object *obj) 1579drm_gem_object_handle_reference(struct drm_gem_object *obj)
@@ -1565,11 +1646,21 @@ static __inline__ struct drm_local_map *drm_core_findmap(struct drm_device *dev,
1565 return NULL; 1646 return NULL;
1566} 1647}
1567 1648
1568static __inline__ int drm_device_is_agp(struct drm_device *dev) 1649static __inline__ void drm_core_dropmap(struct drm_local_map *map)
1569{ 1650{
1570 if (drm_core_check_feature(dev, DRIVER_USE_PLATFORM_DEVICE)) 1651}
1571 return 0;
1572 1652
1653#include "drm_mem_util.h"
1654
1655extern int drm_fill_in_dev(struct drm_device *dev,
1656 const struct pci_device_id *ent,
1657 struct drm_driver *driver);
1658int drm_get_minor(struct drm_device *dev, struct drm_minor **minor, int type);
1659/*@}*/
1660
1661/* PCI section */
1662static __inline__ int drm_pci_device_is_agp(struct drm_device *dev)
1663{
1573 if (dev->driver->device_is_agp != NULL) { 1664 if (dev->driver->device_is_agp != NULL) {
1574 int err = (*dev->driver->device_is_agp) (dev); 1665 int err = (*dev->driver->device_is_agp) (dev);
1575 1666
@@ -1581,35 +1672,26 @@ static __inline__ int drm_device_is_agp(struct drm_device *dev)
1581 return pci_find_capability(dev->pdev, PCI_CAP_ID_AGP); 1672 return pci_find_capability(dev->pdev, PCI_CAP_ID_AGP);
1582} 1673}
1583 1674
1584static __inline__ int drm_device_is_pcie(struct drm_device *dev)
1585{
1586 if (drm_core_check_feature(dev, DRIVER_USE_PLATFORM_DEVICE))
1587 return 0;
1588 else
1589 return pci_find_capability(dev->pdev, PCI_CAP_ID_EXP);
1590}
1591 1675
1592static __inline__ void drm_core_dropmap(struct drm_local_map *map) 1676static __inline__ int drm_pci_device_is_pcie(struct drm_device *dev)
1593{ 1677{
1678 return pci_find_capability(dev->pdev, PCI_CAP_ID_EXP);
1594} 1679}
1595 1680
1596#include "drm_mem_util.h"
1597
1598static inline void *drm_get_device(struct drm_device *dev)
1599{
1600 if (drm_core_check_feature(dev, DRIVER_USE_PLATFORM_DEVICE))
1601 return dev->platformdev;
1602 else
1603 return dev->pdev;
1604}
1605 1681
1606extern int drm_platform_init(struct drm_driver *driver); 1682extern int drm_pci_init(struct drm_driver *driver, struct pci_driver *pdriver);
1607extern int drm_pci_init(struct drm_driver *driver); 1683extern void drm_pci_exit(struct drm_driver *driver, struct pci_driver *pdriver);
1608extern int drm_fill_in_dev(struct drm_device *dev, 1684extern int drm_get_pci_dev(struct pci_dev *pdev,
1609 const struct pci_device_id *ent, 1685 const struct pci_device_id *ent,
1610 struct drm_driver *driver); 1686 struct drm_driver *driver);
1611int drm_get_minor(struct drm_device *dev, struct drm_minor **minor, int type); 1687
1612/*@}*/ 1688
1689/* platform section */
1690extern int drm_platform_init(struct drm_driver *driver, struct platform_device *platform_device);
1691extern void drm_platform_exit(struct drm_driver *driver, struct platform_device *platform_device);
1692
1693extern int drm_get_platform_dev(struct platform_device *pdev,
1694 struct drm_driver *driver);
1613 1695
1614#endif /* __KERNEL__ */ 1696#endif /* __KERNEL__ */
1615#endif 1697#endif
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 3e5a51af757c..33d12f87f0e0 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -65,7 +65,7 @@ enum drm_mode_status {
65 MODE_H_ILLEGAL, /* mode has illegal horizontal timings */ 65 MODE_H_ILLEGAL, /* mode has illegal horizontal timings */
66 MODE_V_ILLEGAL, /* mode has illegal horizontal timings */ 66 MODE_V_ILLEGAL, /* mode has illegal horizontal timings */
67 MODE_BAD_WIDTH, /* requires an unsupported linepitch */ 67 MODE_BAD_WIDTH, /* requires an unsupported linepitch */
68 MODE_NOMODE, /* no mode with a maching name */ 68 MODE_NOMODE, /* no mode with a matching name */
69 MODE_NO_INTERLACE, /* interlaced mode not supported */ 69 MODE_NO_INTERLACE, /* interlaced mode not supported */
70 MODE_NO_DBLESCAN, /* doublescan mode not supported */ 70 MODE_NO_DBLESCAN, /* doublescan mode not supported */
71 MODE_NO_VSCAN, /* multiscan mode not supported */ 71 MODE_NO_VSCAN, /* multiscan mode not supported */
@@ -183,7 +183,9 @@ enum subpixel_order {
183 SubPixelNone, 183 SubPixelNone,
184}; 184};
185 185
186 186#define DRM_COLOR_FORMAT_RGB444 (1<<0)
187#define DRM_COLOR_FORMAT_YCRCB444 (1<<1)
188#define DRM_COLOR_FORMAT_YCRCB422 (1<<2)
187/* 189/*
188 * Describes a given display (e.g. CRT or flat panel) and its limitations. 190 * Describes a given display (e.g. CRT or flat panel) and its limitations.
189 */ 191 */
@@ -198,8 +200,10 @@ struct drm_display_info {
198 unsigned int min_vfreq, max_vfreq; 200 unsigned int min_vfreq, max_vfreq;
199 unsigned int min_hfreq, max_hfreq; 201 unsigned int min_hfreq, max_hfreq;
200 unsigned int pixel_clock; 202 unsigned int pixel_clock;
203 unsigned int bpc;
201 204
202 enum subpixel_order subpixel_order; 205 enum subpixel_order subpixel_order;
206 u32 color_formats;
203 207
204 char *raw_edid; /* if any */ 208 char *raw_edid; /* if any */
205}; 209};
@@ -221,7 +225,8 @@ struct drm_framebuffer_funcs {
221 * the semantics and arguments have a one to one mapping 225 * the semantics and arguments have a one to one mapping
222 * on this function. 226 * on this function.
223 */ 227 */
224 int (*dirty)(struct drm_framebuffer *framebuffer, unsigned flags, 228 int (*dirty)(struct drm_framebuffer *framebuffer,
229 struct drm_file *file_priv, unsigned flags,
225 unsigned color, struct drm_clip_rect *clips, 230 unsigned color, struct drm_clip_rect *clips,
226 unsigned num_clips); 231 unsigned num_clips);
227}; 232};
@@ -274,6 +279,7 @@ struct drm_pending_vblank_event;
274 279
275/** 280/**
276 * drm_crtc_funcs - control CRTCs for a given device 281 * drm_crtc_funcs - control CRTCs for a given device
282 * @reset: reset CRTC after state has been invalidate (e.g. resume)
277 * @dpms: control display power levels 283 * @dpms: control display power levels
278 * @save: save CRTC state 284 * @save: save CRTC state
279 * @resore: restore CRTC state 285 * @resore: restore CRTC state
@@ -301,6 +307,8 @@ struct drm_crtc_funcs {
301 void (*save)(struct drm_crtc *crtc); /* suspend? */ 307 void (*save)(struct drm_crtc *crtc); /* suspend? */
302 /* Restore CRTC state */ 308 /* Restore CRTC state */
303 void (*restore)(struct drm_crtc *crtc); /* resume? */ 309 void (*restore)(struct drm_crtc *crtc); /* resume? */
310 /* Reset CRTC state */
311 void (*reset)(struct drm_crtc *crtc);
304 312
305 /* cursor controls */ 313 /* cursor controls */
306 int (*cursor_set)(struct drm_crtc *crtc, struct drm_file *file_priv, 314 int (*cursor_set)(struct drm_crtc *crtc, struct drm_file *file_priv,
@@ -317,7 +325,7 @@ struct drm_crtc_funcs {
317 325
318 /* 326 /*
319 * Flip to the given framebuffer. This implements the page 327 * Flip to the given framebuffer. This implements the page
320 * flip ioctl descibed in drm_mode.h, specifically, the 328 * flip ioctl described in drm_mode.h, specifically, the
321 * implementation must return immediately and block all 329 * implementation must return immediately and block all
322 * rendering to the current fb until the flip has completed. 330 * rendering to the current fb until the flip has completed.
323 * If userspace set the event flag in the ioctl, the event 331 * If userspace set the event flag in the ioctl, the event
@@ -350,8 +358,14 @@ struct drm_crtc {
350 358
351 bool enabled; 359 bool enabled;
352 360
361 /* Requested mode from modesetting. */
353 struct drm_display_mode mode; 362 struct drm_display_mode mode;
354 363
364 /* Programmed mode in hw, after adjustments for encoders,
365 * crtc, panel scaling etc. Needed for timestamping etc.
366 */
367 struct drm_display_mode hwmode;
368
355 int x, y; 369 int x, y;
356 const struct drm_crtc_funcs *funcs; 370 const struct drm_crtc_funcs *funcs;
357 371
@@ -359,6 +373,9 @@ struct drm_crtc {
359 uint32_t gamma_size; 373 uint32_t gamma_size;
360 uint16_t *gamma_store; 374 uint16_t *gamma_store;
361 375
376 /* Constants needed for precise vblank and swap timestamping. */
377 s64 framedur_ns, linedur_ns, pixeldur_ns;
378
362 /* if you are using the helper */ 379 /* if you are using the helper */
363 void *helper_private; 380 void *helper_private;
364}; 381};
@@ -369,6 +386,7 @@ struct drm_crtc {
369 * @dpms: set power state (see drm_crtc_funcs above) 386 * @dpms: set power state (see drm_crtc_funcs above)
370 * @save: save connector state 387 * @save: save connector state
371 * @restore: restore connector state 388 * @restore: restore connector state
389 * @reset: reset connector after state has been invalidate (e.g. resume)
372 * @mode_valid: is this mode valid on the given connector? 390 * @mode_valid: is this mode valid on the given connector?
373 * @mode_fixup: try to fixup proposed mode for this connector 391 * @mode_fixup: try to fixup proposed mode for this connector
374 * @mode_set: set this mode 392 * @mode_set: set this mode
@@ -386,6 +404,7 @@ struct drm_connector_funcs {
386 void (*dpms)(struct drm_connector *connector, int mode); 404 void (*dpms)(struct drm_connector *connector, int mode);
387 void (*save)(struct drm_connector *connector); 405 void (*save)(struct drm_connector *connector);
388 void (*restore)(struct drm_connector *connector); 406 void (*restore)(struct drm_connector *connector);
407 void (*reset)(struct drm_connector *connector);
389 408
390 /* Check to see if anything is attached to the connector. 409 /* Check to see if anything is attached to the connector.
391 * @force is set to false whilst polling, true when checking the 410 * @force is set to false whilst polling, true when checking the
@@ -403,6 +422,7 @@ struct drm_connector_funcs {
403}; 422};
404 423
405struct drm_encoder_funcs { 424struct drm_encoder_funcs {
425 void (*reset)(struct drm_encoder *encoder);
406 void (*destroy)(struct drm_encoder *encoder); 426 void (*destroy)(struct drm_encoder *encoder);
407}; 427};
408 428
@@ -500,6 +520,8 @@ struct drm_connector {
500 uint32_t encoder_ids[DRM_CONNECTOR_MAX_ENCODER]; 520 uint32_t encoder_ids[DRM_CONNECTOR_MAX_ENCODER];
501 uint32_t force_encoder_id; 521 uint32_t force_encoder_id;
502 struct drm_encoder *encoder; /* currently active encoder */ 522 struct drm_encoder *encoder; /* currently active encoder */
523
524 int null_edid_counter; /* needed to workaround some HW bugs where we get all 0s */
503}; 525};
504 526
505/** 527/**
@@ -643,9 +665,10 @@ extern int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid
643extern void drm_mode_probed_add(struct drm_connector *connector, struct drm_display_mode *mode); 665extern void drm_mode_probed_add(struct drm_connector *connector, struct drm_display_mode *mode);
644extern void drm_mode_remove(struct drm_connector *connector, struct drm_display_mode *mode); 666extern void drm_mode_remove(struct drm_connector *connector, struct drm_display_mode *mode);
645extern struct drm_display_mode *drm_mode_duplicate(struct drm_device *dev, 667extern struct drm_display_mode *drm_mode_duplicate(struct drm_device *dev,
646 struct drm_display_mode *mode); 668 const struct drm_display_mode *mode);
647extern void drm_mode_debug_printmodeline(struct drm_display_mode *mode); 669extern void drm_mode_debug_printmodeline(struct drm_display_mode *mode);
648extern void drm_mode_config_init(struct drm_device *dev); 670extern void drm_mode_config_init(struct drm_device *dev);
671extern void drm_mode_config_reset(struct drm_device *dev);
649extern void drm_mode_config_cleanup(struct drm_device *dev); 672extern void drm_mode_config_cleanup(struct drm_device *dev);
650extern void drm_mode_set_name(struct drm_display_mode *mode); 673extern void drm_mode_set_name(struct drm_display_mode *mode);
651extern bool drm_mode_equal(struct drm_display_mode *mode1, struct drm_display_mode *mode2); 674extern bool drm_mode_equal(struct drm_display_mode *mode1, struct drm_display_mode *mode2);
@@ -668,8 +691,8 @@ extern void drm_mode_validate_size(struct drm_device *dev,
668extern void drm_mode_prune_invalid(struct drm_device *dev, 691extern void drm_mode_prune_invalid(struct drm_device *dev,
669 struct list_head *mode_list, bool verbose); 692 struct list_head *mode_list, bool verbose);
670extern void drm_mode_sort(struct list_head *mode_list); 693extern void drm_mode_sort(struct list_head *mode_list);
671extern int drm_mode_hsync(struct drm_display_mode *mode); 694extern int drm_mode_hsync(const struct drm_display_mode *mode);
672extern int drm_mode_vrefresh(struct drm_display_mode *mode); 695extern int drm_mode_vrefresh(const struct drm_display_mode *mode);
673extern void drm_mode_set_crtcinfo(struct drm_display_mode *p, 696extern void drm_mode_set_crtcinfo(struct drm_display_mode *p,
674 int adjust_flags); 697 int adjust_flags);
675extern void drm_mode_connector_list_update(struct drm_connector *connector); 698extern void drm_mode_connector_list_update(struct drm_connector *connector);
@@ -761,7 +784,9 @@ extern int drm_mode_gamma_get_ioctl(struct drm_device *dev,
761 void *data, struct drm_file *file_priv); 784 void *data, struct drm_file *file_priv);
762extern int drm_mode_gamma_set_ioctl(struct drm_device *dev, 785extern int drm_mode_gamma_set_ioctl(struct drm_device *dev,
763 void *data, struct drm_file *file_priv); 786 void *data, struct drm_file *file_priv);
787extern u8 *drm_find_cea_extension(struct edid *edid);
764extern bool drm_detect_hdmi_monitor(struct edid *edid); 788extern bool drm_detect_hdmi_monitor(struct edid *edid);
789extern bool drm_detect_monitor_audio(struct edid *edid);
765extern int drm_mode_page_flip_ioctl(struct drm_device *dev, 790extern int drm_mode_page_flip_ioctl(struct drm_device *dev,
766 void *data, struct drm_file *file_priv); 791 void *data, struct drm_file *file_priv);
767extern struct drm_display_mode *drm_cvt_mode(struct drm_device *dev, 792extern struct drm_display_mode *drm_cvt_mode(struct drm_device *dev,
@@ -780,4 +805,11 @@ extern int drm_add_modes_noedid(struct drm_connector *connector,
780extern bool drm_edid_is_valid(struct edid *edid); 805extern bool drm_edid_is_valid(struct edid *edid);
781struct drm_display_mode *drm_mode_find_dmt(struct drm_device *dev, 806struct drm_display_mode *drm_mode_find_dmt(struct drm_device *dev,
782 int hsize, int vsize, int fresh); 807 int hsize, int vsize, int fresh);
808
809extern int drm_mode_create_dumb_ioctl(struct drm_device *dev,
810 void *data, struct drm_file *file_priv);
811extern int drm_mode_mmap_dumb_ioctl(struct drm_device *dev,
812 void *data, struct drm_file *file_priv);
813extern int drm_mode_destroy_dumb_ioctl(struct drm_device *dev,
814 void *data, struct drm_file *file_priv);
783#endif /* __DRM_CRTC_H__ */ 815#endif /* __DRM_CRTC_H__ */
diff --git a/include/drm/drm_crtc_helper.h b/include/drm/drm_crtc_helper.h
index 59b7073b13fe..73b071203dcc 100644
--- a/include/drm/drm_crtc_helper.h
+++ b/include/drm/drm_crtc_helper.h
@@ -39,6 +39,11 @@
39 39
40#include <linux/fb.h> 40#include <linux/fb.h>
41 41
42enum mode_set_atomic {
43 LEAVE_ATOMIC_MODE_SET,
44 ENTER_ATOMIC_MODE_SET,
45};
46
42struct drm_crtc_helper_funcs { 47struct drm_crtc_helper_funcs {
43 /* 48 /*
44 * Control power levels on the CRTC. If the mode passed in is 49 * Control power levels on the CRTC. If the mode passed in is
@@ -61,7 +66,8 @@ struct drm_crtc_helper_funcs {
61 int (*mode_set_base)(struct drm_crtc *crtc, int x, int y, 66 int (*mode_set_base)(struct drm_crtc *crtc, int x, int y,
62 struct drm_framebuffer *old_fb); 67 struct drm_framebuffer *old_fb);
63 int (*mode_set_base_atomic)(struct drm_crtc *crtc, 68 int (*mode_set_base_atomic)(struct drm_crtc *crtc,
64 struct drm_framebuffer *fb, int x, int y); 69 struct drm_framebuffer *fb, int x, int y,
70 enum mode_set_atomic);
65 71
66 /* reload the current crtc LUT */ 72 /* reload the current crtc LUT */
67 void (*load_lut)(struct drm_crtc *crtc); 73 void (*load_lut)(struct drm_crtc *crtc);
diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h
index a49e791db0b0..91567bbdb027 100644
--- a/include/drm/drm_dp_helper.h
+++ b/include/drm/drm_dp_helper.h
@@ -23,6 +23,9 @@
23#ifndef _DRM_DP_HELPER_H_ 23#ifndef _DRM_DP_HELPER_H_
24#define _DRM_DP_HELPER_H_ 24#define _DRM_DP_HELPER_H_
25 25
26#include <linux/types.h>
27#include <linux/i2c.h>
28
26/* From the VESA DisplayPort spec */ 29/* From the VESA DisplayPort spec */
27 30
28#define AUX_NATIVE_WRITE 0x8 31#define AUX_NATIVE_WRITE 0x8
@@ -50,6 +53,7 @@
50 53
51#define DP_MAX_LANE_COUNT 0x002 54#define DP_MAX_LANE_COUNT 0x002
52# define DP_MAX_LANE_COUNT_MASK 0x1f 55# define DP_MAX_LANE_COUNT_MASK 0x1f
56# define DP_TPS3_SUPPORTED (1 << 6)
53# define DP_ENHANCED_FRAME_CAP (1 << 7) 57# define DP_ENHANCED_FRAME_CAP (1 << 7)
54 58
55#define DP_MAX_DOWNSPREAD 0x003 59#define DP_MAX_DOWNSPREAD 0x003
@@ -68,10 +72,13 @@
68 72
69#define DP_MAIN_LINK_CHANNEL_CODING 0x006 73#define DP_MAIN_LINK_CHANNEL_CODING 0x006
70 74
75#define DP_TRAINING_AUX_RD_INTERVAL 0x00e
76
71/* link configuration */ 77/* link configuration */
72#define DP_LINK_BW_SET 0x100 78#define DP_LINK_BW_SET 0x100
73# define DP_LINK_BW_1_62 0x06 79# define DP_LINK_BW_1_62 0x06
74# define DP_LINK_BW_2_7 0x0a 80# define DP_LINK_BW_2_7 0x0a
81# define DP_LINK_BW_5_4 0x14
75 82
76#define DP_LANE_COUNT_SET 0x101 83#define DP_LANE_COUNT_SET 0x101
77# define DP_LANE_COUNT_MASK 0x0f 84# define DP_LANE_COUNT_MASK 0x0f
@@ -81,6 +88,7 @@
81# define DP_TRAINING_PATTERN_DISABLE 0 88# define DP_TRAINING_PATTERN_DISABLE 0
82# define DP_TRAINING_PATTERN_1 1 89# define DP_TRAINING_PATTERN_1 1
83# define DP_TRAINING_PATTERN_2 2 90# define DP_TRAINING_PATTERN_2 2
91# define DP_TRAINING_PATTERN_3 3
84# define DP_TRAINING_PATTERN_MASK 0x3 92# define DP_TRAINING_PATTERN_MASK 0x3
85 93
86# define DP_LINK_QUAL_PATTERN_DISABLE (0 << 2) 94# define DP_LINK_QUAL_PATTERN_DISABLE (0 << 2)
diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h
index 5881fad91faa..eacb415b309a 100644
--- a/include/drm/drm_edid.h
+++ b/include/drm/drm_edid.h
@@ -155,12 +155,35 @@ struct detailed_timing {
155#define DRM_EDID_INPUT_SEPARATE_SYNCS (1 << 3) 155#define DRM_EDID_INPUT_SEPARATE_SYNCS (1 << 3)
156#define DRM_EDID_INPUT_BLANK_TO_BLACK (1 << 4) 156#define DRM_EDID_INPUT_BLANK_TO_BLACK (1 << 4)
157#define DRM_EDID_INPUT_VIDEO_LEVEL (3 << 5) 157#define DRM_EDID_INPUT_VIDEO_LEVEL (3 << 5)
158#define DRM_EDID_INPUT_DIGITAL (1 << 7) /* bits below must be zero if set */ 158#define DRM_EDID_INPUT_DIGITAL (1 << 7)
159#define DRM_EDID_DIGITAL_DEPTH_MASK (7 << 4)
160#define DRM_EDID_DIGITAL_DEPTH_UNDEF (0 << 4)
161#define DRM_EDID_DIGITAL_DEPTH_6 (1 << 4)
162#define DRM_EDID_DIGITAL_DEPTH_8 (2 << 4)
163#define DRM_EDID_DIGITAL_DEPTH_10 (3 << 4)
164#define DRM_EDID_DIGITAL_DEPTH_12 (4 << 4)
165#define DRM_EDID_DIGITAL_DEPTH_14 (5 << 4)
166#define DRM_EDID_DIGITAL_DEPTH_16 (6 << 4)
167#define DRM_EDID_DIGITAL_DEPTH_RSVD (7 << 4)
168#define DRM_EDID_DIGITAL_TYPE_UNDEF (0)
169#define DRM_EDID_DIGITAL_TYPE_DVI (1)
170#define DRM_EDID_DIGITAL_TYPE_HDMI_A (2)
171#define DRM_EDID_DIGITAL_TYPE_HDMI_B (3)
172#define DRM_EDID_DIGITAL_TYPE_MDDI (4)
173#define DRM_EDID_DIGITAL_TYPE_DP (5)
159 174
160#define DRM_EDID_FEATURE_DEFAULT_GTF (1 << 0) 175#define DRM_EDID_FEATURE_DEFAULT_GTF (1 << 0)
161#define DRM_EDID_FEATURE_PREFERRED_TIMING (1 << 1) 176#define DRM_EDID_FEATURE_PREFERRED_TIMING (1 << 1)
162#define DRM_EDID_FEATURE_STANDARD_COLOR (1 << 2) 177#define DRM_EDID_FEATURE_STANDARD_COLOR (1 << 2)
178/* If analog */
163#define DRM_EDID_FEATURE_DISPLAY_TYPE (3 << 3) /* 00=mono, 01=rgb, 10=non-rgb, 11=unknown */ 179#define DRM_EDID_FEATURE_DISPLAY_TYPE (3 << 3) /* 00=mono, 01=rgb, 10=non-rgb, 11=unknown */
180/* If digital */
181#define DRM_EDID_FEATURE_COLOR_MASK (3 << 3)
182#define DRM_EDID_FEATURE_RGB (0 << 3)
183#define DRM_EDID_FEATURE_RGB_YCRCB444 (1 << 3)
184#define DRM_EDID_FEATURE_RGB_YCRCB422 (2 << 3)
185#define DRM_EDID_FEATURE_RGB_YCRCB (3 << 3) /* both 4:4:4 and 4:2:2 */
186
164#define DRM_EDID_FEATURE_PM_ACTIVE_OFF (1 << 5) 187#define DRM_EDID_FEATURE_PM_ACTIVE_OFF (1 << 5)
165#define DRM_EDID_FEATURE_PM_SUSPEND (1 << 6) 188#define DRM_EDID_FEATURE_PM_SUSPEND (1 << 6)
166#define DRM_EDID_FEATURE_PM_STANDBY (1 << 7) 189#define DRM_EDID_FEATURE_PM_STANDBY (1 << 7)
diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h
index f22e7fe4b6db..6e3076ad646e 100644
--- a/include/drm/drm_fb_helper.h
+++ b/include/drm/drm_fb_helper.h
@@ -40,20 +40,6 @@ struct drm_fb_helper_crtc {
40 struct drm_display_mode *desired_mode; 40 struct drm_display_mode *desired_mode;
41}; 41};
42 42
43/* mode specified on the command line */
44struct drm_fb_helper_cmdline_mode {
45 bool specified;
46 bool refresh_specified;
47 bool bpp_specified;
48 int xres, yres;
49 int bpp;
50 int refresh;
51 bool rb;
52 bool interlace;
53 bool cvt;
54 bool margins;
55};
56
57struct drm_fb_helper_surface_size { 43struct drm_fb_helper_surface_size {
58 u32 fb_width; 44 u32 fb_width;
59 u32 fb_height; 45 u32 fb_height;
@@ -74,8 +60,8 @@ struct drm_fb_helper_funcs {
74}; 60};
75 61
76struct drm_fb_helper_connector { 62struct drm_fb_helper_connector {
77 struct drm_fb_helper_cmdline_mode cmdline_mode;
78 struct drm_connector *connector; 63 struct drm_connector *connector;
64 struct drm_cmdline_mode cmdline_mode;
79}; 65};
80 66
81struct drm_fb_helper { 67struct drm_fb_helper {
@@ -118,6 +104,7 @@ int drm_fb_helper_setcolreg(unsigned regno,
118 unsigned transp, 104 unsigned transp,
119 struct fb_info *info); 105 struct fb_info *info);
120 106
107bool drm_fb_helper_restore_fbdev_mode(struct drm_fb_helper *fb_helper);
121void drm_fb_helper_restore(void); 108void drm_fb_helper_restore(void);
122void drm_fb_helper_fill_var(struct fb_info *info, struct drm_fb_helper *fb_helper, 109void drm_fb_helper_fill_var(struct fb_info *info, struct drm_fb_helper *fb_helper,
123 uint32_t fb_width, uint32_t fb_height); 110 uint32_t fb_width, uint32_t fb_height);
@@ -126,7 +113,7 @@ void drm_fb_helper_fill_fix(struct fb_info *info, uint32_t pitch,
126 113
127int drm_fb_helper_setcmap(struct fb_cmap *cmap, struct fb_info *info); 114int drm_fb_helper_setcmap(struct fb_cmap *cmap, struct fb_info *info);
128 115
129bool drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper); 116int drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper);
130bool drm_fb_helper_initial_config(struct drm_fb_helper *fb_helper, int bpp_sel); 117bool drm_fb_helper_initial_config(struct drm_fb_helper *fb_helper, int bpp_sel);
131int drm_fb_helper_single_add_all_connectors(struct drm_fb_helper *fb_helper); 118int drm_fb_helper_single_add_all_connectors(struct drm_fb_helper *fb_helper);
132int drm_fb_helper_debug_enter(struct fb_info *info); 119int drm_fb_helper_debug_enter(struct fb_info *info);
diff --git a/include/drm/drm_hashtab.h b/include/drm/drm_hashtab.h
index 0af087a4d3b3..3650d5d011ee 100644
--- a/include/drm/drm_hashtab.h
+++ b/include/drm/drm_hashtab.h
@@ -45,14 +45,10 @@ struct drm_hash_item {
45}; 45};
46 46
47struct drm_open_hash { 47struct drm_open_hash {
48 unsigned int size;
49 unsigned int order;
50 unsigned int fill;
51 struct hlist_head *table; 48 struct hlist_head *table;
52 int use_vmalloc; 49 u8 order;
53}; 50};
54 51
55
56extern int drm_ht_create(struct drm_open_hash *ht, unsigned int order); 52extern int drm_ht_create(struct drm_open_hash *ht, unsigned int order);
57extern int drm_ht_insert_item(struct drm_open_hash *ht, struct drm_hash_item *item); 53extern int drm_ht_insert_item(struct drm_open_hash *ht, struct drm_hash_item *item);
58extern int drm_ht_just_insert_please(struct drm_open_hash *ht, struct drm_hash_item *item, 54extern int drm_ht_just_insert_please(struct drm_open_hash *ht, struct drm_hash_item *item,
diff --git a/include/drm/drm_mm.h b/include/drm/drm_mm.h
index bf01531193d5..564b14aa7e16 100644
--- a/include/drm/drm_mm.h
+++ b/include/drm/drm_mm.h
@@ -42,33 +42,58 @@
42#endif 42#endif
43 43
44struct drm_mm_node { 44struct drm_mm_node {
45 struct list_head free_stack;
46 struct list_head node_list; 45 struct list_head node_list;
47 unsigned free : 1; 46 struct list_head hole_stack;
47 unsigned hole_follows : 1;
48 unsigned scanned_block : 1; 48 unsigned scanned_block : 1;
49 unsigned scanned_prev_free : 1; 49 unsigned scanned_prev_free : 1;
50 unsigned scanned_next_free : 1; 50 unsigned scanned_next_free : 1;
51 unsigned scanned_preceeds_hole : 1;
52 unsigned allocated : 1;
51 unsigned long start; 53 unsigned long start;
52 unsigned long size; 54 unsigned long size;
53 struct drm_mm *mm; 55 struct drm_mm *mm;
54}; 56};
55 57
56struct drm_mm { 58struct drm_mm {
57 /* List of free memory blocks, most recently freed ordered. */ 59 /* List of all memory nodes that immediately precede a free hole. */
58 struct list_head free_stack; 60 struct list_head hole_stack;
59 /* List of all memory nodes, ordered according to the (increasing) start 61 /* head_node.node_list is the list of all memory nodes, ordered
60 * address of the memory node. */ 62 * according to the (increasing) start address of the memory node. */
61 struct list_head node_list; 63 struct drm_mm_node head_node;
62 struct list_head unused_nodes; 64 struct list_head unused_nodes;
63 int num_unused; 65 int num_unused;
64 spinlock_t unused_lock; 66 spinlock_t unused_lock;
67 unsigned int scan_check_range : 1;
65 unsigned scan_alignment; 68 unsigned scan_alignment;
66 unsigned long scan_size; 69 unsigned long scan_size;
67 unsigned long scan_hit_start; 70 unsigned long scan_hit_start;
68 unsigned scan_hit_size; 71 unsigned scan_hit_size;
69 unsigned scanned_blocks; 72 unsigned scanned_blocks;
73 unsigned long scan_start;
74 unsigned long scan_end;
75 struct drm_mm_node *prev_scanned_node;
70}; 76};
71 77
78static inline bool drm_mm_node_allocated(struct drm_mm_node *node)
79{
80 return node->allocated;
81}
82
83static inline bool drm_mm_initialized(struct drm_mm *mm)
84{
85 return mm->hole_stack.next;
86}
87#define drm_mm_for_each_node(entry, mm) list_for_each_entry(entry, \
88 &(mm)->head_node.node_list, \
89 node_list)
90#define drm_mm_for_each_scanned_node_reverse(entry, n, mm) \
91 for (entry = (mm)->prev_scanned_node, \
92 next = entry ? list_entry(entry->node_list.next, \
93 struct drm_mm_node, node_list) : NULL; \
94 entry != NULL; entry = next, \
95 next = entry ? list_entry(entry->node_list.next, \
96 struct drm_mm_node, node_list) : NULL) \
72/* 97/*
73 * Basic range manager support (drm_mm.c) 98 * Basic range manager support (drm_mm.c)
74 */ 99 */
@@ -115,7 +140,15 @@ static inline struct drm_mm_node *drm_mm_get_block_atomic_range(
115 return drm_mm_get_block_range_generic(parent, size, alignment, 140 return drm_mm_get_block_range_generic(parent, size, alignment,
116 start, end, 1); 141 start, end, 1);
117} 142}
143extern int drm_mm_insert_node(struct drm_mm *mm, struct drm_mm_node *node,
144 unsigned long size, unsigned alignment);
145extern int drm_mm_insert_node_in_range(struct drm_mm *mm,
146 struct drm_mm_node *node,
147 unsigned long size, unsigned alignment,
148 unsigned long start, unsigned long end);
118extern void drm_mm_put_block(struct drm_mm_node *cur); 149extern void drm_mm_put_block(struct drm_mm_node *cur);
150extern void drm_mm_remove_node(struct drm_mm_node *node);
151extern void drm_mm_replace_node(struct drm_mm_node *old, struct drm_mm_node *new);
119extern struct drm_mm_node *drm_mm_search_free(const struct drm_mm *mm, 152extern struct drm_mm_node *drm_mm_search_free(const struct drm_mm *mm,
120 unsigned long size, 153 unsigned long size,
121 unsigned alignment, 154 unsigned alignment,
@@ -131,11 +164,6 @@ extern int drm_mm_init(struct drm_mm *mm, unsigned long start,
131 unsigned long size); 164 unsigned long size);
132extern void drm_mm_takedown(struct drm_mm *mm); 165extern void drm_mm_takedown(struct drm_mm *mm);
133extern int drm_mm_clean(struct drm_mm *mm); 166extern int drm_mm_clean(struct drm_mm *mm);
134extern unsigned long drm_mm_tail_space(struct drm_mm *mm);
135extern int drm_mm_remove_space_from_tail(struct drm_mm *mm,
136 unsigned long size);
137extern int drm_mm_add_space_to_tail(struct drm_mm *mm,
138 unsigned long size, int atomic);
139extern int drm_mm_pre_get(struct drm_mm *mm); 167extern int drm_mm_pre_get(struct drm_mm *mm);
140 168
141static inline struct drm_mm *drm_get_mm(struct drm_mm_node *block) 169static inline struct drm_mm *drm_get_mm(struct drm_mm_node *block)
@@ -145,6 +173,10 @@ static inline struct drm_mm *drm_get_mm(struct drm_mm_node *block)
145 173
146void drm_mm_init_scan(struct drm_mm *mm, unsigned long size, 174void drm_mm_init_scan(struct drm_mm *mm, unsigned long size,
147 unsigned alignment); 175 unsigned alignment);
176void drm_mm_init_scan_with_range(struct drm_mm *mm, unsigned long size,
177 unsigned alignment,
178 unsigned long start,
179 unsigned long end);
148int drm_mm_scan_add_block(struct drm_mm_node *node); 180int drm_mm_scan_add_block(struct drm_mm_node *node);
149int drm_mm_scan_remove_block(struct drm_mm_node *node); 181int drm_mm_scan_remove_block(struct drm_mm_node *node);
150 182
diff --git a/include/drm/drm_mode.h b/include/drm/drm_mode.h
index 0fc7397c8f1f..c4961ea50a49 100644
--- a/include/drm/drm_mode.h
+++ b/include/drm/drm_mode.h
@@ -277,7 +277,7 @@ struct drm_mode_mode_cmd {
277#define DRM_MODE_CURSOR_MOVE (1<<1) 277#define DRM_MODE_CURSOR_MOVE (1<<1)
278 278
279/* 279/*
280 * depending on the value in flags diffrent members are used. 280 * depending on the value in flags different members are used.
281 * 281 *
282 * CURSOR_BO uses 282 * CURSOR_BO uses
283 * crtc 283 * crtc
@@ -344,4 +344,33 @@ struct drm_mode_crtc_page_flip {
344 __u64 user_data; 344 __u64 user_data;
345}; 345};
346 346
347/* create a dumb scanout buffer */
348struct drm_mode_create_dumb {
349 uint32_t height;
350 uint32_t width;
351 uint32_t bpp;
352 uint32_t flags;
353 /* handle, pitch, size will be returned */
354 uint32_t handle;
355 uint32_t pitch;
356 uint64_t size;
357};
358
359/* set up for mmap of a dumb scanout buffer */
360struct drm_mode_map_dumb {
361 /** Handle for the object being mapped. */
362 __u32 handle;
363 __u32 pad;
364 /**
365 * Fake offset to use for subsequent mmap call
366 *
367 * This is a fixed-size type for 32/64 compatibility.
368 */
369 __u64 offset;
370};
371
372struct drm_mode_destroy_dumb {
373 uint32_t handle;
374};
375
347#endif 376#endif
diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h
index 883c1d439899..3d53efd25ab9 100644
--- a/include/drm/drm_pciids.h
+++ b/include/drm/drm_pciids.h
@@ -28,7 +28,6 @@
28 {0x1002, 0x4156, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV350}, \ 28 {0x1002, 0x4156, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV350}, \
29 {0x1002, 0x4237, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS200|RADEON_IS_IGP}, \ 29 {0x1002, 0x4237, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS200|RADEON_IS_IGP}, \
30 {0x1002, 0x4242, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R200}, \ 30 {0x1002, 0x4242, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R200}, \
31 {0x1002, 0x4243, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R200}, \
32 {0x1002, 0x4336, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS100|RADEON_IS_IGP|RADEON_IS_MOBILITY}, \ 31 {0x1002, 0x4336, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS100|RADEON_IS_IGP|RADEON_IS_MOBILITY}, \
33 {0x1002, 0x4337, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS200|RADEON_IS_IGP|RADEON_IS_MOBILITY}, \ 32 {0x1002, 0x4337, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS200|RADEON_IS_IGP|RADEON_IS_MOBILITY}, \
34 {0x1002, 0x4437, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS200|RADEON_IS_IGP|RADEON_IS_MOBILITY}, \ 33 {0x1002, 0x4437, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS200|RADEON_IS_IGP|RADEON_IS_MOBILITY}, \
@@ -142,6 +141,60 @@
142 {0x1002, 0x5e4c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_NEW_MEMMAP}, \ 141 {0x1002, 0x5e4c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_NEW_MEMMAP}, \
143 {0x1002, 0x5e4d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_NEW_MEMMAP}, \ 142 {0x1002, 0x5e4d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_NEW_MEMMAP}, \
144 {0x1002, 0x5e4f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_NEW_MEMMAP}, \ 143 {0x1002, 0x5e4f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_NEW_MEMMAP}, \
144 {0x1002, 0x6700, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAYMAN|RADEON_NEW_MEMMAP}, \
145 {0x1002, 0x6701, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAYMAN|RADEON_NEW_MEMMAP}, \
146 {0x1002, 0x6702, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAYMAN|RADEON_NEW_MEMMAP}, \
147 {0x1002, 0x6703, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAYMAN|RADEON_NEW_MEMMAP}, \
148 {0x1002, 0x6704, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAYMAN|RADEON_NEW_MEMMAP}, \
149 {0x1002, 0x6705, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAYMAN|RADEON_NEW_MEMMAP}, \
150 {0x1002, 0x6706, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAYMAN|RADEON_NEW_MEMMAP}, \
151 {0x1002, 0x6707, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAYMAN|RADEON_NEW_MEMMAP}, \
152 {0x1002, 0x6708, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAYMAN|RADEON_NEW_MEMMAP}, \
153 {0x1002, 0x6709, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAYMAN|RADEON_NEW_MEMMAP}, \
154 {0x1002, 0x6718, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAYMAN|RADEON_NEW_MEMMAP}, \
155 {0x1002, 0x6719, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAYMAN|RADEON_NEW_MEMMAP}, \
156 {0x1002, 0x671c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAYMAN|RADEON_NEW_MEMMAP}, \
157 {0x1002, 0x671d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAYMAN|RADEON_NEW_MEMMAP}, \
158 {0x1002, 0x671f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAYMAN|RADEON_NEW_MEMMAP}, \
159 {0x1002, 0x6720, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BARTS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
160 {0x1002, 0x6721, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BARTS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
161 {0x1002, 0x6722, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BARTS|RADEON_NEW_MEMMAP}, \
162 {0x1002, 0x6723, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BARTS|RADEON_NEW_MEMMAP}, \
163 {0x1002, 0x6724, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BARTS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
164 {0x1002, 0x6725, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BARTS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
165 {0x1002, 0x6726, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BARTS|RADEON_NEW_MEMMAP}, \
166 {0x1002, 0x6727, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BARTS|RADEON_NEW_MEMMAP}, \
167 {0x1002, 0x6728, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BARTS|RADEON_NEW_MEMMAP}, \
168 {0x1002, 0x6729, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BARTS|RADEON_NEW_MEMMAP}, \
169 {0x1002, 0x6738, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BARTS|RADEON_NEW_MEMMAP}, \
170 {0x1002, 0x6739, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BARTS|RADEON_NEW_MEMMAP}, \
171 {0x1002, 0x673e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BARTS|RADEON_NEW_MEMMAP}, \
172 {0x1002, 0x6740, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
173 {0x1002, 0x6741, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
174 {0x1002, 0x6742, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
175 {0x1002, 0x6743, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
176 {0x1002, 0x6744, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
177 {0x1002, 0x6745, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
178 {0x1002, 0x6746, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \
179 {0x1002, 0x6747, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \
180 {0x1002, 0x6748, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \
181 {0x1002, 0x6749, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \
182 {0x1002, 0x6750, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \
183 {0x1002, 0x6758, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \
184 {0x1002, 0x6759, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \
185 {0x1002, 0x675F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \
186 {0x1002, 0x6760, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
187 {0x1002, 0x6761, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
188 {0x1002, 0x6762, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \
189 {0x1002, 0x6763, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \
190 {0x1002, 0x6764, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
191 {0x1002, 0x6765, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
192 {0x1002, 0x6766, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \
193 {0x1002, 0x6767, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \
194 {0x1002, 0x6768, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \
195 {0x1002, 0x6770, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \
196 {0x1002, 0x6778, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \
197 {0x1002, 0x6779, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \
145 {0x1002, 0x6880, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 198 {0x1002, 0x6880, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
146 {0x1002, 0x6888, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \ 199 {0x1002, 0x6888, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \
147 {0x1002, 0x6889, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \ 200 {0x1002, 0x6889, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \
@@ -150,6 +203,7 @@
150 {0x1002, 0x688D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \ 203 {0x1002, 0x688D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \
151 {0x1002, 0x6898, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \ 204 {0x1002, 0x6898, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \
152 {0x1002, 0x6899, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \ 205 {0x1002, 0x6899, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \
206 {0x1002, 0x689b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \
153 {0x1002, 0x689c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HEMLOCK|RADEON_NEW_MEMMAP}, \ 207 {0x1002, 0x689c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HEMLOCK|RADEON_NEW_MEMMAP}, \
154 {0x1002, 0x689d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HEMLOCK|RADEON_NEW_MEMMAP}, \ 208 {0x1002, 0x689d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HEMLOCK|RADEON_NEW_MEMMAP}, \
155 {0x1002, 0x689e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \ 209 {0x1002, 0x689e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \
@@ -160,7 +214,9 @@
160 {0x1002, 0x68b0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_JUNIPER|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 214 {0x1002, 0x68b0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_JUNIPER|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
161 {0x1002, 0x68b8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_JUNIPER|RADEON_NEW_MEMMAP}, \ 215 {0x1002, 0x68b8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_JUNIPER|RADEON_NEW_MEMMAP}, \
162 {0x1002, 0x68b9, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_JUNIPER|RADEON_NEW_MEMMAP}, \ 216 {0x1002, 0x68b9, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_JUNIPER|RADEON_NEW_MEMMAP}, \
217 {0x1002, 0x68ba, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_JUNIPER|RADEON_NEW_MEMMAP}, \
163 {0x1002, 0x68be, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_JUNIPER|RADEON_NEW_MEMMAP}, \ 218 {0x1002, 0x68be, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_JUNIPER|RADEON_NEW_MEMMAP}, \
219 {0x1002, 0x68bf, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_JUNIPER|RADEON_NEW_MEMMAP}, \
164 {0x1002, 0x68c0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_REDWOOD|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 220 {0x1002, 0x68c0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_REDWOOD|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
165 {0x1002, 0x68c1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_REDWOOD|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 221 {0x1002, 0x68c1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_REDWOOD|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
166 {0x1002, 0x68c7, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_REDWOOD|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 222 {0x1002, 0x68c7, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_REDWOOD|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
@@ -413,12 +469,29 @@
413 {0x1002, 0x9614, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS780|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ 469 {0x1002, 0x9614, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS780|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
414 {0x1002, 0x9615, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS780|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ 470 {0x1002, 0x9615, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS780|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
415 {0x1002, 0x9616, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS780|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ 471 {0x1002, 0x9616, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS780|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
472 {0x1002, 0x9640, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
473 {0x1002, 0x9641, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
474 {0x1002, 0x9642, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO2|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
475 {0x1002, 0x9643, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO2|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
476 {0x1002, 0x9644, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO2|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
477 {0x1002, 0x9645, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO2|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
478 {0x1002, 0x9647, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP},\
479 {0x1002, 0x9648, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP},\
480 {0x1002, 0x964a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
481 {0x1002, 0x964e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP},\
482 {0x1002, 0x964f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP},\
416 {0x1002, 0x9710, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS880|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ 483 {0x1002, 0x9710, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS880|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
417 {0x1002, 0x9711, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS880|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ 484 {0x1002, 0x9711, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS880|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
418 {0x1002, 0x9712, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS880|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ 485 {0x1002, 0x9712, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS880|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
419 {0x1002, 0x9713, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS880|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ 486 {0x1002, 0x9713, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS880|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
420 {0x1002, 0x9714, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS880|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ 487 {0x1002, 0x9714, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS880|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
421 {0x1002, 0x9715, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS880|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ 488 {0x1002, 0x9715, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS880|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
489 {0x1002, 0x9802, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
490 {0x1002, 0x9803, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
491 {0x1002, 0x9804, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
492 {0x1002, 0x9805, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
493 {0x1002, 0x9806, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
494 {0x1002, 0x9807, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
422 {0, 0, 0} 495 {0, 0, 0}
423 496
424#define r128_PCI_IDS \ 497#define r128_PCI_IDS \
diff --git a/include/drm/drm_usb.h b/include/drm/drm_usb.h
new file mode 100644
index 000000000000..33506c11da8b
--- /dev/null
+++ b/include/drm/drm_usb.h
@@ -0,0 +1,15 @@
1#ifndef DRM_USB_H
2#define DRM_USB_H
3
4#include <drmP.h>
5
6#include <linux/usb.h>
7
8extern int drm_usb_init(struct drm_driver *driver, struct usb_driver *udriver);
9extern void drm_usb_exit(struct drm_driver *driver, struct usb_driver *udriver);
10
11int drm_get_usb_dev(struct usb_interface *interface,
12 const struct usb_device_id *id,
13 struct drm_driver *driver);
14
15#endif
diff --git a/include/drm/i830_drm.h b/include/drm/i830_drm.h
deleted file mode 100644
index 61315c29b8f3..000000000000
--- a/include/drm/i830_drm.h
+++ /dev/null
@@ -1,342 +0,0 @@
1#ifndef _I830_DRM_H_
2#define _I830_DRM_H_
3
4/* WARNING: These defines must be the same as what the Xserver uses.
5 * if you change them, you must change the defines in the Xserver.
6 *
7 * KW: Actually, you can't ever change them because doing so would
8 * break backwards compatibility.
9 */
10
11#ifndef _I830_DEFINES_
12#define _I830_DEFINES_
13
14#define I830_DMA_BUF_ORDER 12
15#define I830_DMA_BUF_SZ (1<<I830_DMA_BUF_ORDER)
16#define I830_DMA_BUF_NR 256
17#define I830_NR_SAREA_CLIPRECTS 8
18
19/* Each region is a minimum of 64k, and there are at most 64 of them.
20 */
21#define I830_NR_TEX_REGIONS 64
22#define I830_LOG_MIN_TEX_REGION_SIZE 16
23
24/* KW: These aren't correct but someone set them to two and then
25 * released the module. Now we can't change them as doing so would
26 * break backwards compatibility.
27 */
28#define I830_TEXTURE_COUNT 2
29#define I830_TEXBLEND_COUNT I830_TEXTURE_COUNT
30
31#define I830_TEXBLEND_SIZE 12 /* (4 args + op) * 2 + COLOR_FACTOR */
32
33#define I830_UPLOAD_CTX 0x1
34#define I830_UPLOAD_BUFFERS 0x2
35#define I830_UPLOAD_CLIPRECTS 0x4
36#define I830_UPLOAD_TEX0_IMAGE 0x100 /* handled clientside */
37#define I830_UPLOAD_TEX0_CUBE 0x200 /* handled clientside */
38#define I830_UPLOAD_TEX1_IMAGE 0x400 /* handled clientside */
39#define I830_UPLOAD_TEX1_CUBE 0x800 /* handled clientside */
40#define I830_UPLOAD_TEX2_IMAGE 0x1000 /* handled clientside */
41#define I830_UPLOAD_TEX2_CUBE 0x2000 /* handled clientside */
42#define I830_UPLOAD_TEX3_IMAGE 0x4000 /* handled clientside */
43#define I830_UPLOAD_TEX3_CUBE 0x8000 /* handled clientside */
44#define I830_UPLOAD_TEX_N_IMAGE(n) (0x100 << (n * 2))
45#define I830_UPLOAD_TEX_N_CUBE(n) (0x200 << (n * 2))
46#define I830_UPLOAD_TEXIMAGE_MASK 0xff00
47#define I830_UPLOAD_TEX0 0x10000
48#define I830_UPLOAD_TEX1 0x20000
49#define I830_UPLOAD_TEX2 0x40000
50#define I830_UPLOAD_TEX3 0x80000
51#define I830_UPLOAD_TEX_N(n) (0x10000 << (n))
52#define I830_UPLOAD_TEX_MASK 0xf0000
53#define I830_UPLOAD_TEXBLEND0 0x100000
54#define I830_UPLOAD_TEXBLEND1 0x200000
55#define I830_UPLOAD_TEXBLEND2 0x400000
56#define I830_UPLOAD_TEXBLEND3 0x800000
57#define I830_UPLOAD_TEXBLEND_N(n) (0x100000 << (n))
58#define I830_UPLOAD_TEXBLEND_MASK 0xf00000
59#define I830_UPLOAD_TEX_PALETTE_N(n) (0x1000000 << (n))
60#define I830_UPLOAD_TEX_PALETTE_SHARED 0x4000000
61#define I830_UPLOAD_STIPPLE 0x8000000
62
63/* Indices into buf.Setup where various bits of state are mirrored per
64 * context and per buffer. These can be fired at the card as a unit,
65 * or in a piecewise fashion as required.
66 */
67
68/* Destbuffer state
69 * - backbuffer linear offset and pitch -- invarient in the current dri
70 * - zbuffer linear offset and pitch -- also invarient
71 * - drawing origin in back and depth buffers.
72 *
73 * Keep the depth/back buffer state here to accommodate private buffers
74 * in the future.
75 */
76
77#define I830_DESTREG_CBUFADDR 0
78#define I830_DESTREG_DBUFADDR 1
79#define I830_DESTREG_DV0 2
80#define I830_DESTREG_DV1 3
81#define I830_DESTREG_SENABLE 4
82#define I830_DESTREG_SR0 5
83#define I830_DESTREG_SR1 6
84#define I830_DESTREG_SR2 7
85#define I830_DESTREG_DR0 8
86#define I830_DESTREG_DR1 9
87#define I830_DESTREG_DR2 10
88#define I830_DESTREG_DR3 11
89#define I830_DESTREG_DR4 12
90#define I830_DEST_SETUP_SIZE 13
91
92/* Context state
93 */
94#define I830_CTXREG_STATE1 0
95#define I830_CTXREG_STATE2 1
96#define I830_CTXREG_STATE3 2
97#define I830_CTXREG_STATE4 3
98#define I830_CTXREG_STATE5 4
99#define I830_CTXREG_IALPHAB 5
100#define I830_CTXREG_STENCILTST 6
101#define I830_CTXREG_ENABLES_1 7
102#define I830_CTXREG_ENABLES_2 8
103#define I830_CTXREG_AA 9
104#define I830_CTXREG_FOGCOLOR 10
105#define I830_CTXREG_BLENDCOLR0 11
106#define I830_CTXREG_BLENDCOLR 12 /* Dword 1 of 2 dword command */
107#define I830_CTXREG_VF 13
108#define I830_CTXREG_VF2 14
109#define I830_CTXREG_MCSB0 15
110#define I830_CTXREG_MCSB1 16
111#define I830_CTX_SETUP_SIZE 17
112
113/* 1.3: Stipple state
114 */
115#define I830_STPREG_ST0 0
116#define I830_STPREG_ST1 1
117#define I830_STP_SETUP_SIZE 2
118
119/* Texture state (per tex unit)
120 */
121
122#define I830_TEXREG_MI0 0 /* GFX_OP_MAP_INFO (6 dwords) */
123#define I830_TEXREG_MI1 1
124#define I830_TEXREG_MI2 2
125#define I830_TEXREG_MI3 3
126#define I830_TEXREG_MI4 4
127#define I830_TEXREG_MI5 5
128#define I830_TEXREG_MF 6 /* GFX_OP_MAP_FILTER */
129#define I830_TEXREG_MLC 7 /* GFX_OP_MAP_LOD_CTL */
130#define I830_TEXREG_MLL 8 /* GFX_OP_MAP_LOD_LIMITS */
131#define I830_TEXREG_MCS 9 /* GFX_OP_MAP_COORD_SETS */
132#define I830_TEX_SETUP_SIZE 10
133
134#define I830_TEXREG_TM0LI 0 /* load immediate 2 texture map n */
135#define I830_TEXREG_TM0S0 1
136#define I830_TEXREG_TM0S1 2
137#define I830_TEXREG_TM0S2 3
138#define I830_TEXREG_TM0S3 4
139#define I830_TEXREG_TM0S4 5
140#define I830_TEXREG_NOP0 6 /* noop */
141#define I830_TEXREG_NOP1 7 /* noop */
142#define I830_TEXREG_NOP2 8 /* noop */
143#define __I830_TEXREG_MCS 9 /* GFX_OP_MAP_COORD_SETS -- shared */
144#define __I830_TEX_SETUP_SIZE 10
145
146#define I830_FRONT 0x1
147#define I830_BACK 0x2
148#define I830_DEPTH 0x4
149
150#endif /* _I830_DEFINES_ */
151
152typedef struct _drm_i830_init {
153 enum {
154 I830_INIT_DMA = 0x01,
155 I830_CLEANUP_DMA = 0x02
156 } func;
157 unsigned int mmio_offset;
158 unsigned int buffers_offset;
159 int sarea_priv_offset;
160 unsigned int ring_start;
161 unsigned int ring_end;
162 unsigned int ring_size;
163 unsigned int front_offset;
164 unsigned int back_offset;
165 unsigned int depth_offset;
166 unsigned int w;
167 unsigned int h;
168 unsigned int pitch;
169 unsigned int pitch_bits;
170 unsigned int back_pitch;
171 unsigned int depth_pitch;
172 unsigned int cpp;
173} drm_i830_init_t;
174
175/* Warning: If you change the SAREA structure you must change the Xserver
176 * structure as well */
177
178typedef struct _drm_i830_tex_region {
179 unsigned char next, prev; /* indices to form a circular LRU */
180 unsigned char in_use; /* owned by a client, or free? */
181 int age; /* tracked by clients to update local LRU's */
182} drm_i830_tex_region_t;
183
184typedef struct _drm_i830_sarea {
185 unsigned int ContextState[I830_CTX_SETUP_SIZE];
186 unsigned int BufferState[I830_DEST_SETUP_SIZE];
187 unsigned int TexState[I830_TEXTURE_COUNT][I830_TEX_SETUP_SIZE];
188 unsigned int TexBlendState[I830_TEXBLEND_COUNT][I830_TEXBLEND_SIZE];
189 unsigned int TexBlendStateWordsUsed[I830_TEXBLEND_COUNT];
190 unsigned int Palette[2][256];
191 unsigned int dirty;
192
193 unsigned int nbox;
194 struct drm_clip_rect boxes[I830_NR_SAREA_CLIPRECTS];
195
196 /* Maintain an LRU of contiguous regions of texture space. If
197 * you think you own a region of texture memory, and it has an
198 * age different to the one you set, then you are mistaken and
199 * it has been stolen by another client. If global texAge
200 * hasn't changed, there is no need to walk the list.
201 *
202 * These regions can be used as a proxy for the fine-grained
203 * texture information of other clients - by maintaining them
204 * in the same lru which is used to age their own textures,
205 * clients have an approximate lru for the whole of global
206 * texture space, and can make informed decisions as to which
207 * areas to kick out. There is no need to choose whether to
208 * kick out your own texture or someone else's - simply eject
209 * them all in LRU order.
210 */
211
212 drm_i830_tex_region_t texList[I830_NR_TEX_REGIONS + 1];
213 /* Last elt is sentinal */
214 int texAge; /* last time texture was uploaded */
215 int last_enqueue; /* last time a buffer was enqueued */
216 int last_dispatch; /* age of the most recently dispatched buffer */
217 int last_quiescent; /* */
218 int ctxOwner; /* last context to upload state */
219
220 int vertex_prim;
221
222 int pf_enabled; /* is pageflipping allowed? */
223 int pf_active;
224 int pf_current_page; /* which buffer is being displayed? */
225
226 int perf_boxes; /* performance boxes to be displayed */
227
228 /* Here's the state for texunits 2,3:
229 */
230 unsigned int TexState2[I830_TEX_SETUP_SIZE];
231 unsigned int TexBlendState2[I830_TEXBLEND_SIZE];
232 unsigned int TexBlendStateWordsUsed2;
233
234 unsigned int TexState3[I830_TEX_SETUP_SIZE];
235 unsigned int TexBlendState3[I830_TEXBLEND_SIZE];
236 unsigned int TexBlendStateWordsUsed3;
237
238 unsigned int StippleState[I830_STP_SETUP_SIZE];
239} drm_i830_sarea_t;
240
241/* Flags for perf_boxes
242 */
243#define I830_BOX_RING_EMPTY 0x1 /* populated by kernel */
244#define I830_BOX_FLIP 0x2 /* populated by kernel */
245#define I830_BOX_WAIT 0x4 /* populated by kernel & client */
246#define I830_BOX_TEXTURE_LOAD 0x8 /* populated by kernel */
247#define I830_BOX_LOST_CONTEXT 0x10 /* populated by client */
248
249/* I830 specific ioctls
250 * The device specific ioctl range is 0x40 to 0x79.
251 */
252#define DRM_I830_INIT 0x00
253#define DRM_I830_VERTEX 0x01
254#define DRM_I830_CLEAR 0x02
255#define DRM_I830_FLUSH 0x03
256#define DRM_I830_GETAGE 0x04
257#define DRM_I830_GETBUF 0x05
258#define DRM_I830_SWAP 0x06
259#define DRM_I830_COPY 0x07
260#define DRM_I830_DOCOPY 0x08
261#define DRM_I830_FLIP 0x09
262#define DRM_I830_IRQ_EMIT 0x0a
263#define DRM_I830_IRQ_WAIT 0x0b
264#define DRM_I830_GETPARAM 0x0c
265#define DRM_I830_SETPARAM 0x0d
266
267#define DRM_IOCTL_I830_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I830_INIT, drm_i830_init_t)
268#define DRM_IOCTL_I830_VERTEX DRM_IOW( DRM_COMMAND_BASE + DRM_I830_VERTEX, drm_i830_vertex_t)
269#define DRM_IOCTL_I830_CLEAR DRM_IOW( DRM_COMMAND_BASE + DRM_I830_CLEAR, drm_i830_clear_t)
270#define DRM_IOCTL_I830_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_I830_FLUSH)
271#define DRM_IOCTL_I830_GETAGE DRM_IO ( DRM_COMMAND_BASE + DRM_I830_GETAGE)
272#define DRM_IOCTL_I830_GETBUF DRM_IOWR(DRM_COMMAND_BASE + DRM_I830_GETBUF, drm_i830_dma_t)
273#define DRM_IOCTL_I830_SWAP DRM_IO ( DRM_COMMAND_BASE + DRM_I830_SWAP)
274#define DRM_IOCTL_I830_COPY DRM_IOW( DRM_COMMAND_BASE + DRM_I830_COPY, drm_i830_copy_t)
275#define DRM_IOCTL_I830_DOCOPY DRM_IO ( DRM_COMMAND_BASE + DRM_I830_DOCOPY)
276#define DRM_IOCTL_I830_FLIP DRM_IO ( DRM_COMMAND_BASE + DRM_I830_FLIP)
277#define DRM_IOCTL_I830_IRQ_EMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_I830_IRQ_EMIT, drm_i830_irq_emit_t)
278#define DRM_IOCTL_I830_IRQ_WAIT DRM_IOW( DRM_COMMAND_BASE + DRM_I830_IRQ_WAIT, drm_i830_irq_wait_t)
279#define DRM_IOCTL_I830_GETPARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_I830_GETPARAM, drm_i830_getparam_t)
280#define DRM_IOCTL_I830_SETPARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_I830_SETPARAM, drm_i830_setparam_t)
281
282typedef struct _drm_i830_clear {
283 int clear_color;
284 int clear_depth;
285 int flags;
286 unsigned int clear_colormask;
287 unsigned int clear_depthmask;
288} drm_i830_clear_t;
289
290/* These may be placeholders if we have more cliprects than
291 * I830_NR_SAREA_CLIPRECTS. In that case, the client sets discard to
292 * false, indicating that the buffer will be dispatched again with a
293 * new set of cliprects.
294 */
295typedef struct _drm_i830_vertex {
296 int idx; /* buffer index */
297 int used; /* nr bytes in use */
298 int discard; /* client is finished with the buffer? */
299} drm_i830_vertex_t;
300
301typedef struct _drm_i830_copy_t {
302 int idx; /* buffer index */
303 int used; /* nr bytes in use */
304 void __user *address; /* Address to copy from */
305} drm_i830_copy_t;
306
307typedef struct drm_i830_dma {
308 void __user *virtual;
309 int request_idx;
310 int request_size;
311 int granted;
312} drm_i830_dma_t;
313
314/* 1.3: Userspace can request & wait on irq's:
315 */
316typedef struct drm_i830_irq_emit {
317 int __user *irq_seq;
318} drm_i830_irq_emit_t;
319
320typedef struct drm_i830_irq_wait {
321 int irq_seq;
322} drm_i830_irq_wait_t;
323
324/* 1.3: New ioctl to query kernel params:
325 */
326#define I830_PARAM_IRQ_ACTIVE 1
327
328typedef struct drm_i830_getparam {
329 int param;
330 int __user *value;
331} drm_i830_getparam_t;
332
333/* 1.3: New ioctl to set kernel params:
334 */
335#define I830_SETPARAM_USE_MI_BATCHBUFFER_START 1
336
337typedef struct drm_i830_setparam {
338 int param;
339 int value;
340} drm_i830_setparam_t;
341
342#endif /* _I830_DRM_H_ */
diff --git a/include/drm/i915_drm.h b/include/drm/i915_drm.h
index e41c74facb6a..c4d6dbfa3ff4 100644
--- a/include/drm/i915_drm.h
+++ b/include/drm/i915_drm.h
@@ -286,6 +286,11 @@ typedef struct drm_i915_irq_wait {
286#define I915_PARAM_HAS_PAGEFLIPPING 8 286#define I915_PARAM_HAS_PAGEFLIPPING 8
287#define I915_PARAM_HAS_EXECBUF2 9 287#define I915_PARAM_HAS_EXECBUF2 9
288#define I915_PARAM_HAS_BSD 10 288#define I915_PARAM_HAS_BSD 10
289#define I915_PARAM_HAS_BLT 11
290#define I915_PARAM_HAS_RELAXED_FENCING 12
291#define I915_PARAM_HAS_COHERENT_RINGS 13
292#define I915_PARAM_HAS_EXEC_CONSTANTS 14
293#define I915_PARAM_HAS_RELAXED_DELTA 15
289 294
290typedef struct drm_i915_getparam { 295typedef struct drm_i915_getparam {
291 int param; 296 int param;
@@ -627,8 +632,22 @@ struct drm_i915_gem_execbuffer2 {
627 __u32 num_cliprects; 632 __u32 num_cliprects;
628 /** This is a struct drm_clip_rect *cliprects */ 633 /** This is a struct drm_clip_rect *cliprects */
629 __u64 cliprects_ptr; 634 __u64 cliprects_ptr;
635#define I915_EXEC_RING_MASK (7<<0)
636#define I915_EXEC_DEFAULT (0<<0)
630#define I915_EXEC_RENDER (1<<0) 637#define I915_EXEC_RENDER (1<<0)
631#define I915_EXEC_BSD (1<<1) 638#define I915_EXEC_BSD (2<<0)
639#define I915_EXEC_BLT (3<<0)
640
641/* Used for switching the constants addressing mode on gen4+ RENDER ring.
642 * Gen6+ only supports relative addressing to dynamic state (default) and
643 * absolute addressing.
644 *
645 * These flags are ignored for the BSD and BLT rings.
646 */
647#define I915_EXEC_CONSTANTS_MASK (3<<6)
648#define I915_EXEC_CONSTANTS_REL_GENERAL (0<<6) /* default */
649#define I915_EXEC_CONSTANTS_ABSOLUTE (1<<6)
650#define I915_EXEC_CONSTANTS_REL_SURFACE (2<<6) /* gen4/5 only */
632 __u64 flags; 651 __u64 flags;
633 __u64 rsvd1; 652 __u64 rsvd1;
634 __u64 rsvd2; 653 __u64 rsvd2;
diff --git a/include/drm/intel-gtt.h b/include/drm/intel-gtt.h
new file mode 100644
index 000000000000..9e343c0998b4
--- /dev/null
+++ b/include/drm/intel-gtt.h
@@ -0,0 +1,41 @@
1/* Common header for intel-gtt.ko and i915.ko */
2
3#ifndef _DRM_INTEL_GTT_H
4#define _DRM_INTEL_GTT_H
5
6const struct intel_gtt {
7 /* Size of memory reserved for graphics by the BIOS */
8 unsigned int stolen_size;
9 /* Total number of gtt entries. */
10 unsigned int gtt_total_entries;
11 /* Part of the gtt that is mappable by the cpu, for those chips where
12 * this is not the full gtt. */
13 unsigned int gtt_mappable_entries;
14 /* Whether i915 needs to use the dmar apis or not. */
15 unsigned int needs_dmar : 1;
16} *intel_gtt_get(void);
17
18void intel_gtt_chipset_flush(void);
19void intel_gtt_unmap_memory(struct scatterlist *sg_list, int num_sg);
20void intel_gtt_clear_range(unsigned int first_entry, unsigned int num_entries);
21int intel_gtt_map_memory(struct page **pages, unsigned int num_entries,
22 struct scatterlist **sg_list, int *num_sg);
23void intel_gtt_insert_sg_entries(struct scatterlist *sg_list,
24 unsigned int sg_len,
25 unsigned int pg_start,
26 unsigned int flags);
27void intel_gtt_insert_pages(unsigned int first_entry, unsigned int num_entries,
28 struct page **pages, unsigned int flags);
29
30/* Special gtt memory types */
31#define AGP_DCACHE_MEMORY 1
32#define AGP_PHYS_MEMORY 2
33
34/* New caching attributes for gen6/sandybridge */
35#define AGP_USER_CACHED_MEMORY_LLC_MLC (AGP_USER_TYPES + 2)
36#define AGP_USER_UNCACHED_MEMORY (AGP_USER_TYPES + 4)
37
38/* flag for GFDT type */
39#define AGP_USER_CACHED_MEMORY_GFDT (1 << 3)
40
41#endif
diff --git a/include/drm/mga_drm.h b/include/drm/mga_drm.h
index c16097f99be0..fca817009e13 100644
--- a/include/drm/mga_drm.h
+++ b/include/drm/mga_drm.h
@@ -107,7 +107,7 @@
107 */ 107 */
108#define MGA_NR_SAREA_CLIPRECTS 8 108#define MGA_NR_SAREA_CLIPRECTS 8
109 109
110/* 2 heaps (1 for card, 1 for agp), each divided into upto 128 110/* 2 heaps (1 for card, 1 for agp), each divided into up to 128
111 * regions, subject to a minimum region size of (1<<16) == 64k. 111 * regions, subject to a minimum region size of (1<<16) == 64k.
112 * 112 *
113 * Clients may subdivide regions internally, but when sharing between 113 * Clients may subdivide regions internally, but when sharing between
diff --git a/include/drm/nouveau_drm.h b/include/drm/nouveau_drm.h
index 01a714119506..5edd3a76fffa 100644
--- a/include/drm/nouveau_drm.h
+++ b/include/drm/nouveau_drm.h
@@ -71,15 +71,14 @@ struct drm_nouveau_gpuobj_free {
71#define NOUVEAU_GETPARAM_PCI_VENDOR 3 71#define NOUVEAU_GETPARAM_PCI_VENDOR 3
72#define NOUVEAU_GETPARAM_PCI_DEVICE 4 72#define NOUVEAU_GETPARAM_PCI_DEVICE 4
73#define NOUVEAU_GETPARAM_BUS_TYPE 5 73#define NOUVEAU_GETPARAM_BUS_TYPE 5
74#define NOUVEAU_GETPARAM_FB_PHYSICAL 6
75#define NOUVEAU_GETPARAM_AGP_PHYSICAL 7
76#define NOUVEAU_GETPARAM_FB_SIZE 8 74#define NOUVEAU_GETPARAM_FB_SIZE 8
77#define NOUVEAU_GETPARAM_AGP_SIZE 9 75#define NOUVEAU_GETPARAM_AGP_SIZE 9
78#define NOUVEAU_GETPARAM_PCI_PHYSICAL 10
79#define NOUVEAU_GETPARAM_CHIPSET_ID 11 76#define NOUVEAU_GETPARAM_CHIPSET_ID 11
80#define NOUVEAU_GETPARAM_VM_VRAM_BASE 12 77#define NOUVEAU_GETPARAM_VM_VRAM_BASE 12
81#define NOUVEAU_GETPARAM_GRAPH_UNITS 13 78#define NOUVEAU_GETPARAM_GRAPH_UNITS 13
82#define NOUVEAU_GETPARAM_PTIMER_TIME 14 79#define NOUVEAU_GETPARAM_PTIMER_TIME 14
80#define NOUVEAU_GETPARAM_HAS_BO_USAGE 15
81#define NOUVEAU_GETPARAM_HAS_PAGEFLIP 16
83struct drm_nouveau_getparam { 82struct drm_nouveau_getparam {
84 uint64_t param; 83 uint64_t param;
85 uint64_t value; 84 uint64_t value;
@@ -95,6 +94,13 @@ struct drm_nouveau_setparam {
95#define NOUVEAU_GEM_DOMAIN_GART (1 << 2) 94#define NOUVEAU_GEM_DOMAIN_GART (1 << 2)
96#define NOUVEAU_GEM_DOMAIN_MAPPABLE (1 << 3) 95#define NOUVEAU_GEM_DOMAIN_MAPPABLE (1 << 3)
97 96
97#define NOUVEAU_GEM_TILE_COMP 0x00030000 /* nv50-only */
98#define NOUVEAU_GEM_TILE_LAYOUT_MASK 0x0000ff00
99#define NOUVEAU_GEM_TILE_16BPP 0x00000001
100#define NOUVEAU_GEM_TILE_32BPP 0x00000002
101#define NOUVEAU_GEM_TILE_ZETA 0x00000004
102#define NOUVEAU_GEM_TILE_NONCONTIG 0x00000008
103
98struct drm_nouveau_gem_info { 104struct drm_nouveau_gem_info {
99 uint32_t handle; 105 uint32_t handle;
100 uint32_t domain; 106 uint32_t domain;
@@ -164,7 +170,6 @@ struct drm_nouveau_gem_pushbuf {
164}; 170};
165 171
166#define NOUVEAU_GEM_CPU_PREP_NOWAIT 0x00000001 172#define NOUVEAU_GEM_CPU_PREP_NOWAIT 0x00000001
167#define NOUVEAU_GEM_CPU_PREP_NOBLOCK 0x00000002
168#define NOUVEAU_GEM_CPU_PREP_WRITE 0x00000004 173#define NOUVEAU_GEM_CPU_PREP_WRITE 0x00000004
169struct drm_nouveau_gem_cpu_prep { 174struct drm_nouveau_gem_cpu_prep {
170 uint32_t handle; 175 uint32_t handle;
diff --git a/include/drm/radeon_drm.h b/include/drm/radeon_drm.h
index 10f8b53bdd40..787f7b6fd622 100644
--- a/include/drm/radeon_drm.h
+++ b/include/drm/radeon_drm.h
@@ -641,7 +641,7 @@ typedef struct drm_radeon_vertex2 {
641} drm_radeon_vertex2_t; 641} drm_radeon_vertex2_t;
642 642
643/* v1.3 - obsoletes drm_radeon_vertex2 643/* v1.3 - obsoletes drm_radeon_vertex2
644 * - allows arbitarily large cliprect list 644 * - allows arbitrarily large cliprect list
645 * - allows updating of tcl packet, vector and scalar state 645 * - allows updating of tcl packet, vector and scalar state
646 * - allows memory-efficient description of state updates 646 * - allows memory-efficient description of state updates
647 * - allows state to be emitted without a primitive 647 * - allows state to be emitted without a primitive
@@ -906,6 +906,11 @@ struct drm_radeon_cs {
906#define RADEON_INFO_ACCEL_WORKING2 0x05 906#define RADEON_INFO_ACCEL_WORKING2 0x05
907#define RADEON_INFO_TILING_CONFIG 0x06 907#define RADEON_INFO_TILING_CONFIG 0x06
908#define RADEON_INFO_WANT_HYPERZ 0x07 908#define RADEON_INFO_WANT_HYPERZ 0x07
909#define RADEON_INFO_WANT_CMASK 0x08 /* get access to CMASK on r300 */
910#define RADEON_INFO_CLOCK_CRYSTAL_FREQ 0x09 /* clock crystal frequency */
911#define RADEON_INFO_NUM_BACKENDS 0x0a /* DB/backends for r600+ - need for OQ */
912#define RADEON_INFO_NUM_TILE_PIPES 0x0b /* tile pipes for r600+ */
913#define RADEON_INFO_FUSION_GART_WORKING 0x0c /* fusion writes to GTT were broken before this */
909 914
910struct drm_radeon_info { 915struct drm_radeon_info {
911 uint32_t request; 916 uint32_t request;
diff --git a/include/drm/savage_drm.h b/include/drm/savage_drm.h
index 4863cf6bf96f..818d49be2e6e 100644
--- a/include/drm/savage_drm.h
+++ b/include/drm/savage_drm.h
@@ -29,7 +29,7 @@
29#ifndef __SAVAGE_SAREA_DEFINES__ 29#ifndef __SAVAGE_SAREA_DEFINES__
30#define __SAVAGE_SAREA_DEFINES__ 30#define __SAVAGE_SAREA_DEFINES__
31 31
32/* 2 heaps (1 for card, 1 for agp), each divided into upto 128 32/* 2 heaps (1 for card, 1 for agp), each divided into up to 128
33 * regions, subject to a minimum region size of (1<<16) == 64k. 33 * regions, subject to a minimum region size of (1<<16) == 64k.
34 * 34 *
35 * Clients may subdivide regions internally, but when sharing between 35 * Clients may subdivide regions internally, but when sharing between
diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h
index 2040e6c4f172..62a0e4c4ceee 100644
--- a/include/drm/ttm/ttm_bo_api.h
+++ b/include/drm/ttm/ttm_bo_api.h
@@ -50,10 +50,10 @@ struct drm_mm_node;
50 * 50 *
51 * @fpfn: first valid page frame number to put the object 51 * @fpfn: first valid page frame number to put the object
52 * @lpfn: last valid page frame number to put the object 52 * @lpfn: last valid page frame number to put the object
53 * @num_placement: number of prefered placements 53 * @num_placement: number of preferred placements
54 * @placement: prefered placements 54 * @placement: preferred placements
55 * @num_busy_placement: number of prefered placements when need to evict buffer 55 * @num_busy_placement: number of preferred placements when need to evict buffer
56 * @busy_placement: prefered placements when need to evict buffer 56 * @busy_placement: preferred placements when need to evict buffer
57 * 57 *
58 * Structure indicating the placement you request for an object. 58 * Structure indicating the placement you request for an object.
59 */ 59 */
@@ -74,6 +74,8 @@ struct ttm_placement {
74 * @is_iomem: is this io memory ? 74 * @is_iomem: is this io memory ?
75 * @size: size in byte 75 * @size: size in byte
76 * @offset: offset from the base address 76 * @offset: offset from the base address
77 * @io_reserved_vm: The VM system has a refcount in @io_reserved_count
78 * @io_reserved_count: Refcounting the numbers of callers to ttm_mem_io_reserve
77 * 79 *
78 * Structure indicating the bus placement of an object. 80 * Structure indicating the bus placement of an object.
79 */ 81 */
@@ -83,7 +85,8 @@ struct ttm_bus_placement {
83 unsigned long size; 85 unsigned long size;
84 unsigned long offset; 86 unsigned long offset;
85 bool is_iomem; 87 bool is_iomem;
86 bool io_reserved; 88 bool io_reserved_vm;
89 uint64_t io_reserved_count;
87}; 90};
88 91
89 92
@@ -102,7 +105,8 @@ struct ttm_bus_placement {
102 */ 105 */
103 106
104struct ttm_mem_reg { 107struct ttm_mem_reg {
105 struct drm_mm_node *mm_node; 108 void *mm_node;
109 unsigned long start;
106 unsigned long size; 110 unsigned long size;
107 unsigned long num_pages; 111 unsigned long num_pages;
108 uint32_t page_alignment; 112 uint32_t page_alignment;
@@ -153,11 +157,10 @@ struct ttm_tt;
153 * keeps one refcount. When this refcount reaches zero, 157 * keeps one refcount. When this refcount reaches zero,
154 * the object is destroyed. 158 * the object is destroyed.
155 * @event_queue: Queue for processes waiting on buffer object status change. 159 * @event_queue: Queue for processes waiting on buffer object status change.
156 * @lock: spinlock protecting mostly synchronization members.
157 * @mem: structure describing current placement. 160 * @mem: structure describing current placement.
158 * @persistant_swap_storage: Usually the swap storage is deleted for buffers 161 * @persistent_swap_storage: Usually the swap storage is deleted for buffers
159 * pinned in physical memory. If this behaviour is not desired, this member 162 * pinned in physical memory. If this behaviour is not desired, this member
160 * holds a pointer to a persistant shmem object. 163 * holds a pointer to a persistent shmem object.
161 * @ttm: TTM structure holding system pages. 164 * @ttm: TTM structure holding system pages.
162 * @evicted: Whether the object was evicted without user-space knowing. 165 * @evicted: Whether the object was evicted without user-space knowing.
163 * @cpu_writes: For synchronization. Number of cpu writers. 166 * @cpu_writes: For synchronization. Number of cpu writers.
@@ -212,14 +215,13 @@ struct ttm_buffer_object {
212 struct kref kref; 215 struct kref kref;
213 struct kref list_kref; 216 struct kref list_kref;
214 wait_queue_head_t event_queue; 217 wait_queue_head_t event_queue;
215 spinlock_t lock;
216 218
217 /** 219 /**
218 * Members protected by the bo::reserved lock. 220 * Members protected by the bo::reserved lock.
219 */ 221 */
220 222
221 struct ttm_mem_reg mem; 223 struct ttm_mem_reg mem;
222 struct file *persistant_swap_storage; 224 struct file *persistent_swap_storage;
223 struct ttm_tt *ttm; 225 struct ttm_tt *ttm;
224 bool evicted; 226 bool evicted;
225 227
@@ -236,6 +238,7 @@ struct ttm_buffer_object {
236 struct list_head lru; 238 struct list_head lru;
237 struct list_head ddestroy; 239 struct list_head ddestroy;
238 struct list_head swap; 240 struct list_head swap;
241 struct list_head io_reserve_lru;
239 uint32_t val_seq; 242 uint32_t val_seq;
240 bool seq_valid; 243 bool seq_valid;
241 244
@@ -247,10 +250,10 @@ struct ttm_buffer_object {
247 atomic_t reserved; 250 atomic_t reserved;
248 251
249 /** 252 /**
250 * Members protected by the bo::lock 253 * Members protected by struct buffer_object_device::fence_lock
251 * In addition, setting sync_obj to anything else 254 * In addition, setting sync_obj to anything else
252 * than NULL requires bo::reserved to be held. This allows for 255 * than NULL requires bo::reserved to be held. This allows for
253 * checking NULL while reserved but not holding bo::lock. 256 * checking NULL while reserved but not holding the mentioned lock.
254 */ 257 */
255 258
256 void *sync_obj_arg; 259 void *sync_obj_arg;
@@ -363,6 +366,44 @@ extern int ttm_bo_validate(struct ttm_buffer_object *bo,
363 */ 366 */
364extern void ttm_bo_unref(struct ttm_buffer_object **bo); 367extern void ttm_bo_unref(struct ttm_buffer_object **bo);
365 368
369
370/**
371 * ttm_bo_list_ref_sub
372 *
373 * @bo: The buffer object.
374 * @count: The number of references with which to decrease @bo::list_kref;
375 * @never_free: The refcount should not reach zero with this operation.
376 *
377 * Release @count lru list references to this buffer object.
378 */
379extern void ttm_bo_list_ref_sub(struct ttm_buffer_object *bo, int count,
380 bool never_free);
381
382/**
383 * ttm_bo_add_to_lru
384 *
385 * @bo: The buffer object.
386 *
387 * Add this bo to the relevant mem type lru and, if it's backed by
388 * system pages (ttms) to the swap list.
389 * This function must be called with struct ttm_bo_global::lru_lock held, and
390 * is typically called immediately prior to unreserving a bo.
391 */
392extern void ttm_bo_add_to_lru(struct ttm_buffer_object *bo);
393
394/**
395 * ttm_bo_del_from_lru
396 *
397 * @bo: The buffer object.
398 *
399 * Remove this bo from all lru lists used to lookup and reserve an object.
400 * This function must be called with struct ttm_bo_global::lru_lock held,
401 * and is usually called just immediately after the bo has been reserved to
402 * avoid recursive reservation from lru lists.
403 */
404extern int ttm_bo_del_from_lru(struct ttm_buffer_object *bo);
405
406
366/** 407/**
367 * ttm_bo_lock_delayed_workqueue 408 * ttm_bo_lock_delayed_workqueue
368 * 409 *
@@ -418,9 +459,9 @@ extern void ttm_bo_synccpu_write_release(struct ttm_buffer_object *bo);
418 * user buffer object. 459 * user buffer object.
419 * @interruptible: If needing to sleep to wait for GPU resources, 460 * @interruptible: If needing to sleep to wait for GPU resources,
420 * sleep interruptible. 461 * sleep interruptible.
421 * @persistant_swap_storage: Usually the swap storage is deleted for buffers 462 * @persistent_swap_storage: Usually the swap storage is deleted for buffers
422 * pinned in physical memory. If this behaviour is not desired, this member 463 * pinned in physical memory. If this behaviour is not desired, this member
423 * holds a pointer to a persistant shmem object. Typically, this would 464 * holds a pointer to a persistent shmem object. Typically, this would
424 * point to the shmem object backing a GEM object if TTM is used to back a 465 * point to the shmem object backing a GEM object if TTM is used to back a
425 * GEM user interface. 466 * GEM user interface.
426 * @acc_size: Accounted size for this object. 467 * @acc_size: Accounted size for this object.
@@ -431,6 +472,10 @@ extern void ttm_bo_synccpu_write_release(struct ttm_buffer_object *bo);
431 * together with the @destroy function, 472 * together with the @destroy function,
432 * enables driver-specific objects derived from a ttm_buffer_object. 473 * enables driver-specific objects derived from a ttm_buffer_object.
433 * On successful return, the object kref and list_kref are set to 1. 474 * On successful return, the object kref and list_kref are set to 1.
475 * If a failure occurs, the function will call the @destroy function, or
476 * kfree() if @destroy is NULL. Thus, after a failure, dereferencing @bo is
477 * illegal and will likely cause memory corruption.
478 *
434 * Returns 479 * Returns
435 * -ENOMEM: Out of memory. 480 * -ENOMEM: Out of memory.
436 * -EINVAL: Invalid placement flags. 481 * -EINVAL: Invalid placement flags.
@@ -445,7 +490,7 @@ extern int ttm_bo_init(struct ttm_bo_device *bdev,
445 uint32_t page_alignment, 490 uint32_t page_alignment,
446 unsigned long buffer_start, 491 unsigned long buffer_start,
447 bool interrubtible, 492 bool interrubtible,
448 struct file *persistant_swap_storage, 493 struct file *persistent_swap_storage,
449 size_t acc_size, 494 size_t acc_size,
450 void (*destroy) (struct ttm_buffer_object *)); 495 void (*destroy) (struct ttm_buffer_object *));
451/** 496/**
@@ -461,9 +506,9 @@ extern int ttm_bo_init(struct ttm_bo_device *bdev,
461 * user buffer object. 506 * user buffer object.
462 * @interruptible: If needing to sleep while waiting for GPU resources, 507 * @interruptible: If needing to sleep while waiting for GPU resources,
463 * sleep interruptible. 508 * sleep interruptible.
464 * @persistant_swap_storage: Usually the swap storage is deleted for buffers 509 * @persistent_swap_storage: Usually the swap storage is deleted for buffers
465 * pinned in physical memory. If this behaviour is not desired, this member 510 * pinned in physical memory. If this behaviour is not desired, this member
466 * holds a pointer to a persistant shmem object. Typically, this would 511 * holds a pointer to a persistent shmem object. Typically, this would
467 * point to the shmem object backing a GEM object if TTM is used to back a 512 * point to the shmem object backing a GEM object if TTM is used to back a
468 * GEM user interface. 513 * GEM user interface.
469 * @p_bo: On successful completion *p_bo points to the created object. 514 * @p_bo: On successful completion *p_bo points to the created object.
@@ -483,7 +528,7 @@ extern int ttm_bo_create(struct ttm_bo_device *bdev,
483 uint32_t page_alignment, 528 uint32_t page_alignment,
484 unsigned long buffer_start, 529 unsigned long buffer_start,
485 bool interruptible, 530 bool interruptible,
486 struct file *persistant_swap_storage, 531 struct file *persistent_swap_storage,
487 struct ttm_buffer_object **p_bo); 532 struct ttm_buffer_object **p_bo);
488 533
489/** 534/**
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
index b87504235f18..09af2d746d1c 100644
--- a/include/drm/ttm/ttm_bo_driver.h
+++ b/include/drm/ttm/ttm_bo_driver.h
@@ -50,13 +50,15 @@ struct ttm_backend_func {
50 * @pages: Array of pointers to ttm pages. 50 * @pages: Array of pointers to ttm pages.
51 * @dummy_read_page: Page to be used instead of NULL pages in the 51 * @dummy_read_page: Page to be used instead of NULL pages in the
52 * array @pages. 52 * array @pages.
53 * @dma_addrs: Array of DMA (bus) address of the ttm pages.
53 * 54 *
54 * Populate the backend with ttm pages. Depending on the backend, 55 * Populate the backend with ttm pages. Depending on the backend,
55 * it may or may not copy the @pages array. 56 * it may or may not copy the @pages array.
56 */ 57 */
57 int (*populate) (struct ttm_backend *backend, 58 int (*populate) (struct ttm_backend *backend,
58 unsigned long num_pages, struct page **pages, 59 unsigned long num_pages, struct page **pages,
59 struct page *dummy_read_page); 60 struct page *dummy_read_page,
61 dma_addr_t *dma_addrs);
60 /** 62 /**
61 * struct ttm_backend_func member clear 63 * struct ttm_backend_func member clear
62 * 64 *
@@ -120,7 +122,7 @@ struct ttm_backend {
120#define TTM_PAGE_FLAG_USER_DIRTY (1 << 2) 122#define TTM_PAGE_FLAG_USER_DIRTY (1 << 2)
121#define TTM_PAGE_FLAG_WRITE (1 << 3) 123#define TTM_PAGE_FLAG_WRITE (1 << 3)
122#define TTM_PAGE_FLAG_SWAPPED (1 << 4) 124#define TTM_PAGE_FLAG_SWAPPED (1 << 4)
123#define TTM_PAGE_FLAG_PERSISTANT_SWAP (1 << 5) 125#define TTM_PAGE_FLAG_PERSISTENT_SWAP (1 << 5)
124#define TTM_PAGE_FLAG_ZERO_ALLOC (1 << 6) 126#define TTM_PAGE_FLAG_ZERO_ALLOC (1 << 6)
125#define TTM_PAGE_FLAG_DMA32 (1 << 7) 127#define TTM_PAGE_FLAG_DMA32 (1 << 7)
126 128
@@ -149,6 +151,7 @@ enum ttm_caching_state {
149 * @swap_storage: Pointer to shmem struct file for swap storage. 151 * @swap_storage: Pointer to shmem struct file for swap storage.
150 * @caching_state: The current caching state of the pages. 152 * @caching_state: The current caching state of the pages.
151 * @state: The current binding state of the pages. 153 * @state: The current binding state of the pages.
154 * @dma_address: The DMA (bus) addresses of the pages (if TTM_PAGE_FLAG_DMA32)
152 * 155 *
153 * This is a structure holding the pages, caching- and aperture binding 156 * This is a structure holding the pages, caching- and aperture binding
154 * status for a buffer object that isn't backed by fixed (VRAM / AGP) 157 * status for a buffer object that isn't backed by fixed (VRAM / AGP)
@@ -173,12 +176,97 @@ struct ttm_tt {
173 tt_unbound, 176 tt_unbound,
174 tt_unpopulated, 177 tt_unpopulated,
175 } state; 178 } state;
179 dma_addr_t *dma_address;
176}; 180};
177 181
178#define TTM_MEMTYPE_FLAG_FIXED (1 << 0) /* Fixed (on-card) PCI memory */ 182#define TTM_MEMTYPE_FLAG_FIXED (1 << 0) /* Fixed (on-card) PCI memory */
179#define TTM_MEMTYPE_FLAG_MAPPABLE (1 << 1) /* Memory mappable */ 183#define TTM_MEMTYPE_FLAG_MAPPABLE (1 << 1) /* Memory mappable */
180#define TTM_MEMTYPE_FLAG_CMA (1 << 3) /* Can't map aperture */ 184#define TTM_MEMTYPE_FLAG_CMA (1 << 3) /* Can't map aperture */
181 185
186struct ttm_mem_type_manager;
187
188struct ttm_mem_type_manager_func {
189 /**
190 * struct ttm_mem_type_manager member init
191 *
192 * @man: Pointer to a memory type manager.
193 * @p_size: Implementation dependent, but typically the size of the
194 * range to be managed in pages.
195 *
196 * Called to initialize a private range manager. The function is
197 * expected to initialize the man::priv member.
198 * Returns 0 on success, negative error code on failure.
199 */
200 int (*init)(struct ttm_mem_type_manager *man, unsigned long p_size);
201
202 /**
203 * struct ttm_mem_type_manager member takedown
204 *
205 * @man: Pointer to a memory type manager.
206 *
207 * Called to undo the setup done in init. All allocated resources
208 * should be freed.
209 */
210 int (*takedown)(struct ttm_mem_type_manager *man);
211
212 /**
213 * struct ttm_mem_type_manager member get_node
214 *
215 * @man: Pointer to a memory type manager.
216 * @bo: Pointer to the buffer object we're allocating space for.
217 * @placement: Placement details.
218 * @mem: Pointer to a struct ttm_mem_reg to be filled in.
219 *
220 * This function should allocate space in the memory type managed
221 * by @man. Placement details if
222 * applicable are given by @placement. If successful,
223 * @mem::mm_node should be set to a non-null value, and
224 * @mem::start should be set to a value identifying the beginning
225 * of the range allocated, and the function should return zero.
226 * If the memory region accommodate the buffer object, @mem::mm_node
227 * should be set to NULL, and the function should return 0.
228 * If a system error occurred, preventing the request to be fulfilled,
229 * the function should return a negative error code.
230 *
231 * Note that @mem::mm_node will only be dereferenced by
232 * struct ttm_mem_type_manager functions and optionally by the driver,
233 * which has knowledge of the underlying type.
234 *
235 * This function may not be called from within atomic context, so
236 * an implementation can and must use either a mutex or a spinlock to
237 * protect any data structures managing the space.
238 */
239 int (*get_node)(struct ttm_mem_type_manager *man,
240 struct ttm_buffer_object *bo,
241 struct ttm_placement *placement,
242 struct ttm_mem_reg *mem);
243
244 /**
245 * struct ttm_mem_type_manager member put_node
246 *
247 * @man: Pointer to a memory type manager.
248 * @mem: Pointer to a struct ttm_mem_reg to be filled in.
249 *
250 * This function frees memory type resources previously allocated
251 * and that are identified by @mem::mm_node and @mem::start. May not
252 * be called from within atomic context.
253 */
254 void (*put_node)(struct ttm_mem_type_manager *man,
255 struct ttm_mem_reg *mem);
256
257 /**
258 * struct ttm_mem_type_manager member debug
259 *
260 * @man: Pointer to a memory type manager.
261 * @prefix: Prefix to be used in printout to identify the caller.
262 *
263 * This function is called to print out the state of the memory
264 * type manager to aid debugging of out-of-memory conditions.
265 * It may not be called from within atomic context.
266 */
267 void (*debug)(struct ttm_mem_type_manager *man, const char *prefix);
268};
269
182/** 270/**
183 * struct ttm_mem_type_manager 271 * struct ttm_mem_type_manager
184 * 272 *
@@ -193,17 +281,24 @@ struct ttm_tt {
193 * as defined in ttm_placement_common.h 281 * as defined in ttm_placement_common.h
194 * @default_caching: The default caching policy used for a buffer object 282 * @default_caching: The default caching policy used for a buffer object
195 * placed in this memory type if the user doesn't provide one. 283 * placed in this memory type if the user doesn't provide one.
196 * @manager: The range manager used for this memory type. FIXME: If the aperture 284 * @func: structure pointer implementing the range manager. See above
197 * has a page size different from the underlying system, the granularity 285 * @priv: Driver private closure for @func.
198 * of this manager should take care of this. But the range allocating code 286 * @io_reserve_mutex: Mutex optionally protecting shared io_reserve structures
199 * in ttm_bo.c needs to be modified for this. 287 * @use_io_reserve_lru: Use an lru list to try to unreserve io_mem_regions
288 * reserved by the TTM vm system.
289 * @io_reserve_lru: Optional lru list for unreserving io mem regions.
290 * @io_reserve_fastpath: Only use bdev::driver::io_mem_reserve to obtain
291 * static information. bdev::driver::io_mem_free is never used.
200 * @lru: The lru list for this memory type. 292 * @lru: The lru list for this memory type.
201 * 293 *
202 * This structure is used to identify and manage memory types for a device. 294 * This structure is used to identify and manage memory types for a device.
203 * It's set up by the ttm_bo_driver::init_mem_type method. 295 * It's set up by the ttm_bo_driver::init_mem_type method.
204 */ 296 */
205 297
298
299
206struct ttm_mem_type_manager { 300struct ttm_mem_type_manager {
301 struct ttm_bo_device *bdev;
207 302
208 /* 303 /*
209 * No protection. Constant from start. 304 * No protection. Constant from start.
@@ -216,14 +311,22 @@ struct ttm_mem_type_manager {
216 uint64_t size; 311 uint64_t size;
217 uint32_t available_caching; 312 uint32_t available_caching;
218 uint32_t default_caching; 313 uint32_t default_caching;
314 const struct ttm_mem_type_manager_func *func;
315 void *priv;
316 struct mutex io_reserve_mutex;
317 bool use_io_reserve_lru;
318 bool io_reserve_fastpath;
319
320 /*
321 * Protected by @io_reserve_mutex:
322 */
323
324 struct list_head io_reserve_lru;
219 325
220 /* 326 /*
221 * Protected by the bdev->lru_lock. 327 * Protected by the global->lru_lock.
222 * TODO: Consider one lru_lock per ttm_mem_type_manager.
223 * Plays ill with list removal, though.
224 */ 328 */
225 329
226 struct drm_mm manager;
227 struct list_head lru; 330 struct list_head lru;
228}; 331};
229 332
@@ -426,9 +529,12 @@ struct ttm_bo_global {
426 * 529 *
427 * @driver: Pointer to a struct ttm_bo_driver struct setup by the driver. 530 * @driver: Pointer to a struct ttm_bo_driver struct setup by the driver.
428 * @man: An array of mem_type_managers. 531 * @man: An array of mem_type_managers.
532 * @fence_lock: Protects the synchronizing members on *all* bos belonging
533 * to this device.
429 * @addr_space_mm: Range manager for the device address space. 534 * @addr_space_mm: Range manager for the device address space.
430 * lru_lock: Spinlock that protects the buffer+device lru lists and 535 * lru_lock: Spinlock that protects the buffer+device lru lists and
431 * ddestroy lists. 536 * ddestroy lists.
537 * @val_seq: Current validation sequence.
432 * @nice_mode: Try nicely to wait for buffer idle when cleaning a manager. 538 * @nice_mode: Try nicely to wait for buffer idle when cleaning a manager.
433 * If a GPU lockup has been detected, this is forced to 0. 539 * If a GPU lockup has been detected, this is forced to 0.
434 * @dev_mapping: A pointer to the struct address_space representing the 540 * @dev_mapping: A pointer to the struct address_space representing the
@@ -447,6 +553,7 @@ struct ttm_bo_device {
447 struct ttm_bo_driver *driver; 553 struct ttm_bo_driver *driver;
448 rwlock_t vm_lock; 554 rwlock_t vm_lock;
449 struct ttm_mem_type_manager man[TTM_NUM_MEM_TYPES]; 555 struct ttm_mem_type_manager man[TTM_NUM_MEM_TYPES];
556 spinlock_t fence_lock;
450 /* 557 /*
451 * Protected by the vm lock. 558 * Protected by the vm lock.
452 */ 559 */
@@ -457,6 +564,7 @@ struct ttm_bo_device {
457 * Protected by the global:lru lock. 564 * Protected by the global:lru lock.
458 */ 565 */
459 struct list_head ddestroy; 566 struct list_head ddestroy;
567 uint32_t val_seq;
460 568
461 /* 569 /*
462 * Protected by load / firstopen / lastclose /unload sync. 570 * Protected by load / firstopen / lastclose /unload sync.
@@ -606,7 +714,7 @@ extern void ttm_tt_cache_flush(struct page *pages[], unsigned long num_pages);
606 */ 714 */
607extern int ttm_tt_set_placement_caching(struct ttm_tt *ttm, uint32_t placement); 715extern int ttm_tt_set_placement_caching(struct ttm_tt *ttm, uint32_t placement);
608extern int ttm_tt_swapout(struct ttm_tt *ttm, 716extern int ttm_tt_swapout(struct ttm_tt *ttm,
609 struct file *persistant_swap_storage); 717 struct file *persistent_swap_storage);
610 718
611/* 719/*
612 * ttm_bo.c 720 * ttm_bo.c
@@ -649,6 +757,12 @@ extern int ttm_bo_mem_space(struct ttm_buffer_object *bo,
649 struct ttm_mem_reg *mem, 757 struct ttm_mem_reg *mem,
650 bool interruptible, 758 bool interruptible,
651 bool no_wait_reserve, bool no_wait_gpu); 759 bool no_wait_reserve, bool no_wait_gpu);
760
761extern void ttm_bo_mem_put(struct ttm_buffer_object *bo,
762 struct ttm_mem_reg *mem);
763extern void ttm_bo_mem_put_locked(struct ttm_buffer_object *bo,
764 struct ttm_mem_reg *mem);
765
652/** 766/**
653 * ttm_bo_wait_for_cpu 767 * ttm_bo_wait_for_cpu
654 * 768 *
@@ -663,31 +777,6 @@ extern int ttm_bo_mem_space(struct ttm_buffer_object *bo,
663 777
664extern int ttm_bo_wait_cpu(struct ttm_buffer_object *bo, bool no_wait); 778extern int ttm_bo_wait_cpu(struct ttm_buffer_object *bo, bool no_wait);
665 779
666/**
667 * ttm_bo_pci_offset - Get the PCI offset for the buffer object memory.
668 *
669 * @bo Pointer to a struct ttm_buffer_object.
670 * @bus_base On return the base of the PCI region
671 * @bus_offset On return the byte offset into the PCI region
672 * @bus_size On return the byte size of the buffer object or zero if
673 * the buffer object memory is not accessible through a PCI region.
674 *
675 * Returns:
676 * -EINVAL if the buffer object is currently not mappable.
677 * 0 otherwise.
678 */
679
680extern int ttm_bo_pci_offset(struct ttm_bo_device *bdev,
681 struct ttm_mem_reg *mem,
682 unsigned long *bus_base,
683 unsigned long *bus_offset,
684 unsigned long *bus_size);
685
686extern int ttm_mem_io_reserve(struct ttm_bo_device *bdev,
687 struct ttm_mem_reg *mem);
688extern void ttm_mem_io_free(struct ttm_bo_device *bdev,
689 struct ttm_mem_reg *mem);
690
691extern void ttm_bo_global_release(struct drm_global_reference *ref); 780extern void ttm_bo_global_release(struct drm_global_reference *ref);
692extern int ttm_bo_global_init(struct drm_global_reference *ref); 781extern int ttm_bo_global_init(struct drm_global_reference *ref);
693 782
@@ -720,6 +809,22 @@ extern int ttm_bo_device_init(struct ttm_bo_device *bdev,
720extern void ttm_bo_unmap_virtual(struct ttm_buffer_object *bo); 809extern void ttm_bo_unmap_virtual(struct ttm_buffer_object *bo);
721 810
722/** 811/**
812 * ttm_bo_unmap_virtual
813 *
814 * @bo: tear down the virtual mappings for this BO
815 *
816 * The caller must take ttm_mem_io_lock before calling this function.
817 */
818extern void ttm_bo_unmap_virtual_locked(struct ttm_buffer_object *bo);
819
820extern int ttm_mem_io_reserve_vm(struct ttm_buffer_object *bo);
821extern void ttm_mem_io_free_vm(struct ttm_buffer_object *bo);
822extern int ttm_mem_io_lock(struct ttm_mem_type_manager *man,
823 bool interruptible);
824extern void ttm_mem_io_unlock(struct ttm_mem_type_manager *man);
825
826
827/**
723 * ttm_bo_reserve: 828 * ttm_bo_reserve:
724 * 829 *
725 * @bo: A pointer to a struct ttm_buffer_object. 830 * @bo: A pointer to a struct ttm_buffer_object.
@@ -736,7 +841,7 @@ extern void ttm_bo_unmap_virtual(struct ttm_buffer_object *bo);
736 * different order, either by will or as a result of a buffer being evicted 841 * different order, either by will or as a result of a buffer being evicted
737 * to make room for a buffer already reserved. (Buffers are reserved before 842 * to make room for a buffer already reserved. (Buffers are reserved before
738 * they are evicted). The following algorithm prevents such deadlocks from 843 * they are evicted). The following algorithm prevents such deadlocks from
739 * occuring: 844 * occurring:
740 * 1) Buffers are reserved with the lru spinlock held. Upon successful 845 * 1) Buffers are reserved with the lru spinlock held. Upon successful
741 * reservation they are removed from the lru list. This stops a reserved buffer 846 * reservation they are removed from the lru list. This stops a reserved buffer
742 * from being evicted. However the lru spinlock is released between the time 847 * from being evicted. However the lru spinlock is released between the time
@@ -769,11 +874,44 @@ extern void ttm_bo_unmap_virtual(struct ttm_buffer_object *bo);
769 * try again. (only if use_sequence == 1). 874 * try again. (only if use_sequence == 1).
770 * -ERESTARTSYS: A wait for the buffer to become unreserved was interrupted by 875 * -ERESTARTSYS: A wait for the buffer to become unreserved was interrupted by
771 * a signal. Release all buffer reservations and return to user-space. 876 * a signal. Release all buffer reservations and return to user-space.
877 * -EBUSY: The function needed to sleep, but @no_wait was true
878 * -EDEADLK: Bo already reserved using @sequence. This error code will only
879 * be returned if @use_sequence is set to true.
772 */ 880 */
773extern int ttm_bo_reserve(struct ttm_buffer_object *bo, 881extern int ttm_bo_reserve(struct ttm_buffer_object *bo,
774 bool interruptible, 882 bool interruptible,
775 bool no_wait, bool use_sequence, uint32_t sequence); 883 bool no_wait, bool use_sequence, uint32_t sequence);
776 884
885
886/**
887 * ttm_bo_reserve_locked:
888 *
889 * @bo: A pointer to a struct ttm_buffer_object.
890 * @interruptible: Sleep interruptible if waiting.
891 * @no_wait: Don't sleep while trying to reserve, rather return -EBUSY.
892 * @use_sequence: If @bo is already reserved, Only sleep waiting for
893 * it to become unreserved if @sequence < (@bo)->sequence.
894 *
895 * Must be called with struct ttm_bo_global::lru_lock held,
896 * and will not remove reserved buffers from the lru lists.
897 * The function may release the LRU spinlock if it needs to sleep.
898 * Otherwise identical to ttm_bo_reserve.
899 *
900 * Returns:
901 * -EAGAIN: The reservation may cause a deadlock.
902 * Release all buffer reservations, wait for @bo to become unreserved and
903 * try again. (only if use_sequence == 1).
904 * -ERESTARTSYS: A wait for the buffer to become unreserved was interrupted by
905 * a signal. Release all buffer reservations and return to user-space.
906 * -EBUSY: The function needed to sleep, but @no_wait was true
907 * -EDEADLK: Bo already reserved using @sequence. This error code will only
908 * be returned if @use_sequence is set to true.
909 */
910extern int ttm_bo_reserve_locked(struct ttm_buffer_object *bo,
911 bool interruptible,
912 bool no_wait, bool use_sequence,
913 uint32_t sequence);
914
777/** 915/**
778 * ttm_bo_unreserve 916 * ttm_bo_unreserve
779 * 917 *
@@ -784,6 +922,16 @@ extern int ttm_bo_reserve(struct ttm_buffer_object *bo,
784extern void ttm_bo_unreserve(struct ttm_buffer_object *bo); 922extern void ttm_bo_unreserve(struct ttm_buffer_object *bo);
785 923
786/** 924/**
925 * ttm_bo_unreserve_locked
926 *
927 * @bo: A pointer to a struct ttm_buffer_object.
928 *
929 * Unreserve a previous reservation of @bo.
930 * Needs to be called with struct ttm_bo_global::lru_lock held.
931 */
932extern void ttm_bo_unreserve_locked(struct ttm_buffer_object *bo);
933
934/**
787 * ttm_bo_wait_unreserved 935 * ttm_bo_wait_unreserved
788 * 936 *
789 * @bo: A pointer to a struct ttm_buffer_object. 937 * @bo: A pointer to a struct ttm_buffer_object.
@@ -891,6 +1039,8 @@ extern int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo,
891 */ 1039 */
892extern pgprot_t ttm_io_prot(uint32_t caching_flags, pgprot_t tmp); 1040extern pgprot_t ttm_io_prot(uint32_t caching_flags, pgprot_t tmp);
893 1041
1042extern const struct ttm_mem_type_manager_func ttm_bo_manager_func;
1043
894#if (defined(CONFIG_AGP) || (defined(CONFIG_AGP_MODULE) && defined(MODULE))) 1044#if (defined(CONFIG_AGP) || (defined(CONFIG_AGP_MODULE) && defined(MODULE)))
895#define TTM_HAS_AGP 1045#define TTM_HAS_AGP
896#include <linux/agp_backend.h> 1046#include <linux/agp_backend.h>
diff --git a/include/drm/ttm/ttm_execbuf_util.h b/include/drm/ttm/ttm_execbuf_util.h
index cd2c475da9ea..26cc7f9ffa41 100644
--- a/include/drm/ttm/ttm_execbuf_util.h
+++ b/include/drm/ttm/ttm_execbuf_util.h
@@ -41,7 +41,10 @@
41 * @bo: refcounted buffer object pointer. 41 * @bo: refcounted buffer object pointer.
42 * @new_sync_obj_arg: New sync_obj_arg for @bo, to be used once 42 * @new_sync_obj_arg: New sync_obj_arg for @bo, to be used once
43 * adding a new sync object. 43 * adding a new sync object.
44 * @reservied: Indicates whether @bo has been reserved for validation. 44 * @reserved: Indicates whether @bo has been reserved for validation.
45 * @removed: Indicates whether @bo has been removed from lru lists.
46 * @put_count: Number of outstanding references on bo::list_kref.
47 * @old_sync_obj: Pointer to a sync object about to be unreferenced
45 */ 48 */
46 49
47struct ttm_validate_buffer { 50struct ttm_validate_buffer {
@@ -49,6 +52,9 @@ struct ttm_validate_buffer {
49 struct ttm_buffer_object *bo; 52 struct ttm_buffer_object *bo;
50 void *new_sync_obj_arg; 53 void *new_sync_obj_arg;
51 bool reserved; 54 bool reserved;
55 bool removed;
56 int put_count;
57 void *old_sync_obj;
52}; 58};
53 59
54/** 60/**
@@ -66,7 +72,6 @@ extern void ttm_eu_backoff_reservation(struct list_head *list);
66 * function ttm_eu_reserve_buffers 72 * function ttm_eu_reserve_buffers
67 * 73 *
68 * @list: thread private list of ttm_validate_buffer structs. 74 * @list: thread private list of ttm_validate_buffer structs.
69 * @val_seq: A unique sequence number.
70 * 75 *
71 * Tries to reserve bos pointed to by the list entries for validation. 76 * Tries to reserve bos pointed to by the list entries for validation.
72 * If the function returns 0, all buffers are marked as "unfenced", 77 * If the function returns 0, all buffers are marked as "unfenced",
@@ -88,7 +93,7 @@ extern void ttm_eu_backoff_reservation(struct list_head *list);
88 * has failed. 93 * has failed.
89 */ 94 */
90 95
91extern int ttm_eu_reserve_buffers(struct list_head *list, uint32_t val_seq); 96extern int ttm_eu_reserve_buffers(struct list_head *list);
92 97
93/** 98/**
94 * function ttm_eu_fence_buffer_objects. 99 * function ttm_eu_fence_buffer_objects.
diff --git a/include/drm/ttm/ttm_page_alloc.h b/include/drm/ttm/ttm_page_alloc.h
index 116821448c38..8062890f725e 100644
--- a/include/drm/ttm/ttm_page_alloc.h
+++ b/include/drm/ttm/ttm_page_alloc.h
@@ -36,11 +36,13 @@
36 * @flags: ttm flags for page allocation. 36 * @flags: ttm flags for page allocation.
37 * @cstate: ttm caching state for the page. 37 * @cstate: ttm caching state for the page.
38 * @count: number of pages to allocate. 38 * @count: number of pages to allocate.
39 * @dma_address: The DMA (bus) address of pages (if TTM_PAGE_FLAG_DMA32 set).
39 */ 40 */
40int ttm_get_pages(struct list_head *pages, 41int ttm_get_pages(struct list_head *pages,
41 int flags, 42 int flags,
42 enum ttm_caching_state cstate, 43 enum ttm_caching_state cstate,
43 unsigned count); 44 unsigned count,
45 dma_addr_t *dma_address);
44/** 46/**
45 * Put linked list of pages to pool. 47 * Put linked list of pages to pool.
46 * 48 *
@@ -49,11 +51,13 @@ int ttm_get_pages(struct list_head *pages,
49 * count. 51 * count.
50 * @flags: ttm flags for page allocation. 52 * @flags: ttm flags for page allocation.
51 * @cstate: ttm caching state. 53 * @cstate: ttm caching state.
54 * @dma_address: The DMA (bus) address of pages (if TTM_PAGE_FLAG_DMA32 set).
52 */ 55 */
53void ttm_put_pages(struct list_head *pages, 56void ttm_put_pages(struct list_head *pages,
54 unsigned page_count, 57 unsigned page_count,
55 int flags, 58 int flags,
56 enum ttm_caching_state cstate); 59 enum ttm_caching_state cstate,
60 dma_addr_t *dma_address);
57/** 61/**
58 * Initialize pool allocator. 62 * Initialize pool allocator.
59 */ 63 */
diff --git a/include/drm/vmwgfx_drm.h b/include/drm/vmwgfx_drm.h
index 4d0842391edc..5c36432d9ce5 100644
--- a/include/drm/vmwgfx_drm.h
+++ b/include/drm/vmwgfx_drm.h
@@ -72,6 +72,7 @@
72#define DRM_VMW_PARAM_FIFO_OFFSET 3 72#define DRM_VMW_PARAM_FIFO_OFFSET 3
73#define DRM_VMW_PARAM_HW_CAPS 4 73#define DRM_VMW_PARAM_HW_CAPS 4
74#define DRM_VMW_PARAM_FIFO_CAPS 5 74#define DRM_VMW_PARAM_FIFO_CAPS 5
75#define DRM_VMW_PARAM_MAX_FB_SIZE 6
75 76
76/** 77/**
77 * struct drm_vmw_getparam_arg 78 * struct drm_vmw_getparam_arg
@@ -591,7 +592,7 @@ struct drm_vmw_stream_arg {
591/** 592/**
592 * DRM_VMW_UPDATE_LAYOUT - Update layout 593 * DRM_VMW_UPDATE_LAYOUT - Update layout
593 * 594 *
594 * Updates the prefered modes and connection status for connectors. The 595 * Updates the preferred modes and connection status for connectors. The
595 * command conisits of one drm_vmw_update_layout_arg pointing out a array 596 * command conisits of one drm_vmw_update_layout_arg pointing out a array
596 * of num_outputs drm_vmw_rect's. 597 * of num_outputs drm_vmw_rect's.
597 */ 598 */