Subversion Repositories Kolibri OS

Rev

Rev 6082 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6082 Rev 6936
1
/*
1
/*
2
 * Copyright © 2006 Keith Packard
2
 * Copyright © 2006 Keith Packard
3
 * Copyright © 2007-2008 Dave Airlie
3
 * Copyright © 2007-2008 Dave Airlie
4
 * Copyright © 2007-2008 Intel Corporation
4
 * Copyright © 2007-2008 Intel Corporation
5
 *   Jesse Barnes 
5
 *   Jesse Barnes 
6
 * Copyright © 2014 Intel Corporation
6
 * Copyright © 2014 Intel Corporation
7
 *   Daniel Vetter 
7
 *   Daniel Vetter 
8
 *
8
 *
9
 * Permission is hereby granted, free of charge, to any person obtaining a
9
 * Permission is hereby granted, free of charge, to any person obtaining a
10
 * copy of this software and associated documentation files (the "Software"),
10
 * copy of this software and associated documentation files (the "Software"),
11
 * to deal in the Software without restriction, including without limitation
11
 * to deal in the Software without restriction, including without limitation
12
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
13
 * and/or sell copies of the Software, and to permit persons to whom the
13
 * and/or sell copies of the Software, and to permit persons to whom the
14
 * Software is furnished to do so, subject to the following conditions:
14
 * Software is furnished to do so, subject to the following conditions:
15
 *
15
 *
16
 * The above copyright notice and this permission notice shall be included in
16
 * The above copyright notice and this permission notice shall be included in
17
 * all copies or substantial portions of the Software.
17
 * all copies or substantial portions of the Software.
18
 *
18
 *
19
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
21
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
22
 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
22
 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
23
 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
23
 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
24
 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
24
 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25
 * OTHER DEALINGS IN THE SOFTWARE.
25
 * OTHER DEALINGS IN THE SOFTWARE.
26
 */
26
 */
27
#ifndef __DRM_MODES_H__
27
#ifndef __DRM_MODES_H__
28
#define __DRM_MODES_H__
28
#define __DRM_MODES_H__
29
 
29
 
30
/*
30
/*
31
 * Note on terminology:  here, for brevity and convenience, we refer to connector
31
 * Note on terminology:  here, for brevity and convenience, we refer to connector
32
 * control chips as 'CRTCs'.  They can control any type of connector, VGA, LVDS,
32
 * control chips as 'CRTCs'.  They can control any type of connector, VGA, LVDS,
33
 * DVI, etc.  And 'screen' refers to the whole of the visible display, which
33
 * DVI, etc.  And 'screen' refers to the whole of the visible display, which
34
 * may span multiple monitors (and therefore multiple CRTC and connector
34
 * may span multiple monitors (and therefore multiple CRTC and connector
35
 * structures).
35
 * structures).
36
 */
36
 */
-
 
37
 
-
 
38
/**
-
 
39
 * enum drm_mode_status - hardware support status of a mode
-
 
40
 * @MODE_OK: Mode OK
-
 
41
 * @MODE_HSYNC: hsync out of range
-
 
42
 * @MODE_VSYNC: vsync out of range
-
 
43
 * @MODE_H_ILLEGAL: mode has illegal horizontal timings
-
 
44
 * @MODE_V_ILLEGAL: mode has illegal horizontal timings
-
 
45
 * @MODE_BAD_WIDTH: requires an unsupported linepitch
-
 
46
 * @MODE_NOMODE: no mode with a matching name
-
 
47
 * @MODE_NO_INTERLACE: interlaced mode not supported
-
 
48
 * @MODE_NO_DBLESCAN: doublescan mode not supported
-
 
49
 * @MODE_NO_VSCAN: multiscan mode not supported
-
 
50
 * @MODE_MEM: insufficient video memory
-
 
51
 * @MODE_VIRTUAL_X: mode width too large for specified virtual size
-
 
52
 * @MODE_VIRTUAL_Y: mode height too large for specified virtual size
-
 
53
 * @MODE_MEM_VIRT: insufficient video memory given virtual size
-
 
54
 * @MODE_NOCLOCK: no fixed clock available
-
 
55
 * @MODE_CLOCK_HIGH: clock required is too high
-
 
56
 * @MODE_CLOCK_LOW: clock required is too low
-
 
57
 * @MODE_CLOCK_RANGE: clock/mode isn't in a ClockRange
-
 
58
 * @MODE_BAD_HVALUE: horizontal timing was out of range
-
 
59
 * @MODE_BAD_VVALUE: vertical timing was out of range
-
 
60
 * @MODE_BAD_VSCAN: VScan value out of range
-
 
61
 * @MODE_HSYNC_NARROW: horizontal sync too narrow
-
 
62
 * @MODE_HSYNC_WIDE: horizontal sync too wide
-
 
63
 * @MODE_HBLANK_NARROW: horizontal blanking too narrow
-
 
64
 * @MODE_HBLANK_WIDE: horizontal blanking too wide
-
 
65
 * @MODE_VSYNC_NARROW: vertical sync too narrow
-
 
66
 * @MODE_VSYNC_WIDE: vertical sync too wide
-
 
67
 * @MODE_VBLANK_NARROW: vertical blanking too narrow
-
 
68
 * @MODE_VBLANK_WIDE: vertical blanking too wide
-
 
69
 * @MODE_PANEL: exceeds panel dimensions
-
 
70
 * @MODE_INTERLACE_WIDTH: width too large for interlaced mode
-
 
71
 * @MODE_ONE_WIDTH: only one width is supported
-
 
72
 * @MODE_ONE_HEIGHT: only one height is supported
-
 
73
 * @MODE_ONE_SIZE: only one resolution is supported
-
 
74
 * @MODE_NO_REDUCED: monitor doesn't accept reduced blanking
-
 
75
 * @MODE_NO_STEREO: stereo modes not supported
-
 
76
 * @MODE_STALE: mode has become stale
-
 
77
 * @MODE_BAD: unspecified reason
-
 
78
 * @MODE_ERROR: error condition
-
 
79
 *
-
 
80
 * This enum is used to filter out modes not supported by the driver/hardware
-
 
81
 * combination.
37
 
82
 */
