diff options
author | Dave Airlie <airlied@redhat.com> | 2019-01-17 18:20:10 -0500 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2019-01-17 18:31:28 -0500 |
commit | f164a94c2c87752caeb1a3cbe068c440e7f7921f (patch) | |
tree | e914296ef0ce1df83e506a12bf4306d5aa468b24 /include/drm/drm_util.h | |
parent | b122153c7198e35fcb981ca9efd63b0df8ef3eab (diff) | |
parent | 94520db52fc0e931327bb77fe79a952a0e9dd2b0 (diff) |
Merge tag 'drm-misc-next-2019-01-16' of git://anongit.freedesktop.org/drm/drm-misc into drm-next
drm-misc-next for 5.1:
UAPI Changes:
- New fourcc identifier for ARM Framebuffer Compression v1.3
Cross-subsystem Changes:
Core Changes:
- Reorganisation of drm_device and drm_framebuffer headers
- Cleanup of the drmP inclusion
- Fix leaks in the fb-helpers
- Allow for depth different from bpp in fb-helper fbdev emulation
- Remove drm_mode_object from drm_display_mode
Driver Changes:
- Add reflection properties to rockchip
- a bunch of fixes for virtio
- a bunch of fixes for dp_mst and drivers using it, and introduction of a
new refcounting scheme
- Convertion of bochs to atomic and generic fbdev emulation
- Allow meson to remove the firmware framebuffers
[airlied: patch rcar-du to add drm_modes.h]
Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Maxime Ripard <maxime.ripard@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190116200428.u2n4jbk4mzza7n6e@flea
Diffstat (limited to 'include/drm/drm_util.h')
-rw-r--r-- | include/drm/drm_util.h | 53 |
1 files changed, 52 insertions, 1 deletions
diff --git a/include/drm/drm_util.h b/include/drm/drm_util.h index 88abdca89baa..8163d35f8327 100644 --- a/include/drm/drm_util.h +++ b/include/drm/drm_util.h | |||
@@ -26,7 +26,58 @@ | |||
26 | #ifndef _DRM_UTIL_H_ | 26 | #ifndef _DRM_UTIL_H_ |
27 | #define _DRM_UTIL_H_ | 27 | #define _DRM_UTIL_H_ |
28 | 28 | ||
29 | /* helper for handling conditionals in various for_each macros */ | 29 | /** |
30 | * DOC: drm utils | ||
31 | * | ||
32 | * Macros and inline functions that does not naturally belong in other places | ||
33 | */ | ||
34 | |||
35 | #include <linux/interrupt.h> | ||
36 | #include <linux/kgdb.h> | ||
37 | #include <linux/preempt.h> | ||
38 | #include <linux/smp.h> | ||
39 | |||
40 | /* | ||
41 | * Use EXPORT_SYMBOL_FOR_TESTS_ONLY() for functions that shall | ||
42 | * only be visible for drmselftests. | ||
43 | */ | ||
44 | #if defined(CONFIG_DRM_DEBUG_SELFTEST_MODULE) | ||
45 | #define EXPORT_SYMBOL_FOR_TESTS_ONLY(x) EXPORT_SYMBOL(x) | ||
46 | #else | ||
47 | #define EXPORT_SYMBOL_FOR_TESTS_ONLY(x) | ||
48 | #endif | ||
49 | |||
50 | /** | ||
51 | * for_each_if - helper for handling conditionals in various for_each macros | ||
52 | * @condition: The condition to check | ||
53 | * | ||
54 | * Typical use:: | ||
55 | * | ||
56 | * #define for_each_foo_bar(x, y) \' | ||
57 | * list_for_each_entry(x, y->list, head) \' | ||
58 | * for_each_if(x->something == SOMETHING) | ||
59 | * | ||
60 | * The for_each_if() macro makes the use of for_each_foo_bar() less error | ||
61 | * prone. | ||
62 | */ | ||
30 | #define for_each_if(condition) if (!(condition)) {} else | 63 | #define for_each_if(condition) if (!(condition)) {} else |
31 | 64 | ||
65 | /** | ||
66 | * drm_can_sleep - returns true if currently okay to sleep | ||
67 | * | ||
68 | * This function shall not be used in new code. | ||
69 | * The check for running in atomic context may not work - see linux/preempt.h. | ||
70 | * | ||
71 | * FIXME: All users of drm_can_sleep should be removed (see todo.rst) | ||
72 | * | ||
73 | * Returns: | ||
74 | * True if kgdb is active or we are in an atomic context or irqs are disabled | ||
75 | */ | ||
76 | static inline bool drm_can_sleep(void) | ||
77 | { | ||
78 | if (in_atomic() || in_dbg_master() || irqs_disabled()) | ||
79 | return false; | ||
80 | return true; | ||
81 | } | ||
82 | |||
32 | #endif | 83 | #endif |