aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include/drm/intel/gtt_view_types.h
blob: 128392d98f3a57ee499dcd6956933c9b6071a1aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/* SPDX-License-Identifier: MIT */
/* Copyright © 2025 Intel Corporation */

#ifndef __DRM_INTEL_GTT_VIEW_TYPES_H__
#define __DRM_INTEL_GTT_VIEW_TYPES_H__

#include <linux/types.h>

struct intel_remapped_plane_info {
	/* in gtt pages */
	u32 offset:31;
	u32 linear:1;
	union {
		/* in gtt pages for !linear */
		struct {
			u16 width;
			u16 height;
			u16 src_stride;
			u16 dst_stride;
		};

		/* in gtt pages for linear */
		u32 size;
	};
} __packed;

struct intel_rotation_info {
	struct intel_remapped_plane_info plane[2];
} __packed;

struct intel_partial_info {
	u64 offset;
	unsigned int size;
} __packed;

struct intel_remapped_info {
	struct intel_remapped_plane_info plane[4];
	/* in gtt pages */
	u32 plane_alignment;
} __packed;

enum intel_gtt_view_type {
	INTEL_GTT_VIEW_NORMAL = 0,
	INTEL_GTT_VIEW_ROTATED = sizeof(struct intel_rotation_info),
	INTEL_GTT_VIEW_PARTIAL = sizeof(struct intel_partial_info),
	INTEL_GTT_VIEW_REMAPPED = sizeof(struct intel_remapped_info),
};

struct intel_gtt_view {
	enum intel_gtt_view_type type;
	union {
		/* Members need to contain no holes/padding */
		struct intel_partial_info partial;
		struct intel_rotation_info rotated;
		struct intel_remapped_info remapped;
	};
};

static inline bool intel_gtt_view_is_normal(const struct intel_gtt_view *view)
{
	return view->type == INTEL_GTT_VIEW_NORMAL;
}

static inline bool intel_gtt_view_is_remapped(const struct intel_gtt_view *view)
{
	return view->type == INTEL_GTT_VIEW_REMAPPED;
}

static inline bool intel_gtt_view_is_rotated(const struct intel_gtt_view *view)
{
	return view->type == INTEL_GTT_VIEW_ROTATED;
}

static inline bool intel_gtt_view_is_partial(const struct intel_gtt_view *view)
{
	return view->type == INTEL_GTT_VIEW_PARTIAL;
}

#endif /* __DRM_INTEL_GTT_VIEW_TYPES_H__ */