38
enum drm_mode_status {
83
enum drm_mode_status {
39
    MODE_OK	= 0,	/* Mode OK */
84
	MODE_OK = 0,
40
    MODE_HSYNC,		/* hsync out of range */
85
	MODE_HSYNC,
41
    MODE_VSYNC,		/* vsync out of range */
86
	MODE_VSYNC,
42
    MODE_H_ILLEGAL,	/* mode has illegal horizontal timings */
87
	MODE_H_ILLEGAL,
43
    MODE_V_ILLEGAL,	/* mode has illegal horizontal timings */
88
	MODE_V_ILLEGAL,
44
    MODE_BAD_WIDTH,	/* requires an unsupported linepitch */
89
	MODE_BAD_WIDTH,
45
    MODE_NOMODE,	/* no mode with a matching name */
90
	MODE_NOMODE,
46
    MODE_NO_INTERLACE,	/* interlaced mode not supported */
91
	MODE_NO_INTERLACE,
47
    MODE_NO_DBLESCAN,	/* doublescan mode not supported */
92
	MODE_NO_DBLESCAN,
48
    MODE_NO_VSCAN,	/* multiscan mode not supported */
93
	MODE_NO_VSCAN,
49
    MODE_MEM,		/* insufficient video memory */
94
	MODE_MEM,
50
    MODE_VIRTUAL_X,	/* mode width too large for specified virtual size */
95
	MODE_VIRTUAL_X,
51
    MODE_VIRTUAL_Y,	/* mode height too large for specified virtual size */
96
	MODE_VIRTUAL_Y,
52
    MODE_MEM_VIRT,	/* insufficient video memory given virtual size */
97
	MODE_MEM_VIRT,
53
    MODE_NOCLOCK,	/* no fixed clock available */
98
	MODE_NOCLOCK,
54
    MODE_CLOCK_HIGH,	/* clock required is too high */
99
	MODE_CLOCK_HIGH,
55
    MODE_CLOCK_LOW,	/* clock required is too low */
100
	MODE_CLOCK_LOW,
56
    MODE_CLOCK_RANGE,	/* clock/mode isn't in a ClockRange */
101
	MODE_CLOCK_RANGE,
57
    MODE_BAD_HVALUE,	/* horizontal timing was out of range */
102
	MODE_BAD_HVALUE,
58
    MODE_BAD_VVALUE,	/* vertical timing was out of range */
103
	MODE_BAD_VVALUE,
59
    MODE_BAD_VSCAN,	/* VScan value out of range */
104
	MODE_BAD_VSCAN,
60
    MODE_HSYNC_NARROW,	/* horizontal sync too narrow */
105
	MODE_HSYNC_NARROW,
61
    MODE_HSYNC_WIDE,	/* horizontal sync too wide */
106
	MODE_HSYNC_WIDE,
62
    MODE_HBLANK_NARROW,	/* horizontal blanking too narrow */
107
	MODE_HBLANK_NARROW,
63
    MODE_HBLANK_WIDE,	/* horizontal blanking too wide */
108
	MODE_HBLANK_WIDE,
64
    MODE_VSYNC_NARROW,	/* vertical sync too narrow */
109
	MODE_VSYNC_NARROW,
65
    MODE_VSYNC_WIDE,	/* vertical sync too wide */
110
	MODE_VSYNC_WIDE,
66
    MODE_VBLANK_NARROW,	/* vertical blanking too narrow */
111
	MODE_VBLANK_NARROW,
67
    MODE_VBLANK_WIDE,	/* vertical blanking too wide */
112
	MODE_VBLANK_WIDE,
68
    MODE_PANEL,         /* exceeds panel dimensions */
113
	MODE_PANEL,
69
    MODE_INTERLACE_WIDTH, /* width too large for interlaced mode */
114
	MODE_INTERLACE_WIDTH,
70
    MODE_ONE_WIDTH,     /* only one width is supported */
115
	MODE_ONE_WIDTH,
71
    MODE_ONE_HEIGHT,    /* only one height is supported */
116
	MODE_ONE_HEIGHT,
72
    MODE_ONE_SIZE,      /* only one resolution is supported */
117
	MODE_ONE_SIZE,
73
    MODE_NO_REDUCED,    /* monitor doesn't accept reduced blanking */
118
	MODE_NO_REDUCED,
74
    MODE_NO_STEREO,	/* stereo modes not supported */
119
	MODE_NO_STEREO,
75
    MODE_UNVERIFIED = -3, /* mode needs to reverified */
120
	MODE_STALE = -3,
76
    MODE_BAD = -2,	/* unspecified reason */
121
	MODE_BAD = -2,
77
    MODE_ERROR	= -1	/* error condition */
122
	MODE_ERROR = -1
78
};
123
};
79
 
