aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/drm/drmP.h27
-rw-r--r--include/drm/drm_atomic.h69
-rw-r--r--include/drm/drm_atomic_helper.h126
-rw-r--r--include/drm/drm_crtc.h327
-rw-r--r--include/drm/drm_crtc_helper.h13
-rw-r--r--include/drm/drm_displayid.h76
-rw-r--r--include/drm/drm_dp_helper.h26
-rw-r--r--include/drm/drm_dp_mst_helper.h8
-rw-r--r--include/drm/drm_edid.h109
-rw-r--r--include/drm/drm_fb_helper.h6
-rw-r--r--include/drm/drm_flip_work.h33
-rw-r--r--include/drm/drm_gem.h7
-rw-r--r--include/drm/drm_gem_cma_helper.h30
-rw-r--r--include/drm/drm_mipi_dsi.h94
-rw-r--r--include/drm/drm_modeset_lock.h5
-rw-r--r--include/drm/drm_plane_helper.h44
-rw-r--r--include/drm/i915_pciids.h17
-rw-r--r--include/drm/ttm/ttm_execbuf_util.h9
-rw-r--r--include/linux/hdmi.h21
-rw-r--r--include/linux/mmu_notifier.h88
-rw-r--r--include/linux/platform_data/rcar-du.h74
-rw-r--r--include/trace/events/host1x.h27
-rw-r--r--include/uapi/drm/drm_mode.h2
-rw-r--r--include/uapi/drm/i915_drm.h7
-rw-r--r--include/uapi/linux/kfd_ioctl.h154
25 files changed, 1211 insertions, 188 deletions
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 53ed87698a74..8ba35c622e22 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -125,8 +125,8 @@ struct dma_buf_attachment;
125extern __printf(2, 3) 125extern __printf(2, 3)
126void drm_ut_debug_printk(const char *function_name, 126void drm_ut_debug_printk(const char *function_name,
127 const char *format, ...); 127 const char *format, ...);
128extern __printf(2, 3) 128extern __printf(1, 2)
129void drm_err(const char *func, const char *format, ...); 129void drm_err(const char *format, ...);
130 130
131/***********************************************************************/ 131/***********************************************************************/
132/** \name DRM template customization defaults */ 132/** \name DRM template customization defaults */
@@ -155,7 +155,7 @@ void drm_err(const char *func, const char *format, ...);
155 * \param arg arguments 155 * \param arg arguments
156 */ 156 */
157#define DRM_ERROR(fmt, ...) \ 157#define DRM_ERROR(fmt, ...) \
158 drm_err(__func__, fmt, ##__VA_ARGS__) 158 drm_err(fmt, ##__VA_ARGS__)
159 159
160/** 160/**
161 * Rate limited error output. Like DRM_ERROR() but won't flood the log. 161 * Rate limited error output. Like DRM_ERROR() but won't flood the log.
@@ -170,7 +170,7 @@ void drm_err(const char *func, const char *format, ...);
170 DEFAULT_RATELIMIT_BURST); \ 170 DEFAULT_RATELIMIT_BURST); \
171 \ 171 \
172 if (__ratelimit(&_rs)) \ 172 if (__ratelimit(&_rs)) \
173 drm_err(__func__, fmt, ##__VA_ARGS__); \ 173 drm_err(fmt, ##__VA_ARGS__); \
174}) 174})
175 175
176#define DRM_INFO(fmt, ...) \ 176#define DRM_INFO(fmt, ...) \
@@ -809,7 +809,7 @@ struct drm_device {
809 struct drm_local_map *agp_buffer_map; 809 struct drm_local_map *agp_buffer_map;
810 unsigned int agp_buffer_token; 810 unsigned int agp_buffer_token;
811 811
812 struct drm_mode_config mode_config; /**< Current mode config */ 812 struct drm_mode_config mode_config; /**< Current mode config */
813 813
814 /** \name GEM information */ 814 /** \name GEM information */
815 /*@{ */ 815 /*@{ */
@@ -986,7 +986,7 @@ extern void drm_gem_dmabuf_release(struct dma_buf *dma_buf);
986 986
987extern int drm_prime_sg_to_page_addr_arrays(struct sg_table *sgt, struct page **pages, 987extern int drm_prime_sg_to_page_addr_arrays(struct sg_table *sgt, struct page **pages,
988 dma_addr_t *addrs, int max_pages); 988 dma_addr_t *addrs, int max_pages);
989extern struct sg_table *drm_prime_pages_to_sg(struct page **pages, int nr_pages); 989extern struct sg_table *drm_prime_pages_to_sg(struct page **pages, unsigned int nr_pages);
990extern void drm_prime_gem_destroy(struct drm_gem_object *obj, struct sg_table *sg); 990extern void drm_prime_gem_destroy(struct drm_gem_object *obj, struct sg_table *sg);
991 991
992 992
@@ -1028,10 +1028,25 @@ void drm_pci_agp_destroy(struct drm_device *dev);
1028 1028
1029extern int drm_pci_init(struct drm_driver *driver, struct pci_driver *pdriver); 1029extern int drm_pci_init(struct drm_driver *driver, struct pci_driver *pdriver);
1030extern void drm_pci_exit(struct drm_driver *driver, struct pci_driver *pdriver); 1030extern void drm_pci_exit(struct drm_driver *driver, struct pci_driver *pdriver);
1031#ifdef CONFIG_PCI
1031extern int drm_get_pci_dev(struct pci_dev *pdev, 1032extern int drm_get_pci_dev(struct pci_dev *pdev,
1032 const struct pci_device_id *ent, 1033 const struct pci_device_id *ent,
1033 struct drm_driver *driver); 1034 struct drm_driver *driver);
1034extern int drm_pci_set_busid(struct drm_device *dev, struct drm_master *master); 1035extern int drm_pci_set_busid(struct drm_device *dev, struct drm_master *master);
1036#else
1037static inline int drm_get_pci_dev(struct pci_dev *pdev,
1038 const struct pci_device_id *ent,
1039 struct drm_driver *driver)
1040{
1041 return -ENOSYS;
1042}
1043
1044static inline int drm_pci_set_busid(struct drm_device *dev,
1045 struct drm_master *master)
1046{
1047 return -ENOSYS;
1048}
1049#endif
1035 1050
1036#define DRM_PCIE_SPEED_25 1 1051#define DRM_PCIE_SPEED_25 1
1037#define DRM_PCIE_SPEED_50 2 1052#define DRM_PCIE_SPEED_50 2
diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h
new file mode 100644
index 000000000000..ad2229574dd9
--- /dev/null
+++ b/include/drm/drm_atomic.h
@@ -0,0 +1,69 @@
1/*
2 * Copyright (C) 2014 Red Hat
3 * Copyright (C) 2014 Intel Corp.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
19 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
20 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
21 * OTHER DEALINGS IN THE SOFTWARE.
22 *
23 * Authors:
24 * Rob Clark <robdclark@gmail.com>
25 * Daniel Vetter <daniel.vetter@ffwll.ch>
26 */
27
28#ifndef DRM_ATOMIC_H_
29#define DRM_ATOMIC_H_
30
31#include <drm/drm_crtc.h>
32
33struct drm_atomic_state * __must_check
34drm_atomic_state_alloc(struct drm_device *dev);
35void drm_atomic_state_clear(struct drm_atomic_state *state);
36void drm_atomic_state_free(struct drm_atomic_state *state);
37
38struct drm_crtc_state * __must_check
39drm_atomic_get_crtc_state(struct drm_atomic_state *state,
40 struct drm_crtc *crtc);
41struct drm_plane_state * __must_check
42drm_atomic_get_plane_state(struct drm_atomic_state *state,
43 struct drm_plane *plane);
44struct drm_connector_state * __must_check
45drm_atomic_get_connector_state(struct drm_atomic_state *state,
46 struct drm_connector *connector);
47
48int __must_check
49drm_atomic_set_crtc_for_plane(struct drm_atomic_state *state,
50 struct drm_plane *plane, struct drm_crtc *crtc);
51void drm_atomic_set_fb_for_plane(struct drm_plane_state *plane_state,
52 struct drm_framebuffer *fb);
53int __must_check
54drm_atomic_set_crtc_for_connector(struct drm_connector_state *conn_state,
55 struct drm_crtc *crtc);
56int __must_check
57drm_atomic_add_affected_connectors(struct drm_atomic_state *state,
58 struct drm_crtc *crtc);
59int
60drm_atomic_connectors_for_crtc(struct drm_atomic_state *state,
61 struct drm_crtc *crtc);
62
63void drm_atomic_legacy_backoff(struct drm_atomic_state *state);
64
65int __must_check drm_atomic_check_only(struct drm_atomic_state *state);
66int __must_check drm_atomic_commit(struct drm_atomic_state *state);
67int __must_check drm_atomic_async_commit(struct drm_atomic_state *state);
68
69#endif /* DRM_ATOMIC_H_ */
diff --git a/include/drm/drm_atomic_helper.h b/include/drm/drm_atomic_helper.h
new file mode 100644
index 000000000000..f956b413311e
--- /dev/null
+++ b/include/drm/drm_atomic_helper.h
@@ -0,0 +1,126 @@
1/*
2 * Copyright (C) 2014 Red Hat
3 * Copyright (C) 2014 Intel Corp.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
19 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
20 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
21 * OTHER DEALINGS IN THE SOFTWARE.
22 *
23 * Authors:
24 * Rob Clark <robdclark@gmail.com>
25 * Daniel Vetter <daniel.vetter@ffwll.ch>
26 */
27
28#ifndef DRM_ATOMIC_HELPER_H_
29#define DRM_ATOMIC_HELPER_H_
30
31#include <drm/drm_crtc.h>
32
33int drm_atomic_helper_check(struct drm_device *dev,
34 struct drm_atomic_state *state);
35int drm_atomic_helper_commit(struct drm_device *dev,
36 struct drm_atomic_state *state,
37 bool async);
38
39void drm_atomic_helper_wait_for_vblanks(struct drm_device *dev,
40 struct drm_atomic_state *old_state);
41
42void drm_atomic_helper_commit_pre_planes(struct drm_device *dev,
43 struct drm_atomic_state *state);
44void drm_atomic_helper_commit_post_planes(struct drm_device *dev,
45 struct drm_atomic_state *old_state);
46
47int drm_atomic_helper_prepare_planes(struct drm_device *dev,
48 struct drm_atomic_state *state);
49void drm_atomic_helper_commit_planes(struct drm_device *dev,
50 struct drm_atomic_state *state);
51void drm_atomic_helper_cleanup_planes(struct drm_device *dev,
52 struct drm_atomic_state *old_state);
53
54void drm_atomic_helper_swap_state(struct drm_device *dev,
55 struct drm_atomic_state *state);
56
57/* implementations for legacy interfaces */
58int drm_atomic_helper_update_plane(struct drm_plane *plane,
59 struct drm_crtc *crtc,
60 struct drm_framebuffer *fb,
61 int crtc_x, int crtc_y,
62 unsigned int crtc_w, unsigned int crtc_h,
63 uint32_t src_x, uint32_t src_y,
64 uint32_t src_w, uint32_t src_h);
65int drm_atomic_helper_disable_plane(struct drm_plane *plane);
66int drm_atomic_helper_set_config(struct drm_mode_set *set);
67
68int drm_atomic_helper_crtc_set_property(struct drm_crtc *crtc,
69 struct drm_property *property,
70 uint64_t val);
71int drm_atomic_helper_plane_set_property(struct drm_plane *plane,
72 struct drm_property *property,
73 uint64_t val);
74int drm_atomic_helper_connector_set_property(struct drm_connector *connector,
75 struct drm_property *property,
76 uint64_t val);
77int drm_atomic_helper_page_flip(struct drm_crtc *crtc,
78 struct drm_framebuffer *fb,
79 struct drm_pending_vblank_event *event,
80 uint32_t flags);
81
82/* default implementations for state handling */
83void drm_atomic_helper_crtc_reset(struct drm_crtc *crtc);
84struct drm_crtc_state *
85drm_atomic_helper_crtc_duplicate_state(struct drm_crtc *crtc);
86void drm_atomic_helper_crtc_destroy_state(struct drm_crtc *crtc,
87 struct drm_crtc_state *state);
88
89void drm_atomic_helper_plane_reset(struct drm_plane *plane);
90struct drm_plane_state *
91drm_atomic_helper_plane_duplicate_state(struct drm_plane *plane);
92void drm_atomic_helper_plane_destroy_state(struct drm_plane *plane,
93 struct drm_plane_state *state);
94
95void drm_atomic_helper_connector_reset(struct drm_connector *connector);
96struct drm_connector_state *
97drm_atomic_helper_connector_duplicate_state(struct drm_connector *connector);
98void drm_atomic_helper_connector_destroy_state(struct drm_connector *connector,
99 struct drm_connector_state *state);
100
101/**
102 * drm_atomic_crtc_for_each_plane - iterate over planes currently attached to CRTC
103 * @plane: the loop cursor
104 * @crtc: the crtc whose planes are iterated
105 *
106 * This iterates over the current state, useful (for example) when applying
107 * atomic state after it has been checked and swapped. To iterate over the
108 * planes which *will* be attached (for ->atomic_check()) see
109 * drm_crtc_for_each_pending_plane()
110 */
111#define drm_atomic_crtc_for_each_plane(plane, crtc) \
112 drm_for_each_plane_mask(plane, (crtc)->dev, (crtc)->state->plane_mask)
113
114/**
115 * drm_crtc_atomic_state_for_each_plane - iterate over attached planes in new state
116 * @plane: the loop cursor
117 * @crtc_state: the incoming crtc-state
118 *
119 * Similar to drm_crtc_for_each_plane(), but iterates the planes that will be
120 * attached if the specified state is applied. Useful during (for example)
121 * ->atomic_check() operations, to validate the incoming state
122 */
123#define drm_atomic_crtc_state_for_each_plane(plane, crtc_state) \
124 drm_for_each_plane_mask(plane, (crtc_state)->state->dev, (crtc_state)->plane_mask)
125
126#endif /* DRM_ATOMIC_HELPER_H_ */
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index c40070a92d6b..b86329813ad3 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -42,6 +42,7 @@ struct drm_object_properties;
42struct drm_file; 42struct drm_file;
43struct drm_clip_rect; 43struct drm_clip_rect;
44struct device_node; 44struct device_node;
45struct fence;
45 46
46#define DRM_MODE_OBJECT_CRTC 0xcccccccc 47#define DRM_MODE_OBJECT_CRTC 0xcccccccc
47#define DRM_MODE_OBJECT_CONNECTOR 0xc0c0c0c0 48#define DRM_MODE_OBJECT_CONNECTOR 0xc0c0c0c0
@@ -136,14 +137,22 @@ struct drm_display_info {
136 u8 cea_rev; 137 u8 cea_rev;
137}; 138};
138 139
140/* data corresponds to displayid vend/prod/serial */
141struct drm_tile_group {
142 struct kref refcount;
143 struct drm_device *dev;
144 int id;
145 u8 group_data[8];
146};
147
139struct drm_framebuffer_funcs { 148struct drm_framebuffer_funcs {
140 /* note: use drm_framebuffer_remove() */ 149 /* note: use drm_framebuffer_remove() */
141 void (*destroy)(struct drm_framebuffer *framebuffer); 150 void (*destroy)(struct drm_framebuffer *framebuffer);
142 int (*create_handle)(struct drm_framebuffer *fb, 151 int (*create_handle)(struct drm_framebuffer *fb,
143 struct drm_file *file_priv, 152 struct drm_file *file_priv,
144 unsigned int *handle); 153 unsigned int *handle);
145 /** 154 /*
146 * Optinal callback for the dirty fb ioctl. 155 * Optional callback for the dirty fb ioctl.
147 * 156 *
148 * Userspace can notify the driver via this callback 157 * Userspace can notify the driver via this callback
149 * that a area of the framebuffer has changed and should 158 * that a area of the framebuffer has changed and should
@@ -196,7 +205,7 @@ struct drm_framebuffer {
196struct drm_property_blob { 205struct drm_property_blob {
197 struct drm_mode_object base; 206 struct drm_mode_object base;
198 struct list_head head; 207 struct list_head head;
199 unsigned int length; 208 size_t length;
200 unsigned char data[]; 209 unsigned char data[];
201}; 210};
202 211
@@ -215,7 +224,7 @@ struct drm_property {
215 uint64_t *values; 224 uint64_t *values;
216 struct drm_device *dev; 225 struct drm_device *dev;
217 226
218 struct list_head enum_blob_list; 227 struct list_head enum_list;
219}; 228};
220 229
221struct drm_crtc; 230struct drm_crtc;
@@ -224,19 +233,65 @@ struct drm_encoder;
224struct drm_pending_vblank_event; 233struct drm_pending_vblank_event;
225struct drm_plane; 234struct drm_plane;
226struct drm_bridge; 235struct drm_bridge;
236struct drm_atomic_state;
227 237
228/** 238/**
229 * drm_crtc_funcs - control CRTCs for a given device 239 * struct drm_crtc_state - mutable CRTC state
240 * @enable: whether the CRTC should be enabled, gates all other state
241 * @mode_changed: for use by helpers and drivers when computing state updates
242 * @plane_mask: bitmask of (1 << drm_plane_index(plane)) of attached planes
243 * @last_vblank_count: for helpers and drivers to capture the vblank of the
244 * update to ensure framebuffer cleanup isn't done too early
245 * @planes_changed: for use by helpers and drivers when computing state updates
246 * @adjusted_mode: for use by helpers and drivers to compute adjusted mode timings
247 * @mode: current mode timings
248 * @event: optional pointer to a DRM event to signal upon completion of the
249 * state update
250 * @state: backpointer to global drm_atomic_state
251 */
252struct drm_crtc_state {
253 bool enable;
254
255 /* computed state bits used by helpers and drivers */
256 bool planes_changed : 1;
257 bool mode_changed : 1;
258
259 /* attached planes bitmask:
260 * WARNING: transitional helpers do not maintain plane_mask so
261 * drivers not converted over to atomic helpers should not rely
262 * on plane_mask being accurate!
263 */
264 u32 plane_mask;
265
266 /* last_vblank_count: for vblank waits before cleanup */
267 u32 last_vblank_count;
268
269 /* adjusted_mode: for use by helpers and drivers */
270 struct drm_display_mode adjusted_mode;
271
272 struct drm_display_mode mode;
273
274 struct drm_pending_vblank_event *event;
275
276 struct drm_atomic_state *state;
277};
278
279/**
280 * struct drm_crtc_funcs - control CRTCs for a given device
230 * @save: save CRTC state 281 * @save: save CRTC state
231 * @restore: restore CRTC state 282 * @restore: restore CRTC state
232 * @reset: reset CRTC after state has been invalidated (e.g. resume) 283 * @reset: reset CRTC after state has been invalidated (e.g. resume)
233 * @cursor_set: setup the cursor 284 * @cursor_set: setup the cursor
285 * @cursor_set2: setup the cursor with hotspot, superseeds @cursor_set if set
234 * @cursor_move: move the cursor 286 * @cursor_move: move the cursor
235 * @gamma_set: specify color ramp for CRTC 287 * @gamma_set: specify color ramp for CRTC
236 * @destroy: deinit and free object 288 * @destroy: deinit and free object
237 * @set_property: called when a property is changed 289 * @set_property: called when a property is changed
238 * @set_config: apply a new CRTC configuration 290 * @set_config: apply a new CRTC configuration
239 * @page_flip: initiate a page flip 291 * @page_flip: initiate a page flip
292 * @atomic_duplicate_state: duplicate the atomic state for this CRTC
293 * @atomic_destroy_state: destroy an atomic state for this CRTC
294 * @atomic_set_property: set a property on an atomic state for this CRTC
240 * 295 *
241 * The drm_crtc_funcs structure is the central CRTC management structure 296 * The drm_crtc_funcs structure is the central CRTC management structure
242 * in the DRM. Each CRTC controls one or more connectors (note that the name 297 * in the DRM. Each CRTC controls one or more connectors (note that the name
@@ -287,16 +342,28 @@ struct drm_crtc_funcs {
287 342
288 int (*set_property)(struct drm_crtc *crtc, 343 int (*set_property)(struct drm_crtc *crtc,
289 struct drm_property *property, uint64_t val); 344 struct drm_property *property, uint64_t val);
345
346 /* atomic update handling */
347 struct drm_crtc_state *(*atomic_duplicate_state)(struct drm_crtc *crtc);
348 void (*atomic_destroy_state)(struct drm_crtc *crtc,
349 struct drm_crtc_state *state);
350 int (*atomic_set_property)(struct drm_crtc *crtc,
351 struct drm_crtc_state *state,
352 struct drm_property *property,
353 uint64_t val);
290}; 354};
291 355
292/** 356/**
293 * drm_crtc - central CRTC control structure 357 * struct drm_crtc - central CRTC control structure
294 * @dev: parent DRM device 358 * @dev: parent DRM device
359 * @port: OF node used by drm_of_find_possible_crtcs()
295 * @head: list management 360 * @head: list management
296 * @mutex: per-CRTC locking 361 * @mutex: per-CRTC locking
297 * @base: base KMS object for ID tracking etc. 362 * @base: base KMS object for ID tracking etc.
298 * @primary: primary plane for this CRTC 363 * @primary: primary plane for this CRTC
299 * @cursor: cursor plane for this CRTC 364 * @cursor: cursor plane for this CRTC
365 * @cursor_x: current x position of the cursor, used for universal cursor planes
366 * @cursor_y: current y position of the cursor, used for universal cursor planes
300 * @enabled: is this CRTC enabled? 367 * @enabled: is this CRTC enabled?
301 * @mode: current mode timings 368 * @mode: current mode timings
302 * @hwmode: mode timings as programmed to hw regs 369 * @hwmode: mode timings as programmed to hw regs
@@ -309,10 +376,13 @@ struct drm_crtc_funcs {
309 * @gamma_size: size of gamma ramp 376 * @gamma_size: size of gamma ramp
310 * @gamma_store: gamma ramp values 377 * @gamma_store: gamma ramp values
311 * @framedur_ns: precise frame timing 378 * @framedur_ns: precise frame timing
312 * @framedur_ns: precise line timing 379 * @linedur_ns: precise line timing
313 * @pixeldur_ns: precise pixel timing 380 * @pixeldur_ns: precise pixel timing
314 * @helper_private: mid-layer private data 381 * @helper_private: mid-layer private data
315 * @properties: property tracking for this CRTC 382 * @properties: property tracking for this CRTC
383 * @state: current atomic state for this CRTC
384 * @acquire_ctx: per-CRTC implicit acquire context used by atomic drivers for
385 * legacy ioctls
316 * 386 *
317 * Each CRTC may have one or more connectors associated with it. This structure 387 * Each CRTC may have one or more connectors associated with it. This structure
318 * allows the CRTC to be controlled. 388 * allows the CRTC to be controlled.
@@ -322,7 +392,7 @@ struct drm_crtc {
322 struct device_node *port; 392 struct device_node *port;
323 struct list_head head; 393 struct list_head head;
324 394
325 /** 395 /*
326 * crtc mutex 396 * crtc mutex
327 * 397 *
328 * This provides a read lock for the overall crtc state (mode, dpms 398 * This provides a read lock for the overall crtc state (mode, dpms
@@ -368,6 +438,8 @@ struct drm_crtc {
368 438
369 struct drm_object_properties properties; 439 struct drm_object_properties properties;
370 440
441 struct drm_crtc_state *state;
442
371 /* 443 /*
372 * For legacy crtc ioctls so that atomic drivers can get at the locking 444 * For legacy crtc ioctls so that atomic drivers can get at the locking
373 * acquire context. 445 * acquire context.
@@ -375,9 +447,22 @@ struct drm_crtc {
375 struct drm_modeset_acquire_ctx *acquire_ctx; 447 struct drm_modeset_acquire_ctx *acquire_ctx;
376}; 448};
377 449
450/**
451 * struct drm_connector_state - mutable connector state
452 * @crtc: CRTC to connect connector to, NULL if disabled
453 * @best_encoder: can be used by helpers and drivers to select the encoder
454 * @state: backpointer to global drm_atomic_state
455 */
456struct drm_connector_state {
457 struct drm_crtc *crtc; /* do not write directly, use drm_atomic_set_crtc_for_connector() */
458
459 struct drm_encoder *best_encoder;
460
461 struct drm_atomic_state *state;
462};
378 463
379/** 464/**
380 * drm_connector_funcs - control connectors on a given device 465 * struct drm_connector_funcs - control connectors on a given device
381 * @dpms: set power state (see drm_crtc_funcs above) 466 * @dpms: set power state (see drm_crtc_funcs above)
382 * @save: save connector state 467 * @save: save connector state
383 * @restore: restore connector state 468 * @restore: restore connector state
@@ -387,6 +472,9 @@ struct drm_crtc {
387 * @set_property: property for this connector may need an update 472 * @set_property: property for this connector may need an update
388 * @destroy: make object go away 473 * @destroy: make object go away
389 * @force: notify the driver that the connector is forced on 474 * @force: notify the driver that the connector is forced on
475 * @atomic_duplicate_state: duplicate the atomic state for this connector
476 * @atomic_destroy_state: destroy an atomic state for this connector
477 * @atomic_set_property: set a property on an atomic state for this connector
390 * 478 *
391 * Each CRTC may have one or more connectors attached to it. The functions 479 * Each CRTC may have one or more connectors attached to it. The functions
392 * below allow the core DRM code to control connectors, enumerate available modes, 480 * below allow the core DRM code to control connectors, enumerate available modes,
@@ -411,10 +499,19 @@ struct drm_connector_funcs {
411 uint64_t val); 499 uint64_t val);
412 void (*destroy)(struct drm_connector *connector); 500 void (*destroy)(struct drm_connector *connector);
413 void (*force)(struct drm_connector *connector); 501 void (*force)(struct drm_connector *connector);
502
503 /* atomic update handling */
504 struct drm_connector_state *(*atomic_duplicate_state)(struct drm_connector *connector);
505 void (*atomic_destroy_state)(struct drm_connector *connector,
506 struct drm_connector_state *state);
507 int (*atomic_set_property)(struct drm_connector *connector,
508 struct drm_connector_state *state,
509 struct drm_property *property,
510 uint64_t val);
414}; 511};
415 512
416/** 513/**
417 * drm_encoder_funcs - encoder controls 514 * struct drm_encoder_funcs - encoder controls
418 * @reset: reset state (e.g. at init or resume time) 515 * @reset: reset state (e.g. at init or resume time)
419 * @destroy: cleanup and free associated data 516 * @destroy: cleanup and free associated data
420 * 517 *
@@ -428,7 +525,7 @@ struct drm_encoder_funcs {
428#define DRM_CONNECTOR_MAX_ENCODER 3 525#define DRM_CONNECTOR_MAX_ENCODER 3
429 526
430/** 527/**
431 * drm_encoder - central DRM encoder structure 528 * struct drm_encoder - central DRM encoder structure
432 * @dev: parent DRM device 529 * @dev: parent DRM device
433 * @head: list management 530 * @head: list management
434 * @base: base KMS object 531 * @base: base KMS object
@@ -472,7 +569,7 @@ struct drm_encoder {
472#define MAX_ELD_BYTES 128 569#define MAX_ELD_BYTES 128
473 570
474/** 571/**
475 * drm_connector - central DRM connector control structure 572 * struct drm_connector - central DRM connector control structure
476 * @dev: parent DRM device 573 * @dev: parent DRM device
477 * @kdev: kernel device for sysfs attributes 574 * @kdev: kernel device for sysfs attributes
478 * @attr: sysfs attributes 575 * @attr: sysfs attributes
@@ -483,6 +580,7 @@ struct drm_encoder {
483 * @connector_type_id: index into connector type enum 580 * @connector_type_id: index into connector type enum
484 * @interlace_allowed: can this connector handle interlaced modes? 581 * @interlace_allowed: can this connector handle interlaced modes?
485 * @doublescan_allowed: can this connector handle doublescan? 582 * @doublescan_allowed: can this connector handle doublescan?
583 * @stereo_allowed: can this connector handle stereo modes?
486 * @modes: modes available on this connector (from fill_modes() + user) 584 * @modes: modes available on this connector (from fill_modes() + user)
487 * @status: one of the drm_connector_status enums (connected, not, or unknown) 585 * @status: one of the drm_connector_status enums (connected, not, or unknown)
488 * @probed_modes: list of modes derived directly from the display 586 * @probed_modes: list of modes derived directly from the display
@@ -490,10 +588,13 @@ struct drm_encoder {
490 * @funcs: connector control functions 588 * @funcs: connector control functions
491 * @edid_blob_ptr: DRM property containing EDID if present 589 * @edid_blob_ptr: DRM property containing EDID if present
492 * @properties: property tracking for this connector 590 * @properties: property tracking for this connector
591 * @path_blob_ptr: DRM blob property data for the DP MST path property
493 * @polled: a %DRM_CONNECTOR_POLL_<foo> value for core driven polling 592 * @polled: a %DRM_CONNECTOR_POLL_<foo> value for core driven polling
494 * @dpms: current dpms state 593 * @dpms: current dpms state
495 * @helper_private: mid-layer private data 594 * @helper_private: mid-layer private data
595 * @cmdline_mode: mode line parsed from the kernel cmdline for this connector
496 * @force: a %DRM_FORCE_<foo> state for forced mode sets 596 * @force: a %DRM_FORCE_<foo> state for forced mode sets
597 * @override_edid: has the EDID been overwritten through debugfs for testing?
497 * @encoder_ids: valid encoders for this connector 598 * @encoder_ids: valid encoders for this connector
498 * @encoder: encoder driving this connector, if any 599 * @encoder: encoder driving this connector, if any
499 * @eld: EDID-like data, if present 600 * @eld: EDID-like data, if present
@@ -503,6 +604,18 @@ struct drm_encoder {
503 * @video_latency: video latency info from ELD, if found 604 * @video_latency: video latency info from ELD, if found
504 * @audio_latency: audio latency info from ELD, if found 605 * @audio_latency: audio latency info from ELD, if found
505 * @null_edid_counter: track sinks that give us all zeros for the EDID 606 * @null_edid_counter: track sinks that give us all zeros for the EDID
607 * @bad_edid_counter: track sinks that give us an EDID with invalid checksum
608 * @debugfs_entry: debugfs directory for this connector
609 * @state: current atomic state for this connector
610 * @has_tile: is this connector connected to a tiled monitor
611 * @tile_group: tile group for the connected monitor
612 * @tile_is_single_monitor: whether the tile is one monitor housing
613 * @num_h_tile: number of horizontal tiles in the tile group
614 * @num_v_tile: number of vertical tiles in the tile group
615 * @tile_h_loc: horizontal location of this tile
616 * @tile_v_loc: vertical location of this tile
617 * @tile_h_size: horizontal size of this tile.
618 * @tile_v_size: vertical size of this tile.
506 * 619 *
507 * Each connector may be connected to one or more CRTCs, or may be clonable by 620 * Each connector may be connected to one or more CRTCs, or may be clonable by
508 * another connector if they can share a CRTC. Each connector also has a specific 621 * another connector if they can share a CRTC. Each connector also has a specific
@@ -538,6 +651,8 @@ struct drm_connector {
538 651
539 struct drm_property_blob *path_blob_ptr; 652 struct drm_property_blob *path_blob_ptr;
540 653
654 struct drm_property_blob *tile_blob_ptr;
655
541 uint8_t polled; /* DRM_CONNECTOR_POLL_* */ 656 uint8_t polled; /* DRM_CONNECTOR_POLL_* */
542 657
543 /* requested DPMS state */ 658 /* requested DPMS state */
@@ -563,14 +678,63 @@ struct drm_connector {
563 unsigned bad_edid_counter; 678 unsigned bad_edid_counter;
564 679
565 struct dentry *debugfs_entry; 680 struct dentry *debugfs_entry;
681
682 struct drm_connector_state *state;
683
684 /* DisplayID bits */
685 bool has_tile;
686 struct drm_tile_group *tile_group;
687 bool tile_is_single_monitor;
688
689 uint8_t num_h_tile, num_v_tile;
690 uint8_t tile_h_loc, tile_v_loc;
691 uint16_t tile_h_size, tile_v_size;
692};
693
694/**
695 * struct drm_plane_state - mutable plane state
696 * @crtc: currently bound CRTC, NULL if disabled
697 * @fb: currently bound framebuffer
698 * @fence: optional fence to wait for before scanning out @fb
699 * @crtc_x: left position of visible portion of plane on crtc
700 * @crtc_y: upper position of visible portion of plane on crtc
701 * @crtc_w: width of visible portion of plane on crtc
702 * @crtc_h: height of visible portion of plane on crtc
703 * @src_x: left position of visible portion of plane within
704 * plane (in 16.16)
705 * @src_y: upper position of visible portion of plane within
706 * plane (in 16.16)
707 * @src_w: width of visible portion of plane (in 16.16)
708 * @src_h: height of visible portion of plane (in 16.16)
709 * @state: backpointer to global drm_atomic_state
710 */
711struct drm_plane_state {
712 struct drm_crtc *crtc; /* do not write directly, use drm_atomic_set_crtc_for_plane() */
713 struct drm_framebuffer *fb; /* do not write directly, use drm_atomic_set_fb_for_plane() */
714 struct fence *fence;
715
716 /* Signed dest location allows it to be partially off screen */
717 int32_t crtc_x, crtc_y;
718 uint32_t crtc_w, crtc_h;
719
720 /* Source values are 16.16 fixed point */
721 uint32_t src_x, src_y;
722 uint32_t src_h, src_w;
723
724 struct drm_atomic_state *state;
566}; 725};
567 726
727
568/** 728/**
569 * drm_plane_funcs - driver plane control functions 729 * struct drm_plane_funcs - driver plane control functions
570 * @update_plane: update the plane configuration 730 * @update_plane: update the plane configuration
571 * @disable_plane: shut down the plane 731 * @disable_plane: shut down the plane
572 * @destroy: clean up plane resources 732 * @destroy: clean up plane resources
733 * @reset: reset plane after state has been invalidated (e.g. resume)
573 * @set_property: called when a property is changed 734 * @set_property: called when a property is changed
735 * @atomic_duplicate_state: duplicate the atomic state for this plane
736 * @atomic_destroy_state: destroy an atomic state for this plane
737 * @atomic_set_property: set a property on an atomic state for this plane
574 */ 738 */
575struct drm_plane_funcs { 739struct drm_plane_funcs {
576 int (*update_plane)(struct drm_plane *plane, 740 int (*update_plane)(struct drm_plane *plane,
@@ -585,6 +749,15 @@ struct drm_plane_funcs {
585 749
586 int (*set_property)(struct drm_plane *plane, 750 int (*set_property)(struct drm_plane *plane,
587 struct drm_property *property, uint64_t val); 751 struct drm_property *property, uint64_t val);
752
753 /* atomic update handling */
754 struct drm_plane_state *(*atomic_duplicate_state)(struct drm_plane *plane);
755 void (*atomic_destroy_state)(struct drm_plane *plane,
756 struct drm_plane_state *state);
757 int (*atomic_set_property)(struct drm_plane *plane,
758 struct drm_plane_state *state,
759 struct drm_property *property,
760 uint64_t val);
588}; 761};
589 762
590enum drm_plane_type { 763enum drm_plane_type {
@@ -594,7 +767,7 @@ enum drm_plane_type {
594}; 767};
595 768
596/** 769/**
597 * drm_plane - central DRM plane control structure 770 * struct drm_plane - central DRM plane control structure
598 * @dev: DRM device this plane belongs to 771 * @dev: DRM device this plane belongs to
599 * @head: for list management 772 * @head: for list management
600 * @base: base mode object 773 * @base: base mode object
@@ -603,14 +776,19 @@ enum drm_plane_type {
603 * @format_count: number of formats supported 776 * @format_count: number of formats supported
604 * @crtc: currently bound CRTC 777 * @crtc: currently bound CRTC
605 * @fb: currently bound fb 778 * @fb: currently bound fb
779 * @old_fb: Temporary tracking of the old fb while a modeset is ongoing. Used by
780 * drm_mode_set_config_internal() to implement correct refcounting.
606 * @funcs: helper functions 781 * @funcs: helper functions
607 * @properties: property tracking for this plane 782 * @properties: property tracking for this plane
608 * @type: type of plane (overlay, primary, cursor) 783 * @type: type of plane (overlay, primary, cursor)
784 * @state: current atomic state for this plane
609 */ 785 */
610struct drm_plane { 786struct drm_plane {
611 struct drm_device *dev; 787 struct drm_device *dev;
612 struct list_head head; 788 struct list_head head;
613 789
790 struct drm_modeset_lock mutex;
791
614 struct drm_mode_object base; 792 struct drm_mode_object base;
615 793
616 uint32_t possible_crtcs; 794 uint32_t possible_crtcs;
@@ -620,8 +798,6 @@ struct drm_plane {
620 struct drm_crtc *crtc; 798 struct drm_crtc *crtc;
621 struct drm_framebuffer *fb; 799 struct drm_framebuffer *fb;
622 800
623 /* Temporary tracking of the old fb while a modeset is ongoing. Used
624 * by drm_mode_set_config_internal to implement correct refcounting. */
625 struct drm_framebuffer *old_fb; 801 struct drm_framebuffer *old_fb;
626 802
627 const struct drm_plane_funcs *funcs; 803 const struct drm_plane_funcs *funcs;
@@ -629,10 +805,14 @@ struct drm_plane {
629 struct drm_object_properties properties; 805 struct drm_object_properties properties;
630 806
631 enum drm_plane_type type; 807 enum drm_plane_type type;
808
809 void *helper_private;
810
811 struct drm_plane_state *state;
632}; 812};
633 813
634/** 814/**
635 * drm_bridge_funcs - drm_bridge control functions 815 * struct drm_bridge_funcs - drm_bridge control functions
636 * @mode_fixup: Try to fixup (or reject entirely) proposed mode for this bridge 816 * @mode_fixup: Try to fixup (or reject entirely) proposed mode for this bridge
637 * @disable: Called right before encoder prepare, disables the bridge 817 * @disable: Called right before encoder prepare, disables the bridge
638 * @post_disable: Called right after encoder prepare, for lockstepped disable 818 * @post_disable: Called right after encoder prepare, for lockstepped disable
@@ -656,7 +836,7 @@ struct drm_bridge_funcs {
656}; 836};
657 837
658/** 838/**
659 * drm_bridge - central DRM bridge control structure 839 * struct drm_bridge - central DRM bridge control structure
660 * @dev: DRM device this bridge belongs to 840 * @dev: DRM device this bridge belongs to
661 * @head: list management 841 * @head: list management
662 * @base: base mode object 842 * @base: base mode object
@@ -674,8 +854,35 @@ struct drm_bridge {
674}; 854};
675 855
676/** 856/**
677 * drm_mode_set - new values for a CRTC config change 857 * struct struct drm_atomic_state - the global state object for atomic updates
678 * @head: list management 858 * @dev: parent DRM device
859 * @flags: state flags like async update
860 * @planes: pointer to array of plane pointers
861 * @plane_states: pointer to array of plane states pointers
862 * @crtcs: pointer to array of CRTC pointers
863 * @crtc_states: pointer to array of CRTC states pointers
864 * @num_connector: size of the @connectors and @connector_states arrays
865 * @connectors: pointer to array of connector pointers
866 * @connector_states: pointer to array of connector states pointers
867 * @acquire_ctx: acquire context for this atomic modeset state update
868 */
869struct drm_atomic_state {
870 struct drm_device *dev;
871 uint32_t flags;
872 struct drm_plane **planes;
873 struct drm_plane_state **plane_states;
874 struct drm_crtc **crtcs;
875 struct drm_crtc_state **crtc_states;
876 int num_connector;
877 struct drm_connector **connectors;
878 struct drm_connector_state **connector_states;
879
880 struct drm_modeset_acquire_ctx *acquire_ctx;
881};
882
883
884/**
885 * struct drm_mode_set - new values for a CRTC config change
679 * @fb: framebuffer to use for new config 886 * @fb: framebuffer to use for new config
680 * @crtc: CRTC whose configuration we're about to change 887 * @crtc: CRTC whose configuration we're about to change
681 * @mode: mode timings to use 888 * @mode: mode timings to use
@@ -705,6 +912,9 @@ struct drm_mode_set {
705 * struct drm_mode_config_funcs - basic driver provided mode setting functions 912 * struct drm_mode_config_funcs - basic driver provided mode setting functions
706 * @fb_create: create a new framebuffer object 913 * @fb_create: create a new framebuffer object
707 * @output_poll_changed: function to handle output configuration changes 914 * @output_poll_changed: function to handle output configuration changes
915 * @atomic_check: check whether a give atomic state update is possible
916 * @atomic_commit: commit an atomic state update previously verified with
917 * atomic_check()
708 * 918 *
709 * Some global (i.e. not per-CRTC, connector, etc) mode setting functions that 919 * Some global (i.e. not per-CRTC, connector, etc) mode setting functions that
710 * involve drivers. 920 * involve drivers.
@@ -714,13 +924,20 @@ struct drm_mode_config_funcs {
714 struct drm_file *file_priv, 924 struct drm_file *file_priv,
715 struct drm_mode_fb_cmd2 *mode_cmd); 925 struct drm_mode_fb_cmd2 *mode_cmd);
716 void (*output_poll_changed)(struct drm_device *dev); 926 void (*output_poll_changed)(struct drm_device *dev);
927
928 int (*atomic_check)(struct drm_device *dev,
929 struct drm_atomic_state *a);
930 int (*atomic_commit)(struct drm_device *dev,
931 struct drm_atomic_state *a,
932 bool async);
717}; 933};
718 934
719/** 935/**
720 * drm_mode_group - group of mode setting resources for potential sub-grouping 936 * struct drm_mode_group - group of mode setting resources for potential sub-grouping
721 * @num_crtcs: CRTC count 937 * @num_crtcs: CRTC count
722 * @num_encoders: encoder count 938 * @num_encoders: encoder count
723 * @num_connectors: connector count 939 * @num_connectors: connector count
940 * @num_bridges: bridge count
724 * @id_list: list of KMS object IDs in this group 941 * @id_list: list of KMS object IDs in this group
725 * 942 *
726 * Currently this simply tracks the global mode setting state. But in the 943 * Currently this simply tracks the global mode setting state. But in the
@@ -740,10 +957,14 @@ struct drm_mode_group {
740}; 957};
741 958
742/** 959/**
743 * drm_mode_config - Mode configuration control structure 960 * struct drm_mode_config - Mode configuration control structure
744 * @mutex: mutex protecting KMS related lists and structures 961 * @mutex: mutex protecting KMS related lists and structures
962 * @connection_mutex: ww mutex protecting connector state and routing
963 * @acquire_ctx: global implicit acquire context used by atomic drivers for
964 * legacy ioctls
745 * @idr_mutex: mutex for KMS ID allocation and management 965 * @idr_mutex: mutex for KMS ID allocation and management
746 * @crtc_idr: main KMS ID tracking object 966 * @crtc_idr: main KMS ID tracking object
967 * @fb_lock: mutex to protect fb state and lists
747 * @num_fb: number of fbs available 968 * @num_fb: number of fbs available
748 * @fb_list: list of framebuffers available 969 * @fb_list: list of framebuffers available
749 * @num_connector: number of connectors on this device 970 * @num_connector: number of connectors on this device
@@ -752,17 +973,28 @@ struct drm_mode_group {
752 * @bridge_list: list of bridge objects 973 * @bridge_list: list of bridge objects
753 * @num_encoder: number of encoders on this device 974 * @num_encoder: number of encoders on this device
754 * @encoder_list: list of encoder objects 975 * @encoder_list: list of encoder objects
976 * @num_overlay_plane: number of overlay planes on this device
977 * @num_total_plane: number of universal (i.e. with primary/curso) planes on this device
978 * @plane_list: list of plane objects
755 * @num_crtc: number of CRTCs on this device 979 * @num_crtc: number of CRTCs on this device
756 * @crtc_list: list of CRTC objects 980 * @crtc_list: list of CRTC objects
981 * @property_list: list of property objects
757 * @min_width: minimum pixel width on this device 982 * @min_width: minimum pixel width on this device
758 * @min_height: minimum pixel height on this device 983 * @min_height: minimum pixel height on this device
759 * @max_width: maximum pixel width on this device 984 * @max_width: maximum pixel width on this device
760 * @max_height: maximum pixel height on this device 985 * @max_height: maximum pixel height on this device
761 * @funcs: core driver provided mode setting functions 986 * @funcs: core driver provided mode setting functions
762 * @fb_base: base address of the framebuffer 987 * @fb_base: base address of the framebuffer
763 * @poll_enabled: track polling status for this device 988 * @poll_enabled: track polling support for this device
989 * @poll_running: track polling status for this device
764 * @output_poll_work: delayed work for polling in process context 990 * @output_poll_work: delayed work for polling in process context
991 * @property_blob_list: list of all the blob property objects
765 * @*_property: core property tracking 992 * @*_property: core property tracking
993 * @preferred_depth: preferred RBG pixel depth, used by fb helpers
994 * @prefer_shadow: hint to userspace to prefer shadow-fb rendering
995 * @async_page_flip: does this device support async flips on the primary plane?
996 * @cursor_width: hint to userspace for max cursor width
997 * @cursor_height: hint to userspace for max cursor height
766 * 998 *
767 * Core mode resource tracking structure. All CRTC, encoders, and connectors 999 * Core mode resource tracking structure. All CRTC, encoders, and connectors
768 * enumerated by the driver are added here, as are global properties. Some 1000 * enumerated by the driver are added here, as are global properties. Some
@@ -774,16 +1006,10 @@ struct drm_mode_config {
774 struct drm_modeset_acquire_ctx *acquire_ctx; /* for legacy _lock_all() / _unlock_all() */ 1006 struct drm_modeset_acquire_ctx *acquire_ctx; /* for legacy _lock_all() / _unlock_all() */
775 struct mutex idr_mutex; /* for IDR management */ 1007 struct mutex idr_mutex; /* for IDR management */
776 struct idr crtc_idr; /* use this idr for all IDs, fb, crtc, connector, modes - just makes life easier */ 1008 struct idr crtc_idr; /* use this idr for all IDs, fb, crtc, connector, modes - just makes life easier */
1009 struct idr tile_idr; /* use this idr for all IDs, fb, crtc, connector, modes - just makes life easier */
777 /* this is limited to one for now */ 1010 /* this is limited to one for now */
778 1011
779 1012 struct mutex fb_lock; /* proctects global and per-file fb lists */
780 /**
781 * fb_lock - mutex to protect fb state
782 *
783 * Besides the global fb list his also protects the fbs list in the
784 * file_priv
785 */
786 struct mutex fb_lock;
787 int num_fb; 1013 int num_fb;
788 struct list_head fb_list; 1014 struct list_head fb_list;
789 1015
@@ -824,6 +1050,7 @@ struct drm_mode_config {
824 struct drm_property *edid_property; 1050 struct drm_property *edid_property;
825 struct drm_property *dpms_property; 1051 struct drm_property *dpms_property;
826 struct drm_property *path_property; 1052 struct drm_property *path_property;
1053 struct drm_property *tile_property;
827 struct drm_property *plane_type_property; 1054 struct drm_property *plane_type_property;
828 struct drm_property *rotation_property; 1055 struct drm_property *rotation_property;
829 1056
@@ -851,6 +1078,10 @@ struct drm_mode_config {
851 struct drm_property *aspect_ratio_property; 1078 struct drm_property *aspect_ratio_property;
852 struct drm_property *dirty_info_property; 1079 struct drm_property *dirty_info_property;
853 1080
1081 /* properties for virtual machine layout */
1082 struct drm_property *suggested_x_property;
1083 struct drm_property *suggested_y_property;
1084
854 /* dumb ioctl parameters */ 1085 /* dumb ioctl parameters */
855 uint32_t preferred_depth, prefer_shadow; 1086 uint32_t preferred_depth, prefer_shadow;
856 1087
@@ -861,6 +1092,19 @@ struct drm_mode_config {
861 uint32_t cursor_width, cursor_height; 1092 uint32_t cursor_width, cursor_height;
862}; 1093};
863 1094
1095/**
1096 * drm_for_each_plane_mask - iterate over planes specified by bitmask
1097 * @plane: the loop cursor
1098 * @dev: the DRM device
1099 * @plane_mask: bitmask of plane indices
1100 *
1101 * Iterate over all planes specified by bitmask.
1102 */
1103#define drm_for_each_plane_mask(plane, dev, plane_mask) \
1104 list_for_each_entry((plane), &(dev)->mode_config.plane_list, head) \
1105 if ((plane_mask) & (1 << drm_plane_index(plane)))
1106
1107
864#define obj_to_crtc(x) container_of(x, struct drm_crtc, base) 1108#define obj_to_crtc(x) container_of(x, struct drm_crtc, base)
865#define obj_to_connector(x) container_of(x, struct drm_connector, base) 1109#define obj_to_connector(x) container_of(x, struct drm_connector, base)
866#define obj_to_encoder(x) container_of(x, struct drm_encoder, base) 1110#define obj_to_encoder(x) container_of(x, struct drm_encoder, base)
@@ -880,9 +1124,6 @@ extern int drm_crtc_init_with_planes(struct drm_device *dev,
880 struct drm_plane *primary, 1124 struct drm_plane *primary,
881 struct drm_plane *cursor, 1125 struct drm_plane *cursor,
882 const struct drm_crtc_funcs *funcs); 1126 const struct drm_crtc_funcs *funcs);
883extern int drm_crtc_init(struct drm_device *dev,
884 struct drm_crtc *crtc,
885 const struct drm_crtc_funcs *funcs);
886extern void drm_crtc_cleanup(struct drm_crtc *crtc); 1127extern void drm_crtc_cleanup(struct drm_crtc *crtc);
887extern unsigned int drm_crtc_index(struct drm_crtc *crtc); 1128extern unsigned int drm_crtc_index(struct drm_crtc *crtc);
888 1129
@@ -978,9 +1219,10 @@ extern void drm_mode_config_reset(struct drm_device *dev);
978extern void drm_mode_config_cleanup(struct drm_device *dev); 1219extern void drm_mode_config_cleanup(struct drm_device *dev);
979 1220
980extern int drm_mode_connector_set_path_property(struct drm_connector *connector, 1221extern int drm_mode_connector_set_path_property(struct drm_connector *connector,
981 char *path); 1222 const char *path);
1223int drm_mode_connector_set_tile_property(struct drm_connector *connector);
982extern int drm_mode_connector_update_edid_property(struct drm_connector *connector, 1224extern int drm_mode_connector_update_edid_property(struct drm_connector *connector,
983 struct edid *edid); 1225 const struct edid *edid);
984 1226
985static inline bool drm_property_type_is(struct drm_property *property, 1227static inline bool drm_property_type_is(struct drm_property *property,
986 uint32_t type) 1228 uint32_t type)
@@ -1041,11 +1283,13 @@ extern void drm_property_destroy(struct drm_device *dev, struct drm_property *pr
1041extern int drm_property_add_enum(struct drm_property *property, int index, 1283extern int drm_property_add_enum(struct drm_property *property, int index,
1042 uint64_t value, const char *name); 1284 uint64_t value, const char *name);
1043extern int drm_mode_create_dvi_i_properties(struct drm_device *dev); 1285extern int drm_mode_create_dvi_i_properties(struct drm_device *dev);
1044extern int drm_mode_create_tv_properties(struct drm_device *dev, int num_formats, 1286extern int drm_mode_create_tv_properties(struct drm_device *dev,
1045 char *formats[]); 1287 unsigned int num_modes,
1288 char *modes[]);
1046extern int drm_mode_create_scaling_mode_property(struct drm_device *dev); 1289extern int drm_mode_create_scaling_mode_property(struct drm_device *dev);
1047extern int drm_mode_create_aspect_ratio_property(struct drm_device *dev); 1290extern int drm_mode_create_aspect_ratio_property(struct drm_device *dev);
1048extern int drm_mode_create_dirty_info_property(struct drm_device *dev); 1291extern int drm_mode_create_dirty_info_property(struct drm_device *dev);
1292extern int drm_mode_create_suggested_offset_properties(struct drm_device *dev);
1049 1293
1050extern int drm_mode_connector_attach_encoder(struct drm_connector *connector, 1294extern int drm_mode_connector_attach_encoder(struct drm_connector *connector,
1051 struct drm_encoder *encoder); 1295 struct drm_encoder *encoder);
@@ -1113,6 +1357,13 @@ extern void drm_set_preferred_mode(struct drm_connector *connector,
1113extern int drm_edid_header_is_valid(const u8 *raw_edid); 1357extern int drm_edid_header_is_valid(const u8 *raw_edid);
1114extern bool drm_edid_block_valid(u8 *raw_edid, int block, bool print_bad_edid); 1358extern bool drm_edid_block_valid(u8 *raw_edid, int block, bool print_bad_edid);
1115extern bool drm_edid_is_valid(struct edid *edid); 1359extern bool drm_edid_is_valid(struct edid *edid);
1360
1361extern struct drm_tile_group *drm_mode_create_tile_group(struct drm_device *dev,
1362 char topology[8]);
1363extern struct drm_tile_group *drm_mode_get_tile_group(struct drm_device *dev,
1364 char topology[8]);
1365extern void drm_mode_put_tile_group(struct drm_device *dev,
1366 struct drm_tile_group *tg);
1116struct drm_display_mode *drm_mode_find_dmt(struct drm_device *dev, 1367struct drm_display_mode *drm_mode_find_dmt(struct drm_device *dev,
1117 int hsize, int vsize, int fresh, 1368 int hsize, int vsize, int fresh,
1118 bool rb); 1369 bool rb);
diff --git a/include/drm/drm_crtc_helper.h b/include/drm/drm_crtc_helper.h
index a3d75fefd010..7adbb65ea8ae 100644
--- a/include/drm/drm_crtc_helper.h
+++ b/include/drm/drm_crtc_helper.h
@@ -68,6 +68,7 @@ struct drm_crtc_helper_funcs {
68 int (*mode_set)(struct drm_crtc *crtc, struct drm_display_mode *mode, 68 int (*mode_set)(struct drm_crtc *crtc, struct drm_display_mode *mode,
69 struct drm_display_mode *adjusted_mode, int x, int y, 69 struct drm_display_mode *adjusted_mode, int x, int y,
70 struct drm_framebuffer *old_fb); 70 struct drm_framebuffer *old_fb);
71 void (*mode_set_nofb)(struct drm_crtc *crtc);
71 72
72 /* Move the crtc on the current fb to the given position *optional* */ 73 /* Move the crtc on the current fb to the given position *optional* */
73 int (*mode_set_base)(struct drm_crtc *crtc, int x, int y, 74 int (*mode_set_base)(struct drm_crtc *crtc, int x, int y,
@@ -81,6 +82,12 @@ struct drm_crtc_helper_funcs {
81 82
82 /* disable crtc when not in use - more explicit than dpms off */ 83 /* disable crtc when not in use - more explicit than dpms off */
83 void (*disable)(struct drm_crtc *crtc); 84 void (*disable)(struct drm_crtc *crtc);
85
86 /* atomic helpers */
87 int (*atomic_check)(struct drm_crtc *crtc,
88 struct drm_crtc_state *state);
89 void (*atomic_begin)(struct drm_crtc *crtc);
90 void (*atomic_flush)(struct drm_crtc *crtc);
84}; 91};
85 92
86/** 93/**
@@ -161,6 +168,12 @@ static inline void drm_connector_helper_add(struct drm_connector *connector,
161 168
162extern void drm_helper_resume_force_mode(struct drm_device *dev); 169extern void drm_helper_resume_force_mode(struct drm_device *dev);
163 170
171int drm_helper_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode,
172 struct drm_display_mode *adjusted_mode, int x, int y,
173 struct drm_framebuffer *old_fb);
174int drm_helper_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
175 struct drm_framebuffer *old_fb);
176
164/* drm_probe_helper.c */ 177/* drm_probe_helper.c */
165extern int drm_helper_probe_single_connector_modes(struct drm_connector 178extern int drm_helper_probe_single_connector_modes(struct drm_connector
166 *connector, uint32_t maxX, 179 *connector, uint32_t maxX,
diff --git a/include/drm/drm_displayid.h b/include/drm/drm_displayid.h
new file mode 100644
index 000000000000..623b4e98e748
--- /dev/null
+++ b/include/drm/drm_displayid.h
@@ -0,0 +1,76 @@
1/*
2 * Copyright © 2014 Red Hat Inc.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 */
22#ifndef DRM_DISPLAYID_H
23#define DRM_DISPLAYID_H
24
25#define DATA_BLOCK_PRODUCT_ID 0x00
26#define DATA_BLOCK_DISPLAY_PARAMETERS 0x01
27#define DATA_BLOCK_COLOR_CHARACTERISTICS 0x02
28#define DATA_BLOCK_TYPE_1_DETAILED_TIMING 0x03
29#define DATA_BLOCK_TYPE_2_DETAILED_TIMING 0x04
30#define DATA_BLOCK_TYPE_3_SHORT_TIMING 0x05
31#define DATA_BLOCK_TYPE_4_DMT_TIMING 0x06
32#define DATA_BLOCK_VESA_TIMING 0x07
33#define DATA_BLOCK_CEA_TIMING 0x08
34#define DATA_BLOCK_VIDEO_TIMING_RANGE 0x09
35#define DATA_BLOCK_PRODUCT_SERIAL_NUMBER 0x0a
36#define DATA_BLOCK_GP_ASCII_STRING 0x0b
37#define DATA_BLOCK_DISPLAY_DEVICE_DATA 0x0c
38#define DATA_BLOCK_INTERFACE_POWER_SEQUENCING 0x0d
39#define DATA_BLOCK_TRANSFER_CHARACTERISTICS 0x0e
40#define DATA_BLOCK_DISPLAY_INTERFACE 0x0f
41#define DATA_BLOCK_STEREO_DISPLAY_INTERFACE 0x10
42#define DATA_BLOCK_TILED_DISPLAY 0x12
43
44#define DATA_BLOCK_VENDOR_SPECIFIC 0x7f
45
46#define PRODUCT_TYPE_EXTENSION 0
47#define PRODUCT_TYPE_TEST 1
48#define PRODUCT_TYPE_PANEL 2
49#define PRODUCT_TYPE_MONITOR 3
50#define PRODUCT_TYPE_TV 4
51#define PRODUCT_TYPE_REPEATER 5
52#define PRODUCT_TYPE_DIRECT_DRIVE 6
53
54struct displayid_hdr {
55 u8 rev;
56 u8 bytes;
57 u8 prod_id;
58 u8 ext_count;
59} __packed;
60
61struct displayid_block {
62 u8 tag;
63 u8 rev;
64 u8 num_bytes;
65} __packed;
66
67struct displayid_tiled_block {
68 struct displayid_block base;
69 u8 tile_cap;
70 u8 topo[3];
71 u8 tile_size[4];
72 u8 tile_pixel_bezel[5];
73 u8 topology_id[8];
74} __packed;
75
76#endif
diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h
index 9305c718d789..11f8c84f98ce 100644
--- a/include/drm/drm_dp_helper.h
+++ b/include/drm/drm_dp_helper.h
@@ -303,7 +303,8 @@
303#define DP_TEST_CRC_B_CB 0x244 303#define DP_TEST_CRC_B_CB 0x244
304 304
305#define DP_TEST_SINK_MISC 0x246 305#define DP_TEST_SINK_MISC 0x246
306#define DP_TEST_CRC_SUPPORTED (1 << 5) 306# define DP_TEST_CRC_SUPPORTED (1 << 5)
307# define DP_TEST_COUNT_MASK 0x7
307 308
308#define DP_TEST_RESPONSE 0x260 309#define DP_TEST_RESPONSE 0x260
309# define DP_TEST_ACK (1 << 0) 310# define DP_TEST_ACK (1 << 0)
@@ -313,7 +314,7 @@
313#define DP_TEST_EDID_CHECKSUM 0x261 314#define DP_TEST_EDID_CHECKSUM 0x261
314 315
315#define DP_TEST_SINK 0x270 316#define DP_TEST_SINK 0x270
316#define DP_TEST_SINK_START (1 << 0) 317# define DP_TEST_SINK_START (1 << 0)
317 318
318#define DP_PAYLOAD_TABLE_UPDATE_STATUS 0x2c0 /* 1.2 MST */ 319#define DP_PAYLOAD_TABLE_UPDATE_STATUS 0x2c0 /* 1.2 MST */
319# define DP_PAYLOAD_TABLE_UPDATED (1 << 0) 320# define DP_PAYLOAD_TABLE_UPDATED (1 << 0)
@@ -404,26 +405,6 @@
404#define MODE_I2C_READ 4 405#define MODE_I2C_READ 4
405#define MODE_I2C_STOP 8 406#define MODE_I2C_STOP 8
406 407
407/**
408 * struct i2c_algo_dp_aux_data - driver interface structure for i2c over dp
409 * aux algorithm
410 * @running: set by the algo indicating whether an i2c is ongoing or whether
411 * the i2c bus is quiescent
412 * @address: i2c target address for the currently ongoing transfer
413 * @aux_ch: driver callback to transfer a single byte of the i2c payload
414 */
415struct i2c_algo_dp_aux_data {
416 bool running;
417 u16 address;
418 int (*aux_ch) (struct i2c_adapter *adapter,
419 int mode, uint8_t write_byte,
420 uint8_t *read_byte);
421};
422
423int
424i2c_dp_aux_add_bus(struct i2c_adapter *adapter);
425
426
427#define DP_LINK_STATUS_SIZE 6 408#define DP_LINK_STATUS_SIZE 6
428bool drm_dp_channel_eq_ok(const u8 link_status[DP_LINK_STATUS_SIZE], 409bool drm_dp_channel_eq_ok(const u8 link_status[DP_LINK_STATUS_SIZE],
429 int lane_count); 410 int lane_count);
@@ -550,6 +531,7 @@ struct drm_dp_aux {
550 struct mutex hw_mutex; 531 struct mutex hw_mutex;
551 ssize_t (*transfer)(struct drm_dp_aux *aux, 532 ssize_t (*transfer)(struct drm_dp_aux *aux,
552 struct drm_dp_aux_msg *msg); 533 struct drm_dp_aux_msg *msg);
534 unsigned i2c_nack_count, i2c_defer_count;
553}; 535};
554 536
555ssize_t drm_dp_dpcd_read(struct drm_dp_aux *aux, unsigned int offset, 537ssize_t drm_dp_dpcd_read(struct drm_dp_aux *aux, unsigned int offset,
diff --git a/include/drm/drm_dp_mst_helper.h b/include/drm/drm_dp_mst_helper.h
index 338fc1053835..00c1da927245 100644
--- a/include/drm/drm_dp_mst_helper.h
+++ b/include/drm/drm_dp_mst_helper.h
@@ -28,7 +28,7 @@
28struct drm_dp_mst_branch; 28struct drm_dp_mst_branch;
29 29
30/** 30/**
31 * struct drm_dp_vcpi - Virtual Channel Payload Identifer 31 * struct drm_dp_vcpi - Virtual Channel Payload Identifier
32 * @vcpi: Virtual channel ID. 32 * @vcpi: Virtual channel ID.
33 * @pbn: Payload Bandwidth Number for this channel 33 * @pbn: Payload Bandwidth Number for this channel
34 * @aligned_pbn: PBN aligned with slot size 34 * @aligned_pbn: PBN aligned with slot size
@@ -92,6 +92,8 @@ struct drm_dp_mst_port {
92 struct drm_dp_vcpi vcpi; 92 struct drm_dp_vcpi vcpi;
93 struct drm_connector *connector; 93 struct drm_connector *connector;
94 struct drm_dp_mst_topology_mgr *mgr; 94 struct drm_dp_mst_topology_mgr *mgr;
95
96 struct edid *cached_edid; /* for DP logical ports - make tiling work */
95}; 97};
96 98
97/** 99/**
@@ -371,7 +373,7 @@ struct drm_dp_sideband_msg_tx {
371struct drm_dp_mst_topology_mgr; 373struct drm_dp_mst_topology_mgr;
372struct drm_dp_mst_topology_cbs { 374struct drm_dp_mst_topology_cbs {
373 /* create a connector for a port */ 375 /* create a connector for a port */
374 struct drm_connector *(*add_connector)(struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port, char *path); 376 struct drm_connector *(*add_connector)(struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port, const char *path);
375 void (*destroy_connector)(struct drm_dp_mst_topology_mgr *mgr, 377 void (*destroy_connector)(struct drm_dp_mst_topology_mgr *mgr,
376 struct drm_connector *connector); 378 struct drm_connector *connector);
377 void (*hotplug)(struct drm_dp_mst_topology_mgr *mgr); 379 void (*hotplug)(struct drm_dp_mst_topology_mgr *mgr);
@@ -474,7 +476,7 @@ int drm_dp_mst_topology_mgr_set_mst(struct drm_dp_mst_topology_mgr *mgr, bool ms
474int drm_dp_mst_hpd_irq(struct drm_dp_mst_topology_mgr *mgr, u8 *esi, bool *handled); 476int drm_dp_mst_hpd_irq(struct drm_dp_mst_topology_mgr *mgr, u8 *esi, bool *handled);
475 477
476 478
477enum drm_connector_status drm_dp_mst_detect_port(struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port); 479enum drm_connector_status drm_dp_mst_detect_port(struct drm_connector *connector, struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port);
478 480
479struct edid *drm_dp_mst_get_edid(struct drm_connector *connector, struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port); 481struct edid *drm_dp_mst_get_edid(struct drm_connector *connector, struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port);
480 482
diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h
index b96031d947a0..87d85e81d3a7 100644
--- a/include/drm/drm_edid.h
+++ b/include/drm/drm_edid.h
@@ -27,12 +27,14 @@
27 27
28#define EDID_LENGTH 128 28#define EDID_LENGTH 128
29#define DDC_ADDR 0x50 29#define DDC_ADDR 0x50
30#define DDC_ADDR2 0x52 /* E-DDC 1.2 - where DisplayID can hide */
30 31
31#define CEA_EXT 0x02 32#define CEA_EXT 0x02
32#define VTB_EXT 0x10 33#define VTB_EXT 0x10
33#define DI_EXT 0x40 34#define DI_EXT 0x40
34#define LS_EXT 0x50 35#define LS_EXT 0x50
35#define MI_EXT 0x60 36#define MI_EXT 0x60
37#define DISPLAYID_EXT 0x70
36 38
37struct est_timings { 39struct est_timings {
38 u8 t1; 40 u8 t1;
@@ -207,6 +209,61 @@ struct detailed_timing {
207#define DRM_EDID_HDMI_DC_30 (1 << 4) 209#define DRM_EDID_HDMI_DC_30 (1 << 4)
208#define DRM_EDID_HDMI_DC_Y444 (1 << 3) 210#define DRM_EDID_HDMI_DC_Y444 (1 << 3)
209 211
212/* ELD Header Block */
213#define DRM_ELD_HEADER_BLOCK_SIZE 4
214
215#define DRM_ELD_VER 0
216# define DRM_ELD_VER_SHIFT 3
217# define DRM_ELD_VER_MASK (0x1f << 3)
218
219#define DRM_ELD_BASELINE_ELD_LEN 2 /* in dwords! */
220
221/* ELD Baseline Block for ELD_Ver == 2 */
222#define DRM_ELD_CEA_EDID_VER_MNL 4
223# define DRM_ELD_CEA_EDID_VER_SHIFT 5
224# define DRM_ELD_CEA_EDID_VER_MASK (7 << 5)
225# define DRM_ELD_CEA_EDID_VER_NONE (0 << 5)
226# define DRM_ELD_CEA_EDID_VER_CEA861 (1 << 5)
227# define DRM_ELD_CEA_EDID_VER_CEA861A (2 << 5)
228# define DRM_ELD_CEA_EDID_VER_CEA861BCD (3 << 5)
229# define DRM_ELD_MNL_SHIFT 0
230# define DRM_ELD_MNL_MASK (0x1f << 0)
231
232#define DRM_ELD_SAD_COUNT_CONN_TYPE 5
233# define DRM_ELD_SAD_COUNT_SHIFT 4
234# define DRM_ELD_SAD_COUNT_MASK (0xf << 4)
235# define DRM_ELD_CONN_TYPE_SHIFT 2
236# define DRM_ELD_CONN_TYPE_MASK (3 << 2)
237# define DRM_ELD_CONN_TYPE_HDMI (0 << 2)
238# define DRM_ELD_CONN_TYPE_DP (1 << 2)
239# define DRM_ELD_SUPPORTS_AI (1 << 1)
240# define DRM_ELD_SUPPORTS_HDCP (1 << 0)
241
242#define DRM_ELD_AUD_SYNCH_DELAY 6 /* in units of 2 ms */
243# define DRM_ELD_AUD_SYNCH_DELAY_MAX 0xfa /* 500 ms */
244
245#define DRM_ELD_SPEAKER 7
246# define DRM_ELD_SPEAKER_RLRC (1 << 6)
247# define DRM_ELD_SPEAKER_FLRC (1 << 5)
248# define DRM_ELD_SPEAKER_RC (1 << 4)
249# define DRM_ELD_SPEAKER_RLR (1 << 3)
250# define DRM_ELD_SPEAKER_FC (1 << 2)
251# define DRM_ELD_SPEAKER_LFE (1 << 1)
252# define DRM_ELD_SPEAKER_FLR (1 << 0)
253
254#define DRM_ELD_PORT_ID 8 /* offsets 8..15 inclusive */
255# define DRM_ELD_PORT_ID_LEN 8
256
257#define DRM_ELD_MANUFACTURER_NAME0 16
258#define DRM_ELD_MANUFACTURER_NAME1 17
259
260#define DRM_ELD_PRODUCT_CODE0 18
261#define DRM_ELD_PRODUCT_CODE1 19
262
263#define DRM_ELD_MONITOR_NAME_STRING 20 /* offsets 20..(20+mnl-1) inclusive */
264
265#define DRM_ELD_CEA_SAD(mnl, sad) (20 + (mnl) + 3 * (sad))
266
210struct edid { 267struct edid {
211 u8 header[8]; 268 u8 header[8];
212 /* Vendor & product info */ 269 /* Vendor & product info */
@@ -279,4 +336,56 @@ int
279drm_hdmi_vendor_infoframe_from_display_mode(struct hdmi_vendor_infoframe *frame, 336drm_hdmi_vendor_infoframe_from_display_mode(struct hdmi_vendor_infoframe *frame,
280 const struct drm_display_mode *mode); 337 const struct drm_display_mode *mode);
281 338
339/**
340 * drm_eld_mnl - Get ELD monitor name length in bytes.
341 * @eld: pointer to an eld memory structure with mnl set
342 */
343static inline int drm_eld_mnl(const uint8_t *eld)
344{
345 return (eld[DRM_ELD_CEA_EDID_VER_MNL] & DRM_ELD_MNL_MASK) >> DRM_ELD_MNL_SHIFT;
346}
347
348/**
349 * drm_eld_sad_count - Get ELD SAD count.
350 * @eld: pointer to an eld memory structure with sad_count set
351 */
352static inline int drm_eld_sad_count(const uint8_t *eld)
353{
354 return (eld[DRM_ELD_SAD_COUNT_CONN_TYPE] & DRM_ELD_SAD_COUNT_MASK) >>
355 DRM_ELD_SAD_COUNT_SHIFT;
356}
357
358/**
359 * drm_eld_calc_baseline_block_size - Calculate baseline block size in bytes
360 * @eld: pointer to an eld memory structure with mnl and sad_count set
361 *
362 * This is a helper for determining the payload size of the baseline block, in
363 * bytes, for e.g. setting the Baseline_ELD_Len field in the ELD header block.
364 */
365static inline int drm_eld_calc_baseline_block_size(const uint8_t *eld)
366{
367 return DRM_ELD_MONITOR_NAME_STRING - DRM_ELD_HEADER_BLOCK_SIZE +
368 drm_eld_mnl(eld) + drm_eld_sad_count(eld) * 3;
369}
370
371/**
372 * drm_eld_size - Get ELD size in bytes
373 * @eld: pointer to a complete eld memory structure
374 *
375 * The returned value does not include the vendor block. It's vendor specific,
376 * and comprises of the remaining bytes in the ELD memory buffer after
377 * drm_eld_size() bytes of header and baseline block.
378 *
379 * The returned value is guaranteed to be a multiple of 4.
380 */
381static inline int drm_eld_size(const uint8_t *eld)
382{
383 return DRM_ELD_HEADER_BLOCK_SIZE + eld[DRM_ELD_BASELINE_ELD_LEN] * 4;
384}
385
386struct edid *drm_do_get_edid(struct drm_connector *connector,
387 int (*get_edid_block)(void *data, u8 *buf, unsigned int block,
388 size_t len),
389 void *data);
390
282#endif /* __DRM_EDID_H__ */ 391#endif /* __DRM_EDID_H__ */
diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h
index f4ad254e3488..b597068103aa 100644
--- a/include/drm/drm_fb_helper.h
+++ b/include/drm/drm_fb_helper.h
@@ -34,9 +34,14 @@ struct drm_fb_helper;
34 34
35#include <linux/kgdb.h> 35#include <linux/kgdb.h>
36 36
37struct drm_fb_offset {
38 int x, y;
39};
40
37struct drm_fb_helper_crtc { 41struct drm_fb_helper_crtc {
38 struct drm_mode_set mode_set; 42 struct drm_mode_set mode_set;
39 struct drm_display_mode *desired_mode; 43 struct drm_display_mode *desired_mode;
44 int x, y;
40}; 45};
41 46
42struct drm_fb_helper_surface_size { 47struct drm_fb_helper_surface_size {
@@ -72,6 +77,7 @@ struct drm_fb_helper_funcs {
72 bool (*initial_config)(struct drm_fb_helper *fb_helper, 77 bool (*initial_config)(struct drm_fb_helper *fb_helper,
73 struct drm_fb_helper_crtc **crtcs, 78 struct drm_fb_helper_crtc **crtcs,
74 struct drm_display_mode **modes, 79 struct drm_display_mode **modes,
80 struct drm_fb_offset *offsets,
75 bool *enabled, int width, int height); 81 bool *enabled, int width, int height);
76}; 82};
77 83
diff --git a/include/drm/drm_flip_work.h b/include/drm/drm_flip_work.h
index 9eed34dcd6af..d387cf06ae05 100644
--- a/include/drm/drm_flip_work.h
+++ b/include/drm/drm_flip_work.h
@@ -25,6 +25,7 @@
25#define DRM_FLIP_WORK_H 25#define DRM_FLIP_WORK_H
26 26
27#include <linux/kfifo.h> 27#include <linux/kfifo.h>
28#include <linux/spinlock.h>
28#include <linux/workqueue.h> 29#include <linux/workqueue.h>
29 30
30/** 31/**
@@ -32,9 +33,9 @@
32 * 33 *
33 * Util to queue up work to run from work-queue context after flip/vblank. 34 * Util to queue up work to run from work-queue context after flip/vblank.
34 * Typically this can be used to defer unref of framebuffer's, cursor 35 * Typically this can be used to defer unref of framebuffer's, cursor
35 * bo's, etc until after vblank. The APIs are all safe (and lockless) 36 * bo's, etc until after vblank. The APIs are all thread-safe.
36 * for up to one producer and once consumer at a time. The single-consumer 37 * Moreover, drm_flip_work_queue_task and drm_flip_work_queue can be called
37 * aspect is ensured by committing the queued work to a single work-queue. 38 * in atomic context.
38 */ 39 */
39 40
40struct drm_flip_work; 41struct drm_flip_work;
@@ -51,26 +52,40 @@ struct drm_flip_work;
51typedef void (*drm_flip_func_t)(struct drm_flip_work *work, void *val); 52typedef void (*drm_flip_func_t)(struct drm_flip_work *work, void *val);
52 53
53/** 54/**
55 * struct drm_flip_task - flip work task
56 * @node: list entry element
57 * @data: data to pass to work->func
58 */
59struct drm_flip_task {
60 struct list_head node;
61 void *data;
62};
63
64/**
54 * struct drm_flip_work - flip work queue 65 * struct drm_flip_work - flip work queue
55 * @name: debug name 66 * @name: debug name
56 * @pending: number of queued but not committed items
57 * @count: number of committed items
58 * @func: callback fxn called for each committed item 67 * @func: callback fxn called for each committed item
59 * @worker: worker which calls @func 68 * @worker: worker which calls @func
60 * @fifo: queue of committed items 69 * @queued: queued tasks
70 * @commited: commited tasks
71 * @lock: lock to access queued and commited lists
61 */ 72 */
62struct drm_flip_work { 73struct drm_flip_work {
63 const char *name; 74 const char *name;
64 atomic_t pending, count;
65 drm_flip_func_t func; 75 drm_flip_func_t func;
66 struct work_struct worker; 76 struct work_struct worker;
67 DECLARE_KFIFO_PTR(fifo, void *); 77 struct list_head queued;
78 struct list_head commited;
79 spinlock_t lock;
68}; 80};
69 81
82struct drm_flip_task *drm_flip_work_allocate_task(void *data, gfp_t flags);
83void drm_flip_work_queue_task(struct drm_flip_work *work,
84 struct drm_flip_task *task);
70void drm_flip_work_queue(struct drm_flip_work *work, void *val); 85void drm_flip_work_queue(struct drm_flip_work *work, void *val);
71void drm_flip_work_commit(struct drm_flip_work *work, 86void drm_flip_work_commit(struct drm_flip_work *work,
72 struct workqueue_struct *wq); 87 struct workqueue_struct *wq);
73int drm_flip_work_init(struct drm_flip_work *work, int size, 88void drm_flip_work_init(struct drm_flip_work *work,
74 const char *name, drm_flip_func_t func); 89 const char *name, drm_flip_func_t func);
75void drm_flip_work_cleanup(struct drm_flip_work *work); 90void drm_flip_work_cleanup(struct drm_flip_work *work);
76 91
diff --git a/include/drm/drm_gem.h b/include/drm/drm_gem.h
index 1e6ae1458f7a..780511a459c0 100644
--- a/include/drm/drm_gem.h
+++ b/include/drm/drm_gem.h
@@ -119,6 +119,13 @@ struct drm_gem_object {
119 * simply leave it as NULL. 119 * simply leave it as NULL.
120 */ 120 */
121 struct dma_buf_attachment *import_attach; 121 struct dma_buf_attachment *import_attach;
122
123 /**
124 * dumb - created as dumb buffer
125 * Whether the gem object was created using the dumb buffer interface
126 * as such it may not be used for GPU rendering.
127 */
128 bool dumb;
122}; 129};
123 130
124void drm_gem_object_release(struct drm_gem_object *obj); 131void drm_gem_object_release(struct drm_gem_object *obj);
diff --git a/include/drm/drm_gem_cma_helper.h b/include/drm/drm_gem_cma_helper.h
index 2ff35f3de9c5..acd6af8a8e67 100644
--- a/include/drm/drm_gem_cma_helper.h
+++ b/include/drm/drm_gem_cma_helper.h
@@ -4,6 +4,13 @@
4#include <drm/drmP.h> 4#include <drm/drmP.h>
5#include <drm/drm_gem.h> 5#include <drm/drm_gem.h>
6 6
7/**
8 * struct drm_gem_cma_object - GEM object backed by CMA memory allocations
9 * @base: base GEM object
10 * @paddr: physical address of the backing memory
11 * @sgt: scatter/gather table for imported PRIME buffers
12 * @vaddr: kernel virtual address of the backing memory
13 */
7struct drm_gem_cma_object { 14struct drm_gem_cma_object {
8 struct drm_gem_object base; 15 struct drm_gem_object base;
9 dma_addr_t paddr; 16 dma_addr_t paddr;
@@ -19,23 +26,30 @@ to_drm_gem_cma_obj(struct drm_gem_object *gem_obj)
19 return container_of(gem_obj, struct drm_gem_cma_object, base); 26 return container_of(gem_obj, struct drm_gem_cma_object, base);
20} 27}
21 28
22/* free gem object. */ 29/* free GEM object */
23void drm_gem_cma_free_object(struct drm_gem_object *gem_obj); 30void drm_gem_cma_free_object(struct drm_gem_object *gem_obj);
24 31
25/* create memory region for drm framebuffer. */ 32/* create memory region for DRM framebuffer */
33int drm_gem_cma_dumb_create_internal(struct drm_file *file_priv,
34 struct drm_device *drm,
35 struct drm_mode_create_dumb *args);
36
37/* create memory region for DRM framebuffer */
26int drm_gem_cma_dumb_create(struct drm_file *file_priv, 38int drm_gem_cma_dumb_create(struct drm_file *file_priv,
27 struct drm_device *drm, struct drm_mode_create_dumb *args); 39 struct drm_device *drm,
40 struct drm_mode_create_dumb *args);
28 41
29/* map memory region for drm framebuffer to user space. */ 42/* map memory region for DRM framebuffer to user space */
30int drm_gem_cma_dumb_map_offset(struct drm_file *file_priv, 43int drm_gem_cma_dumb_map_offset(struct drm_file *file_priv,
31 struct drm_device *drm, uint32_t handle, uint64_t *offset); 44 struct drm_device *drm, u32 handle,
45 u64 *offset);
32 46
33/* set vm_flags and we can change the vm attribute to other one at here. */ 47/* set vm_flags and we can change the VM attribute to other one at here */
34int drm_gem_cma_mmap(struct file *filp, struct vm_area_struct *vma); 48int drm_gem_cma_mmap(struct file *filp, struct vm_area_struct *vma);
35 49
36/* allocate physical memory. */ 50/* allocate physical memory */
37struct drm_gem_cma_object *drm_gem_cma_create(struct drm_device *drm, 51struct drm_gem_cma_object *drm_gem_cma_create(struct drm_device *drm,
38 unsigned int size); 52 size_t size);
39 53
40extern const struct vm_operations_struct drm_gem_cma_vm_ops; 54extern const struct vm_operations_struct drm_gem_cma_vm_ops;
41 55
diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h
index 8569dc5a1026..f1d8d0dbb4f1 100644
--- a/include/drm/drm_mipi_dsi.h
+++ b/include/drm/drm_mipi_dsi.h
@@ -26,6 +26,7 @@ struct mipi_dsi_device;
26 * struct mipi_dsi_msg - read/write DSI buffer 26 * struct mipi_dsi_msg - read/write DSI buffer
27 * @channel: virtual channel id 27 * @channel: virtual channel id
28 * @type: payload data type 28 * @type: payload data type
29 * @flags: flags controlling this message transmission
29 * @tx_len: length of @tx_buf 30 * @tx_len: length of @tx_buf
30 * @tx_buf: data to be written 31 * @tx_buf: data to be written
31 * @rx_len: length of @rx_buf 32 * @rx_len: length of @rx_buf
@@ -43,12 +44,44 @@ struct mipi_dsi_msg {
43 void *rx_buf; 44 void *rx_buf;
44}; 45};
45 46
47bool mipi_dsi_packet_format_is_short(u8 type);
48bool mipi_dsi_packet_format_is_long(u8 type);
49
50/**
51 * struct mipi_dsi_packet - represents a MIPI DSI packet in protocol format
52 * @size: size (in bytes) of the packet
53 * @header: the four bytes that make up the header (Data ID, Word Count or
54 * Packet Data, and ECC)
55 * @payload_length: number of bytes in the payload
56 * @payload: a pointer to a buffer containing the payload, if any
57 */
58struct mipi_dsi_packet {
59 size_t size;
60 u8 header[4];
61 size_t payload_length;
62 const u8 *payload;
63};
64
65int mipi_dsi_create_packet(struct mipi_dsi_packet *packet,
66 const struct mipi_dsi_msg *msg);
67
46/** 68/**
47 * struct mipi_dsi_host_ops - DSI bus operations 69 * struct mipi_dsi_host_ops - DSI bus operations
48 * @attach: attach DSI device to DSI host 70 * @attach: attach DSI device to DSI host
49 * @detach: detach DSI device from DSI host 71 * @detach: detach DSI device from DSI host
50 * @transfer: send and/or receive DSI packet, return number of received bytes, 72 * @transfer: transmit a DSI packet
51 * or error 73 *
74 * DSI packets transmitted by .transfer() are passed in as mipi_dsi_msg
75 * structures. This structure contains information about the type of packet
76 * being transmitted as well as the transmit and receive buffers. When an
77 * error is encountered during transmission, this function will return a
78 * negative error code. On success it shall return the number of bytes
79 * transmitted for write packets or the number of bytes received for read
80 * packets.
81 *
82 * Note that typically DSI packet transmission is atomic, so the .transfer()
83 * function will seldomly return anything other than the number of bytes
84 * contained in the transmit buffer on success.
52 */ 85 */
53struct mipi_dsi_host_ops { 86struct mipi_dsi_host_ops {
54 int (*attach)(struct mipi_dsi_host *host, 87 int (*attach)(struct mipi_dsi_host *host,
@@ -56,7 +89,7 @@ struct mipi_dsi_host_ops {
56 int (*detach)(struct mipi_dsi_host *host, 89 int (*detach)(struct mipi_dsi_host *host,
57 struct mipi_dsi_device *dsi); 90 struct mipi_dsi_device *dsi);
58 ssize_t (*transfer)(struct mipi_dsi_host *host, 91 ssize_t (*transfer)(struct mipi_dsi_host *host,
59 struct mipi_dsi_msg *msg); 92 const struct mipi_dsi_msg *msg);
60}; 93};
61 94
62/** 95/**
@@ -130,12 +163,57 @@ static inline struct mipi_dsi_device *to_mipi_dsi_device(struct device *dev)
130 return container_of(dev, struct mipi_dsi_device, dev); 163 return container_of(dev, struct mipi_dsi_device, dev);
131} 164}
132 165
166struct mipi_dsi_device *of_find_mipi_dsi_device_by_node(struct device_node *np);
133int mipi_dsi_attach(struct mipi_dsi_device *dsi); 167int mipi_dsi_attach(struct mipi_dsi_device *dsi);
134int mipi_dsi_detach(struct mipi_dsi_device *dsi); 168int mipi_dsi_detach(struct mipi_dsi_device *dsi);
135ssize_t mipi_dsi_dcs_write(struct mipi_dsi_device *dsi, const void *data, 169int mipi_dsi_set_maximum_return_packet_size(struct mipi_dsi_device *dsi,
136 size_t len); 170 u16 value);
171
172ssize_t mipi_dsi_generic_write(struct mipi_dsi_device *dsi, const void *payload,
173 size_t size);
174ssize_t mipi_dsi_generic_read(struct mipi_dsi_device *dsi, const void *params,
175 size_t num_params, void *data, size_t size);
176
177/**
178 * enum mipi_dsi_dcs_tear_mode - Tearing Effect Output Line mode
179 * @MIPI_DSI_DCS_TEAR_MODE_VBLANK: the TE output line consists of V-Blanking
180 * information only
181 * @MIPI_DSI_DCS_TEAR_MODE_VHBLANK : the TE output line consists of both
182 * V-Blanking and H-Blanking information
183 */
184enum mipi_dsi_dcs_tear_mode {
185 MIPI_DSI_DCS_TEAR_MODE_VBLANK,
186 MIPI_DSI_DCS_TEAR_MODE_VHBLANK,
187};
188
189#define MIPI_DSI_DCS_POWER_MODE_DISPLAY (1 << 2)
190#define MIPI_DSI_DCS_POWER_MODE_NORMAL (1 << 3)
191#define MIPI_DSI_DCS_POWER_MODE_SLEEP (1 << 4)
192#define MIPI_DSI_DCS_POWER_MODE_PARTIAL (1 << 5)
193#define MIPI_DSI_DCS_POWER_MODE_IDLE (1 << 6)
194
195ssize_t mipi_dsi_dcs_write_buffer(struct mipi_dsi_device *dsi,
196 const void *data, size_t len);
197ssize_t mipi_dsi_dcs_write(struct mipi_dsi_device *dsi, u8 cmd,
198 const void *data, size_t len);
137ssize_t mipi_dsi_dcs_read(struct mipi_dsi_device *dsi, u8 cmd, void *data, 199ssize_t mipi_dsi_dcs_read(struct mipi_dsi_device *dsi, u8 cmd, void *data,
138 size_t len); 200 size_t len);
201int mipi_dsi_dcs_nop(struct mipi_dsi_device *dsi);
202int mipi_dsi_dcs_soft_reset(struct mipi_dsi_device *dsi);
203int mipi_dsi_dcs_get_power_mode(struct mipi_dsi_device *dsi, u8 *mode);
204int mipi_dsi_dcs_get_pixel_format(struct mipi_dsi_device *dsi, u8 *format);
205int mipi_dsi_dcs_enter_sleep_mode(struct mipi_dsi_device *dsi);
206int mipi_dsi_dcs_exit_sleep_mode(struct mipi_dsi_device *dsi);
207int mipi_dsi_dcs_set_display_off(struct mipi_dsi_device *dsi);
208int mipi_dsi_dcs_set_display_on(struct mipi_dsi_device *dsi);
209int mipi_dsi_dcs_set_column_address(struct mipi_dsi_device *dsi, u16 start,
210 u16 end);
211int mipi_dsi_dcs_set_page_address(struct mipi_dsi_device *dsi, u16 start,
212 u16 end);
213int mipi_dsi_dcs_set_tear_off(struct mipi_dsi_device *dsi);
214int mipi_dsi_dcs_set_tear_on(struct mipi_dsi_device *dsi,
215 enum mipi_dsi_dcs_tear_mode mode);
216int mipi_dsi_dcs_set_pixel_format(struct mipi_dsi_device *dsi, u8 format);
139 217
140/** 218/**
141 * struct mipi_dsi_driver - DSI driver 219 * struct mipi_dsi_driver - DSI driver
@@ -167,9 +245,13 @@ static inline void mipi_dsi_set_drvdata(struct mipi_dsi_device *dsi, void *data)
167 dev_set_drvdata(&dsi->dev, data); 245 dev_set_drvdata(&dsi->dev, data);
168} 246}
169 247
170int mipi_dsi_driver_register(struct mipi_dsi_driver *driver); 248int mipi_dsi_driver_register_full(struct mipi_dsi_driver *driver,
249 struct module *owner);
171void mipi_dsi_driver_unregister(struct mipi_dsi_driver *driver); 250void mipi_dsi_driver_unregister(struct mipi_dsi_driver *driver);
172 251
252#define mipi_dsi_driver_register(driver) \
253 mipi_dsi_driver_register_full(driver, THIS_MODULE)
254
173#define module_mipi_dsi_driver(__mipi_dsi_driver) \ 255#define module_mipi_dsi_driver(__mipi_dsi_driver) \
174 module_driver(__mipi_dsi_driver, mipi_dsi_driver_register, \ 256 module_driver(__mipi_dsi_driver, mipi_dsi_driver_register, \
175 mipi_dsi_driver_unregister) 257 mipi_dsi_driver_unregister)
diff --git a/include/drm/drm_modeset_lock.h b/include/drm/drm_modeset_lock.h
index 75a5c45e21c7..70595ff565ba 100644
--- a/include/drm/drm_modeset_lock.h
+++ b/include/drm/drm_modeset_lock.h
@@ -33,6 +33,7 @@ struct drm_modeset_lock;
33 * @ww_ctx: base acquire ctx 33 * @ww_ctx: base acquire ctx
34 * @contended: used internally for -EDEADLK handling 34 * @contended: used internally for -EDEADLK handling
35 * @locked: list of held locks 35 * @locked: list of held locks
36 * @trylock_only: trylock mode used in atomic contexts/panic notifiers
36 * 37 *
37 * Each thread competing for a set of locks must use one acquire 38 * Each thread competing for a set of locks must use one acquire
38 * ctx. And if any lock fxn returns -EDEADLK, it must backoff and 39 * ctx. And if any lock fxn returns -EDEADLK, it must backoff and
@@ -126,11 +127,13 @@ void drm_modeset_unlock(struct drm_modeset_lock *lock);
126 127
127struct drm_device; 128struct drm_device;
128struct drm_crtc; 129struct drm_crtc;
130struct drm_plane;
129 131
130void drm_modeset_lock_all(struct drm_device *dev); 132void drm_modeset_lock_all(struct drm_device *dev);
131int __drm_modeset_lock_all(struct drm_device *dev, bool trylock); 133int __drm_modeset_lock_all(struct drm_device *dev, bool trylock);
132void drm_modeset_unlock_all(struct drm_device *dev); 134void drm_modeset_unlock_all(struct drm_device *dev);
133void drm_modeset_lock_crtc(struct drm_crtc *crtc); 135void drm_modeset_lock_crtc(struct drm_crtc *crtc,
136 struct drm_plane *plane);
134void drm_modeset_unlock_crtc(struct drm_crtc *crtc); 137void drm_modeset_unlock_crtc(struct drm_crtc *crtc);
135void drm_warn_on_modeset_not_all_locked(struct drm_device *dev); 138void drm_warn_on_modeset_not_all_locked(struct drm_device *dev);
136struct drm_modeset_acquire_ctx * 139struct drm_modeset_acquire_ctx *
diff --git a/include/drm/drm_plane_helper.h b/include/drm/drm_plane_helper.h
index 52e6870534b2..a185392cafeb 100644
--- a/include/drm/drm_plane_helper.h
+++ b/include/drm/drm_plane_helper.h
@@ -25,6 +25,7 @@
25#define DRM_PLANE_HELPER_H 25#define DRM_PLANE_HELPER_H
26 26
27#include <drm/drm_rect.h> 27#include <drm/drm_rect.h>
28#include <drm/drm_crtc.h>
28 29
29/* 30/*
30 * Drivers that don't allow primary plane scaling may pass this macro in place 31 * Drivers that don't allow primary plane scaling may pass this macro in place
@@ -42,6 +43,37 @@
42 * planes. 43 * planes.
43 */ 44 */
44 45
46extern int drm_crtc_init(struct drm_device *dev,
47 struct drm_crtc *crtc,
48 const struct drm_crtc_funcs *funcs);
49
50/**
51 * drm_plane_helper_funcs - helper operations for CRTCs
52 * @prepare_fb: prepare a framebuffer for use by the plane
53 * @cleanup_fb: cleanup a framebuffer when it's no longer used by the plane
54 * @atomic_check: check that a given atomic state is valid and can be applied
55 * @atomic_update: apply an atomic state to the plane
56 *
57 * The helper operations are called by the mid-layer CRTC helper.
58 */
59struct drm_plane_helper_funcs {
60 int (*prepare_fb)(struct drm_plane *plane,
61 struct drm_framebuffer *fb);
62 void (*cleanup_fb)(struct drm_plane *plane,
63 struct drm_framebuffer *fb);
64
65 int (*atomic_check)(struct drm_plane *plane,
66 struct drm_plane_state *state);
67 void (*atomic_update)(struct drm_plane *plane,
68 struct drm_plane_state *old_state);
69};
70
71static inline void drm_plane_helper_add(struct drm_plane *plane,
72 const struct drm_plane_helper_funcs *funcs)
73{
74 plane->helper_private = (void *)funcs;
75}
76
45extern int drm_plane_helper_check_update(struct drm_plane *plane, 77extern int drm_plane_helper_check_update(struct drm_plane *plane,
46 struct drm_crtc *crtc, 78 struct drm_crtc *crtc,
47 struct drm_framebuffer *fb, 79 struct drm_framebuffer *fb,
@@ -68,4 +100,16 @@ extern struct drm_plane *drm_primary_helper_create_plane(struct drm_device *dev,
68 int num_formats); 100 int num_formats);
69 101
70 102
103int drm_plane_helper_update(struct drm_plane *plane, struct drm_crtc *crtc,
104 struct drm_framebuffer *fb,
105 int crtc_x, int crtc_y,
106 unsigned int crtc_w, unsigned int crtc_h,
107 uint32_t src_x, uint32_t src_y,
108 uint32_t src_w, uint32_t src_h);
109int drm_plane_helper_disable(struct drm_plane *plane);
110
111/* For use by drm_crtc_helper.c */
112int drm_plane_helper_commit(struct drm_plane *plane,
113 struct drm_plane_state *plane_state,
114 struct drm_framebuffer *old_fb);
71#endif 115#endif
diff --git a/include/drm/i915_pciids.h b/include/drm/i915_pciids.h
index a70d45647898..180ad0e6de21 100644
--- a/include/drm/i915_pciids.h
+++ b/include/drm/i915_pciids.h
@@ -259,4 +259,21 @@
259 INTEL_VGA_DEVICE(0x22b2, info), \ 259 INTEL_VGA_DEVICE(0x22b2, info), \
260 INTEL_VGA_DEVICE(0x22b3, info) 260 INTEL_VGA_DEVICE(0x22b3, info)
261 261
262#define INTEL_SKL_IDS(info) \
263 INTEL_VGA_DEVICE(0x1916, info), /* ULT GT2 */ \
264 INTEL_VGA_DEVICE(0x1906, info), /* ULT GT1 */ \
265 INTEL_VGA_DEVICE(0x1926, info), /* ULT GT3 */ \
266 INTEL_VGA_DEVICE(0x1921, info), /* ULT GT2F */ \
267 INTEL_VGA_DEVICE(0x190E, info), /* ULX GT1 */ \
268 INTEL_VGA_DEVICE(0x191E, info), /* ULX GT2 */ \
269 INTEL_VGA_DEVICE(0x1912, info), /* DT GT2 */ \
270 INTEL_VGA_DEVICE(0x1902, info), /* DT GT1 */ \
271 INTEL_VGA_DEVICE(0x191B, info), /* Halo GT2 */ \
272 INTEL_VGA_DEVICE(0x192B, info), /* Halo GT3 */ \
273 INTEL_VGA_DEVICE(0x190B, info), /* Halo GT1 */ \
274 INTEL_VGA_DEVICE(0x191A, info), /* SRV GT2 */ \
275 INTEL_VGA_DEVICE(0x192A, info), /* SRV GT3 */ \
276 INTEL_VGA_DEVICE(0x190A, info), /* SRV GT1 */ \
277 INTEL_VGA_DEVICE(0x191D, info) /* WKS GT2 */
278
262#endif /* _I915_PCIIDS_H */ 279#endif /* _I915_PCIIDS_H */
diff --git a/include/drm/ttm/ttm_execbuf_util.h b/include/drm/ttm/ttm_execbuf_util.h
index 460441714413..b620c317c772 100644
--- a/include/drm/ttm/ttm_execbuf_util.h
+++ b/include/drm/ttm/ttm_execbuf_util.h
@@ -68,6 +68,7 @@ extern void ttm_eu_backoff_reservation(struct ww_acquire_ctx *ticket,
68 * non-blocking reserves should be tried. 68 * non-blocking reserves should be tried.
69 * @list: thread private list of ttm_validate_buffer structs. 69 * @list: thread private list of ttm_validate_buffer structs.
70 * @intr: should the wait be interruptible 70 * @intr: should the wait be interruptible
71 * @dups: [out] optional list of duplicates.
71 * 72 *
72 * Tries to reserve bos pointed to by the list entries for validation. 73 * Tries to reserve bos pointed to by the list entries for validation.
73 * If the function returns 0, all buffers are marked as "unfenced", 74 * If the function returns 0, all buffers are marked as "unfenced",
@@ -83,6 +84,11 @@ extern void ttm_eu_backoff_reservation(struct ww_acquire_ctx *ticket,
83 * calling process receives a signal while waiting. In that case, no 84 * calling process receives a signal while waiting. In that case, no
84 * buffers on the list will be reserved upon return. 85 * buffers on the list will be reserved upon return.
85 * 86 *
87 * If dups is non NULL all buffers already reserved by the current thread
88 * (e.g. duplicates) are added to this list, otherwise -EALREADY is returned
89 * on the first already reserved buffer and all buffers from the list are
90 * unreserved again.
91 *
86 * Buffers reserved by this function should be unreserved by 92 * Buffers reserved by this function should be unreserved by
87 * a call to either ttm_eu_backoff_reservation() or 93 * a call to either ttm_eu_backoff_reservation() or
88 * ttm_eu_fence_buffer_objects() when command submission is complete or 94 * ttm_eu_fence_buffer_objects() when command submission is complete or
@@ -90,7 +96,8 @@ extern void ttm_eu_backoff_reservation(struct ww_acquire_ctx *ticket,
90 */ 96 */
91 97
92extern int ttm_eu_reserve_buffers(struct ww_acquire_ctx *ticket, 98extern int ttm_eu_reserve_buffers(struct ww_acquire_ctx *ticket,
93 struct list_head *list, bool intr); 99 struct list_head *list, bool intr,
100 struct list_head *dups);
94 101
95/** 102/**
96 * function ttm_eu_fence_buffer_objects. 103 * function ttm_eu_fence_buffer_objects.
diff --git a/include/linux/hdmi.h b/include/linux/hdmi.h
index 11c0182a153b..cbb5790a35cd 100644
--- a/include/linux/hdmi.h
+++ b/include/linux/hdmi.h
@@ -1,9 +1,24 @@
1/* 1/*
2 * Copyright (C) 2012 Avionic Design GmbH 2 * Copyright (C) 2012 Avionic Design GmbH
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify 4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * it under the terms of the GNU General Public License version 2 as 5 * copy of this software and associated documentation files (the "Software"),
6 * published by the Free Software Foundation. 6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sub license,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the
12 * next paragraph) shall be included in all copies or substantial portions
13 * of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
7 */ 22 */
8 23
9#ifndef __LINUX_HDMI_H_ 24#ifndef __LINUX_HDMI_H_
diff --git a/include/linux/mmu_notifier.h b/include/linux/mmu_notifier.h
index ab8564b03468..95243d28a0ee 100644
--- a/include/linux/mmu_notifier.h
+++ b/include/linux/mmu_notifier.h
@@ -98,11 +98,11 @@ struct mmu_notifier_ops {
98 /* 98 /*
99 * invalidate_range_start() and invalidate_range_end() must be 99 * invalidate_range_start() and invalidate_range_end() must be
100 * paired and are called only when the mmap_sem and/or the 100 * paired and are called only when the mmap_sem and/or the
101 * locks protecting the reverse maps are held. The subsystem 101 * locks protecting the reverse maps are held. If the subsystem
102 * must guarantee that no additional references are taken to 102 * can't guarantee that no additional references are taken to
103 * the pages in the range established between the call to 103 * the pages in the range, it has to implement the
104 * invalidate_range_start() and the matching call to 104 * invalidate_range() notifier to remove any references taken
105 * invalidate_range_end(). 105 * after invalidate_range_start().
106 * 106 *
107 * Invalidation of multiple concurrent ranges may be 107 * Invalidation of multiple concurrent ranges may be
108 * optionally permitted by the driver. Either way the 108 * optionally permitted by the driver. Either way the
@@ -144,6 +144,29 @@ struct mmu_notifier_ops {
144 void (*invalidate_range_end)(struct mmu_notifier *mn, 144 void (*invalidate_range_end)(struct mmu_notifier *mn,
145 struct mm_struct *mm, 145 struct mm_struct *mm,
146 unsigned long start, unsigned long end); 146 unsigned long start, unsigned long end);
147
148 /*
149 * invalidate_range() is either called between
150 * invalidate_range_start() and invalidate_range_end() when the
151 * VM has to free pages that where unmapped, but before the
152 * pages are actually freed, or outside of _start()/_end() when
153 * a (remote) TLB is necessary.
154 *
155 * If invalidate_range() is used to manage a non-CPU TLB with
156 * shared page-tables, it not necessary to implement the
157 * invalidate_range_start()/end() notifiers, as
158 * invalidate_range() alread catches the points in time when an
159 * external TLB range needs to be flushed.
160 *
161 * The invalidate_range() function is called under the ptl
162 * spin-lock and not allowed to sleep.
163 *
164 * Note that this function might be called with just a sub-range
165 * of what was passed to invalidate_range_start()/end(), if
166 * called between those functions.
167 */
168 void (*invalidate_range)(struct mmu_notifier *mn, struct mm_struct *mm,
169 unsigned long start, unsigned long end);
147}; 170};
148 171
149/* 172/*
@@ -190,6 +213,8 @@ extern void __mmu_notifier_invalidate_range_start(struct mm_struct *mm,
190 unsigned long start, unsigned long end); 213 unsigned long start, unsigned long end);
191extern void __mmu_notifier_invalidate_range_end(struct mm_struct *mm, 214extern void __mmu_notifier_invalidate_range_end(struct mm_struct *mm,
192 unsigned long start, unsigned long end); 215 unsigned long start, unsigned long end);
216extern void __mmu_notifier_invalidate_range(struct mm_struct *mm,
217 unsigned long start, unsigned long end);
193 218
194static inline void mmu_notifier_release(struct mm_struct *mm) 219static inline void mmu_notifier_release(struct mm_struct *mm)
195{ 220{
@@ -242,6 +267,13 @@ static inline void mmu_notifier_invalidate_range_end(struct mm_struct *mm,
242 __mmu_notifier_invalidate_range_end(mm, start, end); 267 __mmu_notifier_invalidate_range_end(mm, start, end);
243} 268}
244 269
270static inline void mmu_notifier_invalidate_range(struct mm_struct *mm,
271 unsigned long start, unsigned long end)
272{
273 if (mm_has_notifiers(mm))
274 __mmu_notifier_invalidate_range(mm, start, end);
275}
276
245static inline void mmu_notifier_mm_init(struct mm_struct *mm) 277static inline void mmu_notifier_mm_init(struct mm_struct *mm)
246{ 278{
247 mm->mmu_notifier_mm = NULL; 279 mm->mmu_notifier_mm = NULL;
@@ -279,6 +311,44 @@ static inline void mmu_notifier_mm_destroy(struct mm_struct *mm)
279 __young; \ 311 __young; \
280}) 312})
281 313
314#define ptep_clear_flush_notify(__vma, __address, __ptep) \
315({ \
316 unsigned long ___addr = __address & PAGE_MASK; \
317 struct mm_struct *___mm = (__vma)->vm_mm; \
318 pte_t ___pte; \
319 \
320 ___pte = ptep_clear_flush(__vma, __address, __ptep); \
321 mmu_notifier_invalidate_range(___mm, ___addr, \
322 ___addr + PAGE_SIZE); \
323 \
324 ___pte; \
325})
326
327#define pmdp_clear_flush_notify(__vma, __haddr, __pmd) \
328({ \
329 unsigned long ___haddr = __haddr & HPAGE_PMD_MASK; \
330 struct mm_struct *___mm = (__vma)->vm_mm; \
331 pmd_t ___pmd; \
332 \
333 ___pmd = pmdp_clear_flush(__vma, __haddr, __pmd); \
334 mmu_notifier_invalidate_range(___mm, ___haddr, \
335 ___haddr + HPAGE_PMD_SIZE); \
336 \
337 ___pmd; \
338})
339
340#define pmdp_get_and_clear_notify(__mm, __haddr, __pmd) \
341({ \
342 unsigned long ___haddr = __haddr & HPAGE_PMD_MASK; \
343 pmd_t ___pmd; \
344 \
345 ___pmd = pmdp_get_and_clear(__mm, __haddr, __pmd); \
346 mmu_notifier_invalidate_range(__mm, ___haddr, \
347 ___haddr + HPAGE_PMD_SIZE); \
348 \
349 ___pmd; \
350})
351
282/* 352/*
283 * set_pte_at_notify() sets the pte _after_ running the notifier. 353 * set_pte_at_notify() sets the pte _after_ running the notifier.
284 * This is safe to start by updating the secondary MMUs, because the primary MMU 354 * This is safe to start by updating the secondary MMUs, because the primary MMU
@@ -342,6 +412,11 @@ static inline void mmu_notifier_invalidate_range_end(struct mm_struct *mm,
342{ 412{
343} 413}
344 414
415static inline void mmu_notifier_invalidate_range(struct mm_struct *mm,
416 unsigned long start, unsigned long end)
417{
418}
419
345static inline void mmu_notifier_mm_init(struct mm_struct *mm) 420static inline void mmu_notifier_mm_init(struct mm_struct *mm)
346{ 421{
347} 422}
@@ -352,6 +427,9 @@ static inline void mmu_notifier_mm_destroy(struct mm_struct *mm)
352 427
353#define ptep_clear_flush_young_notify ptep_clear_flush_young 428#define ptep_clear_flush_young_notify ptep_clear_flush_young
354#define pmdp_clear_flush_young_notify pmdp_clear_flush_young 429#define pmdp_clear_flush_young_notify pmdp_clear_flush_young
430#define ptep_clear_flush_notify ptep_clear_flush
431#define pmdp_clear_flush_notify pmdp_clear_flush
432#define pmdp_get_and_clear_notify pmdp_get_and_clear
355#define set_pte_at_notify set_pte_at 433#define set_pte_at_notify set_pte_at
356 434
357#endif /* CONFIG_MMU_NOTIFIER */ 435#endif /* CONFIG_MMU_NOTIFIER */
diff --git a/include/linux/platform_data/rcar-du.h b/include/linux/platform_data/rcar-du.h
deleted file mode 100644
index a5f045e1d8fe..000000000000
--- a/include/linux/platform_data/rcar-du.h
+++ /dev/null
@@ -1,74 +0,0 @@
1/*
2 * rcar_du.h -- R-Car Display Unit DRM driver
3 *
4 * Copyright (C) 2013 Renesas Corporation
5 *
6 * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 */
13
14#ifndef __RCAR_DU_H__
15#define __RCAR_DU_H__
16
17#include <video/videomode.h>
18
19enum rcar_du_output {
20 RCAR_DU_OUTPUT_DPAD0,
21 RCAR_DU_OUTPUT_DPAD1,
22 RCAR_DU_OUTPUT_LVDS0,
23 RCAR_DU_OUTPUT_LVDS1,
24 RCAR_DU_OUTPUT_TCON,
25 RCAR_DU_OUTPUT_MAX,
26};
27
28enum rcar_du_encoder_type {
29 RCAR_DU_ENCODER_UNUSED = 0,
30 RCAR_DU_ENCODER_NONE,
31 RCAR_DU_ENCODER_VGA,
32 RCAR_DU_ENCODER_LVDS,
33};
34
35struct rcar_du_panel_data {
36 unsigned int width_mm; /* Panel width in mm */
37 unsigned int height_mm; /* Panel height in mm */
38 struct videomode mode;
39};
40
41struct rcar_du_connector_lvds_data {
42 struct rcar_du_panel_data panel;
43};
44
45struct rcar_du_connector_vga_data {
46 /* TODO: Add DDC information for EDID retrieval */
47};
48
49/*
50 * struct rcar_du_encoder_data - Encoder platform data
51 * @type: the encoder type (RCAR_DU_ENCODER_*)
52 * @output: the DU output the connector is connected to (RCAR_DU_OUTPUT_*)
53 * @connector.lvds: platform data for LVDS connectors
54 * @connector.vga: platform data for VGA connectors
55 *
56 * Encoder platform data describes an on-board encoder, its associated DU SoC
57 * output, and the connector.
58 */
59struct rcar_du_encoder_data {
60 enum rcar_du_encoder_type type;
61 enum rcar_du_output output;
62
63 union {
64 struct rcar_du_connector_lvds_data lvds;
65 struct rcar_du_connector_vga_data vga;
66 } connector;
67};
68
69struct rcar_du_platform_data {
70 struct rcar_du_encoder_data *encoders;
71 unsigned int num_encoders;
72};
73
74#endif /* __RCAR_DU_H__ */
diff --git a/include/trace/events/host1x.h b/include/trace/events/host1x.h
index 94db6a2c3540..63116362543c 100644
--- a/include/trace/events/host1x.h
+++ b/include/trace/events/host1x.h
@@ -29,6 +29,8 @@
29#include <linux/ktime.h> 29#include <linux/ktime.h>
30#include <linux/tracepoint.h> 30#include <linux/tracepoint.h>
31 31
32struct host1x_bo;
33
32DECLARE_EVENT_CLASS(host1x, 34DECLARE_EVENT_CLASS(host1x,
33 TP_PROTO(const char *name), 35 TP_PROTO(const char *name),
34 TP_ARGS(name), 36 TP_ARGS(name),
@@ -79,14 +81,14 @@ TRACE_EVENT(host1x_cdma_push,
79); 81);
80 82
81TRACE_EVENT(host1x_cdma_push_gather, 83TRACE_EVENT(host1x_cdma_push_gather,
82 TP_PROTO(const char *name, u32 mem_id, 84 TP_PROTO(const char *name, struct host1x_bo *bo,
83 u32 words, u32 offset, void *cmdbuf), 85 u32 words, u32 offset, void *cmdbuf),
84 86
85 TP_ARGS(name, mem_id, words, offset, cmdbuf), 87 TP_ARGS(name, bo, words, offset, cmdbuf),
86 88
87 TP_STRUCT__entry( 89 TP_STRUCT__entry(
88 __field(const char *, name) 90 __field(const char *, name)
89 __field(u32, mem_id) 91 __field(struct host1x_bo *, bo)
90 __field(u32, words) 92 __field(u32, words)
91 __field(u32, offset) 93 __field(u32, offset)
92 __field(bool, cmdbuf) 94 __field(bool, cmdbuf)
@@ -100,13 +102,13 @@ TRACE_EVENT(host1x_cdma_push_gather,
100 } 102 }
101 __entry->cmdbuf = cmdbuf; 103 __entry->cmdbuf = cmdbuf;
102 __entry->name = name; 104 __entry->name = name;
103 __entry->mem_id = mem_id; 105 __entry->bo = bo;
104 __entry->words = words; 106 __entry->words = words;
105 __entry->offset = offset; 107 __entry->offset = offset;
106 ), 108 ),
107 109
108 TP_printk("name=%s, mem_id=%08x, words=%u, offset=%d, contents=[%s]", 110 TP_printk("name=%s, bo=%p, words=%u, offset=%d, contents=[%s]",
109 __entry->name, __entry->mem_id, 111 __entry->name, __entry->bo,
110 __entry->words, __entry->offset, 112 __entry->words, __entry->offset,
111 __print_hex(__get_dynamic_array(cmdbuf), 113 __print_hex(__get_dynamic_array(cmdbuf),
112 __entry->cmdbuf ? __entry->words * 4 : 0)) 114 __entry->cmdbuf ? __entry->words * 4 : 0))
@@ -221,12 +223,13 @@ TRACE_EVENT(host1x_syncpt_load_min,
221); 223);
222 224
223TRACE_EVENT(host1x_syncpt_wait_check, 225TRACE_EVENT(host1x_syncpt_wait_check,
224 TP_PROTO(void *mem_id, u32 offset, u32 syncpt_id, u32 thresh, u32 min), 226 TP_PROTO(struct host1x_bo *bo, u32 offset, u32 syncpt_id, u32 thresh,
227 u32 min),
225 228
226 TP_ARGS(mem_id, offset, syncpt_id, thresh, min), 229 TP_ARGS(bo, offset, syncpt_id, thresh, min),
227 230
228 TP_STRUCT__entry( 231 TP_STRUCT__entry(
229 __field(void *, mem_id) 232 __field(struct host1x_bo *, bo)
230 __field(u32, offset) 233 __field(u32, offset)
231 __field(u32, syncpt_id) 234 __field(u32, syncpt_id)
232 __field(u32, thresh) 235 __field(u32, thresh)
@@ -234,15 +237,15 @@ TRACE_EVENT(host1x_syncpt_wait_check,
234 ), 237 ),
235 238
236 TP_fast_assign( 239 TP_fast_assign(
237 __entry->mem_id = mem_id; 240 __entry->bo = bo;
238 __entry->offset = offset; 241 __entry->offset = offset;
239 __entry->syncpt_id = syncpt_id; 242 __entry->syncpt_id = syncpt_id;
240 __entry->thresh = thresh; 243 __entry->thresh = thresh;
241 __entry->min = min; 244 __entry->min = min;
242 ), 245 ),
243 246
244 TP_printk("mem_id=%p, offset=%05x, id=%d, thresh=%d, current=%d", 247 TP_printk("bo=%p, offset=%05x, id=%d, thresh=%d, current=%d",
245 __entry->mem_id, __entry->offset, 248 __entry->bo, __entry->offset,
246 __entry->syncpt_id, __entry->thresh, 249 __entry->syncpt_id, __entry->thresh,
247 __entry->min) 250 __entry->min)
248); 251);
diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h
index a0db2d4aa5f0..86574b0005ff 100644
--- a/include/uapi/drm/drm_mode.h
+++ b/include/uapi/drm/drm_mode.h
@@ -286,6 +286,8 @@ struct drm_mode_get_property {
286 char name[DRM_PROP_NAME_LEN]; 286 char name[DRM_PROP_NAME_LEN];
287 287
288 __u32 count_values; 288 __u32 count_values;
289 /* This is only used to count enum values, not blobs. The _blobs is
290 * simply because of a historical reason, i.e. backwards compat. */
289 __u32 count_enum_blobs; 291 __u32 count_enum_blobs;
290}; 292};
291 293
diff --git a/include/uapi/drm/i915_drm.h b/include/uapi/drm/i915_drm.h
index ff57f07c3249..250262265ee3 100644
--- a/include/uapi/drm/i915_drm.h
+++ b/include/uapi/drm/i915_drm.h
@@ -340,6 +340,7 @@ typedef struct drm_i915_irq_wait {
340#define I915_PARAM_HAS_EXEC_HANDLE_LUT 26 340#define I915_PARAM_HAS_EXEC_HANDLE_LUT 26
341#define I915_PARAM_HAS_WT 27 341#define I915_PARAM_HAS_WT 27
342#define I915_PARAM_CMD_PARSER_VERSION 28 342#define I915_PARAM_CMD_PARSER_VERSION 28
343#define I915_PARAM_HAS_COHERENT_PHYS_GTT 29
343 344
344typedef struct drm_i915_getparam { 345typedef struct drm_i915_getparam {
345 int param; 346 int param;
@@ -876,6 +877,12 @@ struct drm_i915_gem_get_tiling {
876 * mmap mapping. 877 * mmap mapping.
877 */ 878 */
878 __u32 swizzle_mode; 879 __u32 swizzle_mode;
880
881 /**
882 * Returned address bit 6 swizzling required for CPU access through
883 * mmap mapping whilst bound.
884 */
885 __u32 phys_swizzle_mode;
879}; 886};
880 887
881struct drm_i915_gem_get_aperture { 888struct drm_i915_gem_get_aperture {
diff --git a/include/uapi/linux/kfd_ioctl.h b/include/uapi/linux/kfd_ioctl.h
new file mode 100644
index 000000000000..7acef41fc209
--- /dev/null
+++ b/include/uapi/linux/kfd_ioctl.h
@@ -0,0 +1,154 @@
1/*
2 * Copyright 2014 Advanced Micro Devices, Inc.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 */
22
23#ifndef KFD_IOCTL_H_INCLUDED
24#define KFD_IOCTL_H_INCLUDED
25
26#include <linux/types.h>
27#include <linux/ioctl.h>
28
29#define KFD_IOCTL_MAJOR_VERSION 1
30#define KFD_IOCTL_MINOR_VERSION 0
31
32struct kfd_ioctl_get_version_args {
33 uint32_t major_version; /* from KFD */
34 uint32_t minor_version; /* from KFD */
35};
36
37/* For kfd_ioctl_create_queue_args.queue_type. */
38#define KFD_IOC_QUEUE_TYPE_COMPUTE 0
39#define KFD_IOC_QUEUE_TYPE_SDMA 1
40#define KFD_IOC_QUEUE_TYPE_COMPUTE_AQL 2
41
42#define KFD_MAX_QUEUE_PERCENTAGE 100
43#define KFD_MAX_QUEUE_PRIORITY 15
44
45struct kfd_ioctl_create_queue_args {
46 uint64_t ring_base_address; /* to KFD */
47 uint64_t write_pointer_address; /* from KFD */
48 uint64_t read_pointer_address; /* from KFD */
49 uint64_t doorbell_offset; /* from KFD */
50
51 uint32_t ring_size; /* to KFD */
52 uint32_t gpu_id; /* to KFD */
53 uint32_t queue_type; /* to KFD */
54 uint32_t queue_percentage; /* to KFD */
55 uint32_t queue_priority; /* to KFD */
56 uint32_t queue_id; /* from KFD */
57
58 uint64_t eop_buffer_address; /* to KFD */
59 uint64_t eop_buffer_size; /* to KFD */
60 uint64_t ctx_save_restore_address; /* to KFD */
61 uint64_t ctx_save_restore_size; /* to KFD */
62};
63
64struct kfd_ioctl_destroy_queue_args {
65 uint32_t queue_id; /* to KFD */
66 uint32_t pad;
67};
68
69struct kfd_ioctl_update_queue_args {
70 uint64_t ring_base_address; /* to KFD */
71
72 uint32_t queue_id; /* to KFD */
73 uint32_t ring_size; /* to KFD */
74 uint32_t queue_percentage; /* to KFD */
75 uint32_t queue_priority; /* to KFD */
76};
77
78/* For kfd_ioctl_set_memory_policy_args.default_policy and alternate_policy */
79#define KFD_IOC_CACHE_POLICY_COHERENT 0
80#define KFD_IOC_CACHE_POLICY_NONCOHERENT 1
81
82struct kfd_ioctl_set_memory_policy_args {
83 uint64_t alternate_aperture_base; /* to KFD */
84 uint64_t alternate_aperture_size; /* to KFD */
85
86 uint32_t gpu_id; /* to KFD */
87 uint32_t default_policy; /* to KFD */
88 uint32_t alternate_policy; /* to KFD */
89 uint32_t pad;
90};
91
92/*
93 * All counters are monotonic. They are used for profiling of compute jobs.
94 * The profiling is done by userspace.
95 *
96 * In case of GPU reset, the counter should not be affected.
97 */
98
99struct kfd_ioctl_get_clock_counters_args {
100 uint64_t gpu_clock_counter; /* from KFD */
101 uint64_t cpu_clock_counter; /* from KFD */
102 uint64_t system_clock_counter; /* from KFD */
103 uint64_t system_clock_freq; /* from KFD */
104
105 uint32_t gpu_id; /* to KFD */
106 uint32_t pad;
107};
108
109#define NUM_OF_SUPPORTED_GPUS 7
110
111struct kfd_process_device_apertures {
112 uint64_t lds_base; /* from KFD */
113 uint64_t lds_limit; /* from KFD */
114 uint64_t scratch_base; /* from KFD */
115 uint64_t scratch_limit; /* from KFD */
116 uint64_t gpuvm_base; /* from KFD */
117 uint64_t gpuvm_limit; /* from KFD */
118 uint32_t gpu_id; /* from KFD */
119 uint32_t pad;
120};
121
122struct kfd_ioctl_get_process_apertures_args {
123 struct kfd_process_device_apertures
124 process_apertures[NUM_OF_SUPPORTED_GPUS];/* from KFD */
125
126 /* from KFD, should be in the range [1 - NUM_OF_SUPPORTED_GPUS] */
127 uint32_t num_of_nodes;
128 uint32_t pad;
129};
130
131#define KFD_IOC_MAGIC 'K'
132
133#define KFD_IOC_GET_VERSION \
134 _IOR(KFD_IOC_MAGIC, 1, struct kfd_ioctl_get_version_args)
135
136#define KFD_IOC_CREATE_QUEUE \
137 _IOWR(KFD_IOC_MAGIC, 2, struct kfd_ioctl_create_queue_args)
138
139#define KFD_IOC_DESTROY_QUEUE \
140 _IOWR(KFD_IOC_MAGIC, 3, struct kfd_ioctl_destroy_queue_args)
141
142#define KFD_IOC_SET_MEMORY_POLICY \
143 _IOW(KFD_IOC_MAGIC, 4, struct kfd_ioctl_set_memory_policy_args)
144
145#define KFD_IOC_GET_CLOCK_COUNTERS \
146 _IOWR(KFD_IOC_MAGIC, 5, struct kfd_ioctl_get_clock_counters_args)
147
148#define KFD_IOC_GET_PROCESS_APERTURES \
149 _IOR(KFD_IOC_MAGIC, 6, struct kfd_ioctl_get_process_apertures_args)
150
151#define KFD_IOC_UPDATE_QUEUE \
152 _IOW(KFD_IOC_MAGIC, 7, struct kfd_ioctl_update_queue_args)
153
154#endif