1 /* SPDX-License-Identifier: MIT */
2 /* Copyright © 2025 Intel Corporation */
3 
4 #ifndef __I915_GTT_VIEW_TYPES_H__
5 #define __I915_GTT_VIEW_TYPES_H__
6 
7 #include <linux/types.h>
8 
9 struct intel_remapped_plane_info {
10 	/* in gtt pages */
11 	u32 offset:31;
12 	u32 linear:1;
13 	union {
14 		/* in gtt pages for !linear */
15 		struct {
16 			u16 width;
17 			u16 height;
18 			u16 src_stride;
19 			u16 dst_stride;
20 		};
21 
22 		/* in gtt pages for linear */
23 		u32 size;
24 	};
25 } __packed;
26 
27 struct intel_rotation_info {
28 	struct intel_remapped_plane_info plane[2];
29 } __packed;
30 
31 struct intel_partial_info {
32 	u64 offset;
33 	unsigned int size;
34 } __packed;
35 
36 struct intel_remapped_info {
37 	struct intel_remapped_plane_info plane[4];
38 	/* in gtt pages */
39 	u32 plane_alignment;
40 } __packed;
41 
42 enum i915_gtt_view_type {
43 	I915_GTT_VIEW_NORMAL = 0,
44 	I915_GTT_VIEW_ROTATED = sizeof(struct intel_rotation_info),
45 	I915_GTT_VIEW_PARTIAL = sizeof(struct intel_partial_info),
46 	I915_GTT_VIEW_REMAPPED = sizeof(struct intel_remapped_info),
47 };
48 
49 struct i915_gtt_view {
50 	enum i915_gtt_view_type type;
51 	union {
52 		/* Members need to contain no holes/padding */
53 		struct intel_partial_info partial;
54 		struct intel_rotation_info rotated;
55 		struct intel_remapped_info remapped;
56 	};
57 };
58 
59 #endif /* __I915_GTT_VIEW_TYPES_H__ */
60