• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */
2 /*
3  * Copyright (c) 2016-2019, The Linux Foundation. All rights reserved.
4  */
5 
6 #ifndef _MDSS_ROTATOR_H_
7 #define _MDSS_ROTATOR_H_
8 
9 #include <linux/msm_mdp_ext.h>
10 
11 #define MDSS_ROTATOR_IOCTL_MAGIC 'w'
12 
13 /* open a rotation session */
14 #define MDSS_ROTATION_OPEN \
15 	_IOWR(MDSS_ROTATOR_IOCTL_MAGIC, 1, struct mdp_rotation_config *)
16 
17 /* change the rotation session configuration */
18 #define MDSS_ROTATION_CONFIG \
19 	_IOWR(MDSS_ROTATOR_IOCTL_MAGIC, 2, struct mdp_rotation_config *)
20 
21 /* queue the rotation request */
22 #define MDSS_ROTATION_REQUEST \
23 	_IOWR(MDSS_ROTATOR_IOCTL_MAGIC, 3, struct mdp_rotation_request *)
24 
25 /* close a rotation session with the specified rotation session ID */
26 #define MDSS_ROTATION_CLOSE	_IOW(MDSS_ROTATOR_IOCTL_MAGIC, 4, unsigned int)
27 
28 /*
29  * Rotation request flag
30  */
31 /* no rotation flag, i.e. color space conversion */
32 #define MDP_ROTATION_NOP	0x01
33 
34 /* left/right flip */
35 #define MDP_ROTATION_FLIP_LR	0x02
36 
37 /* up/down flip */
38 #define MDP_ROTATION_FLIP_UD	0x04
39 
40 /* rotate 90 degree */
41 #define MDP_ROTATION_90		0x08
42 
43 /* rotate 180 degre */
44 #define MDP_ROTATION_180	(MDP_ROTATION_FLIP_LR | MDP_ROTATION_FLIP_UD)
45 
46 /* rotate 270 degree */
47 #define MDP_ROTATION_270	(MDP_ROTATION_90 | MDP_ROTATION_180)
48 
49 /* format is interlaced */
50 #define MDP_ROTATION_DEINTERLACE 0x10
51 
52 /* enable bwc */
53 #define MDP_ROTATION_BWC_EN	0x40
54 
55 /* secure data */
56 #define MDP_ROTATION_SECURE	0x80
57 
58 /*
59  * Rotation commit flag
60  */
61 /* Flag indicates to validate the rotation request */
62 #define MDSS_ROTATION_REQUEST_VALIDATE	0x01
63 
64 #define MDP_ROTATION_REQUEST_VERSION_1_0	0x00010000
65 
66 /*
67  * Client can let driver to allocate the hardware resources with
68  * this particular hw resource id.
69  */
70 #define MDSS_ROTATION_HW_ANY	0xFFFFFFFF
71 
72 /*
73  * Configuration Structures
74  */
75 struct mdp_rotation_buf_info {
76 	uint32_t width;
77 	uint32_t height;
78 	uint32_t format;
79 	struct mult_factor comp_ratio;
80 };
81 
82 struct mdp_rotation_config {
83 	uint32_t	version;
84 	uint32_t	session_id;
85 	struct mdp_rotation_buf_info	input;
86 	struct mdp_rotation_buf_info	output;
87 	uint32_t	frame_rate;
88 	uint32_t	flags;
89 	uint32_t	reserved[6];
90 };
91 
92 struct mdp_rotation_item {
93 	/* rotation request flag */
94 	uint32_t	flags;
95 
96 	/* Source crop rectangle */
97 	struct mdp_rect	src_rect;
98 
99 	/* Destination rectangle */
100 	struct mdp_rect	dst_rect;
101 
102 	/* Input buffer for the request */
103 	struct mdp_layer_buffer	input;
104 
105 	/* The output buffer for the request */
106 	struct mdp_layer_buffer	output;
107 
108 	/*
109 	 * DMA pipe selection for this request by client:
110 	 * 0: DMA pipe 0
111 	 * 1: DMA pipe 1
112 	 * or MDSS_ROTATION_HW_ANY if client wants
113 	 * driver to allocate any that is available
114 	 */
115 	uint32_t	pipe_idx;
116 
117 	/*
118 	 * Write-back block selection for this request by client:
119 	 * 0: Write-back block 0
120 	 * 1: Write-back block 1
121 	 * or MDSS_ROTATION_HW_ANY if client wants
122 	 * driver to allocate any that is available
123 	 */
124 	uint32_t	wb_idx;
125 
126 	/* Which session ID is this request scheduled on */
127 	uint32_t	session_id;
128 
129 	/* 32bits reserved value for future usage */
130 	uint32_t	reserved[6];
131 };
132 
133 struct mdp_rotation_request {
134 	/* 32bit version indicates the request structure */
135 	uint32_t	version;
136 
137 	uint32_t	flags;
138 
139 	/* Number of rotation request items in the list */
140 	uint32_t	count;
141 
142 	/* Pointer to a list of rotation request items */
143 	struct mdp_rotation_item *list;
144 
145 	/* 32bits reserved value for future usage*/
146 	uint32_t	reserved[6];
147 };
148 
149 #endif /* _MDSS_ROTATOR_H_*/
150