~gma500/+junk/emgd160

« back to all changes in this revision

Viewing changes to emgd-dkms-kernel39/emgd/include/mode.h

  • Committer: Luca Forina
  • Date: 2011-05-10 07:28:19 UTC
  • Revision ID: luca.forina@gmail.com-20110510072819-pgj21l6igboa9dsx
emgd-dkms for kernel .39

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- pse-c -*-
 
2
 *-----------------------------------------------------------------------------
 
3
 * Filename: mode.h
 
4
 * $Revision: 1.6 $
 
5
 *-----------------------------------------------------------------------------
 
6
 * Copyright © 2002-2010, Intel Corporation.
 
7
 *
 
8
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 
9
 * of this software and associated documentation files (the "Software"), to deal
 
10
 * in the Software without restriction, including without limitation the rights
 
11
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 
12
 * copies of the Software, and to permit persons to whom the Software is
 
13
 * furnished to do so, subject to the following conditions:
 
14
 *
 
15
 * The above copyright notice and this permission notice shall be included in
 
16
 * all copies or substantial portions of the Software.
 
17
 *
 
18
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 
19
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
20
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 
21
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 
22
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 
23
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 
24
 * THE SOFTWARE.
 
25
 *
 
26
 *-----------------------------------------------------------------------------
 
27
 * Description:
 
28
 *  Contain header information for set mode support
 
29
 *-----------------------------------------------------------------------------
 
30
 */
 
31
 
 
32
#ifndef _MODE_H_
 
33
#define _MODE_H_
 
34
 
 
35
/* IO.h is needed for the FAR define */
 
36
#include <io.h>
 
37
 
 
38
#include <igd_init.h>
 
39
#include <igd_mode.h>
 
40
#include <general.h>
 
41
#include <context.h>
 
42
#include <cmd.h>
 
43
#include <pd.h>
 
44
#include <edid.h>
 
45
#include <displayid.h>
 
46
#include <igd_render.h>
 
47
 
 
48
#ifndef TRUE
 
49
#define TRUE  1
 
50
#endif
 
51
 
 
52
#ifndef FALSE
 
53
#define FALSE 0
 
54
#endif
 
55
 
 
56
#define IGD_INVALID_MODE 0
 
57
 
 
58
/*****************/
 
59
/* Plane Features */
 
60
/*****************/
 
61
#define IGD_PLANE_FEATURES_MASK      0x000000FF
 
62
#define IGD_PLANE_DISPLAY            0x00000001
 
63
#define IGD_PLANE_OVERLAY            0x00000002
 
64
#define IGD_PLANE_SPRITE             0x00000004
 
65
#define IGD_PLANE_CURSOR             0x00000008
 
66
#define IGD_PLANE_VGA                0x00000010
 
67
#define IGD_PLANE_DOUBLE             0x00000020
 
68
/*#define IGD_PLANE_CLONE            0x00000040 currently unused */
 
69
#define IGD_PLANE_DIH                0x00000080
 
70
#define IGD_PLANE_USE_PIPEA          0x00000100
 
71
#define IGD_PLANE_USE_PIPEB          0x00000200
 
72
 
 
73
/*****************/
 
74
/* Pipe Features */
 
75
/*****************/
 
76
/* pipe's supported features */
 
77
#define IGD_PIPE_FEATURES_MASK       0x000000FF
 
78
#define IGD_PIPE_DOUBLE              0x00000001
 
79
/* the following 2 bits are not pipe features but
 
80
 * pipe identification bits that share the same
 
81
 * pipe_features variable of the pipe structure
 
82
 * NOTE that these bit-wise OR flags in nibble-2
 
83
 * are also used in the port_features variable
 
84
 * of the port structure (same locations) but
 
85
 * called IGD_PORT_USE_PIPEX
 
86
 */
 
87
#define IGD_PIPE_IS_PIPEA            0x00000100
 
88
#define IGD_PIPE_IS_PIPEB            0x00000200
 
89
 
 
90
/*******************/
 
91
/* Cursor Features */
 
92
/*******************/
 
93
/*
 
94
 * Cursor's supported features
 
95
 */
 
96
/*
 
97
 * cursor's pipe usage regulations. These are copies of the PIPE_IS_ bits so
 
98
 * that a quick (pipe_features & plane_features & MASK) will tell you if
 
99
 * the pipe can be used.
 
100
 */
 
