aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2016-11-10 18:28:44 -0500
committerDave Airlie <airlied@redhat.com>2016-11-10 18:28:44 -0500
commit3e91168a6a76f7e21c44f04ebf953589ca59f03c (patch)
tree27b12142f17fc575fd40825b91e7e8773994f13d /include
parentdb8feb6979e91c2e916631a75dbfe9f10f6b05e5 (diff)
parent4b514e10157a8e34a5e909487ef6fb8342e2e3ad (diff)
Merge tag 'topic/drm-misc-2016-11-10' of git://anongit.freedesktop.org/drm-intel into drm-next
- better atomic state debugging from Rob - fence prep from gustavo - sumits flushed out his backlog of pending dma-buf/fence patches from various people - drm_mm leak debugging plus trying to appease Kconfig (Chris) - a few misc things all over * tag 'topic/drm-misc-2016-11-10' of git://anongit.freedesktop.org/drm-intel: (35 commits) drm: Make DRM_DEBUG_MM depend on STACKTRACE_SUPPORT drm/i915: Restrict DRM_DEBUG_MM automatic selection drm: Restrict stackdepot usage to builtin drm.ko drm/msm: module param to dump state on error irq drm/msm/mdp5: add atomic_print_state support drm/atomic: add debugfs file to dump out atomic state drm/atomic: add new drm_debug bit to dump atomic state drm: add helpers to go from plane state to drm_rect drm: add helper for printing to log or seq_file drm: helper macros to print composite types reservation: revert "wait only with non-zero timeout specified (v3)" v2 drm/ttm: fix ttm_bo_wait dma-buf/fence: revert "don't wait when specified timeout is zero" (v2) dma-buf/fence: make timeout handling in fence_default_wait consistent (v2) drm/amdgpu: add the interface of waiting multiple fences (v4) dma-buf: return index of the first signaled fence (v2) MAINTAINERS: update Sync File Framework files dma-buf/sw_sync: put fence reference from the fence creation dma-buf/sw_sync: mark sync_timeline_create() static drm: Add stackdepot include for DRM_DEBUG_MM ...
Diffstat (limited to 'include')
-rw-r--r--include/drm/drmP.h27
-rw-r--r--include/drm/drm_atomic.h9
-rw-r--r--include/drm/drm_connector.h13
-rw-r--r--include/drm/drm_crtc.h13
-rw-r--r--include/drm/drm_mm.h6
-rw-r--r--include/drm/drm_modeset_helper_vtables.h16
-rw-r--r--include/drm/drm_plane.h93
-rw-r--r--include/drm/drm_print.h117
-rw-r--r--include/linux/dma-fence.h3
-rw-r--r--include/uapi/drm/amdgpu_drm.h28
-rw-r--r--include/uapi/drm/drm_mode.h10
11 files changed, 312 insertions, 23 deletions
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index e336e3901876..4e58137c1882 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -135,6 +135,7 @@ struct dma_buf_attachment;
135#define DRM_UT_PRIME 0x08 135#define DRM_UT_PRIME 0x08
136#define DRM_UT_ATOMIC 0x10 136#define DRM_UT_ATOMIC 0x10
137#define DRM_UT_VBL 0x20 137#define DRM_UT_VBL 0x20
138#define DRM_UT_STATE 0x40
138 139
139extern __printf(6, 7) 140extern __printf(6, 7)
140void drm_dev_printk(const struct device *dev, const char *level, 141void drm_dev_printk(const struct device *dev, const char *level,
@@ -306,6 +307,27 @@ void drm_printk(const char *level, unsigned int category,
306#define DRM_DEBUG_PRIME_RATELIMITED(fmt, args...) \ 307#define DRM_DEBUG_PRIME_RATELIMITED(fmt, args...) \
307 DRM_DEV_DEBUG_PRIME_RATELIMITED(NULL, fmt, ##args) 308 DRM_DEV_DEBUG_PRIME_RATELIMITED(NULL, fmt, ##args)
308 309
310/* Format strings and argument splitters to simplify printing
311 * various "complex" objects
312 */
313#define DRM_MODE_FMT "%d:\"%s\" %d %d %d %d %d %d %d %d %d %d 0x%x 0x%x"
314#define DRM_MODE_ARG(m) \
315 (m)->base.id, (m)->name, (m)->vrefresh, (m)->clock, \
316 (m)->hdisplay, (m)->hsync_start, (m)->hsync_end, (m)->htotal, \
317 (m)->vdisplay, (m)->vsync_start, (m)->vsync_end, (m)->vtotal, \
318 (m)->type, (m)->flags
319
320#define DRM_RECT_FMT "%dx%d%+d%+d"
321#define DRM_RECT_ARG(r) drm_rect_width(r), drm_rect_height(r), (r)->x1, (r)->y1
322
323/* for rect's in fixed-point format: */
324#define DRM_RECT_FP_FMT "%d.%06ux%d.%06u%+d.%06u%+d.%06u"
325#define DRM_RECT_FP_ARG(r) \
326 drm_rect_width(r) >> 16, ((drm_rect_width(r) & 0xffff) * 15625) >> 10, \
327 drm_rect_height(r) >> 16, ((drm_rect_height(r) & 0xffff) * 15625) >> 10, \
328 (r)->x1 >> 16, (((r)->x1 & 0xffff) * 15625) >> 10, \
329 (r)->y1 >> 16, (((r)->y1 & 0xffff) * 15625) >> 10
330
309/*@}*/ 331/*@}*/
310 332
311/***********************************************************************/ 333/***********************************************************************/
@@ -941,8 +963,13 @@ static inline bool drm_is_primary_client(const struct drm_file *file_priv)
941extern int drm_ioctl_permit(u32 flags, struct drm_file *file_priv); 963extern int drm_ioctl_permit(u32 flags, struct drm_file *file_priv);
942extern long drm_ioctl(struct file *filp, 964extern long drm_ioctl(struct file *filp,
943 unsigned int cmd, unsigned long arg); 965 unsigned int cmd, unsigned long arg);
966#ifdef CONFIG_COMPAT
944extern long drm_compat_ioctl(struct file *filp, 967extern long drm_compat_ioctl(struct file *filp,
945 unsigned int cmd, unsigned long arg); 968 unsigned int cmd, unsigned long arg);
969#else
970/* Let drm_compat_ioctl be assigned to .compat_ioctl unconditionally */
971#define drm_compat_ioctl NULL
972#endif
946extern bool drm_ioctl_flags(unsigned int nr, unsigned int *flags); 973extern bool drm_ioctl_flags(unsigned int nr, unsigned int *flags);
947 974
948/* File Operations (drm_fops.c) */ 975/* File Operations (drm_fops.c) */
diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h
index fc8af53b18aa..331bb100b718 100644
--- a/include/drm/drm_atomic.h
+++ b/include/drm/drm_atomic.h
@@ -345,6 +345,8 @@ drm_atomic_set_crtc_for_plane(struct drm_plane_state *plane_state,
345 struct drm_crtc *crtc); 345 struct drm_crtc *crtc);
346void drm_atomic_set_fb_for_plane(struct drm_plane_state *plane_state, 346void drm_atomic_set_fb_for_plane(struct drm_plane_state *plane_state,
347 struct drm_framebuffer *fb); 347 struct drm_framebuffer *fb);
348void drm_atomic_set_fence_for_plane(struct drm_plane_state *plane_state,
349 struct dma_fence *fence);
348int __must_check 350int __must_check
349drm_atomic_set_crtc_for_connector(struct drm_connector_state *conn_state, 351drm_atomic_set_crtc_for_connector(struct drm_connector_state *conn_state,
350 struct drm_crtc *crtc); 352 struct drm_crtc *crtc);
@@ -364,6 +366,13 @@ int __must_check drm_atomic_check_only(struct drm_atomic_state *state);
364int __must_check drm_atomic_commit(struct drm_atomic_state *state); 366int __must_check drm_atomic_commit(struct drm_atomic_state *state);
365int __must_check drm_atomic_nonblocking_commit(struct drm_atomic_state *state); 367int __must_check drm_atomic_nonblocking_commit(struct drm_atomic_state *state);
366 368
369void drm_state_dump(struct drm_device *dev, struct drm_printer *p);
370
371#ifdef CONFIG_DEBUG_FS
372struct drm_minor;
373int drm_atomic_debugfs_init(struct drm_minor *minor);
374#endif
375
367#define for_each_connector_in_state(__state, connector, connector_state, __i) \ 376#define for_each_connector_in_state(__state, connector, connector_state, __i) \
368 for ((__i) = 0; \ 377 for ((__i) = 0; \
369 (__i) < (__state)->num_connector && \ 378 (__i) < (__state)->num_connector && \
diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
index ac9d7d8e0e43..3e9727264b65 100644
--- a/include/drm/drm_connector.h
+++ b/include/drm/drm_connector.h
@@ -37,6 +37,7 @@ struct drm_crtc;
37struct drm_encoder; 37struct drm_encoder;
38struct drm_property; 38struct drm_property;
39struct drm_property_blob; 39struct drm_property_blob;
40struct drm_printer;
40struct edid; 41struct edid;
41 42
42enum drm_connector_force { 43enum drm_connector_force {
@@ -481,6 +482,18 @@ struct drm_connector_funcs {
481 const struct drm_connector_state *state, 482 const struct drm_connector_state *state,
482 struct drm_property *property, 483 struct drm_property *property,
483 uint64_t *val); 484 uint64_t *val);
485
486 /**
487 * @atomic_print_state:
488 *
489 * If driver subclasses struct &drm_connector_state, it should implement
490 * this optional hook for printing additional driver specific state.
491 *
492 * Do not call this directly, use drm_atomic_connector_print_state()
493 * instead.
494 */
495 void (*atomic_print_state)(struct drm_printer *p,
496 const struct drm_connector_state *state);
484}; 497};
485 498
486/* mode specified on the command line */ 499/* mode specified on the command line */
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index fa1aa214c8ea..8cca2a895981 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -53,6 +53,7 @@ struct drm_device;
53struct drm_mode_set; 53struct drm_mode_set;
54struct drm_file; 54struct drm_file;
55struct drm_clip_rect; 55struct drm_clip_rect;
56struct drm_printer;
56struct device_node; 57struct device_node;
57struct dma_fence; 58struct dma_fence;
58struct edid; 59struct edid;
@@ -594,6 +595,18 @@ struct drm_crtc_funcs {
594 */ 595 */
595 int (*set_crc_source)(struct drm_crtc *crtc, const char *source, 596 int (*set_crc_source)(struct drm_crtc *crtc, const char *source,
596 size_t *values_cnt); 597 size_t *values_cnt);
598
599 /**
600 * @atomic_print_state:
601 *
602 * If driver subclasses struct &drm_crtc_state, it should implement
603 * this optional hook for printing additional driver specific state.
604 *
605 * Do not call this directly, use drm_atomic_crtc_print_state()
606 * instead.
607 */
608 void (*atomic_print_state)(struct drm_printer *p,
609 const struct drm_crtc_state *state);
597}; 610};
598 611
599/** 612/**
diff --git a/include/drm/drm_mm.h b/include/drm/drm_mm.h
index 205ddcf6d55d..41ddafe92b2f 100644
--- a/include/drm/drm_mm.h
+++ b/include/drm/drm_mm.h
@@ -44,6 +44,9 @@
44#ifdef CONFIG_DEBUG_FS 44#ifdef CONFIG_DEBUG_FS
45#include <linux/seq_file.h> 45#include <linux/seq_file.h>
46#endif 46#endif
47#ifdef CONFIG_DRM_DEBUG_MM
48#include <linux/stackdepot.h>
49#endif
47 50
48enum drm_mm_search_flags { 51enum drm_mm_search_flags {
49 DRM_MM_SEARCH_DEFAULT = 0, 52 DRM_MM_SEARCH_DEFAULT = 0,
@@ -74,6 +77,9 @@ struct drm_mm_node {
74 u64 size; 77 u64 size;
75 u64 __subtree_last; 78 u64 __subtree_last;
76 struct drm_mm *mm; 79 struct drm_mm *mm;
80#ifdef CONFIG_DRM_DEBUG_MM
81 depot_stack_handle_t stack;
82#endif
77}; 83};
78 84
79struct drm_mm { 85struct drm_mm {
diff --git a/include/drm/drm_modeset_helper_vtables.h b/include/drm/drm_modeset_helper_vtables.h
index 10e449c86dbd..72478cf82147 100644
--- a/include/drm/drm_modeset_helper_vtables.h
+++ b/include/drm/drm_modeset_helper_vtables.h
@@ -361,8 +361,8 @@ struct drm_crtc_helper_funcs {
361 * 361 *
362 * Note that the power state of the display pipe when this function is 362 * Note that the power state of the display pipe when this function is
363 * called depends upon the exact helpers and calling sequence the driver 363 * called depends upon the exact helpers and calling sequence the driver
364 * has picked. See drm_atomic_commit_planes() for a discussion of the 364 * has picked. See drm_atomic_helper_commit_planes() for a discussion of
365 * tradeoffs and variants of plane commit helpers. 365 * the tradeoffs and variants of plane commit helpers.
366 * 366 *
367 * This callback is used by the atomic modeset helpers and by the 367 * This callback is used by the atomic modeset helpers and by the
368 * transitional plane helpers, but it is optional. 368 * transitional plane helpers, but it is optional.
@@ -385,8 +385,8 @@ struct drm_crtc_helper_funcs {
385 * 385 *
386 * Note that the power state of the display pipe when this function is 386 * Note that the power state of the display pipe when this function is
387 * called depends upon the exact helpers and calling sequence the driver 387 * called depends upon the exact helpers and calling sequence the driver
388 * has picked. See drm_atomic_commit_planes() for a discussion of the 388 * has picked. See drm_atomic_helper_commit_planes() for a discussion of
389 * tradeoffs and variants of plane commit helpers. 389 * the tradeoffs and variants of plane commit helpers.
390 * 390 *
391 * This callback is used by the atomic modeset helpers and by the 391 * This callback is used by the atomic modeset helpers and by the
392 * transitional plane helpers, but it is optional. 392 * transitional plane helpers, but it is optional.
@@ -940,8 +940,8 @@ struct drm_plane_helper_funcs {
940 * 940 *
941 * Note that the power state of the display pipe when this function is 941 * Note that the power state of the display pipe when this function is
942 * called depends upon the exact helpers and calling sequence the driver 942 * called depends upon the exact helpers and calling sequence the driver
943 * has picked. See drm_atomic_commit_planes() for a discussion of the 943 * has picked. See drm_atomic_helper_commit_planes() for a discussion of
944 * tradeoffs and variants of plane commit helpers. 944 * the tradeoffs and variants of plane commit helpers.
945 * 945 *
946 * This callback is used by the atomic modeset helpers and by the 946 * This callback is used by the atomic modeset helpers and by the
947 * transitional plane helpers, but it is optional. 947 * transitional plane helpers, but it is optional.
@@ -963,8 +963,8 @@ struct drm_plane_helper_funcs {
963 * 963 *
964 * Note that the power state of the display pipe when this function is 964 * Note that the power state of the display pipe when this function is
965 * called depends upon the exact helpers and calling sequence the driver 965 * called depends upon the exact helpers and calling sequence the driver
966 * has picked. See drm_atomic_commit_planes() for a discussion of the 966 * has picked. See drm_atomic_helper_commit_planes() for a discussion of
967 * tradeoffs and variants of plane commit helpers. 967 * the tradeoffs and variants of plane commit helpers.
968 * 968 *
969 * This callback is used by the atomic modeset helpers and by the 969 * This callback is used by the atomic modeset helpers and by the
970 * transitional plane helpers, but it is optional. 970 * transitional plane helpers, but it is optional.
diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h
index 0bed92c5dbd8..5b38eb94783b 100644
--- a/include/drm/drm_plane.h
+++ b/include/drm/drm_plane.h
@@ -28,15 +28,11 @@
28#include <drm/drm_mode_object.h> 28#include <drm/drm_mode_object.h>
29 29
30struct drm_crtc; 30struct drm_crtc;
31struct drm_printer;
31 32
32/** 33/**
33 * struct drm_plane_state - mutable plane state 34 * struct drm_plane_state - mutable plane state
34 * @plane: backpointer to the plane 35 * @plane: backpointer to the plane
35 * @crtc: currently bound CRTC, NULL if disabled
36 * @fb: currently bound framebuffer
37 * @fence: optional fence to wait for before scanning out @fb
38 * @crtc_x: left position of visible portion of plane on crtc
39 * @crtc_y: upper position of visible portion of plane on crtc
40 * @crtc_w: width of visible portion of plane on crtc 36 * @crtc_w: width of visible portion of plane on crtc
41 * @crtc_h: height of visible portion of plane on crtc 37 * @crtc_h: height of visible portion of plane on crtc
42 * @src_x: left position of visible portion of plane within 38 * @src_x: left position of visible portion of plane within
@@ -57,18 +53,51 @@ struct drm_crtc;
57 * it can be trusted. 53 * it can be trusted.
58 * @src: clipped source coordinates of the plane (in 16.16) 54 * @src: clipped source coordinates of the plane (in 16.16)
59 * @dst: clipped destination coordinates of the plane 55 * @dst: clipped destination coordinates of the plane
60 * @visible: visibility of the plane
61 * @state: backpointer to global drm_atomic_state 56 * @state: backpointer to global drm_atomic_state
62 */ 57 */
63struct drm_plane_state { 58struct drm_plane_state {
64 struct drm_plane *plane; 59 struct drm_plane *plane;
65 60
66 struct drm_crtc *crtc; /* do not write directly, use drm_atomic_set_crtc_for_plane() */ 61 /**
67 struct drm_framebuffer *fb; /* do not write directly, use drm_atomic_set_fb_for_plane() */ 62 * @crtc:
63 *
64 * Currently bound CRTC, NULL if disabled. Do not this write directly,
65 * use drm_atomic_set_crtc_for_plane()
66 */
67 struct drm_crtc *crtc;
68
69 /**
70 * @fb:
71 *
72 * Currently bound framebuffer. Do not write this directly, use
73 * drm_atomic_set_fb_for_plane()
74 */
75 struct drm_framebuffer *fb;
76
77 /**
78 * @fence:
79 *
80 * Optional fence to wait for before scanning out @fb. Do not write this
81 * directly, use drm_atomic_set_fence_for_plane()
82 */
68 struct dma_fence *fence; 83 struct dma_fence *fence;
69 84
70 /* Signed dest location allows it to be partially off screen */ 85 /**
71 int32_t crtc_x, crtc_y; 86 * @crtc_x:
87 *
88 * Left position of visible portion of plane on crtc, signed dest
89 * location allows it to be partially off screen.
90 */
91
92 int32_t crtc_x;
93 /**
94 * @crtc_y:
95 *
96 * Upper position of visible portion of plane on crtc, signed dest
97 * location allows it to be partially off screen.
98 */
99 int32_t crtc_y;
100
72 uint32_t crtc_w, crtc_h; 101 uint32_t crtc_w, crtc_h;
73 102
74 /* Source values are 16.16 fixed point */ 103 /* Source values are 16.16 fixed point */
@@ -85,15 +114,41 @@ struct drm_plane_state {
85 /* Clipped coordinates */ 114 /* Clipped coordinates */
86 struct drm_rect src, dst; 115 struct drm_rect src, dst;
87 116
88 /* 117 /**
89 * Is the plane actually visible? Can be false even 118 * @visible:
90 * if fb!=NULL and crtc!=NULL, due to clipping. 119 *
120 * Visibility of the plane. This can be false even if fb!=NULL and
121 * crtc!=NULL, due to clipping.
91 */ 122 */
92 bool visible; 123 bool visible;
93 124
94 struct drm_atomic_state *state; 125 struct drm_atomic_state *state;
95}; 126};
96 127
128static inline struct drm_rect
129drm_plane_state_src(const struct drm_plane_state *state)
130{
131 struct drm_rect src = {
132 .x1 = state->src_x,
133 .y1 = state->src_y,
134 .x2 = state->src_x + state->src_w,
135 .y2 = state->src_y + state->src_h,
136 };
137 return src;
138}
139
140static inline struct drm_rect
141drm_plane_state_dest(const struct drm_plane_state *state)
142{
143 struct drm_rect dest = {
144 .x1 = state->crtc_x,
145 .y1 = state->crtc_y,
146 .x2 = state->crtc_x + state->crtc_w,
147 .y2 = state->crtc_y + state->crtc_h,
148 };
149 return dest;
150}
151
97/** 152/**
98 * struct drm_plane_funcs - driver plane control functions 153 * struct drm_plane_funcs - driver plane control functions
99 */ 154 */
@@ -322,6 +377,18 @@ struct drm_plane_funcs {
322 * before data structures are torndown. 377 * before data structures are torndown.
323 */ 378 */
324 void (*early_unregister)(struct drm_plane *plane); 379 void (*early_unregister)(struct drm_plane *plane);
380
381 /**
382 * @atomic_print_state:
383 *
384 * If driver subclasses struct &drm_plane_state, it should implement
385 * this optional hook for printing additional driver specific state.
386 *
387 * Do not call this directly, use drm_atomic_plane_print_state()
388 * instead.
389 */
390 void (*atomic_print_state)(struct drm_printer *p,
391 const struct drm_plane_state *state);
325}; 392};
326 393
327/** 394/**
diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h
new file mode 100644
index 000000000000..475ffe3730e9
--- /dev/null
+++ b/include/drm/drm_print.h
@@ -0,0 +1,117 @@
1/*
2 * Copyright (C) 2016 Red Hat
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 * Authors:
23 * Rob Clark <robdclark@gmail.com>
24 */
25
26#ifndef DRM_PRINT_H_
27#define DRM_PRINT_H_
28
29#include <linux/seq_file.h>
30#include <linux/device.h>
31
32/**
33 * DOC: print
34 *
35 * A simple wrapper for dev_printk(), seq_printf(), etc. Allows same
36 * debug code to be used for both debugfs and printk logging.
37 *
38 * For example::
39 *
40 * void log_some_info(struct drm_printer *p)
41 * {
42 * drm_printf(p, "foo=%d\n", foo);
43 * drm_printf(p, "bar=%d\n", bar);
44 * }
45 *
46 * #ifdef CONFIG_DEBUG_FS
47 * void debugfs_show(struct seq_file *f)
48 * {
49 * struct drm_printer p = drm_seq_file_printer(f);
50 * log_some_info(&p);
51 * }
52 * #endif
53 *
54 * void some_other_function(...)
55 * {
56 * struct drm_printer p = drm_info_printer(drm->dev);
57 * log_some_info(&p);
58 * }
59 */
60
61/**
62 * struct drm_printer - drm output "stream"
63 * @printfn: actual output fxn
64 * @arg: output fxn specific data
65 *
66 * Do not use struct members directly. Use drm_printer_seq_file(),
67 * drm_printer_info(), etc to initialize. And drm_printf() for output.
68 */
69struct drm_printer {
70 void (*printfn)(struct drm_printer *p, struct va_format *vaf);
71 void *arg;
72};
73
74void __drm_printfn_seq_file(struct drm_printer *p, struct va_format *vaf);
75void __drm_printfn_info(struct drm_printer *p, struct va_format *vaf);
76
77/**
78 * drm_printf - print to a &drm_printer stream
79 * @p: the &drm_printer
80 * @f: format string
81 */
82void drm_printf(struct drm_printer *p, const char *f, ...);
83
84
85/**
86 * drm_seq_file_printer - construct a &drm_printer that outputs to &seq_file
87 * @f: the struct &seq_file to output to
88 *
89 * RETURNS:
90 * The &drm_printer object
91 */
92static inline struct drm_printer drm_seq_file_printer(struct seq_file *f)
93{
94 struct drm_printer p = {
95 .printfn = __drm_printfn_seq_file,
96 .arg = f,
97 };
98 return p;
99}
100
101/**
102 * drm_info_printer - construct a &drm_printer that outputs to dev_printk()
103 * @dev: the struct &device pointer
104 *
105 * RETURNS:
106 * The &drm_printer object
107 */
108static inline struct drm_printer drm_info_printer(struct device *dev)
109{
110 struct drm_printer p = {
111 .printfn = __drm_printfn_info,
112 .arg = dev,
113 };
114 return p;
115}
116
117#endif /* DRM_PRINT_H_ */
diff --git a/include/linux/dma-fence.h b/include/linux/dma-fence.h
index ba60c043a5d3..fcf4b1971eba 100644
--- a/include/linux/dma-fence.h
+++ b/include/linux/dma-fence.h
@@ -382,7 +382,8 @@ signed long dma_fence_wait_timeout(struct dma_fence *,
382 bool intr, signed long timeout); 382 bool intr, signed long timeout);
383signed long dma_fence_wait_any_timeout(struct dma_fence **fences, 383signed long dma_fence_wait_any_timeout(struct dma_fence **fences,
384 uint32_t count, 384 uint32_t count,
385 bool intr, signed long timeout); 385 bool intr, signed long timeout,
386 uint32_t *idx);
386 387
387/** 388/**
388 * dma_fence_wait - sleep until the fence gets signaled 389 * dma_fence_wait - sleep until the fence gets signaled
diff --git a/include/uapi/drm/amdgpu_drm.h b/include/uapi/drm/amdgpu_drm.h
index 4684f378f046..2191a9e4f3db 100644
--- a/include/uapi/drm/amdgpu_drm.h
+++ b/include/uapi/drm/amdgpu_drm.h
@@ -50,6 +50,7 @@ extern "C" {
50#define DRM_AMDGPU_WAIT_CS 0x09 50#define DRM_AMDGPU_WAIT_CS 0x09
51#define DRM_AMDGPU_GEM_OP 0x10 51#define DRM_AMDGPU_GEM_OP 0x10
52#define DRM_AMDGPU_GEM_USERPTR 0x11 52#define DRM_AMDGPU_GEM_USERPTR 0x11
53#define DRM_AMDGPU_WAIT_FENCES 0x12
53 54
54#define DRM_IOCTL_AMDGPU_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_CREATE, union drm_amdgpu_gem_create) 55#define DRM_IOCTL_AMDGPU_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_CREATE, union drm_amdgpu_gem_create)
55#define DRM_IOCTL_AMDGPU_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_MMAP, union drm_amdgpu_gem_mmap) 56#define DRM_IOCTL_AMDGPU_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_MMAP, union drm_amdgpu_gem_mmap)
@@ -63,6 +64,7 @@ extern "C" {
63#define DRM_IOCTL_AMDGPU_WAIT_CS DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_WAIT_CS, union drm_amdgpu_wait_cs) 64#define DRM_IOCTL_AMDGPU_WAIT_CS DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_WAIT_CS, union drm_amdgpu_wait_cs)
64#define DRM_IOCTL_AMDGPU_GEM_OP DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_OP, struct drm_amdgpu_gem_op) 65#define DRM_IOCTL_AMDGPU_GEM_OP DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_OP, struct drm_amdgpu_gem_op)
65#define DRM_IOCTL_AMDGPU_GEM_USERPTR DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_USERPTR, struct drm_amdgpu_gem_userptr) 66#define DRM_IOCTL_AMDGPU_GEM_USERPTR DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_USERPTR, struct drm_amdgpu_gem_userptr)
67#define DRM_IOCTL_AMDGPU_WAIT_FENCES DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_WAIT_FENCES, union drm_amdgpu_wait_fences)
66 68
67#define AMDGPU_GEM_DOMAIN_CPU 0x1 69#define AMDGPU_GEM_DOMAIN_CPU 0x1
68#define AMDGPU_GEM_DOMAIN_GTT 0x2 70#define AMDGPU_GEM_DOMAIN_GTT 0x2
@@ -307,6 +309,32 @@ union drm_amdgpu_wait_cs {
307 struct drm_amdgpu_wait_cs_out out; 309 struct drm_amdgpu_wait_cs_out out;
308}; 310};
309 311
312struct drm_amdgpu_fence {
313 __u32 ctx_id;
314 __u32 ip_type;
315 __u32 ip_instance;
316 __u32 ring;
317 __u64 seq_no;
318};
319
320struct drm_amdgpu_wait_fences_in {
321 /** This points to uint64_t * which points to fences */
322 __u64 fences;
323 __u32 fence_count;
324 __u32 wait_all;
325 __u64 timeout_ns;
326};
327
328struct drm_amdgpu_wait_fences_out {
329 __u32 status;
330 __u32 first_signaled;
331};
332
333union drm_amdgpu_wait_fences {
334 struct drm_amdgpu_wait_fences_in in;
335 struct drm_amdgpu_wait_fences_out out;
336};
337
310#define AMDGPU_GEM_OP_GET_GEM_CREATE_INFO 0 338#define AMDGPU_GEM_OP_GET_GEM_CREATE_INFO 0
311#define AMDGPU_GEM_OP_SET_PLACEMENT 1 339#define AMDGPU_GEM_OP_SET_PLACEMENT 1
312 340
diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h
index 084b50a02dc5..01000c9f7c2c 100644
--- a/include/uapi/drm/drm_mode.h
+++ b/include/uapi/drm/drm_mode.h
@@ -47,7 +47,15 @@ extern "C" {
47#define DRM_MODE_TYPE_DRIVER (1<<6) 47#define DRM_MODE_TYPE_DRIVER (1<<6)
48 48
49/* Video mode flags */ 49/* Video mode flags */
50/* bit compatible with the xorg definitions. */ 50/* bit compatible with the xrandr RR_ definitions (bits 0-13)
51 *
52 * ABI warning: Existing userspace really expects
53 * the mode flags to match the xrandr definitions. Any
54 * changes that don't match the xrandr definitions will
55 * likely need a new client cap or some other mechanism
56 * to avoid breaking existing userspace. This includes
57 * allocating new flags in the previously unused bits!
58 */
51#define DRM_MODE_FLAG_PHSYNC (1<<0) 59#define DRM_MODE_FLAG_PHSYNC (1<<0)
52#define DRM_MODE_FLAG_NHSYNC (1<<1) 60#define DRM_MODE_FLAG_NHSYNC (1<<1)
53#define DRM_MODE_FLAG_PVSYNC (1<<2) 61#define DRM_MODE_FLAG_PVSYNC (1<<2)