124
 
80
#define DRM_MODE_TYPE_CLOCK_CRTC_C (DRM_MODE_TYPE_CLOCK_C | \
125
#define DRM_MODE_TYPE_CLOCK_CRTC_C (DRM_MODE_TYPE_CLOCK_C | \
81
				    DRM_MODE_TYPE_CRTC_C)
126
				    DRM_MODE_TYPE_CRTC_C)
82
 
127
 
83
#define DRM_MODE(nm, t, c, hd, hss, hse, ht, hsk, vd, vss, vse, vt, vs, f) \
128
#define DRM_MODE(nm, t, c, hd, hss, hse, ht, hsk, vd, vss, vse, vt, vs, f) \
84
	.name = nm, .status = 0, .type = (t), .clock = (c), \
129
	.name = nm, .status = 0, .type = (t), .clock = (c), \
85
	.hdisplay = (hd), .hsync_start = (hss), .hsync_end = (hse), \
130
	.hdisplay = (hd), .hsync_start = (hss), .hsync_end = (hse), \
86
	.htotal = (ht), .hskew = (hsk), .vdisplay = (vd), \
131
	.htotal = (ht), .hskew = (hsk), .vdisplay = (vd), \
87
	.vsync_start = (vss), .vsync_end = (vse), .vtotal = (vt), \
132
	.vsync_start = (vss), .vsync_end = (vse), .vtotal = (vt), \
88
	.vscan = (vs), .flags = (f), \
133
	.vscan = (vs), .flags = (f), \
89
	.base.type = DRM_MODE_OBJECT_MODE
134
	.base.type = DRM_MODE_OBJECT_MODE
90
 
135
 
91
#define CRTC_INTERLACE_HALVE_V	(1 << 0) /* halve V values for interlacing */
136
#define CRTC_INTERLACE_HALVE_V	(1 << 0) /* halve V values for interlacing */
92
#define CRTC_STEREO_DOUBLE	(1 << 1) /* adjust timings for stereo modes */
137
#define CRTC_STEREO_DOUBLE	(1 << 1) /* adjust timings for stereo modes */
93
#define CRTC_NO_DBLSCAN		(1 << 2) /* don't adjust doublescan */
138
#define CRTC_NO_DBLSCAN		(1 << 2) /* don't adjust doublescan */
94
#define CRTC_NO_VSCAN		(1 << 3) /* don't adjust doublescan */
139
#define CRTC_NO_VSCAN		(1 << 3) /* don't adjust doublescan */
95
#define CRTC_STEREO_DOUBLE_ONLY	(CRTC_STEREO_DOUBLE | CRTC_NO_DBLSCAN | CRTC_NO_VSCAN)
140
#define CRTC_STEREO_DOUBLE_ONLY	(CRTC_STEREO_DOUBLE | CRTC_NO_DBLSCAN | CRTC_NO_VSCAN)
96
 
141
 
97
#define DRM_MODE_FLAG_3D_MAX	DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF
142
#define DRM_MODE_FLAG_3D_MAX	DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF
-
 
143
 
-
 
