xref: /linux/drivers/gpu/drm/i915/display/intel_display_utils.h (revision 815e260a18a3af4dab59025ee99a7156c0e8b5e0)
1 /* SPDX-License-Identifier: MIT */
2 /* Copyright © 2025 Intel Corporation */
3 
4 #ifndef __INTEL_DISPLAY_UTILS__
5 #define __INTEL_DISPLAY_UTILS__
6 
7 #include <linux/bug.h>
8 #include <linux/types.h>
9 
10 struct intel_display;
11 
12 #ifndef MISSING_CASE
13 #define MISSING_CASE(x) WARN(1, "Missing case (%s == %ld)\n", \
14 			     __stringify(x), (long)(x))
15 #endif
16 
17 #ifndef fetch_and_zero
18 #define fetch_and_zero(ptr) ({						\
19 	typeof(*ptr) __T = *(ptr);					\
20 	*(ptr) = (typeof(*ptr))0;					\
21 	__T;								\
22 })
23 #endif
24 
25 #define KHz(x) (1000 * (x))
26 #define MHz(x) KHz(1000 * (x))
27 
28 bool intel_display_run_as_guest(struct intel_display *display);
29 bool intel_display_vtd_active(struct intel_display *display);
30 
31 #endif /* __INTEL_DISPLAY_UTILS__ */
32