101
#define IGD_CURSOR_USE_PIPE_MASK       0x00000F00
 
102
#define IGD_CURSOR_USE_PIPEA           IGD_PIPE_IS_PIPEA
 
103
#define IGD_CURSOR_USE_PIPEB           IGD_PIPE_IS_PIPEB
 
104
 
 
105
/*****************/
 
106
/* Port features */
 
107
/*****************/
 
108
/*
 
109
 * Port's supported features
 
110
 *
 
111
 * port features also uses IGD_PORT_SHARE_MASK thus port feature bits
 
112
 * cannot collide with IGD_PORT_SHARE_MASK
 
113
 */
 
114
#define IGD_PORT_FEATURES_MASK       0x000000FF
 
115
#define IGD_RGBA_COLOR               0x00000001
 
116
#define IGD_RGBA_ALPHA               0x00000002
 
117
#define IGD_VGA_COMPRESS             0x00000004 /* Compress VGA to 640x480 */
 
118
#define IGD_PORT_GANG                0x00000008
 
119
/*
 
120
 * port's pipe usage regulations. These are copies of the PIPE_IS_ bits so
 
121
 * that a quick (pipe_features & port_features & MASK) will tell you if
 
122
 * the pipe can be used.
 
123
 */
 
124
#define IGD_PORT_USE_PIPE_MASK       0x00000F00
 
125
#define IGD_PORT_USE_PIPE_MASK_SHIFT 8
 
126
#define IGD_PORT_USE_PIPEA           IGD_PIPE_IS_PIPEA
 
127
#define IGD_PORT_USE_PIPEB           IGD_PIPE_IS_PIPEB
 
128
/*
 
129
 * Ports Sharing information. The port in question can share a pipe with the
 
130
 * listed ports. If a shares with b, b must share with a too.
 
131
 * Must be the same as IGD_PORT_MASK = 0x3f000
 
132
 */
 
133
#define IGD_PORT_SHARE_MASK          IGD_PORT_MASK
 
134
#define IGD_PORT_SHARE_ANALOG        IGD_PORT_ANALOG
 
135
#define IGD_PORT_SHARE_DIGITAL       IGD_PORT_DIGITAL
 
136
#define IGD_PORT_SHARE_LVDS          IGD_PORT_LVDS
 
137
#define IGD_PORT_SHARE_TV            IGD_PORT_TV
 
138
 
 
139
/* MAX rings, planes and ports connected to a pipe */
 
140
#define IGD_MAX_PIPE_QUEUES      4
 
141
#define IGD_MAX_PIPE_PLANES      5
 
142
#define IGD_MAX_PIPE_DISPLAYS    4
 
143
#define IGD_MAX_PIPES            2
 
144
#define MAX_DISPLAYS             IGD_MAX_DISPLAYS /* From igd_mode.h */
 
145
 
 
146
/* Parameters to mode_update_plane_pipe_ports */
 
147
#define MODE_UPDATE_PLANE  0x1
 
148
#define MODE_UPDATE_PIPE   0x2
 
149
#define MODE_UPDATE_PORT   0x4
 
150
#define MODE_UPDATE_NONE   0x0
 
151
 
 
152
#define PLANE(display) \
 
153
        ((igd_display_plane_t *)(((igd_display_context_t *)display)->plane))
 
154
#define PIPE(display)  \
 
155
        ((igd_display_pipe_t *)(((igd_display_context_t *)display)->pipe))
 
156
#define PORT(display, pn)  \
 
157
        ((igd_display_port_t *)(((igd_display_context_t *)display)->port[pn-1]))
 
158
#define PORT_OWNER(display)  \
 
159
        ((igd_display_port_t *)(((igd_display_context_t *)display)->port[display->port_number-1]))
 
160
 
 
161
#define MODE_IS_SUPPORTED(t) (t->mode_info_flags & IGD_MODE_SUPPORTED)
 
162
#define MODE_IS_VGA(t) \
 
163
        ((((pd_timing_t *)t)->mode_info_flags & IGD_MODE_VESA) &&       \
 
164
                (t->mode_number < 0x1D))
 
165
 
 
166
/* #define DC_PORT_NUMBER(dc, i) ((dc >> (i * 4)) & 0x0f) */
 