144
/**
-
 
145
 * struct drm_display_mode - DRM kernel-internal display mode structure
-
 
146
 * @hdisplay: horizontal display size
-
 
147
 * @hsync_start: horizontal sync start
-
 
148
 * @hsync_end: horizontal sync end
-
 
149
 * @htotal: horizontal total size
-
 
150
 * @hskew: horizontal skew?!
-
 
151
 * @vdisplay: vertical display size
-
 
152
 * @vsync_start: vertical sync start
-
 
153
 * @vsync_end: vertical sync end
-
 
154
 * @vtotal: vertical total size
-
 
155
 * @vscan: vertical scan?!
-
 
156
 * @crtc_hdisplay: hardware mode horizontal display size
-
 
157
 * @crtc_hblank_start: hardware mode horizontal blank start
-
 
158
 * @crtc_hblank_end: hardware mode horizontal blank end
-
 
159
 * @crtc_hsync_start: hardware mode horizontal sync start
-
 
160
 * @crtc_hsync_end: hardware mode horizontal sync end
-
 
161
 * @crtc_htotal: hardware mode horizontal total size
-
 
162
 * @crtc_hskew: hardware mode horizontal skew?!
-
 
163
 * @crtc_vdisplay: hardware mode vertical display size
-
 
164
 * @crtc_vblank_start: hardware mode vertical blank start
-
 
165
 * @crtc_vblank_end: hardware mode vertical blank end
-
 
166
 * @crtc_vsync_start: hardware mode vertical sync start
-
 
167
 * @crtc_vsync_end: hardware mode vertical sync end
-
 
168
 * @crtc_vtotal: hardware mode vertical total size
-
 
169
 *
-
 
170
 * The horizontal and vertical timings are defined per the following diagram.
-
 
171
 *
-
 
172
 *
-
 
173
 *               Active                 Front           Sync           Back
-
 
174
 *              Region                 Porch                          Porch
-
 
175
 *     <-----------------------><----------------><-------------><-------------->
-
 
176
 *       //////////////////////|
-
 
177
 *      ////////////////////// |
-
 
178
 *     //////////////////////  |..................               ................
-
 
179
 *                                                _______________
-
 
180
 *     <----- [hv]display ----->
-
 
181
 *     <------------- [hv]sync_start ------------>
-
 
182
 *     <--------------------- [hv]sync_end --------------------->
-
 
183
 *     <-------------------------------- [hv]total ----------------------------->*
-
 
184
 *
-
 
185
 * This structure contains two copies of timings. First are the plain timings,
-
 
186
 * which specify the logical mode, as it would be for a progressive 1:1 scanout
-
 
187
 * at the refresh rate userspace can observe through vblank timestamps. Then
-
 
188
 * there's the hardware timings, which are corrected for interlacing,
-
 
189
 * double-clocking and similar things. They are provided as a convenience, and
-
 
190
 * can be appropriately computed using drm_mode_set_crtcinfo().
98
 
191
 */
-
 
