aboutsummaryrefslogtreecommitdiffstats
path: root/include/drm
diff options
context:
space:
mode:
Diffstat (limited to 'include/drm')
-rw-r--r--include/drm/drmP.h34
-rw-r--r--include/drm/drm_crtc.h38
-rw-r--r--include/drm/drm_edid.h6
-rw-r--r--include/drm/drm_encoder_slave.h20
-rw-r--r--include/drm/drm_fb_cma_helper.h5
-rw-r--r--include/drm/drm_fb_helper.h18
-rw-r--r--include/drm/drm_gem_cma_helper.h4
-rw-r--r--include/drm/drm_mm.h40
-rw-r--r--include/drm/drm_pciids.h13
-rw-r--r--include/drm/intel-gtt.h22
-rw-r--r--include/drm/ttm/ttm_bo_driver.h61
11 files changed, 205 insertions, 56 deletions
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index fad21c927a38..2d94d7413d71 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -85,6 +85,9 @@ struct module;
85struct drm_file; 85struct drm_file;
86struct drm_device; 86struct drm_device;
87 87
88struct device_node;
89struct videomode;
90
88#include <drm/drm_os_linux.h> 91#include <drm/drm_os_linux.h>
89#include <drm/drm_hashtab.h> 92#include <drm/drm_hashtab.h>
90#include <drm/drm_mm.h> 93#include <drm/drm_mm.h>
@@ -446,7 +449,15 @@ struct drm_file {
446 int is_master; /* this file private is a master for a minor */ 449 int is_master; /* this file private is a master for a minor */
447 struct drm_master *master; /* master this node is currently associated with 450 struct drm_master *master; /* master this node is currently associated with
448 N.B. not always minor->master */ 451 N.B. not always minor->master */
452
453 /**
454 * fbs - List of framebuffers associated with this file.
455 *
456 * Protected by fbs_lock. Note that the fbs list holds a reference on
457 * the fb object to prevent it from untimely disappearing.
458 */
449 struct list_head fbs; 459 struct list_head fbs;
460 struct mutex fbs_lock;
450 461
451 wait_queue_head_t event_wait; 462 wait_queue_head_t event_wait;
452 struct list_head event_list; 463 struct list_head event_list;
@@ -919,6 +930,14 @@ struct drm_driver {
919 /* import dmabuf -> GEM */ 930 /* import dmabuf -> GEM */
920 struct drm_gem_object * (*gem_prime_import)(struct drm_device *dev, 931 struct drm_gem_object * (*gem_prime_import)(struct drm_device *dev,
921 struct dma_buf *dma_buf); 932 struct dma_buf *dma_buf);
933 /* low-level interface used by drm_gem_prime_{import,export} */
934 int (*gem_prime_pin)(struct drm_gem_object *obj);
935 struct sg_table *(*gem_prime_get_sg_table)(struct drm_gem_object *obj);
936 struct drm_gem_object *(*gem_prime_import_sg_table)(
937 struct drm_device *dev, size_t size,
938 struct sg_table *sgt);
939 void *(*gem_prime_vmap)(struct drm_gem_object *obj);
940 void (*gem_prime_vunmap)(struct drm_gem_object *obj, void *vaddr);
922 941
923 /* vga arb irq handler */ 942 /* vga arb irq handler */
924 void (*vgaarb_irq)(struct drm_device *dev, bool state); 943 void (*vgaarb_irq)(struct drm_device *dev, bool state);
@@ -1276,6 +1295,11 @@ static inline int drm_device_is_unplugged(struct drm_device *dev)
1276 return ret; 1295 return ret;
1277} 1296}
1278 1297
1298static inline bool drm_modeset_is_locked(struct drm_device *dev)
1299{
1300 return mutex_is_locked(&dev->mode_config.mutex);
1301}
1302
1279/******************************************************************/ 1303/******************************************************************/
1280/** \name Internal function definitions */ 1304/** \name Internal function definitions */
1281/*@{*/ 1305/*@{*/
@@ -1456,6 +1480,12 @@ extern struct drm_display_mode *
1456drm_mode_create_from_cmdline_mode(struct drm_device *dev, 1480drm_mode_create_from_cmdline_mode(struct drm_device *dev,
1457 struct drm_cmdline_mode *cmd); 1481 struct drm_cmdline_mode *cmd);
1458 1482
1483extern int drm_display_mode_from_videomode(const struct videomode *vm,
1484 struct drm_display_mode *dmode);
1485extern int of_get_drm_display_mode(struct device_node *np,
1486 struct drm_display_mode *dmode,
1487 int index);
1488
1459/* Modesetting support */ 1489/* Modesetting support */
1460extern void drm_vblank_pre_modeset(struct drm_device *dev, int crtc); 1490extern void drm_vblank_pre_modeset(struct drm_device *dev, int crtc);
1461extern void drm_vblank_post_modeset(struct drm_device *dev, int crtc); 1491extern void drm_vblank_post_modeset(struct drm_device *dev, int crtc);
@@ -1540,9 +1570,13 @@ extern int drm_clients_info(struct seq_file *m, void* data);
1540extern int drm_gem_name_info(struct seq_file *m, void *data); 1570extern int drm_gem_name_info(struct seq_file *m, void *data);
1541 1571
1542 1572
1573extern struct dma_buf *drm_gem_prime_export(struct drm_device *dev,
1574 struct drm_gem_object *obj, int flags);
1543extern int drm_gem_prime_handle_to_fd(struct drm_device *dev, 1575extern int drm_gem_prime_handle_to_fd(struct drm_device *dev,
1544 struct drm_file *file_priv, uint32_t handle, uint32_t flags, 1576 struct drm_file *file_priv, uint32_t handle, uint32_t flags,
1545 int *prime_fd); 1577 int *prime_fd);
1578extern struct drm_gem_object *drm_gem_prime_import(struct drm_device *dev,
1579 struct dma_buf *dma_buf);
1546extern int drm_gem_prime_fd_to_handle(struct drm_device *dev, 1580extern int drm_gem_prime_fd_to_handle(struct drm_device *dev,
1547 struct drm_file *file_priv, int prime_fd, uint32_t *handle); 1581 struct drm_file *file_priv, int prime_fd, uint32_t *handle);
1548 1582
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 00d78b5161c0..8839b3a24660 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -38,7 +38,8 @@ struct drm_device;
38struct drm_mode_set; 38struct drm_mode_set;
39struct drm_framebuffer; 39struct drm_framebuffer;
40struct drm_object_properties; 40struct drm_object_properties;
41 41struct drm_file;
42struct drm_clip_rect;
42 43
43#define DRM_MODE_OBJECT_CRTC 0xcccccccc 44#define DRM_MODE_OBJECT_CRTC 0xcccccccc
44#define DRM_MODE_OBJECT_CONNECTOR 0xc0c0c0c0 45#define DRM_MODE_OBJECT_CONNECTOR 0xc0c0c0c0
@@ -254,6 +255,10 @@ struct drm_framebuffer {
254 * userspace perspective. 255 * userspace perspective.
255 */ 256 */
256 struct kref refcount; 257 struct kref refcount;
258 /*
259 * Place on the dev->mode_config.fb_list, access protected by
260 * dev->mode_config.fb_lock.
261 */
257 struct list_head head; 262 struct list_head head;
258 struct drm_mode_object base; 263 struct drm_mode_object base;
259 const struct drm_framebuffer_funcs *funcs; 264 const struct drm_framebuffer_funcs *funcs;
@@ -390,6 +395,15 @@ struct drm_crtc {
390 struct drm_device *dev; 395 struct drm_device *dev;
391 struct list_head head; 396 struct list_head head;
392 397
398 /**
399 * crtc mutex
400 *
401 * This provides a read lock for the overall crtc state (mode, dpms
402 * state, ...) and a write lock for everything which can be update
403 * without a full modeset (fb, cursor data, ...)
404 */
405 struct mutex mutex;
406
393 struct drm_mode_object base; 407 struct drm_mode_object base;
394 408
395 /* framebuffer the connector is currently bound to */ 409 /* framebuffer the connector is currently bound to */
@@ -771,8 +785,18 @@ struct drm_mode_config {
771 struct mutex idr_mutex; /* for IDR management */ 785 struct mutex idr_mutex; /* for IDR management */
772 struct idr crtc_idr; /* use this idr for all IDs, fb, crtc, connector, modes - just makes life easier */ 786 struct idr crtc_idr; /* use this idr for all IDs, fb, crtc, connector, modes - just makes life easier */
773 /* this is limited to one for now */ 787 /* this is limited to one for now */
788
789
790 /**
791 * fb_lock - mutex to protect fb state
792 *
793 * Besides the global fb list his also protects the fbs list in the
794 * file_priv
795 */
796 struct mutex fb_lock;
774 int num_fb; 797 int num_fb;
775 struct list_head fb_list; 798 struct list_head fb_list;
799
776 int num_connector; 800 int num_connector;
777 struct list_head connector_list; 801 struct list_head connector_list;
778 int num_encoder; 802 int num_encoder;
@@ -842,6 +866,10 @@ struct drm_prop_enum_list {
842 char *name; 866 char *name;
843}; 867};
844 868
869extern void drm_modeset_lock_all(struct drm_device *dev);
870extern void drm_modeset_unlock_all(struct drm_device *dev);
871extern void drm_warn_on_modeset_not_all_locked(struct drm_device *dev);
872
845extern int drm_crtc_init(struct drm_device *dev, 873extern int drm_crtc_init(struct drm_device *dev,
846 struct drm_crtc *crtc, 874 struct drm_crtc *crtc,
847 const struct drm_crtc_funcs *funcs); 875 const struct drm_crtc_funcs *funcs);
@@ -932,10 +960,13 @@ extern void drm_framebuffer_set_object(struct drm_device *dev,
932extern int drm_framebuffer_init(struct drm_device *dev, 960extern int drm_framebuffer_init(struct drm_device *dev,
933 struct drm_framebuffer *fb, 961 struct drm_framebuffer *fb,
934 const struct drm_framebuffer_funcs *funcs); 962 const struct drm_framebuffer_funcs *funcs);
963extern struct drm_framebuffer *drm_framebuffer_lookup(struct drm_device *dev,
964 uint32_t id);
935extern void drm_framebuffer_unreference(struct drm_framebuffer *fb); 965extern void drm_framebuffer_unreference(struct drm_framebuffer *fb);
936extern void drm_framebuffer_reference(struct drm_framebuffer *fb); 966extern void drm_framebuffer_reference(struct drm_framebuffer *fb);
937extern void drm_framebuffer_remove(struct drm_framebuffer *fb); 967extern void drm_framebuffer_remove(struct drm_framebuffer *fb);
938extern void drm_framebuffer_cleanup(struct drm_framebuffer *fb); 968extern void drm_framebuffer_cleanup(struct drm_framebuffer *fb);
969extern void drm_framebuffer_unregister_private(struct drm_framebuffer *fb);
939extern int drmfb_probe(struct drm_device *dev, struct drm_crtc *crtc); 970extern int drmfb_probe(struct drm_device *dev, struct drm_crtc *crtc);
940extern int drmfb_remove(struct drm_device *dev, struct drm_framebuffer *fb); 971extern int drmfb_remove(struct drm_device *dev, struct drm_framebuffer *fb);
941extern void drm_crtc_probe_connector_modes(struct drm_device *dev, int maxX, int maxY); 972extern void drm_crtc_probe_connector_modes(struct drm_device *dev, int maxX, int maxY);
@@ -985,6 +1016,7 @@ extern int drm_mode_getcrtc(struct drm_device *dev,
985 void *data, struct drm_file *file_priv); 1016 void *data, struct drm_file *file_priv);
986extern int drm_mode_getconnector(struct drm_device *dev, 1017extern int drm_mode_getconnector(struct drm_device *dev,
987 void *data, struct drm_file *file_priv); 1018 void *data, struct drm_file *file_priv);
1019extern int drm_mode_set_config_internal(struct drm_mode_set *set);
988extern int drm_mode_setcrtc(struct drm_device *dev, 1020extern int drm_mode_setcrtc(struct drm_device *dev,
989 void *data, struct drm_file *file_priv); 1021 void *data, struct drm_file *file_priv);
990extern int drm_mode_getplane(struct drm_device *dev, 1022extern int drm_mode_getplane(struct drm_device *dev,
@@ -1030,9 +1062,10 @@ extern int drm_mode_gamma_get_ioctl(struct drm_device *dev,
1030extern int drm_mode_gamma_set_ioctl(struct drm_device *dev, 1062extern int drm_mode_gamma_set_ioctl(struct drm_device *dev,
1031 void *data, struct drm_file *file_priv); 1063 void *data, struct drm_file *file_priv);
1032extern u8 *drm_find_cea_extension(struct edid *edid); 1064extern u8 *drm_find_cea_extension(struct edid *edid);
1033extern u8 drm_match_cea_mode(struct drm_display_mode *to_match); 1065extern u8 drm_match_cea_mode(const struct drm_display_mode *to_match);
1034extern bool drm_detect_hdmi_monitor(struct edid *edid); 1066extern bool drm_detect_hdmi_monitor(struct edid *edid);
1035extern bool drm_detect_monitor_audio(struct edid *edid); 1067extern bool drm_detect_monitor_audio(struct edid *edid);
1068extern bool drm_rgb_quant_range_selectable(struct edid *edid);
1036extern int drm_mode_page_flip_ioctl(struct drm_device *dev, 1069extern int drm_mode_page_flip_ioctl(struct drm_device *dev,
1037 void *data, struct drm_file *file_priv); 1070 void *data, struct drm_file *file_priv);
1038extern struct drm_display_mode *drm_cvt_mode(struct drm_device *dev, 1071extern struct drm_display_mode *drm_cvt_mode(struct drm_device *dev,
@@ -1047,7 +1080,6 @@ extern struct drm_display_mode *drm_gtf_mode_complex(struct drm_device *dev,
1047 int GTF_2C, int GTF_K, int GTF_2J); 1080 int GTF_2C, int GTF_K, int GTF_2J);
1048extern int drm_add_modes_noedid(struct drm_connector *connector, 1081extern int drm_add_modes_noedid(struct drm_connector *connector,
1049 int hdisplay, int vdisplay); 1082 int hdisplay, int vdisplay);
1050extern uint8_t drm_mode_cea_vic(const struct drm_display_mode *mode);
1051 1083
1052extern int drm_edid_header_is_valid(const u8 *raw_edid); 1084extern int drm_edid_header_is_valid(const u8 *raw_edid);
1053extern bool drm_edid_block_valid(u8 *raw_edid, int block, bool print_bad_edid); 1085extern bool drm_edid_block_valid(u8 *raw_edid, int block, bool print_bad_edid);
diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h
index 0cac551c5347..5da1b4ae7d84 100644
--- a/include/drm/drm_edid.h
+++ b/include/drm/drm_edid.h
@@ -247,6 +247,8 @@ struct edid {
247struct drm_encoder; 247struct drm_encoder;
248struct drm_connector; 248struct drm_connector;
249struct drm_display_mode; 249struct drm_display_mode;
250struct hdmi_avi_infoframe;
251
250void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid); 252void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid);
251int drm_av_sync_delay(struct drm_connector *connector, 253int drm_av_sync_delay(struct drm_connector *connector,
252 struct drm_display_mode *mode); 254 struct drm_display_mode *mode);
@@ -254,4 +256,8 @@ struct drm_connector *drm_select_eld(struct drm_encoder *encoder,
254 struct drm_display_mode *mode); 256 struct drm_display_mode *mode);
255int drm_load_edid_firmware(struct drm_connector *connector); 257int drm_load_edid_firmware(struct drm_connector *connector);
256 258
259int
260drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame,
261 const struct drm_display_mode *mode);
262
257#endif /* __DRM_EDID_H__ */ 263#endif /* __DRM_EDID_H__ */
diff --git a/include/drm/drm_encoder_slave.h b/include/drm/drm_encoder_slave.h
index b0c11a7809bb..8b9cc3671858 100644
--- a/include/drm/drm_encoder_slave.h
+++ b/include/drm/drm_encoder_slave.h
@@ -159,4 +159,24 @@ static inline void drm_i2c_encoder_unregister(struct drm_i2c_encoder_driver *dri
159 159
160void drm_i2c_encoder_destroy(struct drm_encoder *encoder); 160void drm_i2c_encoder_destroy(struct drm_encoder *encoder);
161 161
162
163/*
164 * Wrapper fxns which can be plugged in to drm_encoder_helper_funcs:
165 */
166
167void drm_i2c_encoder_dpms(struct drm_encoder *encoder, int mode);
168bool drm_i2c_encoder_mode_fixup(struct drm_encoder *encoder,
169 const struct drm_display_mode *mode,
170 struct drm_display_mode *adjusted_mode);
171void drm_i2c_encoder_prepare(struct drm_encoder *encoder);
172void drm_i2c_encoder_commit(struct drm_encoder *encoder);
173void drm_i2c_encoder_mode_set(struct drm_encoder *encoder,
174 struct drm_display_mode *mode,
175 struct drm_display_mode *adjusted_mode);
176enum drm_connector_status drm_i2c_encoder_detect(struct drm_encoder *encoder,
177 struct drm_connector *connector);
178void drm_i2c_encoder_save(struct drm_encoder *encoder);
179void drm_i2c_encoder_restore(struct drm_encoder *encoder);
180
181
162#endif 182#endif
diff --git a/include/drm/drm_fb_cma_helper.h b/include/drm/drm_fb_cma_helper.h
index 76c709837543..4a3fc244301c 100644
--- a/include/drm/drm_fb_cma_helper.h
+++ b/include/drm/drm_fb_cma_helper.h
@@ -23,5 +23,10 @@ struct drm_framebuffer *drm_fb_cma_create(struct drm_device *dev,
23struct drm_gem_cma_object *drm_fb_cma_get_gem_obj(struct drm_framebuffer *fb, 23struct drm_gem_cma_object *drm_fb_cma_get_gem_obj(struct drm_framebuffer *fb,
24 unsigned int plane); 24 unsigned int plane);
25 25
26#ifdef CONFIG_DEBUG_FS
27void drm_fb_cma_describe(struct drm_framebuffer *fb, struct seq_file *m);
28int drm_fb_cma_debugfs_show(struct seq_file *m, void *arg);
29#endif
30
26#endif 31#endif
27 32
diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h
index 5120b01c2eeb..c09511625a11 100644
--- a/include/drm/drm_fb_helper.h
+++ b/include/drm/drm_fb_helper.h
@@ -48,6 +48,18 @@ struct drm_fb_helper_surface_size {
48 u32 surface_depth; 48 u32 surface_depth;
49}; 49};
50 50
51/**
52 * struct drm_fb_helper_funcs - driver callbacks for the fbdev emulation library
53 * @gamma_set: - Set the given gamma lut register on the given crtc.
54 * @gamma_get: - Read the given gamma lut register on the given crtc, used to
55 * save the current lut when force-restoring the fbdev for e.g.
56 * kdbg.
57 * @fb_probe: - Driver callback to allocate and initialize the fbdev info
58 * structure. Futhermore it also needs to allocate the drm
59 * framebuffer used to back the fbdev.
60 *
61 * Driver callbacks used by the fbdev emulation helper library.
62 */
51struct drm_fb_helper_funcs { 63struct drm_fb_helper_funcs {
52 void (*gamma_set)(struct drm_crtc *crtc, u16 red, u16 green, 64 void (*gamma_set)(struct drm_crtc *crtc, u16 red, u16 green,
53 u16 blue, int regno); 65 u16 blue, int regno);
@@ -65,9 +77,7 @@ struct drm_fb_helper_connector {
65 77
66struct drm_fb_helper { 78struct drm_fb_helper {
67 struct drm_framebuffer *fb; 79 struct drm_framebuffer *fb;
68 struct drm_framebuffer *saved_fb;
69 struct drm_device *dev; 80 struct drm_device *dev;
70 struct drm_display_mode *mode;
71 int crtc_count; 81 int crtc_count;
72 struct drm_fb_helper_crtc *crtc_info; 82 struct drm_fb_helper_crtc *crtc_info;
73 int connector_count; 83 int connector_count;
@@ -82,9 +92,6 @@ struct drm_fb_helper {
82 bool delayed_hotplug; 92 bool delayed_hotplug;
83}; 93};
84 94
85int drm_fb_helper_single_fb_probe(struct drm_fb_helper *helper,
86 int preferred_bpp);
87
88int drm_fb_helper_init(struct drm_device *dev, 95int drm_fb_helper_init(struct drm_device *dev,
89 struct drm_fb_helper *helper, int crtc_count, 96 struct drm_fb_helper *helper, int crtc_count,
90 int max_conn); 97 int max_conn);
@@ -103,7 +110,6 @@ int drm_fb_helper_setcolreg(unsigned regno,
103 struct fb_info *info); 110 struct fb_info *info);
104 111
105bool drm_fb_helper_restore_fbdev_mode(struct drm_fb_helper *fb_helper); 112bool drm_fb_helper_restore_fbdev_mode(struct drm_fb_helper *fb_helper);
106void drm_fb_helper_restore(void);
107void drm_fb_helper_fill_var(struct fb_info *info, struct drm_fb_helper *fb_helper, 113void drm_fb_helper_fill_var(struct fb_info *info, struct drm_fb_helper *fb_helper,
108 uint32_t fb_width, uint32_t fb_height); 114 uint32_t fb_width, uint32_t fb_height);
109void drm_fb_helper_fill_fix(struct fb_info *info, uint32_t pitch, 115void drm_fb_helper_fill_fix(struct fb_info *info, uint32_t pitch,
diff --git a/include/drm/drm_gem_cma_helper.h b/include/drm/drm_gem_cma_helper.h
index f0f6b1af25ad..63397ced9254 100644
--- a/include/drm/drm_gem_cma_helper.h
+++ b/include/drm/drm_gem_cma_helper.h
@@ -41,4 +41,8 @@ struct drm_gem_cma_object *drm_gem_cma_create(struct drm_device *drm,
41 41
42extern const struct vm_operations_struct drm_gem_cma_vm_ops; 42extern const struct vm_operations_struct drm_gem_cma_vm_ops;
43 43
44#ifdef CONFIG_DEBUG_FS
45void drm_gem_cma_describe(struct drm_gem_cma_object *obj, struct seq_file *m);
46#endif
47
44#endif /* __DRM_GEM_CMA_HELPER_H__ */ 48#endif /* __DRM_GEM_CMA_HELPER_H__ */
diff --git a/include/drm/drm_mm.h b/include/drm/drm_mm.h
index 3527fb3f75bb..88591ef8fa24 100644
--- a/include/drm/drm_mm.h
+++ b/include/drm/drm_mm.h
@@ -89,6 +89,29 @@ static inline bool drm_mm_initialized(struct drm_mm *mm)
89{ 89{
90 return mm->hole_stack.next; 90 return mm->hole_stack.next;
91} 91}
92
93static inline unsigned long __drm_mm_hole_node_start(struct drm_mm_node *hole_node)
94{
95 return hole_node->start + hole_node->size;
96}
97
98static inline unsigned long drm_mm_hole_node_start(struct drm_mm_node *hole_node)
99{
100 BUG_ON(!hole_node->hole_follows);
101 return __drm_mm_hole_node_start(hole_node);
102}
103
104static inline unsigned long __drm_mm_hole_node_end(struct drm_mm_node *hole_node)
105{
106 return list_entry(hole_node->node_list.next,
107 struct drm_mm_node, node_list)->start;
108}
109
110static inline unsigned long drm_mm_hole_node_end(struct drm_mm_node *hole_node)
111{
112 return __drm_mm_hole_node_end(hole_node);
113}
114
92#define drm_mm_for_each_node(entry, mm) list_for_each_entry(entry, \ 115#define drm_mm_for_each_node(entry, mm) list_for_each_entry(entry, \
93 &(mm)->head_node.node_list, \ 116 &(mm)->head_node.node_list, \
94 node_list) 117 node_list)
@@ -99,9 +122,26 @@ static inline bool drm_mm_initialized(struct drm_mm *mm)
99 entry != NULL; entry = next, \ 122 entry != NULL; entry = next, \
100 next = entry ? list_entry(entry->node_list.next, \ 123 next = entry ? list_entry(entry->node_list.next, \
101 struct drm_mm_node, node_list) : NULL) \ 124 struct drm_mm_node, node_list) : NULL) \
125
126/* Note that we need to unroll list_for_each_entry in order to inline
127 * setting hole_start and hole_end on each iteration and keep the
128 * macro sane.
129 */
130#define drm_mm_for_each_hole(entry, mm, hole_start, hole_end) \
131 for (entry = list_entry((mm)->hole_stack.next, struct drm_mm_node, hole_stack); \
132 &entry->hole_stack != &(mm)->hole_stack ? \
133 hole_start = drm_mm_hole_node_start(entry), \
134 hole_end = drm_mm_hole_node_end(entry), \
135 1 : 0; \
136 entry = list_entry(entry->hole_stack.next, struct drm_mm_node, hole_stack))
137
102/* 138/*
103 * Basic range manager support (drm_mm.c) 139 * Basic range manager support (drm_mm.c)
104 */ 140 */
141extern struct drm_mm_node *drm_mm_create_block(struct drm_mm *mm,
142 unsigned long start,
143 unsigned long size,
144 bool atomic);
105extern struct drm_mm_node *drm_mm_get_block_generic(struct drm_mm_node *node, 145extern struct drm_mm_node *drm_mm_get_block_generic(struct drm_mm_node *node,
106 unsigned long size, 146 unsigned long size,
107 unsigned alignment, 147 unsigned alignment,
diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h
index c5c35e629426..a386b0b654cc 100644
--- a/include/drm/drm_pciids.h
+++ b/include/drm/drm_pciids.h
@@ -139,6 +139,19 @@
139 {0x1002, 0x5e4c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_NEW_MEMMAP}, \ 139 {0x1002, 0x5e4c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_NEW_MEMMAP}, \
140 {0x1002, 0x5e4d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_NEW_MEMMAP}, \ 140 {0x1002, 0x5e4d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_NEW_MEMMAP}, \
141 {0x1002, 0x5e4f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_NEW_MEMMAP}, \ 141 {0x1002, 0x5e4f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_NEW_MEMMAP}, \
142 {0x1002, 0x6600, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
143 {0x1002, 0x6601, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
144 {0x1002, 0x6602, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
145 {0x1002, 0x6603, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
146 {0x1002, 0x6606, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
147 {0x1002, 0x6607, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
148 {0x1002, 0x6610, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \
149 {0x1002, 0x6611, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \
150 {0x1002, 0x6613, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \
151 {0x1002, 0x6620, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
152 {0x1002, 0x6621, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
153 {0x1002, 0x6623, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
154 {0x1002, 0x6631, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \
142 {0x1002, 0x6700, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAYMAN|RADEON_NEW_MEMMAP}, \ 155 {0x1002, 0x6700, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAYMAN|RADEON_NEW_MEMMAP}, \
143 {0x1002, 0x6701, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAYMAN|RADEON_NEW_MEMMAP}, \ 156 {0x1002, 0x6701, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAYMAN|RADEON_NEW_MEMMAP}, \
144 {0x1002, 0x6702, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAYMAN|RADEON_NEW_MEMMAP}, \ 157 {0x1002, 0x6702, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAYMAN|RADEON_NEW_MEMMAP}, \
diff --git a/include/drm/intel-gtt.h b/include/drm/intel-gtt.h
index 6eb76a1f11ab..b08bdade6002 100644
--- a/include/drm/intel-gtt.h
+++ b/include/drm/intel-gtt.h
@@ -3,26 +3,8 @@
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 5
6struct intel_gtt { 6void intel_gtt_get(size_t *gtt_total, size_t *stolen_size,
7 /* Size of memory reserved for graphics by the BIOS */ 7 phys_addr_t *mappable_base, unsigned long *mappable_end);
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 /* Whether we idle the gpu before mapping/unmapping */
17 unsigned int do_idle_maps : 1;
18 /* Share the scratch page dma with ppgtts. */
19 dma_addr_t scratch_page_dma;
20 struct page *scratch_page;
21 /* for ppgtt PDE access */
22 u32 __iomem *gtt;
23 /* needed for ioremap in drm/i915 */
24 phys_addr_t gma_bus_addr;
25} *intel_gtt_get(void);
26 8
27int intel_gmch_probe(struct pci_dev *bridge_pdev, struct pci_dev *gpu_pdev, 9int intel_gmch_probe(struct pci_dev *bridge_pdev, struct pci_dev *gpu_pdev,
28 struct agp_bridge_data *bridge); 10 struct agp_bridge_data *bridge);
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
index e3a43a47d78c..0fbd046e7c93 100644
--- a/include/drm/ttm/ttm_bo_driver.h
+++ b/include/drm/ttm/ttm_bo_driver.h
@@ -790,16 +790,7 @@ extern void ttm_mem_io_unlock(struct ttm_mem_type_manager *man);
790 * to make room for a buffer already reserved. (Buffers are reserved before 790 * to make room for a buffer already reserved. (Buffers are reserved before
791 * they are evicted). The following algorithm prevents such deadlocks from 791 * they are evicted). The following algorithm prevents such deadlocks from
792 * occurring: 792 * occurring:
793 * 1) Buffers are reserved with the lru spinlock held. Upon successful 793 * Processes attempting to reserve multiple buffers other than for eviction,
794 * reservation they are removed from the lru list. This stops a reserved buffer
795 * from being evicted. However the lru spinlock is released between the time
796 * a buffer is selected for eviction and the time it is reserved.
797 * Therefore a check is made when a buffer is reserved for eviction, that it
798 * is still the first buffer in the lru list, before it is removed from the
799 * list. @check_lru == 1 forces this check. If it fails, the function returns
800 * -EINVAL, and the caller should then choose a new buffer to evict and repeat
801 * the procedure.
802 * 2) Processes attempting to reserve multiple buffers other than for eviction,
803 * (typically execbuf), should first obtain a unique 32-bit 794 * (typically execbuf), should first obtain a unique 32-bit
804 * validation sequence number, 795 * validation sequence number,
805 * and call this function with @use_sequence == 1 and @sequence == the unique 796 * and call this function with @use_sequence == 1 and @sequence == the unique
@@ -830,9 +821,39 @@ extern int ttm_bo_reserve(struct ttm_buffer_object *bo,
830 bool interruptible, 821 bool interruptible,
831 bool no_wait, bool use_sequence, uint32_t sequence); 822 bool no_wait, bool use_sequence, uint32_t sequence);
832 823
824/**
825 * ttm_bo_reserve_slowpath_nolru:
826 * @bo: A pointer to a struct ttm_buffer_object.
827 * @interruptible: Sleep interruptible if waiting.
828 * @sequence: Set (@bo)->sequence to this value after lock
829 *
830 * This is called after ttm_bo_reserve returns -EAGAIN and we backed off
831 * from all our other reservations. Because there are no other reservations
832 * held by us, this function cannot deadlock any more.
833 *
834 * Will not remove reserved buffers from the lru lists.
835 * Otherwise identical to ttm_bo_reserve_slowpath.
836 */
837extern int ttm_bo_reserve_slowpath_nolru(struct ttm_buffer_object *bo,
838 bool interruptible,
839 uint32_t sequence);
840
833 841
834/** 842/**
835 * ttm_bo_reserve_locked: 843 * ttm_bo_reserve_slowpath:
844 * @bo: A pointer to a struct ttm_buffer_object.
845 * @interruptible: Sleep interruptible if waiting.
846 * @sequence: Set (@bo)->sequence to this value after lock
847 *
848 * This is called after ttm_bo_reserve returns -EAGAIN and we backed off
849 * from all our other reservations. Because there are no other reservations
850 * held by us, this function cannot deadlock any more.
851 */
852extern int ttm_bo_reserve_slowpath(struct ttm_buffer_object *bo,
853 bool interruptible, uint32_t sequence);
854
855/**
856 * ttm_bo_reserve_nolru:
836 * 857 *
837 * @bo: A pointer to a struct ttm_buffer_object. 858 * @bo: A pointer to a struct ttm_buffer_object.
838 * @interruptible: Sleep interruptible if waiting. 859 * @interruptible: Sleep interruptible if waiting.
@@ -840,9 +861,7 @@ extern int ttm_bo_reserve(struct ttm_buffer_object *bo,
840 * @use_sequence: If @bo is already reserved, Only sleep waiting for 861 * @use_sequence: If @bo is already reserved, Only sleep waiting for
841 * it to become unreserved if @sequence < (@bo)->sequence. 862 * it to become unreserved if @sequence < (@bo)->sequence.
842 * 863 *
843 * Must be called with struct ttm_bo_global::lru_lock held, 864 * Will not remove reserved buffers from the lru lists.
844 * and will not remove reserved buffers from the lru lists.
845 * The function may release the LRU spinlock if it needs to sleep.
846 * Otherwise identical to ttm_bo_reserve. 865 * Otherwise identical to ttm_bo_reserve.
847 * 866 *
848 * Returns: 867 * Returns:
@@ -855,7 +874,7 @@ extern int ttm_bo_reserve(struct ttm_buffer_object *bo,
855 * -EDEADLK: Bo already reserved using @sequence. This error code will only 874 * -EDEADLK: Bo already reserved using @sequence. This error code will only
856 * be returned if @use_sequence is set to true. 875 * be returned if @use_sequence is set to true.
857 */ 876 */
858extern int ttm_bo_reserve_locked(struct ttm_buffer_object *bo, 877extern int ttm_bo_reserve_nolru(struct ttm_buffer_object *bo,
859 bool interruptible, 878 bool interruptible,
860 bool no_wait, bool use_sequence, 879 bool no_wait, bool use_sequence,
861 uint32_t sequence); 880 uint32_t sequence);
@@ -879,18 +898,6 @@ extern void ttm_bo_unreserve(struct ttm_buffer_object *bo);
879 */ 898 */
880extern void ttm_bo_unreserve_locked(struct ttm_buffer_object *bo); 899extern void ttm_bo_unreserve_locked(struct ttm_buffer_object *bo);
881 900
882/**
883 * ttm_bo_wait_unreserved
884 *
885 * @bo: A pointer to a struct ttm_buffer_object.
886 *
887 * Wait for a struct ttm_buffer_object to become unreserved.
888 * This is typically used in the execbuf code to relax cpu-usage when
889 * a potential deadlock condition backoff.
890 */
891extern int ttm_bo_wait_unreserved(struct ttm_buffer_object *bo,
892 bool interruptible);
893
894/* 901/*
895 * ttm_bo_util.c 902 * ttm_bo_util.c
896 */ 903 */