167
#define DC_PORT_NUMBER IGD_DC_PORT_NUMBER
 
168
 
 
169
/* This structure is used for the mode table which is a list of all
 
170
 * supported modes. */
 
171
 
 
172
typedef pd_timing_t igd_timing_info_t, *pigd_timing_info_t;
 
173
 
 
174
 
 
175
/*
 
176
 * NOTE: The plane typedef is a generic type. Each plane type has an
 
177
 * equivalent typedef that is more specific to the type of plane. They
 
178
 * MUST remain equivalent. If you change one you must change them all.
 
179
 */
 
180
typedef struct _igd_plane {
 
181
        unsigned long plane_reg;       /* plane control register */
 
182
        unsigned long plane_features;  /* plane feature list */
 
183
        int           inuse;           /* plane inuse ? */
 
184
        int           ref_cnt;         /* # of displays using this plane */
 
185
        unsigned long *pixel_formats;  /* supported pixel formats */
 
186
        void *plane_info;              /* ptr to plane_info */
 
187
        struct _igd_plane *mirror;     /* pointer to mirror plane */
 
188
} igd_plane_t;
 
189
 
 
190
typedef struct _igd_display_plane {
 
191
        unsigned long plane_reg;         /* plane contron register */
 
192
        unsigned long plane_features;    /* list of plane features */
 
193
        int           inuse;             /* plane inuse ? */
 
194
        int           ref_cnt;           /* # of displays using this plane */
 
195
        unsigned long *pixel_formats;    /* list of pixel formats supported */
 
196
        igd_framebuffer_info_t *fb_info; /* attached fb to this plane */
 
197
        struct _igd_display_plane *mirror;  /* pointer to mirror plane */
 
198
} igd_display_plane_t, *pigd_display_plane_t;
 
199
 
 
200
typedef struct _igd_cursor {
 
201
        unsigned long cursor_reg;        /* cursor control register */
 
202
        unsigned long plane_features;    /* cursor plane features */
 
203
        int           inuse;             /* is this cursor in use? */
 
204
        int           ref_cnt;           /* # of displays using this plane */
 
205
        unsigned long *pixel_formats;    /* list of pixel_formats supported */
 
206
        igd_cursor_info_t *cursor_info;
 
207
        struct _igd_cursor *mirror;  /* pointer to mirror plane */
 
208
} igd_cursor_t;
 
209
 
 
210
typedef struct _igd_clock {
 
211
        unsigned long dpll_control;       /* DPLL control register */
 
212
        unsigned long mnp;                /* FPx0 register */
 
213
        unsigned long p_shift;            /* Bit location of P within control */
 
214
        unsigned long actual_dclk;                /* The actual dotclock after calculating dpll */
 
215
}igd_clock_t;
 
216
 
 
217
typedef struct _igd_display_pipe {
 
218
        unsigned long pipe_num;             /* 0 Based index */
 
219
        unsigned long pipe_reg;             /* pipe configuration register */
 
220
        unsigned long timing_reg;           /* timing register(htotal) */
 
221
        unsigned long palette_reg;          /* palette register */
 
222
        igd_clock_t   *clock_reg;           /* DPLL clock registers */
 
223
        unsigned long pipe_features;        /* pipe features */
 
224
        int           inuse;                /* pipe allocated? TRUE/FALSE */
 
225
        int           ref_cnt;              /* # of displays using this pipe */
 
226
        cmd_queue_t *queue[IGD_MAX_PIPE_QUEUES]; /* Queues for this pipe */
 
227
        igd_display_plane_t   *plane;      /* dsp plane connected to pipe */
 
228
        igd_cursor_t          *cursor;     /* cursor connected to this pipe */
 
229
        void                  *sprite;     /* sprite connected to this pipe */
 
230
        igd_timing_info_t     *timing;     /* current timings on the port */
 
231
        igd_display_context_t *owner;      /* owner display of this pipe */
 
232
        unsigned long dclk;                /* current dclk running on this pipe */
 
233
}igd_display_pipe_t, *pigd_display_pipe_t;
 