192
struct drm_display_mode {
99
struct drm_display_mode {
193
	/**
-
 
194
	 * @head:
-
 
195
	 *
-
 
196
	 * struct list_head for mode lists.
100
	/* Header */
197
	 */
-
 
198
	struct list_head head;
-
 
199
 
-
 
200
	/**
-
 
201
	 * @base:
-
 
202
	 *
-
 
203
	 * A display mode is a normal modeset object, possibly including public
-
 
204
	 * userspace id.
-
 
205
	 *
-
 
206
	 * FIXME:
-
 
207
	 *
-
 
208
	 * This can probably be removed since the entire concept of userspace
-
 
209
	 * managing modes explicitly has never landed in upstream kernel mode
-
 
210
	 * setting support.
101
	struct list_head head;
211
	 */
-
 
212
	struct drm_mode_object base;
-
 
213
 
-
 
214
	/**
-
 
215
	 * @name:
-
 
216
	 *
102
	struct drm_mode_object base;
217
	 * Human-readable name of the mode, filled out with drm_mode_set_name().
-
 
218
	 */
-
 
219
	char name[DRM_DISPLAY_MODE_LEN];
-
 
220
 
-
 
221
	/**
-
 
222
	 * @status:
-
 
223
	 *
103
 
224
	 * Status of the mode, used to filter out modes not supported by the
-
 
225
	 * hardware. See enum &drm_mode_status.
-
 
226
	 */
-
 
227
	enum drm_mode_status status;
-
 
228
 
-
 
229
	/**
-
 
230
	 * @type:
-
 
231
	 *
-
 
232
	 * A bitmask of flags, mostly about the source of a mode. Possible flags
-
 
233
	 * are:
-
 
234
	 *
-
 
235
	 *  - DRM_MODE_TYPE_BUILTIN: Meant for hard-coded modes, effectively
-
 
236
	 *    unused.
-
 
237
	 *  - DRM_MODE_TYPE_PREFERRED: Preferred mode, usually the native
-
 
238
	 *    resolution of an LCD panel. There should only be one preferred
-
 
239
	 *    mode per connector at any given time.
-
 
240
	 *  - DRM_MODE_TYPE_DRIVER: Mode created by the driver, which is all of
-
 
241
	 *    them really. Drivers must set this bit for all modes they create
-
 
242
	 *    and expose to userspace.
-
 
243
	 *
-
 
244
	 * Plus a big list of flags which shouldn't be used at all, but are
-
 
245
	 * still around since these flags are also used in the userspace ABI:
-
 
246
	 *
-
 
247
	 *  - DRM_MODE_TYPE_DEFAULT: Again a leftover, use
-
 
248
	 *    DRM_MODE_TYPE_PREFERRED instead.
-
 
249
	 *  - DRM_MODE_TYPE_CLOCK_C and DRM_MODE_TYPE_CRTC_C: Define leftovers
-
 
250
	 *    which are stuck around for hysterical raisins only. No one has an
-
 
251
	 *    idea what they were meant for. Don't use.
-
 
252
	 *  - DRM_MODE_TYPE_USERDEF: Mode defined by userspace, again a vestige
104
	char name[DRM_DISPLAY_MODE_LEN];
253
	 *    from older kms designs where userspace had to first add a custom
-
 
254
	 *    mode to the kernel's mode list before it could use it. Don't use.
-
 
255
	 */
-
 
256
	unsigned int type;
105
 
257
 
-
 
258
	/**
106
	enum drm_mode_status status;
259
	 * @clock:
107
	unsigned int type;
260
	 *
108
 
261
	 * Pixel clock in kHz.
109
	/* Proposed mode values */
262
	 */
110
	int clock;		/* in kHz */
263
	int clock;		/* in kHz */
111
	int hdisplay;
264
	int hdisplay;
112
	int hsync_start;
265
	int hsync_start;
113
	int hsync_end;
266
	int hsync_end;
114
	int htotal;
267
	int htotal;
115
	int hskew;
268
	int hskew;
116
	int vdisplay;
269
	int vdisplay;
117
	int vsync_start;
270
	int vsync_start;
118
	int vsync_end;
271
	int vsync_end;
119
	int vtotal;
272
	int vtotal;
120
	int vscan;
273
	int vscan;
-
 
274
	/**
-
 
275
	 * @flags:
-
 
276
	 *
-
 
277
	 * Sync and timing flags:
-
 
278
	 *
-
 
279
	 *  - DRM_MODE_FLAG_PHSYNC: horizontal sync is active high.
-
 
280
	 *  - DRM_MODE_FLAG_NHSYNC: horizontal sync is active low.
-
 
281
	 *  - DRM_MODE_FLAG_PVSYNC: vertical sync is active high.
-
 
282
	 *  - DRM_MODE_FLAG_NVSYNC: vertical sync is active low.
-
 
283
	 *  - DRM_MODE_FLAG_INTERLACE: mode is interlaced.
-
 
284
	 *  - DRM_MODE_FLAG_DBLSCAN: mode uses doublescan.
-
 
285
	 *  - DRM_MODE_FLAG_CSYNC: mode uses composite sync.
-
 
286
	 *  - DRM_MODE_FLAG_PCSYNC: composite sync is active high.
-
 
287
	 *  - DRM_MODE_FLAG_NCSYNC: composite sync is active low.
-
 
288
	 *  - DRM_MODE_FLAG_HSKEW: hskew provided (not used?).
-
 
289
	 *  - DRM_MODE_FLAG_BCAST: not used?
-
 
290
	 *  - DRM_MODE_FLAG_PIXMUX: not used?
-
 
291
	 *  - DRM_MODE_FLAG_DBLCLK: double-clocked mode.
-
 
292
	 *  - DRM_MODE_FLAG_CLKDIV2: half-clocked mode.
-
 
293
	 *
-
 
294
	 * Additionally there's flags to specify how 3D modes are packed:
-
 
295
	 *
-
 
296
	 *  - DRM_MODE_FLAG_3D_NONE: normal, non-3D mode.
-
 
297
	 *  - DRM_MODE_FLAG_3D_FRAME_PACKING: 2 full frames for left and right.
-
 
298
	 *  - DRM_MODE_FLAG_3D_FIELD_ALTERNATIVE: interleaved like fields.
-
 
299
	 *  - DRM_MODE_FLAG_3D_LINE_ALTERNATIVE: interleaved lines.
-
 
300
	 *  - DRM_MODE_FLAG_3D_SIDE_BY_SIDE_FULL: side-by-side full frames.
-
 
301
	 *  - DRM_MODE_FLAG_3D_L_DEPTH: ?
-
 
302
	 *  - DRM_MODE_FLAG_3D_L_DEPTH_GFX_GFX_DEPTH: ?
-
 
303
	 *  - DRM_MODE_FLAG_3D_TOP_AND_BOTTOM: frame split into top and bottom
-
 
304
	 *    parts.
-
 
305
	 *  - DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF: frame split into left and
-
 
306
	 *    right parts.
-
 
307
	 */
121
	unsigned int flags;
308
	unsigned int flags;
-
 
309
 
-
 
310
	/**
-
 
311
	 * @width_mm:
122
 
312
	 *
-
 
313
	 * Addressable size of the output in mm, projectors should set this to
-
 
314
	 * 0.
123
	/* Addressable image size (may be 0 for projectors, etc.) */
315
	 */
-
 
316
	int width_mm;
-
 
317
 
-
 
318
	/**
-
 
319
	 * @height_mm:
-
 
320
	 *
-
 
321
	 * Addressable size of the output in mm, projectors should set this to
-
 
322
	 * 0.
124
	int width_mm;
323
	 */
-
 
324
	int height_mm;
-
 
325
 
-
 
326
	/**
-
 
327
	 * @crtc_clock:
-
 
328
	 *
-
 
329
	 * Actual pixel or dot clock in the hardware. This differs from the
125
	int height_mm;
330
	 * logical @clock when e.g. using interlacing, double-clocking, stereo
-
 
331
	 * modes or other fancy stuff that changes the timings and signals
-
 
332
	 * actually sent over the wire.
-
 
333
	 *
-
 
334
	 * This is again in kHz.
-
 
335
	 *
-
 
336
	 * Note that with digital outputs like HDMI or DP there's usually a
-
 
337
	 * massive confusion between the dot clock and the signal clock at the
-
 
338
	 * bit encoding level. Especially when a 8b/10b encoding is used and the
126
 
339
	 * difference is exactly a factor of 10.
127
	/* Actual mode we give to hw */
340
	 */
128
	int crtc_clock;		/* in KHz */
341
	int crtc_clock;
129
	int crtc_hdisplay;
342
	int crtc_hdisplay;
130
	int crtc_hblank_start;
343
	int crtc_hblank_start;
131
	int crtc_hblank_end;
344
	int crtc_hblank_end;
132
	int crtc_hsync_start;
345
	int crtc_hsync_start;
133
	int crtc_hsync_end;
346
	int crtc_hsync_end;
134
	int crtc_htotal;
347
	int crtc_htotal;
135
	int crtc_hskew;
348
	int crtc_hskew;
136
	int crtc_vdisplay;
349
	int crtc_vdisplay;
137
	int crtc_vblank_start;
350
	int crtc_vblank_start;
138
	int crtc_vblank_end;
351
	int crtc_vblank_end;
139
	int crtc_vsync_start;
352
	int crtc_vsync_start;
140
	int crtc_vsync_end;
353
	int crtc_vsync_end;
141
	int crtc_vtotal;
354
	int crtc_vtotal;
-
 
355
 
-
 
356
	/**
-
 
357
	 * @private:
-
 
358
	 *
-
 
359
	 * Pointer for driver private data. This can only be used for mode
-
 
360
	 * objects passed to drivers in modeset operations. It shouldn't be used
142
 
361
	 * by atomic drivers since they can store any additional data by
-
 
362
	 * subclassing state structures.
143
	/* Driver private mode info */
363
	 */
-
 
364
	int *private;
-
 
365
 
-
 
366
	/**
-
 
367
	 * @private_flags:
-
 
368
	 *
-
 
369
	 * Similar to @private, but just an integer.
144
	int *private;
370
	 */
-
 
371
	int private_flags;
-
 
372
 
-
 
373
	/**
-
 
374
	 * @vrefresh:
-
 
375
	 *
-
 
376
	 * Vertical refresh rate, for debug output in human readable form. Not
-
 
377
	 * used in a functional way.
-
 
378
	 *
145
	int private_flags;
379
	 * This value is in Hz.
-
 
380
	 */
-
 
381
	int vrefresh;
-
 
382
 
-
 
383
	/**
-
 
384
	 * @hsync:
-
 
385
	 *
-
 
386
	 * Horizontal refresh rate, for debug output in human readable form. Not
146
 
387
	 * used in a functional way.
-
 
388
	 *
-
 
389
	 * This value is in kHz.
-
 
390
	 */
-
 
391
	int hsync;
-
 
392
 
-
 
393
	/**
-
 
394
	 * @picture_aspect_ratio:
-
 
395
	 *
147
	int vrefresh;		/* in Hz */
396
	 * Field for setting the HDMI picture aspect ratio of a mode.
148
	int hsync;		/* in kHz */
397
	 */
149
	enum hdmi_picture_aspect picture_aspect_ratio;
398
	enum hdmi_picture_aspect picture_aspect_ratio;
150
};
399
};
151
 
