aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/emgd/include/igd_ovl.h
blob: 60530c688bd54a349c8024eeeb7babb2c78dae7c (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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
/* -*- pse-c -*-
 *-----------------------------------------------------------------------------
 * Filename: igd_ovl.h
 * $Revision: 1.7 $
 *-----------------------------------------------------------------------------
 * Copyright © 2002-2010, Intel Corporation.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms and conditions of the GNU General Public License,
 * version 2, as published by the Free Software Foundation.
 *
 * This program is distributed in the hope it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
 *
 *-----------------------------------------------------------------------------
 * Description:
 *  This is the external header file for overlay. It should be included
 *  by ial and/or other HAL modules that require overlay interaction.
 *-----------------------------------------------------------------------------
 */

#ifndef _IGD_OVL_H
#define _IGD_OVL_H

/*!
 * @defgroup overlay_group Overlay
 * @ingroup video_group
 *
 * The overlay module is responsible for the hardware overlay and the secondary
 * overlay (sometimes referred to as plane C).
 *
 * <B>Relevent Dispatch Fucntions</B>
 * - _igd_dispatch::alter_ovl()
 * - _igd_dispatch::query_ovl()
 * - _igd_dispatch::query_max_size_ovl()
 * @{
 */

/*----------------------------------------------------------------------------
 * Overlay Alter Flags
 *--------------------------------------------------------------------------*/
/*!
 * @name Alter Overlay Flags
 * @anchor alter_ovl_flags
 *
 * Flags for use with _igd_dispatch::alter_ovl()
 * - IGD_OVL_ALTER_OFF: Turn the overlay off
 * - IGD_OVL_ALTER_ON: Turn the overlay on
 *
 * - IGD_OVL_ALTER_PROGRESSIVE: The overlay is progressive.  Only valid when
 *     the overlay is on
 * - IGD_OVL_ALTER_INTERLEAVED: The overlay is interleaved/bobbed.  Only valid
 *     when the overlay is on
 *
 * - IGD_OVL_ALTER_FLIP_EVEN: Flip the even field.  Only valid when the overlay
 *     is on
 * - IGD_OVL_ALTER_FLIP_ODD: Flip the odd field.  Only valid when the overlay
 *     is on
 * @{
 */
#define IGD_OVL_ALTER_OFF 0
#define IGD_OVL_ALTER_ON  1

#define IGD_OVL_ALTER_PROGRESSIVE   0
#define IGD_OVL_ALTER_INTERLEAVED   2

#define IGD_OVL_ALTER_FLIP_EVEN     0
#define IGD_OVL_ALTER_FLIP_ODD      4

#define IGD_FW_VIDEO_OFF	        8

#define IGD_OVL_FORCE_USE_DISP   0x10
#define IGD_OVL_GET_SURFACE_DATA 0x50
/*! @} */

/* These are not actually used by any IAL
#define IGD_OVL_ALTER_MIRROR_NONE  0
#define IGD_OVL_ALTER_MIRROR_H     0x10
#define IGD_OVL_ALTER_MIRROR_V     0x20
#define IGD_OVL_ALTER_MIRROR_HV    (IGD_OVL_FLAGS_MIRROR_H|IGD_OVL_FLAGS_MIRROR_V) */

/*----------------------------------------------------------------------------
 * Overlay Query Flags
 *--------------------------------------------------------------------------*/
/*!
 * @name Query Overlay Flags
 * @anchor query_ovl_flags
 *
 * Flags for use with _igd_dispatch::query_ovl()
 * These flags ARE EXCLUSIVE - ONLY ONE AT A TIME can be used during a
 *    single call to igd_query_ovl
 *
 * - IGD_OVL_QUERY_IS_HW_SUPPORTED: Can the hardware support an overlay for
 *   this display_h?  This will return the same value no matter if the overlay
 *   is on or off, so the IAL must use some other method to determine if the
 *   overlay is in use.
 * - IGD_OVL_QUERY_IS_LAST_FLIP_DONE: Has the last flip completed?
 * - IGD_OVL_QUERY_WAIT_LAST_FLIP_DONE: Wait until the last flip is complete.
 *   Returns TRUE if the last flip was successfully completed.  Returns FALSE
 *   if there was a HW issue where the last flip did not occur.
 * - IGD_OVL_QUERY_IS_ON: Is the hardware overlay currently on?  This does not
 *   include the secondary overlay, only the hardware overlay.
 * - IGD_OVL_QUERY_IS_GAMMA_SUPPORTED: Is the hardware supports GAMMA
 *   correction?
 * - IGD_OVL_QUERY_IS_VIDEO_PARAM_SUPPORTED: Is the hardware supports video
 *   parameters (brightness, contrast, saturation) correction?
 * @{
 */
#define IGD_OVL_QUERY_IS_HW_SUPPORTED                     0x00000001
#define IGD_OVL_QUERY_IS_LAST_FLIP_DONE                   0x00000002
#define IGD_OVL_QUERY_WAIT_LAST_FLIP_DONE                 0x00000003
#define IGD_OVL_QUERY_IS_ON                               0x00000004
#define IGD_OVL_QUERY_IS_GAMMA_SUPPORTED                  0x00000005
#define IGD_OVL_QUERY_IS_VIDEO_PARAM_SUPPORTED            0x00000006
#define IGD_OVL_QUERY_MASK                                0x0000000F
	/* Ensure no bits conflict with IGD_OVL_FORCE_USE_DISP above */
/*! @} */

/* This is now in igd_query_max_size_ovl
 * Get the maximum width/height for the src_surface pixel format
 * return: max width and height parameters; should always return TRUE.
#define IGD_OVL_QUERY_MAX_WIDTH_HEIGHT                    0x00000003
 */

/* This should not be needed.  Since the IAL is always passing in valid
 * gamma information, the IAL should not query the HAL for the information.
#define IGD_OVL_QUERY_COLOR_CORRECT_INFO                  0x00000005*/


/*----------------------------------------------------------------------------
 * Overlay Color Key
 *--------------------------------------------------------------------------*/
/*!
 * @name Overlay Color Key Flags
 * @anchor igd_ovl_color_key_info_flags
 *
 * Flags for use with @ref igd_ovl_color_key_info_t
 * Enables and disables the src and dest color key for the overlay
 *
 * IGD_OVL_DST_BLEND_ENABLE enabled blending the contents of the overlay
 * with the contents of the frambuffer using the alpha from the framebuffer.
 * (As if the framebuffer was on top of the overlay) This feature requires
 * that dest colorkey be enabled.
 *
 * @{
 */
#define IGD_OVL_SRC_COLOR_KEY_DISABLE		0x00000000
#define IGD_OVL_SRC_COLOR_KEY_ENABLE		0x00000001

#define IGD_OVL_DST_COLOR_KEY_DISABLE		0x00000000
#define IGD_OVL_DST_COLOR_KEY_ENABLE		0x00000002

#define IGD_OVL_DST_BLEND_ENABLE            0x00000004
/*! @} */

/*!
 * @brief Overlay Color Key
 *
 * The src_lo, src_hi, and dest color key are in the following pixel format
 * based on the pixel format of the src and dest surface.
 * Note: Alpha is always ignored.
 *
 * - xRGB32        = x[31:24] R[23:16] G[15:8] B[7:0]
 * - xRGB16_555    = x[31:15] R[14:10] G[9:5]  B[4:0]
 * - ARGB8_INDEXED = x[31:8] Index Color[7:0]
 * - YUV surf      = x[31:24] Y[23:16] U[15:8] V[7:0]
 *
 * If the source pixel (overlay) is within the src_lo and src_hi color key
 * (inclusive) for all color components, then the destination pixel is
 * displayed.  Otherwise the source pixel is displayed.
 *
 * If the source and dest color key are both enabled, what happens???
 */
typedef struct _igd_ovl_color_key_info {
	/*! Low end src color key value */
	unsigned long        src_lo;
	/*! High end src color key value */
	unsigned long        src_hi;
	/*! Dest color key value.  If the destination pixel matches the
	 *   dest color key then the souce pixel from the video surface is displayed.
	 *   Otherwise, the destination pixel is displayed */
	unsigned long        dest;
	/*! Enable and disable the src and dest color key.
	 *   See @ref igd_ovl_color_key_info_flags */
	unsigned long        flags;
} igd_ovl_color_key_info_t;

/*----------------------------------------------------------------------------
 * Overlay Video Quality
 *--------------------------------------------------------------------------*/
/*!
 * @brief Overlay Video Quality
 *
 * All have a range between 0x0000 and 0xFFFF with default = 0x8000
 */
typedef struct _igd_ovl_video_quality_info{
	unsigned short		contrast;
	unsigned short		brightness;
	unsigned short		saturation;
} igd_ovl_video_quality_info_t;


/*----------------------------------------------------------------------------
 *  Overlay Gamma
 *--------------------------------------------------------------------------*/
/*!
 * @name Overlay Gamma Flags
 * @anchor igd_ovl_gamma_info_flags
 *
 * Flags for use with @ref igd_ovl_gamma_info_t.
 * Enables and disables the gamma for the overlay
 *
 * @{
 */
#define IGD_OVL_GAMMA_DISABLE               0x00000000
#define IGD_OVL_GAMMA_ENABLE				0x00000001
/*! @} */

/*!
 * @name Overlay Gamma Min/Max
 * @anchor igd_ovl_gamma_info_range
 *
 * Minimum and maximum gamma values for red, green, and blue with
 * @ref igd_ovl_gamma_info_t.  These values are in 24i.8f format.
 * Minimum value is 0.6
 * Maximum value is 6.0
 *
 * @{
 */
#define IGD_OVL_GAMMA_DEFAULT   0x100  /* 1.0 */
#define IGD_OVL_GAMMA_MIN       0x09A  /* 0.6 */
#define IGD_OVL_GAMMA_MAX       0x600  /* 6.0 */
/*! @} */

/*!
 * @brief Overlay Gamma
 *
 * Red, green, and blue values must be between min and max values.
 * This value is in 24i.8f format.
 * See @ref igd_ovl_gamma_info_range
 */
typedef struct _igd_ovl_gamma_info{
	unsigned int		red;
	unsigned int		green;
	unsigned int		blue;
	/*! Enable and disable the gamma for the overlay.
	 *   See @ref igd_ovl_gamma_info_flags */
	unsigned int		flags;
} igd_ovl_gamma_info_t;
/*! @} */

/*----------------------------------------------------------------------------
 * Overlay Info
 *--------------------------------------------------------------------------*/
/*!
 * @brief Overlay Information (includes color key, video quality, and gamma)
 */
typedef struct _igd_ovl_info{
	igd_ovl_color_key_info_t			color_key;
	igd_ovl_video_quality_info_t		video_quality;
	igd_ovl_gamma_info_t				gamma;
} igd_ovl_info_t;

typedef struct _video_surface_data {
	int flags;
	void *file;
} vid_surf_data_t;

#define OVL_PRIMARY   0
#define OVL_SECONDARY 1
#define OVL_MAX_HW    2  /* Maximum number of overlays */

/* Define the maximum number of blend surfaces which can be used */
#define MAX_BLEND_SURF 2

/* User mode overlay context */
typedef struct _ovl_um_context {
	/* OVLADD add additional overlay initialization parameters here. */
	int chiptype;
	void *dispatch; /* can't make this igd_dispatch_t due to circular reference */
	unsigned long dc;
	unsigned int  state;
	
	igd_display_h primary;
	void *primary_pipe; /* intel_pipe_data_t */
	
	igd_display_h secondary;
	void *secondary_pipe; /*intel_pipe_data_t */

	unsigned int blend_surf_num[OVL_MAX_HW];
	igd_surface_t blend_surf[OVL_MAX_HW][MAX_BLEND_SURF];

	vid_surf_data_t *vid_surf_data_ptr;

} ovl_um_context_t;



#endif /*_IGD_OVL_H*/