xref: /linux/drivers/gpu/drm/xe/compat-i915-headers/i915_drv.h (revision 55a42f78ffd386e01a5404419f8c5ded7db70a21)
1 /* SPDX-License-Identifier: MIT */
2 /*
3  * Copyright © 2023 Intel Corporation
4  */
5 #ifndef _XE_I915_DRV_H_
6 #define _XE_I915_DRV_H_
7 
8 /*
9  * "Adaptation header" to allow i915 display to also build for xe driver.
10  * TODO: refactor i915 and xe so this can cease to exist
11  */
12 
13 #include <drm/drm_drv.h>
14 
15 #include "xe_device.h" /* for xe_device_has_flat_ccs() */
16 #include "xe_device_types.h"
17 
18 static inline struct drm_i915_private *to_i915(const struct drm_device *dev)
19 {
20 	return container_of(dev, struct drm_i915_private, drm);
21 }
22 
23 /* compat platform checks only for soc/ usage */
24 #define IS_PLATFORM(xe, x) ((xe)->info.platform == x)
25 #define IS_I915G(dev_priv)	(dev_priv && 0)
26 #define IS_I915GM(dev_priv)	(dev_priv && 0)
27 #define IS_PINEVIEW(dev_priv)	(dev_priv && 0)
28 #define IS_VALLEYVIEW(dev_priv)	(dev_priv && 0)
29 #define IS_CHERRYVIEW(dev_priv)	(dev_priv && 0)
30 #define IS_HASWELL(dev_priv)	(dev_priv && 0)
31 #define IS_BROADWELL(dev_priv)	(dev_priv && 0)
32 #define IS_BROXTON(dev_priv)	(dev_priv && 0)
33 #define IS_GEMINILAKE(dev_priv)	(dev_priv && 0)
34 #define IS_DG2(dev_priv)	IS_PLATFORM(dev_priv, XE_DG2)
35 
36 #define IS_MOBILE(xe) (xe && 0)
37 
38 #define HAS_FLAT_CCS(xe) (xe_device_has_flat_ccs(xe))
39 #define HAS_128_BYTE_Y_TILING(xe) (xe || 1)
40 
41 #endif
42