400
 
152
/* mode specified on the command line */
401
/* mode specified on the command line */
153
struct drm_cmdline_mode {
402
struct drm_cmdline_mode {
154
	bool specified;
403
	bool specified;
155
	bool refresh_specified;
404
	bool refresh_specified;
156
	bool bpp_specified;
405
	bool bpp_specified;
157
	int xres, yres;
406
	int xres, yres;
158
	int bpp;
407
	int bpp;
159
	int refresh;
408
	int refresh;
160
	bool rb;
409
	bool rb;
161
	bool interlace;
410
	bool interlace;
162
	bool cvt;
411
	bool cvt;
163
	bool margins;
412
	bool margins;
164
	enum drm_connector_force force;
413
	enum drm_connector_force force;
165
};
414
};
166
 
415
 
167
/**
416
/**
168
 * drm_mode_is_stereo - check for stereo mode flags
417
 * drm_mode_is_stereo - check for stereo mode flags
169
 * @mode: drm_display_mode to check
418
 * @mode: drm_display_mode to check
170
 *
419
 *
171
 * Returns:
420
 * Returns:
172
 * True if the mode is one of the stereo modes (like side-by-side), false if
421
 * True if the mode is one of the stereo modes (like side-by-side), false if
173
 * not.
422
 * not.
174
 */
