aboutsummaryrefslogtreecommitdiffstats
path: root/include/drm
diff options
context:
space:
mode:
Diffstat (limited to 'include/drm')
-rw-r--r--include/drm/drmP.h3
-rw-r--r--include/drm/drm_crtc.h19
-rw-r--r--include/drm/drm_crtc_helper.h3
-rw-r--r--include/drm/drm_dp_helper.h39
-rw-r--r--include/drm/drm_hashtab.h14
-rw-r--r--include/drm/drm_pciids.h1
-rw-r--r--include/drm/exynos_drm.h26
-rw-r--r--include/drm/intel-gtt.h7
-rw-r--r--include/drm/ttm/ttm_bo_api.h33
-rw-r--r--include/drm/ttm/ttm_bo_driver.h45
-rw-r--r--include/drm/ttm/ttm_execbuf_util.h3
-rw-r--r--include/drm/ttm/ttm_memory.h2
-rw-r--r--include/drm/ttm/ttm_object.h4
13 files changed, 127 insertions, 72 deletions
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 3fd82809b2d4..fad21c927a38 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -1431,6 +1431,8 @@ extern int drm_vblank_wait(struct drm_device *dev, unsigned int *vbl_seq);
1431extern u32 drm_vblank_count(struct drm_device *dev, int crtc); 1431extern u32 drm_vblank_count(struct drm_device *dev, int crtc);
1432extern u32 drm_vblank_count_and_time(struct drm_device *dev, int crtc, 1432extern u32 drm_vblank_count_and_time(struct drm_device *dev, int crtc,
1433 struct timeval *vblanktime); 1433 struct timeval *vblanktime);
1434extern void drm_send_vblank_event(struct drm_device *dev, int crtc,
1435 struct drm_pending_vblank_event *e);
1434extern bool drm_handle_vblank(struct drm_device *dev, int crtc); 1436extern bool drm_handle_vblank(struct drm_device *dev, int crtc);
1435extern int drm_vblank_get(struct drm_device *dev, int crtc); 1437extern int drm_vblank_get(struct drm_device *dev, int crtc);
1436extern void drm_vblank_put(struct drm_device *dev, int crtc); 1438extern void drm_vblank_put(struct drm_device *dev, int crtc);
@@ -1503,6 +1505,7 @@ extern unsigned int drm_debug;
1503 1505
1504extern unsigned int drm_vblank_offdelay; 1506extern unsigned int drm_vblank_offdelay;
1505extern unsigned int drm_timestamp_precision; 1507extern unsigned int drm_timestamp_precision;
1508extern unsigned int drm_timestamp_monotonic;
1506 1509
1507extern struct class *drm_class; 1510extern struct class *drm_class;
1508extern struct proc_dir_entry *drm_proc_root; 1511extern struct proc_dir_entry *drm_proc_root;
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 3fa18b7e9497..00d78b5161c0 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -792,6 +792,7 @@ struct drm_mode_config {
792 792
793 /* output poll support */ 793 /* output poll support */
794 bool poll_enabled; 794 bool poll_enabled;
795 bool poll_running;
795 struct delayed_work output_poll_work; 796 struct delayed_work output_poll_work;
796 797
797 /* pointers to standard properties */ 798 /* pointers to standard properties */
@@ -887,14 +888,14 @@ extern void drm_mode_remove(struct drm_connector *connector, struct drm_display_
887extern void drm_mode_copy(struct drm_display_mode *dst, const struct drm_display_mode *src); 888extern void drm_mode_copy(struct drm_display_mode *dst, const struct drm_display_mode *src);
888extern struct drm_display_mode *drm_mode_duplicate(struct drm_device *dev, 889extern struct drm_display_mode *drm_mode_duplicate(struct drm_device *dev,
889 const struct drm_display_mode *mode); 890 const struct drm_display_mode *mode);
890extern void drm_mode_debug_printmodeline(struct drm_display_mode *mode); 891extern void drm_mode_debug_printmodeline(const struct drm_display_mode *mode);
891extern void drm_mode_config_init(struct drm_device *dev); 892extern void drm_mode_config_init(struct drm_device *dev);
892extern void drm_mode_config_reset(struct drm_device *dev); 893extern void drm_mode_config_reset(struct drm_device *dev);
893extern void drm_mode_config_cleanup(struct drm_device *dev); 894extern void drm_mode_config_cleanup(struct drm_device *dev);
894extern void drm_mode_set_name(struct drm_display_mode *mode); 895extern void drm_mode_set_name(struct drm_display_mode *mode);
895extern bool drm_mode_equal(struct drm_display_mode *mode1, struct drm_display_mode *mode2); 896extern bool drm_mode_equal(const struct drm_display_mode *mode1, const struct drm_display_mode *mode2);
896extern int drm_mode_width(struct drm_display_mode *mode); 897extern int drm_mode_width(const struct drm_display_mode *mode);
897extern int drm_mode_height(struct drm_display_mode *mode); 898extern int drm_mode_height(const struct drm_display_mode *mode);
898 899
899/* for us by fb module */ 900/* for us by fb module */
900extern int drm_mode_attachmode_crtc(struct drm_device *dev, 901extern int drm_mode_attachmode_crtc(struct drm_device *dev,
@@ -919,12 +920,6 @@ extern void drm_mode_set_crtcinfo(struct drm_display_mode *p,
919extern void drm_mode_connector_list_update(struct drm_connector *connector); 920extern void drm_mode_connector_list_update(struct drm_connector *connector);
920extern int drm_mode_connector_update_edid_property(struct drm_connector *connector, 921extern int drm_mode_connector_update_edid_property(struct drm_connector *connector,
921 struct edid *edid); 922 struct edid *edid);
922extern int drm_connector_property_set_value(struct drm_connector *connector,
923 struct drm_property *property,
924 uint64_t value);
925extern int drm_connector_property_get_value(struct drm_connector *connector,
926 struct drm_property *property,
927 uint64_t *value);
928extern int drm_object_property_set_value(struct drm_mode_object *obj, 923extern int drm_object_property_set_value(struct drm_mode_object *obj,
929 struct drm_property *property, 924 struct drm_property *property,
930 uint64_t val); 925 uint64_t val);
@@ -946,8 +941,6 @@ extern int drmfb_remove(struct drm_device *dev, struct drm_framebuffer *fb);
946extern void drm_crtc_probe_connector_modes(struct drm_device *dev, int maxX, int maxY); 941extern void drm_crtc_probe_connector_modes(struct drm_device *dev, int maxX, int maxY);
947extern bool drm_crtc_in_use(struct drm_crtc *crtc); 942extern bool drm_crtc_in_use(struct drm_crtc *crtc);
948 943
949extern void drm_connector_attach_property(struct drm_connector *connector,
950 struct drm_property *property, uint64_t init_val);
951extern void drm_object_attach_property(struct drm_mode_object *obj, 944extern void drm_object_attach_property(struct drm_mode_object *obj,
952 struct drm_property *property, 945 struct drm_property *property,
953 uint64_t init_val); 946 uint64_t init_val);
@@ -1037,6 +1030,7 @@ extern int drm_mode_gamma_get_ioctl(struct drm_device *dev,
1037extern int drm_mode_gamma_set_ioctl(struct drm_device *dev, 1030extern int drm_mode_gamma_set_ioctl(struct drm_device *dev,
1038 void *data, struct drm_file *file_priv); 1031 void *data, struct drm_file *file_priv);
1039extern u8 *drm_find_cea_extension(struct edid *edid); 1032extern u8 *drm_find_cea_extension(struct edid *edid);
1033extern u8 drm_match_cea_mode(struct drm_display_mode *to_match);
1040extern bool drm_detect_hdmi_monitor(struct edid *edid); 1034extern bool drm_detect_hdmi_monitor(struct edid *edid);
1041extern bool drm_detect_monitor_audio(struct edid *edid); 1035extern bool drm_detect_monitor_audio(struct edid *edid);
1042extern int drm_mode_page_flip_ioctl(struct drm_device *dev, 1036extern int drm_mode_page_flip_ioctl(struct drm_device *dev,
@@ -1053,6 +1047,7 @@ extern struct drm_display_mode *drm_gtf_mode_complex(struct drm_device *dev,
1053 int GTF_2C, int GTF_K, int GTF_2J); 1047 int GTF_2C, int GTF_K, int GTF_2J);
1054extern int drm_add_modes_noedid(struct drm_connector *connector, 1048extern int drm_add_modes_noedid(struct drm_connector *connector,
1055 int hdisplay, int vdisplay); 1049 int hdisplay, int vdisplay);
1050extern uint8_t drm_mode_cea_vic(const struct drm_display_mode *mode);
1056 1051
1057extern int drm_edid_header_is_valid(const u8 *raw_edid); 1052extern int drm_edid_header_is_valid(const u8 *raw_edid);
1058extern bool drm_edid_block_valid(u8 *raw_edid, int block, bool print_bad_edid); 1053extern bool drm_edid_block_valid(u8 *raw_edid, int block, bool print_bad_edid);
diff --git a/include/drm/drm_crtc_helper.h b/include/drm/drm_crtc_helper.h
index e01cc80c9c30..f43d556bf40b 100644
--- a/include/drm/drm_crtc_helper.h
+++ b/include/drm/drm_crtc_helper.h
@@ -137,6 +137,8 @@ extern bool drm_helper_encoder_in_use(struct drm_encoder *encoder);
137 137
138extern void drm_helper_connector_dpms(struct drm_connector *connector, int mode); 138extern void drm_helper_connector_dpms(struct drm_connector *connector, int mode);
139 139
140extern void drm_helper_move_panel_connectors_to_head(struct drm_device *);
141
140extern int drm_helper_mode_fill_fb_struct(struct drm_framebuffer *fb, 142extern int drm_helper_mode_fill_fb_struct(struct drm_framebuffer *fb,
141 struct drm_mode_fb_cmd2 *mode_cmd); 143 struct drm_mode_fb_cmd2 *mode_cmd);
142 144
@@ -162,6 +164,7 @@ extern int drm_helper_resume_force_mode(struct drm_device *dev);
162extern void drm_kms_helper_poll_init(struct drm_device *dev); 164extern void drm_kms_helper_poll_init(struct drm_device *dev);
163extern void drm_kms_helper_poll_fini(struct drm_device *dev); 165extern void drm_kms_helper_poll_fini(struct drm_device *dev);
164extern void drm_helper_hpd_irq_event(struct drm_device *dev); 166extern void drm_helper_hpd_irq_event(struct drm_device *dev);
167extern void drm_kms_helper_hotplug_event(struct drm_device *dev);
165 168
166extern void drm_kms_helper_poll_disable(struct drm_device *dev); 169extern void drm_kms_helper_poll_disable(struct drm_device *dev);
167extern void drm_kms_helper_poll_enable(struct drm_device *dev); 170extern void drm_kms_helper_poll_enable(struct drm_device *dev);
diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h
index fe061489f91f..e8e1417af3d9 100644
--- a/include/drm/drm_dp_helper.h
+++ b/include/drm/drm_dp_helper.h
@@ -25,6 +25,7 @@
25 25
26#include <linux/types.h> 26#include <linux/types.h>
27#include <linux/i2c.h> 27#include <linux/i2c.h>
28#include <linux/delay.h>
28 29
29/* 30/*
30 * Unless otherwise noted, all values are from the DP 1.1a spec. Note that 31 * Unless otherwise noted, all values are from the DP 1.1a spec. Note that
@@ -311,6 +312,14 @@
311#define MODE_I2C_READ 4 312#define MODE_I2C_READ 4
312#define MODE_I2C_STOP 8 313#define MODE_I2C_STOP 8
313 314
315/**
316 * struct i2c_algo_dp_aux_data - driver interface structure for i2c over dp
317 * aux algorithm
318 * @running: set by the algo indicating whether an i2c is ongoing or whether
319 * the i2c bus is quiescent
320 * @address: i2c target address for the currently ongoing transfer
321 * @aux_ch: driver callback to transfer a single byte of the i2c payload
322 */
314struct i2c_algo_dp_aux_data { 323struct i2c_algo_dp_aux_data {
315 bool running; 324 bool running;
316 u16 address; 325 u16 address;
@@ -322,4 +331,34 @@ struct i2c_algo_dp_aux_data {
322int 331int
323i2c_dp_aux_add_bus(struct i2c_adapter *adapter); 332i2c_dp_aux_add_bus(struct i2c_adapter *adapter);
324 333
334
335#define DP_LINK_STATUS_SIZE 6
336bool drm_dp_channel_eq_ok(u8 link_status[DP_LINK_STATUS_SIZE],
337 int lane_count);
338bool drm_dp_clock_recovery_ok(u8 link_status[DP_LINK_STATUS_SIZE],
339 int lane_count);
340u8 drm_dp_get_adjust_request_voltage(u8 link_status[DP_LINK_STATUS_SIZE],
341 int lane);
342u8 drm_dp_get_adjust_request_pre_emphasis(u8 link_status[DP_LINK_STATUS_SIZE],
343 int lane);
344
345#define DP_RECEIVER_CAP_SIZE 0xf
346void drm_dp_link_train_clock_recovery_delay(u8 dpcd[DP_RECEIVER_CAP_SIZE]);
347void drm_dp_link_train_channel_eq_delay(u8 dpcd[DP_RECEIVER_CAP_SIZE]);
348
349u8 drm_dp_link_rate_to_bw_code(int link_rate);
350int drm_dp_bw_code_to_link_rate(u8 link_bw);
351
352static inline int
353drm_dp_max_link_rate(u8 dpcd[DP_RECEIVER_CAP_SIZE])
354{
355 return drm_dp_bw_code_to_link_rate(dpcd[DP_MAX_LINK_RATE]);
356}
357
358static inline u8
359drm_dp_max_lane_count(u8 dpcd[DP_RECEIVER_CAP_SIZE])
360{
361 return dpcd[DP_MAX_LANE_COUNT] & DP_MAX_LANE_COUNT_MASK;
362}
363
325#endif /* _DRM_DP_HELPER_H_ */ 364#endif /* _DRM_DP_HELPER_H_ */
diff --git a/include/drm/drm_hashtab.h b/include/drm/drm_hashtab.h
index 3650d5d011ee..fce2ef3fdfff 100644
--- a/include/drm/drm_hashtab.h
+++ b/include/drm/drm_hashtab.h
@@ -61,5 +61,19 @@ extern int drm_ht_remove_key(struct drm_open_hash *ht, unsigned long key);
61extern int drm_ht_remove_item(struct drm_open_hash *ht, struct drm_hash_item *item); 61extern int drm_ht_remove_item(struct drm_open_hash *ht, struct drm_hash_item *item);
62extern void drm_ht_remove(struct drm_open_hash *ht); 62extern void drm_ht_remove(struct drm_open_hash *ht);
63 63
64/*
65 * RCU-safe interface
66 *
67 * The user of this API needs to make sure that two or more instances of the
68 * hash table manipulation functions are never run simultaneously.
69 * The lookup function drm_ht_find_item_rcu may, however, run simultaneously
70 * with any of the manipulation functions as long as it's called from within
71 * an RCU read-locked section.
72 */
73#define drm_ht_insert_item_rcu drm_ht_insert_item
74#define drm_ht_just_insert_please_rcu drm_ht_just_insert_please
75#define drm_ht_remove_key_rcu drm_ht_remove_key
76#define drm_ht_remove_item_rcu drm_ht_remove_item
77#define drm_ht_find_item_rcu drm_ht_find_item
64 78
65#endif 79#endif
diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h
index af1cbaf535ed..c5c35e629426 100644
--- a/include/drm/drm_pciids.h
+++ b/include/drm/drm_pciids.h
@@ -210,6 +210,7 @@
210 {0x1002, 0x6798, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \ 210 {0x1002, 0x6798, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \
211 {0x1002, 0x6799, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \ 211 {0x1002, 0x6799, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \
212 {0x1002, 0x679A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \ 212 {0x1002, 0x679A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \
213 {0x1002, 0x679B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \
213 {0x1002, 0x679E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \ 214 {0x1002, 0x679E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \
214 {0x1002, 0x679F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \ 215 {0x1002, 0x679F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \
215 {0x1002, 0x6800, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 216 {0x1002, 0x6800, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
diff --git a/include/drm/exynos_drm.h b/include/drm/exynos_drm.h
index 3c13a3a4b158..808dad29607a 100644
--- a/include/drm/exynos_drm.h
+++ b/include/drm/exynos_drm.h
@@ -85,4 +85,30 @@ struct exynos_drm_hdmi_pdata {
85 int (*get_hpd)(void); 85 int (*get_hpd)(void);
86}; 86};
87 87
88/**
89 * Platform Specific Structure for DRM based IPP.
90 *
91 * @inv_pclk: if set 1. invert pixel clock
92 * @inv_vsync: if set 1. invert vsync signal for wb
93 * @inv_href: if set 1. invert href signal
94 * @inv_hsync: if set 1. invert hsync signal for wb
95 */
96struct exynos_drm_ipp_pol {
97 unsigned int inv_pclk;
98 unsigned int inv_vsync;
99 unsigned int inv_href;
100 unsigned int inv_hsync;
101};
102
103/**
104 * Platform Specific Structure for DRM based FIMC.
105 *
106 * @pol: current hardware block polarity settings.
107 * @clk_rate: current hardware clock rate.
108 */
109struct exynos_drm_fimc_pdata {
110 struct exynos_drm_ipp_pol pol;
111 int clk_rate;
112};
113
88#endif /* _EXYNOS_DRM_H_ */ 114#endif /* _EXYNOS_DRM_H_ */
diff --git a/include/drm/intel-gtt.h b/include/drm/intel-gtt.h
index 2e37e9f02e71..6eb76a1f11ab 100644
--- a/include/drm/intel-gtt.h
+++ b/include/drm/intel-gtt.h
@@ -3,7 +3,7 @@
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
6const struct intel_gtt { 6struct intel_gtt {
7 /* Size of memory reserved for graphics by the BIOS */ 7 /* Size of memory reserved for graphics by the BIOS */
8 unsigned int stolen_size; 8 unsigned int stolen_size;
9 /* Total number of gtt entries. */ 9 /* Total number of gtt entries. */
@@ -17,6 +17,7 @@ const struct intel_gtt {
17 unsigned int do_idle_maps : 1; 17 unsigned int do_idle_maps : 1;
18 /* Share the scratch page dma with ppgtts. */ 18 /* Share the scratch page dma with ppgtts. */
19 dma_addr_t scratch_page_dma; 19 dma_addr_t scratch_page_dma;
20 struct page *scratch_page;
20 /* for ppgtt PDE access */ 21 /* for ppgtt PDE access */
21 u32 __iomem *gtt; 22 u32 __iomem *gtt;
22 /* needed for ioremap in drm/i915 */ 23 /* needed for ioremap in drm/i915 */
@@ -39,10 +40,6 @@ void intel_gtt_clear_range(unsigned int first_entry, unsigned int num_entries);
39#define AGP_DCACHE_MEMORY 1 40#define AGP_DCACHE_MEMORY 1
40#define AGP_PHYS_MEMORY 2 41#define AGP_PHYS_MEMORY 2
41 42
42/* New caching attributes for gen6/sandybridge */
43#define AGP_USER_CACHED_MEMORY_LLC_MLC (AGP_USER_TYPES + 2)
44#define AGP_USER_UNCACHED_MEMORY (AGP_USER_TYPES + 4)
45
46/* flag for GFDT type */ 43/* flag for GFDT type */
47#define AGP_USER_CACHED_MEMORY_GFDT (1 << 3) 44#define AGP_USER_CACHED_MEMORY_GFDT (1 << 3)
48 45
diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h
index e8028ade567f..3cb5d848fb66 100644
--- a/include/drm/ttm/ttm_bo_api.h
+++ b/include/drm/ttm/ttm_bo_api.h
@@ -141,8 +141,6 @@ struct ttm_tt;
141 * struct ttm_buffer_object 141 * struct ttm_buffer_object
142 * 142 *
143 * @bdev: Pointer to the buffer object device structure. 143 * @bdev: Pointer to the buffer object device structure.
144 * @buffer_start: The virtual user-space start address of ttm_bo_type_user
145 * buffers.
146 * @type: The bo type. 144 * @type: The bo type.
147 * @destroy: Destruction function. If NULL, kfree is used. 145 * @destroy: Destruction function. If NULL, kfree is used.
148 * @num_pages: Actual number of pages. 146 * @num_pages: Actual number of pages.
@@ -172,7 +170,6 @@ struct ttm_tt;
172 * @seq_valid: The value of @val_seq is valid. This value is protected by 170 * @seq_valid: The value of @val_seq is valid. This value is protected by
173 * the bo_device::lru_lock. 171 * the bo_device::lru_lock.
174 * @reserved: Deadlock-free lock used for synchronization state transitions. 172 * @reserved: Deadlock-free lock used for synchronization state transitions.
175 * @sync_obj_arg: Opaque argument to synchronization object function.
176 * @sync_obj: Pointer to a synchronization object. 173 * @sync_obj: Pointer to a synchronization object.
177 * @priv_flags: Flags describing buffer object internal state. 174 * @priv_flags: Flags describing buffer object internal state.
178 * @vm_rb: Rb node for the vm rb tree. 175 * @vm_rb: Rb node for the vm rb tree.
@@ -200,7 +197,6 @@ struct ttm_buffer_object {
200 197
201 struct ttm_bo_global *glob; 198 struct ttm_bo_global *glob;
202 struct ttm_bo_device *bdev; 199 struct ttm_bo_device *bdev;
203 unsigned long buffer_start;
204 enum ttm_bo_type type; 200 enum ttm_bo_type type;
205 void (*destroy) (struct ttm_buffer_object *); 201 void (*destroy) (struct ttm_buffer_object *);
206 unsigned long num_pages; 202 unsigned long num_pages;
@@ -255,7 +251,6 @@ struct ttm_buffer_object {
255 * checking NULL while reserved but not holding the mentioned lock. 251 * checking NULL while reserved but not holding the mentioned lock.
256 */ 252 */
257 253
258 void *sync_obj_arg;
259 void *sync_obj; 254 void *sync_obj;
260 unsigned long priv_flags; 255 unsigned long priv_flags;
261 256
@@ -342,7 +337,6 @@ extern int ttm_bo_wait(struct ttm_buffer_object *bo, bool lazy,
342 * @bo: The buffer object. 337 * @bo: The buffer object.
343 * @placement: Proposed placement for the buffer object. 338 * @placement: Proposed placement for the buffer object.
344 * @interruptible: Sleep interruptible if sleeping. 339 * @interruptible: Sleep interruptible if sleeping.
345 * @no_wait_reserve: Return immediately if other buffers are busy.
346 * @no_wait_gpu: Return immediately if the GPU is busy. 340 * @no_wait_gpu: Return immediately if the GPU is busy.
347 * 341 *
348 * Changes placement and caching policy of the buffer object 342 * Changes placement and caching policy of the buffer object
@@ -355,7 +349,7 @@ extern int ttm_bo_wait(struct ttm_buffer_object *bo, bool lazy,
355 */ 349 */
356extern int ttm_bo_validate(struct ttm_buffer_object *bo, 350extern int ttm_bo_validate(struct ttm_buffer_object *bo,
357 struct ttm_placement *placement, 351 struct ttm_placement *placement,
358 bool interruptible, bool no_wait_reserve, 352 bool interruptible,
359 bool no_wait_gpu); 353 bool no_wait_gpu);
360 354
361/** 355/**
@@ -429,8 +423,9 @@ extern void ttm_bo_unlock_delayed_workqueue(struct ttm_bo_device *bdev,
429 * @no_wait: Return immediately if buffer is busy. 423 * @no_wait: Return immediately if buffer is busy.
430 * 424 *
431 * Synchronizes a buffer object for CPU RW access. This means 425 * Synchronizes a buffer object for CPU RW access. This means
432 * blocking command submission that affects the buffer and 426 * command submission that affects the buffer will return -EBUSY
433 * waiting for buffer idle. This lock is recursive. 427 * until ttm_bo_synccpu_write_release is called.
428 *
434 * Returns 429 * Returns
435 * -EBUSY if the buffer is busy and no_wait is true. 430 * -EBUSY if the buffer is busy and no_wait is true.
436 * -ERESTARTSYS if interrupted by a signal. 431 * -ERESTARTSYS if interrupted by a signal.
@@ -472,8 +467,6 @@ size_t ttm_bo_dma_acc_size(struct ttm_bo_device *bdev,
472 * @type: Requested type of buffer object. 467 * @type: Requested type of buffer object.
473 * @flags: Initial placement flags. 468 * @flags: Initial placement flags.
474 * @page_alignment: Data alignment in pages. 469 * @page_alignment: Data alignment in pages.
475 * @buffer_start: Virtual address of user space data backing a
476 * user buffer object.
477 * @interruptible: If needing to sleep to wait for GPU resources, 470 * @interruptible: If needing to sleep to wait for GPU resources,
478 * sleep interruptible. 471 * sleep interruptible.
479 * @persistent_swap_storage: Usually the swap storage is deleted for buffers 472 * @persistent_swap_storage: Usually the swap storage is deleted for buffers
@@ -505,7 +498,6 @@ extern int ttm_bo_init(struct ttm_bo_device *bdev,
505 enum ttm_bo_type type, 498 enum ttm_bo_type type,
506 struct ttm_placement *placement, 499 struct ttm_placement *placement,
507 uint32_t page_alignment, 500 uint32_t page_alignment,
508 unsigned long buffer_start,
509 bool interrubtible, 501 bool interrubtible,
510 struct file *persistent_swap_storage, 502 struct file *persistent_swap_storage,
511 size_t acc_size, 503 size_t acc_size,
@@ -521,8 +513,6 @@ extern int ttm_bo_init(struct ttm_bo_device *bdev,
521 * @type: Requested type of buffer object. 513 * @type: Requested type of buffer object.
522 * @flags: Initial placement flags. 514 * @flags: Initial placement flags.
523 * @page_alignment: Data alignment in pages. 515 * @page_alignment: Data alignment in pages.
524 * @buffer_start: Virtual address of user space data backing a
525 * user buffer object.
526 * @interruptible: If needing to sleep while waiting for GPU resources, 516 * @interruptible: If needing to sleep while waiting for GPU resources,
527 * sleep interruptible. 517 * sleep interruptible.
528 * @persistent_swap_storage: Usually the swap storage is deleted for buffers 518 * @persistent_swap_storage: Usually the swap storage is deleted for buffers
@@ -545,7 +535,6 @@ extern int ttm_bo_create(struct ttm_bo_device *bdev,
545 enum ttm_bo_type type, 535 enum ttm_bo_type type,
546 struct ttm_placement *placement, 536 struct ttm_placement *placement,
547 uint32_t page_alignment, 537 uint32_t page_alignment,
548 unsigned long buffer_start,
549 bool interruptible, 538 bool interruptible,
550 struct file *persistent_swap_storage, 539 struct file *persistent_swap_storage,
551 struct ttm_buffer_object **p_bo); 540 struct ttm_buffer_object **p_bo);
@@ -736,4 +725,18 @@ extern ssize_t ttm_bo_io(struct ttm_bo_device *bdev, struct file *filp,
736 725
737extern void ttm_bo_swapout_all(struct ttm_bo_device *bdev); 726extern void ttm_bo_swapout_all(struct ttm_bo_device *bdev);
738 727
728/**
729 * ttm_bo_is_reserved - return an indication if a ttm buffer object is reserved
730 *
731 * @bo: The buffer object to check.
732 *
733 * This function returns an indication if a bo is reserved or not, and should
734 * only be used to print an error when it is not from incorrect api usage, since
735 * there's no guarantee that it is the caller that is holding the reservation.
736 */
737static inline bool ttm_bo_is_reserved(struct ttm_buffer_object *bo)
738{
739 return atomic_read(&bo->reserved);
740}
741
739#endif 742#endif
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
index d803b92b0324..e3a43a47d78c 100644
--- a/include/drm/ttm/ttm_bo_driver.h
+++ b/include/drm/ttm/ttm_bo_driver.h
@@ -394,7 +394,7 @@ struct ttm_bo_driver {
394 */ 394 */
395 int (*move) (struct ttm_buffer_object *bo, 395 int (*move) (struct ttm_buffer_object *bo,
396 bool evict, bool interruptible, 396 bool evict, bool interruptible,
397 bool no_wait_reserve, bool no_wait_gpu, 397 bool no_wait_gpu,
398 struct ttm_mem_reg *new_mem); 398 struct ttm_mem_reg *new_mem);
399 399
400 /** 400 /**
@@ -422,10 +422,10 @@ struct ttm_bo_driver {
422 * documentation. 422 * documentation.
423 */ 423 */
424 424
425 bool (*sync_obj_signaled) (void *sync_obj, void *sync_arg); 425 bool (*sync_obj_signaled) (void *sync_obj);
426 int (*sync_obj_wait) (void *sync_obj, void *sync_arg, 426 int (*sync_obj_wait) (void *sync_obj,
427 bool lazy, bool interruptible); 427 bool lazy, bool interruptible);
428 int (*sync_obj_flush) (void *sync_obj, void *sync_arg); 428 int (*sync_obj_flush) (void *sync_obj);
429 void (*sync_obj_unref) (void **sync_obj); 429 void (*sync_obj_unref) (void **sync_obj);
430 void *(*sync_obj_ref) (void *sync_obj); 430 void *(*sync_obj_ref) (void *sync_obj);
431 431
@@ -521,8 +521,6 @@ struct ttm_bo_global {
521 * lru_lock: Spinlock that protects the buffer+device lru lists and 521 * lru_lock: Spinlock that protects the buffer+device lru lists and
522 * ddestroy lists. 522 * ddestroy lists.
523 * @val_seq: Current validation sequence. 523 * @val_seq: Current validation sequence.
524 * @nice_mode: Try nicely to wait for buffer idle when cleaning a manager.
525 * If a GPU lockup has been detected, this is forced to 0.
526 * @dev_mapping: A pointer to the struct address_space representing the 524 * @dev_mapping: A pointer to the struct address_space representing the
527 * device address space. 525 * device address space.
528 * @wq: Work queue structure for the delayed delete workqueue. 526 * @wq: Work queue structure for the delayed delete workqueue.
@@ -556,7 +554,6 @@ struct ttm_bo_device {
556 * Protected by load / firstopen / lastclose /unload sync. 554 * Protected by load / firstopen / lastclose /unload sync.
557 */ 555 */
558 556
559 bool nice_mode;
560 struct address_space *dev_mapping; 557 struct address_space *dev_mapping;
561 558
562 /* 559 /*
@@ -706,7 +703,6 @@ extern bool ttm_mem_reg_is_pci(struct ttm_bo_device *bdev,
706 * @proposed_placement: Proposed new placement for the buffer object. 703 * @proposed_placement: Proposed new placement for the buffer object.
707 * @mem: A struct ttm_mem_reg. 704 * @mem: A struct ttm_mem_reg.
708 * @interruptible: Sleep interruptible when sliping. 705 * @interruptible: Sleep interruptible when sliping.
709 * @no_wait_reserve: Return immediately if other buffers are busy.
710 * @no_wait_gpu: Return immediately if the GPU is busy. 706 * @no_wait_gpu: Return immediately if the GPU is busy.
711 * 707 *
712 * Allocate memory space for the buffer object pointed to by @bo, using 708 * Allocate memory space for the buffer object pointed to by @bo, using
@@ -722,27 +718,13 @@ extern int ttm_bo_mem_space(struct ttm_buffer_object *bo,
722 struct ttm_placement *placement, 718 struct ttm_placement *placement,
723 struct ttm_mem_reg *mem, 719 struct ttm_mem_reg *mem,
724 bool interruptible, 720 bool interruptible,
725 bool no_wait_reserve, bool no_wait_gpu); 721 bool no_wait_gpu);
726 722
727extern void ttm_bo_mem_put(struct ttm_buffer_object *bo, 723extern void ttm_bo_mem_put(struct ttm_buffer_object *bo,
728 struct ttm_mem_reg *mem); 724 struct ttm_mem_reg *mem);
729extern void ttm_bo_mem_put_locked(struct ttm_buffer_object *bo, 725extern void ttm_bo_mem_put_locked(struct ttm_buffer_object *bo,
730 struct ttm_mem_reg *mem); 726 struct ttm_mem_reg *mem);
731 727
732/**
733 * ttm_bo_wait_for_cpu
734 *
735 * @bo: Pointer to a struct ttm_buffer_object.
736 * @no_wait: Don't sleep while waiting.
737 *
738 * Wait until a buffer object is no longer sync'ed for CPU access.
739 * Returns:
740 * -EBUSY: Buffer object was sync'ed for CPU access. (only if no_wait == 1).
741 * -ERESTARTSYS: An interruptible sleep was interrupted by a signal.
742 */
743
744extern int ttm_bo_wait_cpu(struct ttm_buffer_object *bo, bool no_wait);
745
746extern void ttm_bo_global_release(struct drm_global_reference *ref); 728extern void ttm_bo_global_release(struct drm_global_reference *ref);
747extern int ttm_bo_global_init(struct drm_global_reference *ref); 729extern int ttm_bo_global_init(struct drm_global_reference *ref);
748 730
@@ -918,7 +900,6 @@ extern int ttm_bo_wait_unreserved(struct ttm_buffer_object *bo,
918 * 900 *
919 * @bo: A pointer to a struct ttm_buffer_object. 901 * @bo: A pointer to a struct ttm_buffer_object.
920 * @evict: 1: This is an eviction. Don't try to pipeline. 902 * @evict: 1: This is an eviction. Don't try to pipeline.
921 * @no_wait_reserve: Return immediately if other buffers are busy.
922 * @no_wait_gpu: Return immediately if the GPU is busy. 903 * @no_wait_gpu: Return immediately if the GPU is busy.
923 * @new_mem: struct ttm_mem_reg indicating where to move. 904 * @new_mem: struct ttm_mem_reg indicating where to move.
924 * 905 *
@@ -933,15 +914,14 @@ extern int ttm_bo_wait_unreserved(struct ttm_buffer_object *bo,
933 */ 914 */
934 915
935extern int ttm_bo_move_ttm(struct ttm_buffer_object *bo, 916extern int ttm_bo_move_ttm(struct ttm_buffer_object *bo,
936 bool evict, bool no_wait_reserve, 917 bool evict, bool no_wait_gpu,
937 bool no_wait_gpu, struct ttm_mem_reg *new_mem); 918 struct ttm_mem_reg *new_mem);
938 919
939/** 920/**
940 * ttm_bo_move_memcpy 921 * ttm_bo_move_memcpy
941 * 922 *
942 * @bo: A pointer to a struct ttm_buffer_object. 923 * @bo: A pointer to a struct ttm_buffer_object.
943 * @evict: 1: This is an eviction. Don't try to pipeline. 924 * @evict: 1: This is an eviction. Don't try to pipeline.
944 * @no_wait_reserve: Return immediately if other buffers are busy.
945 * @no_wait_gpu: Return immediately if the GPU is busy. 925 * @no_wait_gpu: Return immediately if the GPU is busy.
946 * @new_mem: struct ttm_mem_reg indicating where to move. 926 * @new_mem: struct ttm_mem_reg indicating where to move.
947 * 927 *
@@ -956,8 +936,8 @@ extern int ttm_bo_move_ttm(struct ttm_buffer_object *bo,
956 */ 936 */
957 937
958extern int ttm_bo_move_memcpy(struct ttm_buffer_object *bo, 938extern int ttm_bo_move_memcpy(struct ttm_buffer_object *bo,
959 bool evict, bool no_wait_reserve, 939 bool evict, bool no_wait_gpu,
960 bool no_wait_gpu, struct ttm_mem_reg *new_mem); 940 struct ttm_mem_reg *new_mem);
961 941
962/** 942/**
963 * ttm_bo_free_old_node 943 * ttm_bo_free_old_node
@@ -973,10 +953,7 @@ extern void ttm_bo_free_old_node(struct ttm_buffer_object *bo);
973 * 953 *
974 * @bo: A pointer to a struct ttm_buffer_object. 954 * @bo: A pointer to a struct ttm_buffer_object.
975 * @sync_obj: A sync object that signals when moving is complete. 955 * @sync_obj: A sync object that signals when moving is complete.
976 * @sync_obj_arg: An argument to pass to the sync object idle / wait
977 * functions.
978 * @evict: This is an evict move. Don't return until the buffer is idle. 956 * @evict: This is an evict move. Don't return until the buffer is idle.
979 * @no_wait_reserve: Return immediately if other buffers are busy.
980 * @no_wait_gpu: Return immediately if the GPU is busy. 957 * @no_wait_gpu: Return immediately if the GPU is busy.
981 * @new_mem: struct ttm_mem_reg indicating where to move. 958 * @new_mem: struct ttm_mem_reg indicating where to move.
982 * 959 *
@@ -990,9 +967,7 @@ extern void ttm_bo_free_old_node(struct ttm_buffer_object *bo);
990 967
991extern int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo, 968extern int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo,
992 void *sync_obj, 969 void *sync_obj,
993 void *sync_obj_arg, 970 bool evict, bool no_wait_gpu,
994 bool evict, bool no_wait_reserve,
995 bool no_wait_gpu,
996 struct ttm_mem_reg *new_mem); 971 struct ttm_mem_reg *new_mem);
997/** 972/**
998 * ttm_io_prot 973 * ttm_io_prot
diff --git a/include/drm/ttm/ttm_execbuf_util.h b/include/drm/ttm/ttm_execbuf_util.h
index 1926cae373ba..547e19f06e57 100644
--- a/include/drm/ttm/ttm_execbuf_util.h
+++ b/include/drm/ttm/ttm_execbuf_util.h
@@ -39,8 +39,6 @@
39 * 39 *
40 * @head: list head for thread-private list. 40 * @head: list head for thread-private list.
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
43 * adding a new sync object.
44 * @reserved: Indicates whether @bo has been reserved for validation. 42 * @reserved: Indicates whether @bo has been reserved for validation.
45 * @removed: Indicates whether @bo has been removed from lru lists. 43 * @removed: Indicates whether @bo has been removed from lru lists.
46 * @put_count: Number of outstanding references on bo::list_kref. 44 * @put_count: Number of outstanding references on bo::list_kref.
@@ -50,7 +48,6 @@
50struct ttm_validate_buffer { 48struct ttm_validate_buffer {
51 struct list_head head; 49 struct list_head head;
52 struct ttm_buffer_object *bo; 50 struct ttm_buffer_object *bo;
53 void *new_sync_obj_arg;
54 bool reserved; 51 bool reserved;
55 bool removed; 52 bool removed;
56 int put_count; 53 int put_count;
diff --git a/include/drm/ttm/ttm_memory.h b/include/drm/ttm/ttm_memory.h
index d6d1da468c97..72dcbe81dd07 100644
--- a/include/drm/ttm/ttm_memory.h
+++ b/include/drm/ttm/ttm_memory.h
@@ -60,7 +60,6 @@ struct ttm_mem_shrink {
60 * for the GPU, and this will otherwise block other workqueue tasks(?) 60 * for the GPU, and this will otherwise block other workqueue tasks(?)
61 * At this point we use only a single-threaded workqueue. 61 * At this point we use only a single-threaded workqueue.
62 * @work: The workqueue callback for the shrink queue. 62 * @work: The workqueue callback for the shrink queue.
63 * @queue: Wait queue for processes suspended waiting for memory.
64 * @lock: Lock to protect the @shrink - and the memory accounting members, 63 * @lock: Lock to protect the @shrink - and the memory accounting members,
65 * that is, essentially the whole structure with some exceptions. 64 * that is, essentially the whole structure with some exceptions.
66 * @zones: Array of pointers to accounting zones. 65 * @zones: Array of pointers to accounting zones.
@@ -80,7 +79,6 @@ struct ttm_mem_global {
80 struct ttm_mem_shrink *shrink; 79 struct ttm_mem_shrink *shrink;
81 struct workqueue_struct *swap_queue; 80 struct workqueue_struct *swap_queue;
82 struct work_struct work; 81 struct work_struct work;
83 wait_queue_head_t queue;
84 spinlock_t lock; 82 spinlock_t lock;
85 struct ttm_mem_zone *zones[TTM_MEM_MAX_ZONES]; 83 struct ttm_mem_zone *zones[TTM_MEM_MAX_ZONES];
86 unsigned int num_zones; 84 unsigned int num_zones;
diff --git a/include/drm/ttm/ttm_object.h b/include/drm/ttm/ttm_object.h
index b01c563b2751..fc0cf0649901 100644
--- a/include/drm/ttm/ttm_object.h
+++ b/include/drm/ttm/ttm_object.h
@@ -40,6 +40,7 @@
40#include <linux/list.h> 40#include <linux/list.h>
41#include <drm/drm_hashtab.h> 41#include <drm/drm_hashtab.h>
42#include <linux/kref.h> 42#include <linux/kref.h>
43#include <linux/rcupdate.h>
43#include <ttm/ttm_memory.h> 44#include <ttm/ttm_memory.h>
44 45
45/** 46/**
@@ -120,6 +121,7 @@ struct ttm_object_device;
120 */ 121 */
121 122
122struct ttm_base_object { 123struct ttm_base_object {
124 struct rcu_head rhead;
123 struct drm_hash_item hash; 125 struct drm_hash_item hash;
124 enum ttm_object_type object_type; 126 enum ttm_object_type object_type;
125 bool shareable; 127 bool shareable;
@@ -268,4 +270,6 @@ extern struct ttm_object_device *ttm_object_device_init
268 270
269extern void ttm_object_device_release(struct ttm_object_device **p_tdev); 271extern void ttm_object_device_release(struct ttm_object_device **p_tdev);
270 272
273#define ttm_base_object_kfree(__object, __base)\
274 kfree_rcu(__object, __base.rhead)
271#endif 275#endif