2
*-----------------------------------------------------------------------------
5
*-----------------------------------------------------------------------------
6
* Copyright © 2002-2010, Intel Corporation.
8
* This program is free software; you can redistribute it and/or modify it
9
* under the terms and conditions of the GNU General Public License,
10
* version 2, as published by the Free Software Foundation.
12
* This program is distributed in the hope it will be useful, but WITHOUT
13
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
17
* You should have received a copy of the GNU General Public License along with
18
* this program; if not, write to the Free Software Foundation, Inc.,
19
* 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
21
*-----------------------------------------------------------------------------
23
* Contain header information for set mode support
24
*-----------------------------------------------------------------------------
30
/* IO.h is needed for the FAR define */
40
#include <displayid.h>
41
#include <igd_render.h>
51
#define IGD_INVALID_MODE 0
56
#define IGD_PLANE_FEATURES_MASK 0x000000FF
57
#define IGD_PLANE_DISPLAY 0x00000001
58
#define IGD_PLANE_OVERLAY 0x00000002
59
#define IGD_PLANE_SPRITE 0x00000004
60
#define IGD_PLANE_CURSOR 0x00000008
61
#define IGD_PLANE_VGA 0x00000010
62
#define IGD_PLANE_DOUBLE 0x00000020
63
/*#define IGD_PLANE_CLONE 0x00000040 currently unused */
64
#define IGD_PLANE_DIH 0x00000080
65
#define IGD_PLANE_USE_PIPEA 0x00000100
66
#define IGD_PLANE_USE_PIPEB 0x00000200
71
/* pipe's supported features */
72
#define IGD_PIPE_FEATURES_MASK 0x000000FF
73
#define IGD_PIPE_DOUBLE 0x00000001
74
/* the following 2 bits are not pipe features but
75
* pipe identification bits that share the same
76
* pipe_features variable of the pipe structure
77
* NOTE that these bit-wise OR flags in nibble-2
78
* are also used in the port_features variable
79
* of the port structure (same locations) but
80
* called IGD_PORT_USE_PIPEX
82
#define IGD_PIPE_IS_PIPEA 0x00000100
83
#define IGD_PIPE_IS_PIPEB 0x00000200
89
* Cursor's supported features
92
* cursor's pipe usage regulations. These are copies of the PIPE_IS_ bits so
93
* that a quick (pipe_features & plane_features & MASK) will tell you if
94
* the pipe can be used.
96
#define IGD_CURSOR_USE_PIPE_MASK 0x00000F00
97
#define IGD_CURSOR_USE_PIPEA IGD_PIPE_IS_PIPEA
98
#define IGD_CURSOR_USE_PIPEB IGD_PIPE_IS_PIPEB
104
* Port's supported features
106
* port features also uses IGD_PORT_SHARE_MASK thus port feature bits
107
* cannot collide with IGD_PORT_SHARE_MASK
109
#define IGD_PORT_FEATURES_MASK 0x000000FF
110
#define IGD_RGBA_COLOR 0x00000001
111
#define IGD_RGBA_ALPHA 0x00000002
112
#define IGD_VGA_COMPRESS 0x00000004 /* Compress VGA to 640x480 */
113
#define IGD_PORT_GANG 0x00000008
115
* port's pipe usage regulations. These are copies of the PIPE_IS_ bits so
116
* that a quick (pipe_features & port_features & MASK) will tell you if
117
* the pipe can be used.
119
#define IGD_PORT_USE_PIPE_MASK 0x00000F00
120
#define IGD_PORT_USE_PIPE_MASK_SHIFT 8
121
#define IGD_PORT_USE_PIPEA IGD_PIPE_IS_PIPEA
122
#define IGD_PORT_USE_PIPEB IGD_PIPE_IS_PIPEB
124
* Ports Sharing information. The port in question can share a pipe with the
125
* listed ports. If a shares with b, b must share with a too.
126
* Must be the same as IGD_PORT_MASK = 0x3f000
128
#define IGD_PORT_SHARE_MASK IGD_PORT_MASK
129
#define IGD_PORT_SHARE_ANALOG IGD_PORT_ANALOG
130
#define IGD_PORT_SHARE_DIGITAL IGD_PORT_DIGITAL
131
#define IGD_PORT_SHARE_LVDS IGD_PORT_LVDS
132
#define IGD_PORT_SHARE_TV IGD_PORT_TV
134
/* MAX rings, planes and ports connected to a pipe */
135
#define IGD_MAX_PIPE_QUEUES 4
136
#define IGD_MAX_PIPE_PLANES 5
137
#define IGD_MAX_PIPE_DISPLAYS 4
138
#define IGD_MAX_PIPES 2
139
#define MAX_DISPLAYS IGD_MAX_DISPLAYS /* From igd_mode.h */
141
/* Parameters to mode_update_plane_pipe_ports */
142
#define MODE_UPDATE_PLANE 0x1
143
#define MODE_UPDATE_PIPE 0x2
144
#define MODE_UPDATE_PORT 0x4
145
#define MODE_UPDATE_NONE 0x0
147
#define PLANE(display) \
148
((igd_display_plane_t *)(((igd_display_context_t *)display)->plane))
149
#define PIPE(display) \
150
((igd_display_pipe_t *)(((igd_display_context_t *)display)->pipe))
151
#define PORT(display, pn) \
152
((igd_display_port_t *)(((igd_display_context_t *)display)->port[pn-1]))
153
#define PORT_OWNER(display) \
154
((igd_display_port_t *)(((igd_display_context_t *)display)->port[display->port_number-1]))
156
#define MODE_IS_SUPPORTED(t) (t->mode_info_flags & IGD_MODE_SUPPORTED)
157
#define MODE_IS_VGA(t) \
158
((((pd_timing_t *)t)->mode_info_flags & IGD_MODE_VESA) && \
159
(t->mode_number < 0x1D))
161
/* #define DC_PORT_NUMBER(dc, i) ((dc >> (i * 4)) & 0x0f) */
162
#define DC_PORT_NUMBER IGD_DC_PORT_NUMBER
164
/* This structure is used for the mode table which is a list of all
165
* supported modes. */
167
typedef pd_timing_t igd_timing_info_t, *pigd_timing_info_t;
171
* NOTE: The plane typedef is a generic type. Each plane type has an
172
* equivalent typedef that is more specific to the type of plane. They
173
* MUST remain equivalent. If you change one you must change them all.
175
typedef struct _igd_plane {
176
unsigned long plane_reg; /* plane control register */
177
unsigned long plane_features; /* plane feature list */
178
int inuse; /* plane inuse ? */
179
int ref_cnt; /* # of displays using this plane */
180
unsigned long *pixel_formats; /* supported pixel formats */
181
void *plane_info; /* ptr to plane_info */
182
struct _igd_plane *mirror; /* pointer to mirror plane */
185
typedef struct _igd_display_plane {
186
unsigned long plane_reg; /* plane contron register */
187
unsigned long plane_features; /* list of plane features */
188
int inuse; /* plane inuse ? */
189
int ref_cnt; /* # of displays using this plane */
190
unsigned long *pixel_formats; /* list of pixel formats supported */
191
igd_framebuffer_info_t *fb_info; /* attached fb to this plane */
192
struct _igd_display_plane *mirror; /* pointer to mirror plane */
193
} igd_display_plane_t, *pigd_display_plane_t;
195
typedef struct _igd_cursor {
196
unsigned long cursor_reg; /* cursor control register */
197
unsigned long plane_features; /* cursor plane features */
198
int inuse; /* is this cursor in use? */
199
int ref_cnt; /* # of displays using this plane */
200
unsigned long *pixel_formats; /* list of pixel_formats supported */
201
igd_cursor_info_t *cursor_info;
202
struct _igd_cursor *mirror; /* pointer to mirror plane */
205
typedef struct _igd_clock {
206
unsigned long dpll_control; /* DPLL control register */
207
unsigned long mnp; /* FPx0 register */
208
unsigned long p_shift; /* Bit location of P within control */
209
unsigned long actual_dclk; /* The actual dotclock after calculating dpll */
212
typedef struct _igd_display_pipe {
213
unsigned long pipe_num; /* 0 Based index */
214
unsigned long pipe_reg; /* pipe configuration register */
215
unsigned long timing_reg; /* timing register(htotal) */
216
unsigned long palette_reg; /* palette register */
217
igd_clock_t *clock_reg; /* DPLL clock registers */
218
unsigned long pipe_features; /* pipe features */
219
int inuse; /* pipe allocated? TRUE/FALSE */
220
int ref_cnt; /* # of displays using this pipe */
221
cmd_queue_t *queue[IGD_MAX_PIPE_QUEUES]; /* Queues for this pipe */
222
igd_display_plane_t *plane; /* dsp plane connected to pipe */
223
igd_cursor_t *cursor; /* cursor connected to this pipe */
224
void *sprite; /* sprite connected to this pipe */
225
igd_timing_info_t *timing; /* current timings on the port */
226
igd_display_context_t *owner; /* owner display of this pipe */
227
unsigned long dclk; /* current dclk running on this pipe */
228
}igd_display_pipe_t, *pigd_display_pipe_t;
230
typedef struct _igd_display_port {
231
unsigned long port_type; /* port type */
232
unsigned long port_number; /* port number */
233
char port_name[8]; /* port name DVO A, B, C, LVDS, ANALOG */
234
unsigned long port_reg; /* port control register */
235
unsigned long i2c_reg; /* GPIO pins for i2c on this port */
236
unsigned long dab; /* i2c Device Address Byte */
237
unsigned long ddc_reg; /* GPIO pins for DDC on this port */
238
unsigned long ddc_dab;
239
unsigned long port_features; /* port features */
240
unsigned long clock_bits; /* Clock input to use */
241
int inuse; /* port is in use */
242
unsigned long power_state; /* D Power state for the display/port */
243
unsigned long bl_power_state; /* D Power state for the FP backlight */
244
struct _igd_display_port *mult_port;/* pointer to multiplexed port,
245
* if it is used in that way */
246
igd_display_info_t *pt_info; /* port timing info */
247
pd_driver_t *pd_driver;
248
void *pd_context; /* Context returned from PD */
249
pd_callback_t *callback; /* DD Callback to passed to PD */
250
unsigned long num_timing; /* number of timings available */
251
igd_timing_info_t *timing_table; /* static/dynamic PD timings list */
252
unsigned long i2c_speed; /* Connected encoder's I2C bus speed */
253
unsigned long ddc_speed; /* DDC speed in KHz */
254
igd_param_fp_info_t *fp_info; /* Flat panel parameter info if any */
255
igd_param_dtd_list_t *dtd_list; /* EDID-less DTD info if any */
256
igd_param_attr_list_t *attr_list; /* Saved attributes if any */
257
igd_attr_t *tmp_attr; /* Temp attr array, for copying */
258
unsigned int tmp_attr_num; /* Number of attr in temp array */
259
igd_timing_info_t *fp_native_dtd; /* FP native DTD */
260
unsigned long pd_type; /* Display type given by port driver */
261
unsigned long pd_flags; /* port driver flags */
262
unsigned long saved_bl_power_state;
264
/* This attribute list is designed to eventually suck in things above
265
* such as fb_info. For now, it only has color correction attributes */
266
igd_attr_t *attributes;
268
unsigned char firmware_type;
270
displayid_t *displayid;
271
edid_t *edid; /* EDID information */
274
/* Added for VBIOS size Reduction */
275
unsigned long preserve;
276
unsigned long mult_preserve;
277
unsigned long vga_sync;
279
}igd_display_port_t, *pigd_display_port_t;
281
/* This structure is used to save mode state.
282
* Rightnow, it is saving state of current port and its port driver state.
283
* This information is used while restoring to a previously saved mode
285
* TODO: This can be extended to save all display modules (mode, dsp, pi) reg
286
* information along with port driver's state information. This requires
287
* changes to exiting reg module. */
288
#define MAX_PORT_DRIVERS 20
289
typedef struct _mode_pd_state {
290
igd_display_port_t *port; /* display port */
291
void *state; /* and its port driver state */
294
typedef struct _mode_state_t {
295
mode_pd_state_t pd_state[MAX_PORT_DRIVERS];
298
#endif // _IGD_MODE_H_
301
/*----------------------------------------------------------------------------
302
* File Revision History
303
* $Id: mode.h,v 1.5 2010/07/23 16:54:50 bpaauwe Exp $
304
* $Source: /nfs/fm/proj/eia/cvsroot/koheo/linux/egd_drm/emgd/include/mode.h,v $
305
*----------------------------------------------------------------------------