423
 */
175
static inline bool drm_mode_is_stereo(const struct drm_display_mode *mode)
424
static inline bool drm_mode_is_stereo(const struct drm_display_mode *mode)
176
{
425
{
177
	return mode->flags & DRM_MODE_FLAG_3D_MASK;
426
	return mode->flags & DRM_MODE_FLAG_3D_MASK;
178
}
427
}
179
 
428
 
180
struct drm_connector;
429
struct drm_connector;
181
struct drm_cmdline_mode;
430
struct drm_cmdline_mode;
182
 
431
 
183
struct drm_display_mode *drm_mode_create(struct drm_device *dev);
432
struct drm_display_mode *drm_mode_create(struct drm_device *dev);
184
void drm_mode_destroy(struct drm_device *dev, struct drm_display_mode *mode);
433
void drm_mode_destroy(struct drm_device *dev, struct drm_display_mode *mode);
185
void drm_mode_convert_to_umode(struct drm_mode_modeinfo *out,
434
void drm_mode_convert_to_umode(struct drm_mode_modeinfo *out,
186
                               const struct drm_display_mode *in);
435
                               const struct drm_display_mode *in);
187
int drm_mode_convert_umode(struct drm_display_mode *out,
436
int drm_mode_convert_umode(struct drm_display_mode *out,
188
			   const struct drm_mode_modeinfo *in);
437
			   const struct drm_mode_modeinfo *in);
189
void drm_mode_probed_add(struct drm_connector *connector, struct drm_display_mode *mode);
438
void drm_mode_probed_add(struct drm_connector *connector, struct drm_display_mode *mode);
190
void drm_mode_debug_printmodeline(const struct drm_display_mode *mode);
439
void drm_mode_debug_printmodeline(const struct drm_display_mode *mode);
191
 
440
 
192
struct drm_display_mode *drm_cvt_mode(struct drm_device *dev,
441
struct drm_display_mode *drm_cvt_mode(struct drm_device *dev,
193
				      int hdisplay, int vdisplay, int vrefresh,
442
				      int hdisplay, int vdisplay, int vrefresh,
194
				      bool reduced, bool interlaced,
443
				      bool reduced, bool interlaced,
195
				      bool margins);
444
				      bool margins);
196
struct drm_display_mode *drm_gtf_mode(struct drm_device *dev,
445
struct drm_display_mode *drm_gtf_mode(struct drm_device *dev,
197
				      int hdisplay, int vdisplay, int vrefresh,
446
				      int hdisplay, int vdisplay, int vrefresh,
198
				      bool interlaced, int margins);
447
				      bool interlaced, int margins);
199
struct drm_display_mode *drm_gtf_mode_complex(struct drm_device *dev,
448
struct drm_display_mode *drm_gtf_mode_complex(struct drm_device *dev,
200
					      int hdisplay, int vdisplay,
449
					      int hdisplay, int vdisplay,
201
					      int vrefresh, bool interlaced,
450
					      int vrefresh, bool interlaced,
202
					      int margins,
451
					      int margins,
203
					      int GTF_M, int GTF_2C,
452
					      int GTF_M, int GTF_2C,
204
					      int GTF_K, int GTF_2J);
453
					      int GTF_K, int GTF_2J);
