diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/drm/drmP.h | 102 | ||||
-rw-r--r-- | include/drm/drm_crtc.h | 9 | ||||
-rw-r--r-- | include/drm/drm_fb_helper.h | 3 | ||||
-rw-r--r-- | include/drm/drm_mm.h | 7 | ||||
-rw-r--r-- | include/drm/drm_pciids.h | 40 | ||||
-rw-r--r-- | include/drm/i915_drm.h | 12 | ||||
-rw-r--r-- | include/drm/intel-gtt.h | 35 | ||||
-rw-r--r-- | include/drm/nouveau_drm.h | 5 | ||||
-rw-r--r-- | include/drm/radeon_drm.h | 1 | ||||
-rw-r--r-- | include/drm/ttm/ttm_bo_api.h | 50 | ||||
-rw-r--r-- | include/drm/ttm/ttm_bo_driver.h | 152 | ||||
-rw-r--r-- | include/drm/ttm/ttm_execbuf_util.h | 11 | ||||
-rw-r--r-- | include/linux/agp_backend.h | 2 | ||||
-rw-r--r-- | include/linux/intel-gtt.h | 20 | ||||
-rw-r--r-- | include/linux/kref.h | 2 | ||||
-rw-r--r-- | include/linux/vga_switcheroo.h | 2 |
16 files changed, 357 insertions, 96 deletions
diff --git a/include/drm/drmP.h b/include/drm/drmP.h index 274eaaa15c36..a4694c610330 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h | |||
@@ -683,6 +683,21 @@ struct drm_master { | |||
683 | void *driver_priv; /**< Private structure for driver to use */ | 683 | void *driver_priv; /**< Private structure for driver to use */ |
684 | }; | 684 | }; |
685 | 685 | ||
686 | /* Size of ringbuffer for vblank timestamps. Just double-buffer | ||
687 | * in initial implementation. | ||
688 | */ | ||
689 | #define DRM_VBLANKTIME_RBSIZE 2 | ||
690 | |||
691 | /* Flags and return codes for get_vblank_timestamp() driver function. */ | ||
692 | #define DRM_CALLED_FROM_VBLIRQ 1 | ||
693 | #define DRM_VBLANKTIME_SCANOUTPOS_METHOD (1 << 0) | ||
694 | #define DRM_VBLANKTIME_INVBL (1 << 1) | ||
695 | |||
696 | /* get_scanout_position() return flags */ | ||
697 | #define DRM_SCANOUTPOS_VALID (1 << 0) | ||
698 | #define DRM_SCANOUTPOS_INVBL (1 << 1) | ||
699 | #define DRM_SCANOUTPOS_ACCURATE (1 << 2) | ||
700 | |||
686 | /** | 701 | /** |
687 | * DRM driver structure. This structure represent the common code for | 702 | * DRM driver structure. This structure represent the common code for |
688 | * a family of cards. There will one drm_device for each card present | 703 | * a family of cards. There will one drm_device for each card present |
@@ -760,6 +775,68 @@ struct drm_driver { | |||
760 | */ | 775 | */ |
761 | int (*device_is_agp) (struct drm_device *dev); | 776 | int (*device_is_agp) (struct drm_device *dev); |
762 | 777 | ||
778 | /** | ||
779 | * Called by vblank timestamping code. | ||
780 | * | ||
781 | * Return the current display scanout position from a crtc. | ||
782 | * | ||
783 | * \param dev DRM device. | ||
784 | * \param crtc Id of the crtc to query. | ||
785 | * \param *vpos Target location for current vertical scanout position. | ||
786 | * \param *hpos Target location for current horizontal scanout position. | ||
787 | * | ||
788 | * Returns vpos as a positive number while in active scanout area. | ||
789 | * Returns vpos as a negative number inside vblank, counting the number | ||
790 | * of scanlines to go until end of vblank, e.g., -1 means "one scanline | ||
791 | * until start of active scanout / end of vblank." | ||
792 | * | ||
793 | * \return Flags, or'ed together as follows: | ||
794 | * | ||
795 | * DRM_SCANOUTPOS_VALID = Query successfull. | ||
796 | * DRM_SCANOUTPOS_INVBL = Inside vblank. | ||
797 | * DRM_SCANOUTPOS_ACCURATE = Returned position is accurate. A lack of | ||
798 | * this flag means that returned position may be offset by a constant | ||
799 | * but unknown small number of scanlines wrt. real scanout position. | ||
800 | * | ||
801 | */ | ||
802 | int (*get_scanout_position) (struct drm_device *dev, int crtc, | ||
803 | int *vpos, int *hpos); | ||
804 | |||
805 | /** | ||
806 | * Called by \c drm_get_last_vbltimestamp. Should return a precise | ||
807 | * timestamp when the most recent VBLANK interval ended or will end. | ||
808 | * | ||
809 | * Specifically, the timestamp in @vblank_time should correspond as | ||
810 | * closely as possible to the time when the first video scanline of | ||
811 | * the video frame after the end of VBLANK will start scanning out, | ||
812 | * the time immmediately after end of the VBLANK interval. If the | ||
813 | * @crtc is currently inside VBLANK, this will be a time in the future. | ||
814 | * If the @crtc is currently scanning out a frame, this will be the | ||
815 | * past start time of the current scanout. This is meant to adhere | ||
816 | * to the OpenML OML_sync_control extension specification. | ||
817 | * | ||
818 | * \param dev dev DRM device handle. | ||
819 | * \param crtc crtc for which timestamp should be returned. | ||
820 | * \param *max_error Maximum allowable timestamp error in nanoseconds. | ||
821 | * Implementation should strive to provide timestamp | ||
822 | * with an error of at most *max_error nanoseconds. | ||
823 | * Returns true upper bound on error for timestamp. | ||
824 | * \param *vblank_time Target location for returned vblank timestamp. | ||
825 | * \param flags 0 = Defaults, no special treatment needed. | ||
826 | * \param DRM_CALLED_FROM_VBLIRQ = Function is called from vblank | ||
827 | * irq handler. Some drivers need to apply some workarounds | ||
828 | * for gpu-specific vblank irq quirks if flag is set. | ||
829 | * | ||
830 | * \returns | ||
831 | * Zero if timestamping isn't supported in current display mode or a | ||
832 | * negative number on failure. A positive status code on success, | ||
833 | * which describes how the vblank_time timestamp was computed. | ||
834 | */ | ||
835 | int (*get_vblank_timestamp) (struct drm_device *dev, int crtc, | ||
836 | int *max_error, | ||
837 | struct timeval *vblank_time, | ||
838 | unsigned flags); | ||
839 | |||
763 | /* these have to be filled in */ | 840 | /* these have to be filled in */ |
764 | 841 | ||
765 | irqreturn_t(*irq_handler) (DRM_IRQ_ARGS); | 842 | irqreturn_t(*irq_handler) (DRM_IRQ_ARGS); |
@@ -983,6 +1060,8 @@ struct drm_device { | |||
983 | 1060 | ||
984 | wait_queue_head_t *vbl_queue; /**< VBLANK wait queue */ | 1061 | wait_queue_head_t *vbl_queue; /**< VBLANK wait queue */ |
985 | atomic_t *_vblank_count; /**< number of VBLANK interrupts (driver must alloc the right number of counters) */ | 1062 | atomic_t *_vblank_count; /**< number of VBLANK interrupts (driver must alloc the right number of counters) */ |
1063 | struct timeval *_vblank_time; /**< timestamp of current vblank_count (drivers must alloc right number of fields) */ | ||
1064 | spinlock_t vblank_time_lock; /**< Protects vblank count and time updates during vblank enable/disable */ | ||
986 | spinlock_t vbl_lock; | 1065 | spinlock_t vbl_lock; |
987 | atomic_t *vblank_refcount; /* number of users of vblank interruptsper crtc */ | 1066 | atomic_t *vblank_refcount; /* number of users of vblank interruptsper crtc */ |
988 | u32 *last_vblank; /* protected by dev->vbl_lock, used */ | 1067 | u32 *last_vblank; /* protected by dev->vbl_lock, used */ |
@@ -1041,12 +1120,14 @@ struct drm_device { | |||
1041 | /*@{ */ | 1120 | /*@{ */ |
1042 | spinlock_t object_name_lock; | 1121 | spinlock_t object_name_lock; |
1043 | struct idr object_name_idr; | 1122 | struct idr object_name_idr; |
1044 | uint32_t invalidate_domains; /* domains pending invalidation */ | ||
1045 | uint32_t flush_domains; /* domains pending flush */ | ||
1046 | /*@} */ | 1123 | /*@} */ |
1047 | 1124 | int switch_power_state; | |
1048 | }; | 1125 | }; |
1049 | 1126 | ||
1127 | #define DRM_SWITCH_POWER_ON 0 | ||
1128 | #define DRM_SWITCH_POWER_OFF 1 | ||
1129 | #define DRM_SWITCH_POWER_CHANGING 2 | ||
1130 | |||
1050 | static __inline__ int drm_core_check_feature(struct drm_device *dev, | 1131 | static __inline__ int drm_core_check_feature(struct drm_device *dev, |
1051 | int feature) | 1132 | int feature) |
1052 | { | 1133 | { |
@@ -1284,11 +1365,22 @@ extern int drm_wait_vblank(struct drm_device *dev, void *data, | |||
1284 | struct drm_file *filp); | 1365 | struct drm_file *filp); |
1285 | extern int drm_vblank_wait(struct drm_device *dev, unsigned int *vbl_seq); | 1366 | extern int drm_vblank_wait(struct drm_device *dev, unsigned int *vbl_seq); |
1286 | extern u32 drm_vblank_count(struct drm_device *dev, int crtc); | 1367 | extern u32 drm_vblank_count(struct drm_device *dev, int crtc); |
1368 | extern u32 drm_vblank_count_and_time(struct drm_device *dev, int crtc, | ||
1369 | struct timeval *vblanktime); | ||
1287 | extern void drm_handle_vblank(struct drm_device *dev, int crtc); | 1370 | extern void drm_handle_vblank(struct drm_device *dev, int crtc); |
1288 | extern int drm_vblank_get(struct drm_device *dev, int crtc); | 1371 | extern int drm_vblank_get(struct drm_device *dev, int crtc); |
1289 | extern void drm_vblank_put(struct drm_device *dev, int crtc); | 1372 | extern void drm_vblank_put(struct drm_device *dev, int crtc); |
1290 | extern void drm_vblank_off(struct drm_device *dev, int crtc); | 1373 | extern void drm_vblank_off(struct drm_device *dev, int crtc); |
1291 | extern void drm_vblank_cleanup(struct drm_device *dev); | 1374 | extern void drm_vblank_cleanup(struct drm_device *dev); |
1375 | extern u32 drm_get_last_vbltimestamp(struct drm_device *dev, int crtc, | ||
1376 | struct timeval *tvblank, unsigned flags); | ||
1377 | extern int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev, | ||
1378 | int crtc, int *max_error, | ||
1379 | struct timeval *vblank_time, | ||
1380 | unsigned flags, | ||
1381 | struct drm_crtc *refcrtc); | ||
1382 | extern void drm_calc_timestamping_constants(struct drm_crtc *crtc); | ||
1383 | |||
1292 | /* Modesetting support */ | 1384 | /* Modesetting support */ |
1293 | extern void drm_vblank_pre_modeset(struct drm_device *dev, int crtc); | 1385 | extern void drm_vblank_pre_modeset(struct drm_device *dev, int crtc); |
1294 | extern void drm_vblank_post_modeset(struct drm_device *dev, int crtc); | 1386 | extern void drm_vblank_post_modeset(struct drm_device *dev, int crtc); |
@@ -1321,7 +1413,6 @@ extern int drm_agp_unbind_ioctl(struct drm_device *dev, void *data, | |||
1321 | extern int drm_agp_bind(struct drm_device *dev, struct drm_agp_binding *request); | 1413 | extern int drm_agp_bind(struct drm_device *dev, struct drm_agp_binding *request); |
1322 | extern int drm_agp_bind_ioctl(struct drm_device *dev, void *data, | 1414 | extern int drm_agp_bind_ioctl(struct drm_device *dev, void *data, |
1323 | struct drm_file *file_priv); | 1415 | struct drm_file *file_priv); |
1324 | extern void drm_agp_chipset_flush(struct drm_device *dev); | ||
1325 | 1416 | ||
1326 | /* Stub support (drm_stub.h) */ | 1417 | /* Stub support (drm_stub.h) */ |
1327 | extern int drm_setmaster_ioctl(struct drm_device *dev, void *data, | 1418 | extern int drm_setmaster_ioctl(struct drm_device *dev, void *data, |
@@ -1340,6 +1431,9 @@ extern void drm_put_dev(struct drm_device *dev); | |||
1340 | extern int drm_put_minor(struct drm_minor **minor); | 1431 | extern int drm_put_minor(struct drm_minor **minor); |
1341 | extern unsigned int drm_debug; | 1432 | extern unsigned int drm_debug; |
1342 | 1433 | ||
1434 | extern unsigned int drm_vblank_offdelay; | ||
1435 | extern unsigned int drm_timestamp_precision; | ||
1436 | |||
1343 | extern struct class *drm_class; | 1437 | extern struct class *drm_class; |
1344 | extern struct proc_dir_entry *drm_proc_root; | 1438 | extern struct proc_dir_entry *drm_proc_root; |
1345 | extern struct dentry *drm_debugfs_root; | 1439 | extern struct dentry *drm_debugfs_root; |
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index 029aa688e787..acd7fade160d 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h | |||
@@ -351,8 +351,14 @@ struct drm_crtc { | |||
351 | 351 | ||
352 | bool enabled; | 352 | bool enabled; |
353 | 353 | ||
354 | /* Requested mode from modesetting. */ | ||
354 | struct drm_display_mode mode; | 355 | struct drm_display_mode mode; |
355 | 356 | ||
357 | /* Programmed mode in hw, after adjustments for encoders, | ||
358 | * crtc, panel scaling etc. Needed for timestamping etc. | ||
359 | */ | ||
360 | struct drm_display_mode hwmode; | ||
361 | |||
356 | int x, y; | 362 | int x, y; |
357 | const struct drm_crtc_funcs *funcs; | 363 | const struct drm_crtc_funcs *funcs; |
358 | 364 | ||
@@ -360,6 +366,9 @@ struct drm_crtc { | |||
360 | uint32_t gamma_size; | 366 | uint32_t gamma_size; |
361 | uint16_t *gamma_store; | 367 | uint16_t *gamma_store; |
362 | 368 | ||
369 | /* Constants needed for precise vblank and swap timestamping. */ | ||
370 | s64 framedur_ns, linedur_ns, pixeldur_ns; | ||
371 | |||
363 | /* if you are using the helper */ | 372 | /* if you are using the helper */ |
364 | void *helper_private; | 373 | void *helper_private; |
365 | }; | 374 | }; |
diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h index f22e7fe4b6db..aac27bd56e89 100644 --- a/include/drm/drm_fb_helper.h +++ b/include/drm/drm_fb_helper.h | |||
@@ -121,9 +121,6 @@ int drm_fb_helper_setcolreg(unsigned regno, | |||
121 | void drm_fb_helper_restore(void); | 121 | void drm_fb_helper_restore(void); |
122 | void drm_fb_helper_fill_var(struct fb_info *info, struct drm_fb_helper *fb_helper, | 122 | void drm_fb_helper_fill_var(struct fb_info *info, struct drm_fb_helper *fb_helper, |
123 | uint32_t fb_width, uint32_t fb_height); | 123 | uint32_t fb_width, uint32_t fb_height); |
124 | void drm_fb_helper_fill_fix(struct fb_info *info, uint32_t pitch, | ||
125 | uint32_t depth); | ||
126 | |||
127 | int drm_fb_helper_setcmap(struct fb_cmap *cmap, struct fb_info *info); | 124 | int drm_fb_helper_setcmap(struct fb_cmap *cmap, struct fb_info *info); |
128 | 125 | ||
129 | bool drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper); | 126 | bool drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper); |
diff --git a/include/drm/drm_mm.h b/include/drm/drm_mm.h index bf01531193d5..e39177778601 100644 --- a/include/drm/drm_mm.h +++ b/include/drm/drm_mm.h | |||
@@ -62,11 +62,14 @@ struct drm_mm { | |||
62 | struct list_head unused_nodes; | 62 | struct list_head unused_nodes; |
63 | int num_unused; | 63 | int num_unused; |
64 | spinlock_t unused_lock; | 64 | spinlock_t unused_lock; |
65 | unsigned int scan_check_range : 1; | ||
65 | unsigned scan_alignment; | 66 | unsigned scan_alignment; |
66 | unsigned long scan_size; | 67 | unsigned long scan_size; |
67 | unsigned long scan_hit_start; | 68 | unsigned long scan_hit_start; |
68 | unsigned scan_hit_size; | 69 | unsigned scan_hit_size; |
69 | unsigned scanned_blocks; | 70 | unsigned scanned_blocks; |
71 | unsigned long scan_start; | ||
72 | unsigned long scan_end; | ||
70 | }; | 73 | }; |
71 | 74 | ||
72 | /* | 75 | /* |
@@ -145,6 +148,10 @@ static inline struct drm_mm *drm_get_mm(struct drm_mm_node *block) | |||
145 | 148 | ||
146 | void drm_mm_init_scan(struct drm_mm *mm, unsigned long size, | 149 | void drm_mm_init_scan(struct drm_mm *mm, unsigned long size, |
147 | unsigned alignment); | 150 | unsigned alignment); |
151 | void drm_mm_init_scan_with_range(struct drm_mm *mm, unsigned long size, | ||
152 | unsigned alignment, | ||
153 | unsigned long start, | ||
154 | unsigned long end); | ||
148 | int drm_mm_scan_add_block(struct drm_mm_node *node); | 155 | int drm_mm_scan_add_block(struct drm_mm_node *node); |
149 | int drm_mm_scan_remove_block(struct drm_mm_node *node); | 156 | int drm_mm_scan_remove_block(struct drm_mm_node *node); |
150 | 157 | ||
diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h index 883c1d439899..fe29ae328bd9 100644 --- a/include/drm/drm_pciids.h +++ b/include/drm/drm_pciids.h | |||
@@ -142,6 +142,42 @@ | |||
142 | {0x1002, 0x5e4c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_NEW_MEMMAP}, \ | 142 | {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}, \ | 143 | {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}, \ | 144 | {0x1002, 0x5e4f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_NEW_MEMMAP}, \ |
145 | {0x1002, 0x6720, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BARTS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | ||
146 | {0x1002, 0x6721, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BARTS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | ||
147 | {0x1002, 0x6722, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BARTS|RADEON_NEW_MEMMAP}, \ | ||
148 | {0x1002, 0x6723, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BARTS|RADEON_NEW_MEMMAP}, \ | ||
149 | {0x1002, 0x6724, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BARTS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | ||
150 | {0x1002, 0x6725, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BARTS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | ||
151 | {0x1002, 0x6726, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BARTS|RADEON_NEW_MEMMAP}, \ | ||
152 | {0x1002, 0x6727, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BARTS|RADEON_NEW_MEMMAP}, \ | ||
153 | {0x1002, 0x6728, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BARTS|RADEON_NEW_MEMMAP}, \ | ||
154 | {0x1002, 0x6729, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BARTS|RADEON_NEW_MEMMAP}, \ | ||
155 | {0x1002, 0x6738, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BARTS|RADEON_NEW_MEMMAP}, \ | ||
156 | {0x1002, 0x6739, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BARTS|RADEON_NEW_MEMMAP}, \ | ||
157 | {0x1002, 0x6740, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | ||
158 | {0x1002, 0x6741, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | ||
159 | {0x1002, 0x6742, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | ||
160 | {0x1002, 0x6743, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | ||
161 | {0x1002, 0x6744, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | ||
162 | {0x1002, 0x6745, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | ||
163 | {0x1002, 0x6746, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \ | ||
164 | {0x1002, 0x6747, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \ | ||
165 | {0x1002, 0x6748, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \ | ||
166 | {0x1002, 0x6749, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \ | ||
167 | {0x1002, 0x6750, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \ | ||
168 | {0x1002, 0x6758, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \ | ||
169 | {0x1002, 0x6759, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \ | ||
170 | {0x1002, 0x6760, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | ||
171 | {0x1002, 0x6761, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | ||
172 | {0x1002, 0x6762, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \ | ||
173 | {0x1002, 0x6763, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \ | ||
174 | {0x1002, 0x6764, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | ||
175 | {0x1002, 0x6765, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | ||
176 | {0x1002, 0x6766, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \ | ||
177 | {0x1002, 0x6767, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \ | ||
178 | {0x1002, 0x6768, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \ | ||
179 | {0x1002, 0x6770, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \ | ||
180 | {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}, \ | 181 | {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}, \ | 182 | {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}, \ | 183 | {0x1002, 0x6889, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \ |
@@ -419,6 +455,10 @@ | |||
419 | {0x1002, 0x9713, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS880|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | 455 | {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}, \ | 456 | {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}, \ | 457 | {0x1002, 0x9715, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS880|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
458 | {0x1002, 0x9802, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
459 | {0x1002, 0x9803, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
460 | {0x1002, 0x9804, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
461 | {0x1002, 0x9805, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
422 | {0, 0, 0} | 462 | {0, 0, 0} |
423 | 463 | ||
424 | #define r128_PCI_IDS \ | 464 | #define r128_PCI_IDS \ |
diff --git a/include/drm/i915_drm.h b/include/drm/i915_drm.h index a2776e2807a4..0039f1f97ad8 100644 --- a/include/drm/i915_drm.h +++ b/include/drm/i915_drm.h | |||
@@ -289,6 +289,7 @@ typedef struct drm_i915_irq_wait { | |||
289 | #define I915_PARAM_HAS_BLT 11 | 289 | #define I915_PARAM_HAS_BLT 11 |
290 | #define I915_PARAM_HAS_RELAXED_FENCING 12 | 290 | #define I915_PARAM_HAS_RELAXED_FENCING 12 |
291 | #define I915_PARAM_HAS_COHERENT_RINGS 13 | 291 | #define I915_PARAM_HAS_COHERENT_RINGS 13 |
292 | #define I915_PARAM_HAS_EXEC_CONSTANTS 14 | ||
292 | 293 | ||
293 | typedef struct drm_i915_getparam { | 294 | typedef struct drm_i915_getparam { |
294 | int param; | 295 | int param; |
@@ -635,6 +636,17 @@ struct drm_i915_gem_execbuffer2 { | |||
635 | #define I915_EXEC_RENDER (1<<0) | 636 | #define I915_EXEC_RENDER (1<<0) |
636 | #define I915_EXEC_BSD (2<<0) | 637 | #define I915_EXEC_BSD (2<<0) |
637 | #define I915_EXEC_BLT (3<<0) | 638 | #define I915_EXEC_BLT (3<<0) |
639 | |||
640 | /* Used for switching the constants addressing mode on gen4+ RENDER ring. | ||
641 | * Gen6+ only supports relative addressing to dynamic state (default) and | ||
642 | * absolute addressing. | ||
643 | * | ||
644 | * These flags are ignored for the BSD and BLT rings. | ||
645 | */ | ||
646 | #define I915_EXEC_CONSTANTS_MASK (3<<6) | ||
647 | #define I915_EXEC_CONSTANTS_REL_GENERAL (0<<6) /* default */ | ||
648 | #define I915_EXEC_CONSTANTS_ABSOLUTE (1<<6) | ||
649 | #define I915_EXEC_CONSTANTS_REL_SURFACE (2<<6) /* gen4/5 only */ | ||
638 | __u64 flags; | 650 | __u64 flags; |
639 | __u64 rsvd1; | 651 | __u64 rsvd1; |
640 | __u64 rsvd2; | 652 | __u64 rsvd2; |
diff --git a/include/drm/intel-gtt.h b/include/drm/intel-gtt.h index d3c81946f613..9e343c0998b4 100644 --- a/include/drm/intel-gtt.h +++ b/include/drm/intel-gtt.h | |||
@@ -2,17 +2,40 @@ | |||
2 | 2 | ||
3 | #ifndef _DRM_INTEL_GTT_H | 3 | #ifndef _DRM_INTEL_GTT_H |
4 | #define _DRM_INTEL_GTT_H | 4 | #define _DRM_INTEL_GTT_H |
5 | struct intel_gtt { | 5 | |
6 | /* Number of stolen gtt entries at the beginning. */ | 6 | const struct intel_gtt { |
7 | unsigned int gtt_stolen_entries; | 7 | /* Size of memory reserved for graphics by the BIOS */ |
8 | unsigned int stolen_size; | ||
8 | /* Total number of gtt entries. */ | 9 | /* Total number of gtt entries. */ |
9 | unsigned int gtt_total_entries; | 10 | unsigned int gtt_total_entries; |
10 | /* Part of the gtt that is mappable by the cpu, for those chips where | 11 | /* Part of the gtt that is mappable by the cpu, for those chips where |
11 | * this is not the full gtt. */ | 12 | * this is not the full gtt. */ |
12 | unsigned int gtt_mappable_entries; | 13 | unsigned int gtt_mappable_entries; |
13 | }; | 14 | /* Whether i915 needs to use the dmar apis or not. */ |
15 | unsigned int needs_dmar : 1; | ||
16 | } *intel_gtt_get(void); | ||
14 | 17 | ||
15 | struct intel_gtt *intel_gtt_get(void); | 18 | void intel_gtt_chipset_flush(void); |
19 | void intel_gtt_unmap_memory(struct scatterlist *sg_list, int num_sg); | ||
20 | void intel_gtt_clear_range(unsigned int first_entry, unsigned int num_entries); | ||
21 | int intel_gtt_map_memory(struct page **pages, unsigned int num_entries, | ||
22 | struct scatterlist **sg_list, int *num_sg); | ||
23 | void intel_gtt_insert_sg_entries(struct scatterlist *sg_list, | ||
24 | unsigned int sg_len, | ||
25 | unsigned int pg_start, | ||
26 | unsigned int flags); | ||
27 | void intel_gtt_insert_pages(unsigned int first_entry, unsigned int num_entries, | ||
28 | struct page **pages, unsigned int flags); | ||
16 | 29 | ||
17 | #endif | 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) | ||
18 | 37 | ||
38 | /* flag for GFDT type */ | ||
39 | #define AGP_USER_CACHED_MEMORY_GFDT (1 << 3) | ||
40 | |||
41 | #endif | ||
diff --git a/include/drm/nouveau_drm.h b/include/drm/nouveau_drm.h index bc5590b1a1ac..e2cfe80f6fca 100644 --- a/include/drm/nouveau_drm.h +++ b/include/drm/nouveau_drm.h | |||
@@ -71,16 +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 |
83 | #define NOUVEAU_GETPARAM_HAS_BO_USAGE 15 | 80 | #define NOUVEAU_GETPARAM_HAS_BO_USAGE 15 |
81 | #define NOUVEAU_GETPARAM_HAS_PAGEFLIP 16 | ||
84 | struct drm_nouveau_getparam { | 82 | struct drm_nouveau_getparam { |
85 | uint64_t param; | 83 | uint64_t param; |
86 | uint64_t value; | 84 | uint64_t value; |
@@ -171,7 +169,6 @@ struct drm_nouveau_gem_pushbuf { | |||
171 | }; | 169 | }; |
172 | 170 | ||
173 | #define NOUVEAU_GEM_CPU_PREP_NOWAIT 0x00000001 | 171 | #define NOUVEAU_GEM_CPU_PREP_NOWAIT 0x00000001 |
174 | #define NOUVEAU_GEM_CPU_PREP_NOBLOCK 0x00000002 | ||
175 | #define NOUVEAU_GEM_CPU_PREP_WRITE 0x00000004 | 172 | #define NOUVEAU_GEM_CPU_PREP_WRITE 0x00000004 |
176 | struct drm_nouveau_gem_cpu_prep { | 173 | struct drm_nouveau_gem_cpu_prep { |
177 | uint32_t handle; | 174 | uint32_t handle; |
diff --git a/include/drm/radeon_drm.h b/include/drm/radeon_drm.h index 10f8b53bdd40..e95a86b8b689 100644 --- a/include/drm/radeon_drm.h +++ b/include/drm/radeon_drm.h | |||
@@ -906,6 +906,7 @@ 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 */ | ||
909 | 910 | ||
910 | struct drm_radeon_info { | 911 | struct drm_radeon_info { |
911 | uint32_t request; | 912 | uint32_t request; |
diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h index beafc156a535..50852aad260a 100644 --- a/include/drm/ttm/ttm_bo_api.h +++ b/include/drm/ttm/ttm_bo_api.h | |||
@@ -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 | ||
@@ -154,7 +157,6 @@ struct ttm_tt; | |||
154 | * keeps one refcount. When this refcount reaches zero, | 157 | * keeps one refcount. When this refcount reaches zero, |
155 | * the object is destroyed. | 158 | * the object is destroyed. |
156 | * @event_queue: Queue for processes waiting on buffer object status change. | 159 | * @event_queue: Queue for processes waiting on buffer object status change. |
157 | * @lock: spinlock protecting mostly synchronization members. | ||
158 | * @mem: structure describing current placement. | 160 | * @mem: structure describing current placement. |
159 | * @persistant_swap_storage: Usually the swap storage is deleted for buffers | 161 | * @persistant_swap_storage: Usually the swap storage is deleted for buffers |
160 | * 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 |
@@ -213,7 +215,6 @@ struct ttm_buffer_object { | |||
213 | struct kref kref; | 215 | struct kref kref; |
214 | struct kref list_kref; | 216 | struct kref list_kref; |
215 | wait_queue_head_t event_queue; | 217 | wait_queue_head_t event_queue; |
216 | spinlock_t lock; | ||
217 | 218 | ||
218 | /** | 219 | /** |
219 | * Members protected by the bo::reserved lock. | 220 | * Members protected by the bo::reserved lock. |
@@ -237,6 +238,7 @@ struct ttm_buffer_object { | |||
237 | struct list_head lru; | 238 | struct list_head lru; |
238 | struct list_head ddestroy; | 239 | struct list_head ddestroy; |
239 | struct list_head swap; | 240 | struct list_head swap; |
241 | struct list_head io_reserve_lru; | ||
240 | uint32_t val_seq; | 242 | uint32_t val_seq; |
241 | bool seq_valid; | 243 | bool seq_valid; |
242 | 244 | ||
@@ -248,10 +250,10 @@ struct ttm_buffer_object { | |||
248 | atomic_t reserved; | 250 | atomic_t reserved; |
249 | 251 | ||
250 | /** | 252 | /** |
251 | * Members protected by the bo::lock | 253 | * Members protected by struct buffer_object_device::fence_lock |
252 | * In addition, setting sync_obj to anything else | 254 | * In addition, setting sync_obj to anything else |
253 | * than NULL requires bo::reserved to be held. This allows for | 255 | * than NULL requires bo::reserved to be held. This allows for |
254 | * checking NULL while reserved but not holding bo::lock. | 256 | * checking NULL while reserved but not holding the mentioned lock. |
255 | */ | 257 | */ |
256 | 258 | ||
257 | void *sync_obj_arg; | 259 | void *sync_obj_arg; |
@@ -364,6 +366,44 @@ extern int ttm_bo_validate(struct ttm_buffer_object *bo, | |||
364 | */ | 366 | */ |
365 | extern void ttm_bo_unref(struct ttm_buffer_object **bo); | 367 | extern void ttm_bo_unref(struct ttm_buffer_object **bo); |
366 | 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 | */ | ||
379 | extern 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 | */ | ||
392 | extern 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 | */ | ||
404 | extern int ttm_bo_del_from_lru(struct ttm_buffer_object *bo); | ||
405 | |||
406 | |||
367 | /** | 407 | /** |
368 | * ttm_bo_lock_delayed_workqueue | 408 | * ttm_bo_lock_delayed_workqueue |
369 | * | 409 | * |
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h index 8e0c848326b6..1da8af6ac884 100644 --- a/include/drm/ttm/ttm_bo_driver.h +++ b/include/drm/ttm/ttm_bo_driver.h | |||
@@ -179,30 +179,6 @@ struct ttm_tt { | |||
179 | #define TTM_MEMTYPE_FLAG_MAPPABLE (1 << 1) /* Memory mappable */ | 179 | #define TTM_MEMTYPE_FLAG_MAPPABLE (1 << 1) /* Memory mappable */ |
180 | #define TTM_MEMTYPE_FLAG_CMA (1 << 3) /* Can't map aperture */ | 180 | #define TTM_MEMTYPE_FLAG_CMA (1 << 3) /* Can't map aperture */ |
181 | 181 | ||
182 | /** | ||
183 | * struct ttm_mem_type_manager | ||
184 | * | ||
185 | * @has_type: The memory type has been initialized. | ||
186 | * @use_type: The memory type is enabled. | ||
187 | * @flags: TTM_MEMTYPE_XX flags identifying the traits of the memory | ||
188 | * managed by this memory type. | ||
189 | * @gpu_offset: If used, the GPU offset of the first managed page of | ||
190 | * fixed memory or the first managed location in an aperture. | ||
191 | * @size: Size of the managed region. | ||
192 | * @available_caching: A mask of available caching types, TTM_PL_FLAG_XX, | ||
193 | * as defined in ttm_placement_common.h | ||
194 | * @default_caching: The default caching policy used for a buffer object | ||
195 | * 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 | ||
197 | * has a page size different from the underlying system, the granularity | ||
198 | * of this manager should take care of this. But the range allocating code | ||
199 | * in ttm_bo.c needs to be modified for this. | ||
200 | * @lru: The lru list for this memory type. | ||
201 | * | ||
202 | * 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. | ||
204 | */ | ||
205 | |||
206 | struct ttm_mem_type_manager; | 182 | struct ttm_mem_type_manager; |
207 | 183 | ||
208 | struct ttm_mem_type_manager_func { | 184 | struct ttm_mem_type_manager_func { |
@@ -287,6 +263,36 @@ struct ttm_mem_type_manager_func { | |||
287 | void (*debug)(struct ttm_mem_type_manager *man, const char *prefix); | 263 | void (*debug)(struct ttm_mem_type_manager *man, const char *prefix); |
288 | }; | 264 | }; |
289 | 265 | ||
266 | /** | ||
267 | * struct ttm_mem_type_manager | ||
268 | * | ||
269 | * @has_type: The memory type has been initialized. | ||
270 | * @use_type: The memory type is enabled. | ||
271 | * @flags: TTM_MEMTYPE_XX flags identifying the traits of the memory | ||
272 | * managed by this memory type. | ||
273 | * @gpu_offset: If used, the GPU offset of the first managed page of | ||
274 | * fixed memory or the first managed location in an aperture. | ||
275 | * @size: Size of the managed region. | ||
276 | * @available_caching: A mask of available caching types, TTM_PL_FLAG_XX, | ||
277 | * as defined in ttm_placement_common.h | ||
278 | * @default_caching: The default caching policy used for a buffer object | ||
279 | * placed in this memory type if the user doesn't provide one. | ||
280 | * @func: structure pointer implementing the range manager. See above | ||
281 | * @priv: Driver private closure for @func. | ||
282 | * @io_reserve_mutex: Mutex optionally protecting shared io_reserve structures | ||
283 | * @use_io_reserve_lru: Use an lru list to try to unreserve io_mem_regions | ||
284 | * reserved by the TTM vm system. | ||
285 | * @io_reserve_lru: Optional lru list for unreserving io mem regions. | ||
286 | * @io_reserve_fastpath: Only use bdev::driver::io_mem_reserve to obtain | ||
287 | * static information. bdev::driver::io_mem_free is never used. | ||
288 | * @lru: The lru list for this memory type. | ||
289 | * | ||
290 | * This structure is used to identify and manage memory types for a device. | ||
291 | * It's set up by the ttm_bo_driver::init_mem_type method. | ||
292 | */ | ||
293 | |||
294 | |||
295 | |||
290 | struct ttm_mem_type_manager { | 296 | struct ttm_mem_type_manager { |
291 | struct ttm_bo_device *bdev; | 297 | struct ttm_bo_device *bdev; |
292 | 298 | ||
@@ -303,6 +309,15 @@ struct ttm_mem_type_manager { | |||
303 | uint32_t default_caching; | 309 | uint32_t default_caching; |
304 | const struct ttm_mem_type_manager_func *func; | 310 | const struct ttm_mem_type_manager_func *func; |
305 | void *priv; | 311 | void *priv; |
312 | struct mutex io_reserve_mutex; | ||
313 | bool use_io_reserve_lru; | ||
314 | bool io_reserve_fastpath; | ||
315 | |||
316 | /* | ||
317 | * Protected by @io_reserve_mutex: | ||
318 | */ | ||
319 | |||
320 | struct list_head io_reserve_lru; | ||
306 | 321 | ||
307 | /* | 322 | /* |
308 | * Protected by the global->lru_lock. | 323 | * Protected by the global->lru_lock. |
@@ -510,9 +525,12 @@ struct ttm_bo_global { | |||
510 | * | 525 | * |
511 | * @driver: Pointer to a struct ttm_bo_driver struct setup by the driver. | 526 | * @driver: Pointer to a struct ttm_bo_driver struct setup by the driver. |
512 | * @man: An array of mem_type_managers. | 527 | * @man: An array of mem_type_managers. |
528 | * @fence_lock: Protects the synchronizing members on *all* bos belonging | ||
529 | * to this device. | ||
513 | * @addr_space_mm: Range manager for the device address space. | 530 | * @addr_space_mm: Range manager for the device address space. |
514 | * lru_lock: Spinlock that protects the buffer+device lru lists and | 531 | * lru_lock: Spinlock that protects the buffer+device lru lists and |
515 | * ddestroy lists. | 532 | * ddestroy lists. |
533 | * @val_seq: Current validation sequence. | ||
516 | * @nice_mode: Try nicely to wait for buffer idle when cleaning a manager. | 534 | * @nice_mode: Try nicely to wait for buffer idle when cleaning a manager. |
517 | * If a GPU lockup has been detected, this is forced to 0. | 535 | * If a GPU lockup has been detected, this is forced to 0. |
518 | * @dev_mapping: A pointer to the struct address_space representing the | 536 | * @dev_mapping: A pointer to the struct address_space representing the |
@@ -531,6 +549,7 @@ struct ttm_bo_device { | |||
531 | struct ttm_bo_driver *driver; | 549 | struct ttm_bo_driver *driver; |
532 | rwlock_t vm_lock; | 550 | rwlock_t vm_lock; |
533 | struct ttm_mem_type_manager man[TTM_NUM_MEM_TYPES]; | 551 | struct ttm_mem_type_manager man[TTM_NUM_MEM_TYPES]; |
552 | spinlock_t fence_lock; | ||
534 | /* | 553 | /* |
535 | * Protected by the vm lock. | 554 | * Protected by the vm lock. |
536 | */ | 555 | */ |
@@ -541,6 +560,7 @@ struct ttm_bo_device { | |||
541 | * Protected by the global:lru lock. | 560 | * Protected by the global:lru lock. |
542 | */ | 561 | */ |
543 | struct list_head ddestroy; | 562 | struct list_head ddestroy; |
563 | uint32_t val_seq; | ||
544 | 564 | ||
545 | /* | 565 | /* |
546 | * Protected by load / firstopen / lastclose /unload sync. | 566 | * Protected by load / firstopen / lastclose /unload sync. |
@@ -753,31 +773,6 @@ extern void ttm_bo_mem_put_locked(struct ttm_buffer_object *bo, | |||
753 | 773 | ||
754 | extern int ttm_bo_wait_cpu(struct ttm_buffer_object *bo, bool no_wait); | 774 | extern int ttm_bo_wait_cpu(struct ttm_buffer_object *bo, bool no_wait); |
755 | 775 | ||
756 | /** | ||
757 | * ttm_bo_pci_offset - Get the PCI offset for the buffer object memory. | ||
758 | * | ||
759 | * @bo Pointer to a struct ttm_buffer_object. | ||
760 | * @bus_base On return the base of the PCI region | ||
761 | * @bus_offset On return the byte offset into the PCI region | ||
762 | * @bus_size On return the byte size of the buffer object or zero if | ||
763 | * the buffer object memory is not accessible through a PCI region. | ||
764 | * | ||
765 | * Returns: | ||
766 | * -EINVAL if the buffer object is currently not mappable. | ||
767 | * 0 otherwise. | ||
768 | */ | ||
769 | |||
770 | extern int ttm_bo_pci_offset(struct ttm_bo_device *bdev, | ||
771 | struct ttm_mem_reg *mem, | ||
772 | unsigned long *bus_base, | ||
773 | unsigned long *bus_offset, | ||
774 | unsigned long *bus_size); | ||
775 | |||
776 | extern int ttm_mem_io_reserve(struct ttm_bo_device *bdev, | ||
777 | struct ttm_mem_reg *mem); | ||
778 | extern void ttm_mem_io_free(struct ttm_bo_device *bdev, | ||
779 | struct ttm_mem_reg *mem); | ||
780 | |||
781 | extern void ttm_bo_global_release(struct drm_global_reference *ref); | 776 | extern void ttm_bo_global_release(struct drm_global_reference *ref); |
782 | extern int ttm_bo_global_init(struct drm_global_reference *ref); | 777 | extern int ttm_bo_global_init(struct drm_global_reference *ref); |
783 | 778 | ||
@@ -810,6 +805,22 @@ extern int ttm_bo_device_init(struct ttm_bo_device *bdev, | |||
810 | extern void ttm_bo_unmap_virtual(struct ttm_buffer_object *bo); | 805 | extern void ttm_bo_unmap_virtual(struct ttm_buffer_object *bo); |
811 | 806 | ||
812 | /** | 807 | /** |
808 | * ttm_bo_unmap_virtual | ||
809 | * | ||
810 | * @bo: tear down the virtual mappings for this BO | ||
811 | * | ||
812 | * The caller must take ttm_mem_io_lock before calling this function. | ||
813 | */ | ||
814 | extern void ttm_bo_unmap_virtual_locked(struct ttm_buffer_object *bo); | ||
815 | |||
816 | extern int ttm_mem_io_reserve_vm(struct ttm_buffer_object *bo); | ||
817 | extern void ttm_mem_io_free_vm(struct ttm_buffer_object *bo); | ||
818 | extern int ttm_mem_io_lock(struct ttm_mem_type_manager *man, | ||
819 | bool interruptible); | ||
820 | extern void ttm_mem_io_unlock(struct ttm_mem_type_manager *man); | ||
821 | |||
822 | |||
823 | /** | ||
813 | * ttm_bo_reserve: | 824 | * ttm_bo_reserve: |
814 | * | 825 | * |
815 | * @bo: A pointer to a struct ttm_buffer_object. | 826 | * @bo: A pointer to a struct ttm_buffer_object. |
@@ -859,11 +870,44 @@ extern void ttm_bo_unmap_virtual(struct ttm_buffer_object *bo); | |||
859 | * try again. (only if use_sequence == 1). | 870 | * try again. (only if use_sequence == 1). |
860 | * -ERESTARTSYS: A wait for the buffer to become unreserved was interrupted by | 871 | * -ERESTARTSYS: A wait for the buffer to become unreserved was interrupted by |
861 | * a signal. Release all buffer reservations and return to user-space. | 872 | * a signal. Release all buffer reservations and return to user-space. |
873 | * -EBUSY: The function needed to sleep, but @no_wait was true | ||
874 | * -EDEADLK: Bo already reserved using @sequence. This error code will only | ||
875 | * be returned if @use_sequence is set to true. | ||
862 | */ | 876 | */ |
863 | extern int ttm_bo_reserve(struct ttm_buffer_object *bo, | 877 | extern int ttm_bo_reserve(struct ttm_buffer_object *bo, |
864 | bool interruptible, | 878 | bool interruptible, |
865 | bool no_wait, bool use_sequence, uint32_t sequence); | 879 | bool no_wait, bool use_sequence, uint32_t sequence); |
866 | 880 | ||
881 | |||
882 | /** | ||
883 | * ttm_bo_reserve_locked: | ||
884 | * | ||
885 | * @bo: A pointer to a struct ttm_buffer_object. | ||
886 | * @interruptible: Sleep interruptible if waiting. | ||
887 | * @no_wait: Don't sleep while trying to reserve, rather return -EBUSY. | ||
888 | * @use_sequence: If @bo is already reserved, Only sleep waiting for | ||
889 | * it to become unreserved if @sequence < (@bo)->sequence. | ||
890 | * | ||
891 | * Must be called with struct ttm_bo_global::lru_lock held, | ||
892 | * and will not remove reserved buffers from the lru lists. | ||
893 | * The function may release the LRU spinlock if it needs to sleep. | ||
894 | * Otherwise identical to ttm_bo_reserve. | ||
895 | * | ||
896 | * Returns: | ||
897 | * -EAGAIN: The reservation may cause a deadlock. | ||
898 | * Release all buffer reservations, wait for @bo to become unreserved and | ||
899 | * try again. (only if use_sequence == 1). | ||
900 | * -ERESTARTSYS: A wait for the buffer to become unreserved was interrupted by | ||
901 | * a signal. Release all buffer reservations and return to user-space. | ||
902 | * -EBUSY: The function needed to sleep, but @no_wait was true | ||
903 | * -EDEADLK: Bo already reserved using @sequence. This error code will only | ||
904 | * be returned if @use_sequence is set to true. | ||
905 | */ | ||
906 | extern int ttm_bo_reserve_locked(struct ttm_buffer_object *bo, | ||
907 | bool interruptible, | ||
908 | bool no_wait, bool use_sequence, | ||
909 | uint32_t sequence); | ||
910 | |||
867 | /** | 911 | /** |
868 | * ttm_bo_unreserve | 912 | * ttm_bo_unreserve |
869 | * | 913 | * |
@@ -874,6 +918,16 @@ extern int ttm_bo_reserve(struct ttm_buffer_object *bo, | |||
874 | extern void ttm_bo_unreserve(struct ttm_buffer_object *bo); | 918 | extern void ttm_bo_unreserve(struct ttm_buffer_object *bo); |
875 | 919 | ||
876 | /** | 920 | /** |
921 | * ttm_bo_unreserve_locked | ||
922 | * | ||
923 | * @bo: A pointer to a struct ttm_buffer_object. | ||
924 | * | ||
925 | * Unreserve a previous reservation of @bo. | ||
926 | * Needs to be called with struct ttm_bo_global::lru_lock held. | ||
927 | */ | ||
928 | extern void ttm_bo_unreserve_locked(struct ttm_buffer_object *bo); | ||
929 | |||
930 | /** | ||
877 | * ttm_bo_wait_unreserved | 931 | * ttm_bo_wait_unreserved |
878 | * | 932 | * |
879 | * @bo: A pointer to a struct ttm_buffer_object. | 933 | * @bo: A pointer to a struct ttm_buffer_object. |
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 | ||
47 | struct ttm_validate_buffer { | 50 | struct 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 | ||
91 | extern int ttm_eu_reserve_buffers(struct list_head *list, uint32_t val_seq); | 96 | extern 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/linux/agp_backend.h b/include/linux/agp_backend.h index 09ea4a1e9505..eaf6cd75a1b1 100644 --- a/include/linux/agp_backend.h +++ b/include/linux/agp_backend.h | |||
@@ -102,10 +102,8 @@ extern struct agp_memory *agp_allocate_memory(struct agp_bridge_data *, size_t, | |||
102 | extern int agp_copy_info(struct agp_bridge_data *, struct agp_kern_info *); | 102 | extern int agp_copy_info(struct agp_bridge_data *, struct agp_kern_info *); |
103 | extern int agp_bind_memory(struct agp_memory *, off_t); | 103 | extern int agp_bind_memory(struct agp_memory *, off_t); |
104 | extern int agp_unbind_memory(struct agp_memory *); | 104 | extern int agp_unbind_memory(struct agp_memory *); |
105 | extern int agp_rebind_memory(void); | ||
106 | extern void agp_enable(struct agp_bridge_data *, u32); | 105 | extern void agp_enable(struct agp_bridge_data *, u32); |
107 | extern struct agp_bridge_data *agp_backend_acquire(struct pci_dev *); | 106 | extern struct agp_bridge_data *agp_backend_acquire(struct pci_dev *); |
108 | extern void agp_backend_release(struct agp_bridge_data *); | 107 | extern void agp_backend_release(struct agp_bridge_data *); |
109 | extern void agp_flush_chipset(struct agp_bridge_data *); | ||
110 | 108 | ||
111 | #endif /* _AGP_BACKEND_H */ | 109 | #endif /* _AGP_BACKEND_H */ |
diff --git a/include/linux/intel-gtt.h b/include/linux/intel-gtt.h deleted file mode 100644 index 1d19ab2afa39..000000000000 --- a/include/linux/intel-gtt.h +++ /dev/null | |||
@@ -1,20 +0,0 @@ | |||
1 | /* | ||
2 | * Common Intel AGPGART and GTT definitions. | ||
3 | */ | ||
4 | #ifndef _INTEL_GTT_H | ||
5 | #define _INTEL_GTT_H | ||
6 | |||
7 | #include <linux/agp_backend.h> | ||
8 | |||
9 | /* This is for Intel only GTT controls. | ||
10 | * | ||
11 | * Sandybridge: AGP_USER_CACHED_MEMORY default to LLC only | ||
12 | */ | ||
13 | |||
14 | #define AGP_USER_CACHED_MEMORY_LLC_MLC (AGP_USER_TYPES + 2) | ||
15 | #define AGP_USER_UNCACHED_MEMORY (AGP_USER_TYPES + 4) | ||
16 | |||
17 | /* flag for GFDT type */ | ||
18 | #define AGP_USER_CACHED_MEMORY_GFDT (1 << 3) | ||
19 | |||
20 | #endif | ||
diff --git a/include/linux/kref.h b/include/linux/kref.h index 6cc38fc07ab7..d4a62ab2ee5e 100644 --- a/include/linux/kref.h +++ b/include/linux/kref.h | |||
@@ -24,5 +24,7 @@ struct kref { | |||
24 | void kref_init(struct kref *kref); | 24 | void kref_init(struct kref *kref); |
25 | void kref_get(struct kref *kref); | 25 | void kref_get(struct kref *kref); |
26 | int kref_put(struct kref *kref, void (*release) (struct kref *kref)); | 26 | int kref_put(struct kref *kref, void (*release) (struct kref *kref)); |
27 | int kref_sub(struct kref *kref, unsigned int count, | ||
28 | void (*release) (struct kref *kref)); | ||
27 | 29 | ||
28 | #endif /* _KREF_H_ */ | 30 | #endif /* _KREF_H_ */ |
diff --git a/include/linux/vga_switcheroo.h b/include/linux/vga_switcheroo.h index ae9ab13b963d..4b9a7f596f92 100644 --- a/include/linux/vga_switcheroo.h +++ b/include/linux/vga_switcheroo.h | |||
@@ -33,6 +33,7 @@ struct vga_switcheroo_handler { | |||
33 | void vga_switcheroo_unregister_client(struct pci_dev *dev); | 33 | void vga_switcheroo_unregister_client(struct pci_dev *dev); |
34 | int vga_switcheroo_register_client(struct pci_dev *dev, | 34 | int vga_switcheroo_register_client(struct pci_dev *dev, |
35 | void (*set_gpu_state)(struct pci_dev *dev, enum vga_switcheroo_state), | 35 | void (*set_gpu_state)(struct pci_dev *dev, enum vga_switcheroo_state), |
36 | void (*reprobe)(struct pci_dev *dev), | ||
36 | bool (*can_switch)(struct pci_dev *dev)); | 37 | bool (*can_switch)(struct pci_dev *dev)); |
37 | 38 | ||
38 | void vga_switcheroo_client_fb_set(struct pci_dev *dev, | 39 | void vga_switcheroo_client_fb_set(struct pci_dev *dev, |
@@ -48,6 +49,7 @@ int vga_switcheroo_process_delayed_switch(void); | |||
48 | static inline void vga_switcheroo_unregister_client(struct pci_dev *dev) {} | 49 | static inline void vga_switcheroo_unregister_client(struct pci_dev *dev) {} |
49 | static inline int vga_switcheroo_register_client(struct pci_dev *dev, | 50 | static inline int vga_switcheroo_register_client(struct pci_dev *dev, |
50 | void (*set_gpu_state)(struct pci_dev *dev, enum vga_switcheroo_state), | 51 | void (*set_gpu_state)(struct pci_dev *dev, enum vga_switcheroo_state), |
52 | void (*reprobe)(struct pci_dev *dev), | ||
51 | bool (*can_switch)(struct pci_dev *dev)) { return 0; } | 53 | bool (*can_switch)(struct pci_dev *dev)) { return 0; } |
52 | static inline void vga_switcheroo_client_fb_set(struct pci_dev *dev, struct fb_info *info) {} | 54 | static inline void vga_switcheroo_client_fb_set(struct pci_dev *dev, struct fb_info *info) {} |
53 | static inline int vga_switcheroo_register_handler(struct vga_switcheroo_handler *handler) { return 0; } | 55 | static inline int vga_switcheroo_register_handler(struct vga_switcheroo_handler *handler) { return 0; } |