234
 
 
235
typedef struct _igd_display_port {
 
236
        unsigned long port_type;            /* port type */
 
237
        unsigned long port_number;          /* port number */
 
238
        char          port_name[8];         /* port name DVO A, B, C, LVDS, ANALOG */
 
239
        unsigned long port_reg;             /* port control register */
 
240
        unsigned long i2c_reg;              /* GPIO pins for i2c on this port */
 
241
        unsigned long dab;                  /* i2c Device Address Byte */
 
242
        unsigned long ddc_reg;              /* GPIO pins for DDC on this port */
 
243
        unsigned long ddc_dab;
 
244
        unsigned long port_features;        /* port features */
 
245
        unsigned long clock_bits;           /* Clock input to use */
 
246
        int           inuse;                /* port is in use */
 
247
        unsigned long  power_state;         /* D Power state for the display/port */
 
248
        unsigned long bl_power_state;       /* D Power state for the FP backlight */
 
249
        struct _igd_display_port *mult_port;/* pointer to multiplexed port,
 
250
                                                                                 * if it is used in that way */
 
251
        igd_display_info_t    *pt_info;     /* port timing info */
 
252
        pd_driver_t           *pd_driver;
 
253
        void                  *pd_context;  /* Context returned from PD */
 
254
        pd_callback_t         *callback;    /* DD Callback to passed to PD */
 
255
        unsigned long         num_timing;   /* number of timings available */
 
256
        igd_timing_info_t     *timing_table; /* static/dynamic PD timings list */
 
257
        unsigned long         i2c_speed;    /* Connected encoder's I2C bus speed */
 
258
        unsigned long         ddc_speed;    /* DDC speed in KHz */
 
259
        igd_param_fp_info_t   *fp_info;     /* Flat panel parameter info if any */
 
260
        igd_param_dtd_list_t  *dtd_list;    /* EDID-less DTD info if any */
 
261
        igd_param_attr_list_t *attr_list;   /* Saved attributes if any */
 
262
        igd_attr_t            *tmp_attr;    /* Temp attr array, for copying */
 
263
        unsigned int          tmp_attr_num; /* Number of attr in temp array */
 
264
        igd_timing_info_t     *fp_native_dtd; /* FP native DTD */
 
265
        unsigned long         pd_type;      /* Display type given by port driver */
 
266
        unsigned long         pd_flags;     /* port driver flags */
 
267
        unsigned long         saved_bl_power_state;
 
268
 
 
269
        /* This attribute list is designed to eventually suck in things above
 
270
         * such as fb_info.  For now, it only has color correction attributes */
 
271
        igd_attr_t            *attributes;
 
272
 
 
273
        unsigned char         firmware_type;
 
274
        union {
 
275
                displayid_t       *displayid;
 
276
                edid_t            *edid;         /* EDID information */
 
277
        };
 
278
 
 
279
    /* Added for VBIOS size Reduction */
 
280
        unsigned long         preserve;
 
281
        unsigned long         mult_preserve;
 
282
        unsigned long         vga_sync;
 
283
 
 
284
}igd_display_port_t, *pigd_display_port_t;
 
285
 
 
286
/* This structure is used to save mode state.
 
287
 * Rightnow, it is saving state of current port and its port driver state.
 
288
 * This information is used while restoring to a previously saved mode
 
289
 * state.
 
290
 * TODO: This can be extended to save all display modules (mode, dsp, pi) reg
 
291
 * information along with port driver's state information. This requires
 
292
 * changes to exiting reg module. */
 
293
#define MAX_PORT_DRIVERS     20
 
294
typedef struct _mode_pd_state {
 
295
                igd_display_port_t *port;       /* display port */
 
296
                void               *state;      /* and its port driver state */
 
297
} mode_pd_state_t;
 
298
 
 
299
typedef struct _mode_state_t {
 
300
        mode_pd_state_t pd_state[MAX_PORT_DRIVERS];
 
301
} mode_state_t;
 
302
 
 
303
#endif // _IGD_MODE_H_
 
304
 
 
305
 
 
306
/*----------------------------------------------------------------------------
 
307
 * File Revision History
 
308
 * $Id: mode.h,v 1.6 2011/02/16 17:04:48 astead Exp $
 
309
 * $Source: /nfs/fm/proj/eia/cvsroot/koheo/linux/egd_drm/emgd/include/mode.h,v $
 
310
 *----------------------------------------------------------------------------
 
311
 */