205
void drm_display_mode_from_videomode(const struct videomode *vm,
454
void drm_display_mode_from_videomode(const struct videomode *vm,
206
				     struct drm_display_mode *dmode);
455
				     struct drm_display_mode *dmode);
207
void drm_display_mode_to_videomode(const struct drm_display_mode *dmode,
456
void drm_display_mode_to_videomode(const struct drm_display_mode *dmode,
208
				   struct videomode *vm);
457
				   struct videomode *vm);
209
int of_get_drm_display_mode(struct device_node *np,
458
int of_get_drm_display_mode(struct device_node *np,
210
			    struct drm_display_mode *dmode,
459
			    struct drm_display_mode *dmode,
211
			    int index);
460
			    int index);
212
 
461
 
213
void drm_mode_set_name(struct drm_display_mode *mode);
462
void drm_mode_set_name(struct drm_display_mode *mode);
214
int drm_mode_hsync(const struct drm_display_mode *mode);
463
int drm_mode_hsync(const struct drm_display_mode *mode);
215
int drm_mode_vrefresh(const struct drm_display_mode *mode);
464
int drm_mode_vrefresh(const struct drm_display_mode *mode);
216
 
465
 
217
void drm_mode_set_crtcinfo(struct drm_display_mode *p,
466
void drm_mode_set_crtcinfo(struct drm_display_mode *p,
218
			   int adjust_flags);
467
			   int adjust_flags);
219
void drm_mode_copy(struct drm_display_mode *dst,
468
void drm_mode_copy(struct drm_display_mode *dst,
220
		   const struct drm_display_mode *src);
469
		   const struct drm_display_mode *src);
221
struct drm_display_mode *drm_mode_duplicate(struct drm_device *dev,
470
struct drm_display_mode *drm_mode_duplicate(struct drm_device *dev,
222
					    const struct drm_display_mode *mode);
471
					    const struct drm_display_mode *mode);
223
bool drm_mode_equal(const struct drm_display_mode *mode1,
472
bool drm_mode_equal(const struct drm_display_mode *mode1,
224
		    const struct drm_display_mode *mode2);
473
		    const struct drm_display_mode *mode2);
-
 
474
bool drm_mode_equal_no_clocks(const struct drm_display_mode *mode1,
-
 
475
			      const struct drm_display_mode *mode2);
225
bool drm_mode_equal_no_clocks_no_stereo(const struct drm_display_mode *mode1,
476
bool drm_mode_equal_no_clocks_no_stereo(const struct drm_display_mode *mode1,
226
					const struct drm_display_mode *mode2);
477
					const struct drm_display_mode *mode2);
227
 
478
 
228
/* for use by the crtc helper probe functions */
479
/* for use by the crtc helper probe functions */
229
enum drm_mode_status drm_mode_validate_basic(const struct drm_display_mode *mode);
480
enum drm_mode_status drm_mode_validate_basic(const struct drm_display_mode *mode);
230
enum drm_mode_status drm_mode_validate_size(const struct drm_display_mode *mode,
481
enum drm_mode_status drm_mode_validate_size(const struct drm_display_mode *mode,
231
					    int maxX, int maxY);
482
					    int maxX, int maxY);
232
void drm_mode_prune_invalid(struct drm_device *dev,
483
void drm_mode_prune_invalid(struct drm_device *dev,
233
			    struct list_head *mode_list, bool verbose);
484
			    struct list_head *mode_list, bool verbose);
234
void drm_mode_sort(struct list_head *mode_list);
485
void drm_mode_sort(struct list_head *mode_list);
235
void drm_mode_connector_list_update(struct drm_connector *connector, bool merge_type_bits);
486
void drm_mode_connector_list_update(struct drm_connector *connector);
236
 
487
 
237
/* parsing cmdline modes */
488
/* parsing cmdline modes */
238
bool
489
bool
239
drm_mode_parse_command_line_for_connector(const char *mode_option,
490
drm_mode_parse_command_line_for_connector(const char *mode_option,
240
					  struct drm_connector *connector,
491
					  struct drm_connector *connector,
241
					  struct drm_cmdline_mode *mode);
492
					  struct drm_cmdline_mode *mode);
242
struct drm_display_mode *
493
struct drm_display_mode *
243
drm_mode_create_from_cmdline_mode(struct drm_device *dev,
494
drm_mode_create_from_cmdline_mode(struct drm_device *dev,
244
				  struct drm_cmdline_mode *cmd);
495
				  struct drm_cmdline_mode *cmd);
245
 
496
 
246
#endif /* __DRM_MODES_H__ */
497
#endif /* __DRM_MODES_H__ */