.. | .. |
---|
48 | 48 | * @MODE_HSYNC: hsync out of range |
---|
49 | 49 | * @MODE_VSYNC: vsync out of range |
---|
50 | 50 | * @MODE_H_ILLEGAL: mode has illegal horizontal timings |
---|
51 | | - * @MODE_V_ILLEGAL: mode has illegal horizontal timings |
---|
| 51 | + * @MODE_V_ILLEGAL: mode has illegal vertical timings |
---|
52 | 52 | * @MODE_BAD_WIDTH: requires an unsupported linepitch |
---|
53 | 53 | * @MODE_NOMODE: no mode with a matching name |
---|
54 | 54 | * @MODE_NO_INTERLACE: interlaced mode not supported |
---|
.. | .. |
---|
136 | 136 | .hdisplay = (hd), .hsync_start = (hss), .hsync_end = (hse), \ |
---|
137 | 137 | .htotal = (ht), .hskew = (hsk), .vdisplay = (vd), \ |
---|
138 | 138 | .vsync_start = (vss), .vsync_end = (vse), .vtotal = (vt), \ |
---|
139 | | - .vscan = (vs), .flags = (f), \ |
---|
140 | | - .base.type = DRM_MODE_OBJECT_MODE |
---|
| 139 | + .vscan = (vs), .flags = (f) |
---|
| 140 | + |
---|
| 141 | +/** |
---|
| 142 | + * DRM_SIMPLE_MODE - Simple display mode |
---|
| 143 | + * @hd: Horizontal resolution, width |
---|
| 144 | + * @vd: Vertical resolution, height |
---|
| 145 | + * @hd_mm: Display width in millimeters |
---|
| 146 | + * @vd_mm: Display height in millimeters |
---|
| 147 | + * |
---|
| 148 | + * This macro initializes a &drm_display_mode that only contains info about |
---|
| 149 | + * resolution and physical size. |
---|
| 150 | + */ |
---|
| 151 | +#define DRM_SIMPLE_MODE(hd, vd, hd_mm, vd_mm) \ |
---|
| 152 | + .type = DRM_MODE_TYPE_DRIVER, .clock = 1 /* pass validation */, \ |
---|
| 153 | + .hdisplay = (hd), .hsync_start = (hd), .hsync_end = (hd), \ |
---|
| 154 | + .htotal = (hd), .vdisplay = (vd), .vsync_start = (vd), \ |
---|
| 155 | + .vsync_end = (vd), .vtotal = (vd), .width_mm = (hd_mm), \ |
---|
| 156 | + .height_mm = (vd_mm) |
---|
141 | 157 | |
---|
142 | 158 | #define CRTC_INTERLACE_HALVE_V (1 << 0) /* halve V values for interlacing */ |
---|
143 | 159 | #define CRTC_STEREO_DOUBLE (1 << 1) /* adjust timings for stereo modes */ |
---|
.. | .. |
---|
207 | 223 | */ |
---|
208 | 224 | struct drm_display_mode { |
---|
209 | 225 | /** |
---|
210 | | - * @head: |
---|
211 | | - * |
---|
212 | | - * struct list_head for mode lists. |
---|
213 | | - */ |
---|
214 | | - struct list_head head; |
---|
215 | | - |
---|
216 | | - /** |
---|
217 | | - * @base: |
---|
218 | | - * |
---|
219 | | - * A display mode is a normal modeset object, possibly including public |
---|
220 | | - * userspace id. |
---|
221 | | - * |
---|
222 | | - * FIXME: |
---|
223 | | - * |
---|
224 | | - * This can probably be removed since the entire concept of userspace |
---|
225 | | - * managing modes explicitly has never landed in upstream kernel mode |
---|
226 | | - * setting support. |
---|
227 | | - */ |
---|
228 | | - struct drm_mode_object base; |
---|
229 | | - |
---|
230 | | - /** |
---|
231 | | - * @name: |
---|
232 | | - * |
---|
233 | | - * Human-readable name of the mode, filled out with drm_mode_set_name(). |
---|
234 | | - */ |
---|
235 | | - char name[DRM_DISPLAY_MODE_LEN]; |
---|
236 | | - |
---|
237 | | - /** |
---|
238 | | - * @status: |
---|
239 | | - * |
---|
240 | | - * Status of the mode, used to filter out modes not supported by the |
---|
241 | | - * hardware. See enum &drm_mode_status. |
---|
242 | | - */ |
---|
243 | | - enum drm_mode_status status; |
---|
244 | | - |
---|
245 | | - /** |
---|
246 | | - * @type: |
---|
247 | | - * |
---|
248 | | - * A bitmask of flags, mostly about the source of a mode. Possible flags |
---|
249 | | - * are: |
---|
250 | | - * |
---|
251 | | - * - DRM_MODE_TYPE_PREFERRED: Preferred mode, usually the native |
---|
252 | | - * resolution of an LCD panel. There should only be one preferred |
---|
253 | | - * mode per connector at any given time. |
---|
254 | | - * - DRM_MODE_TYPE_DRIVER: Mode created by the driver, which is all of |
---|
255 | | - * them really. Drivers must set this bit for all modes they create |
---|
256 | | - * and expose to userspace. |
---|
257 | | - * - DRM_MODE_TYPE_USERDEF: Mode defined via kernel command line |
---|
258 | | - * |
---|
259 | | - * Plus a big list of flags which shouldn't be used at all, but are |
---|
260 | | - * still around since these flags are also used in the userspace ABI. |
---|
261 | | - * We no longer accept modes with these types though: |
---|
262 | | - * |
---|
263 | | - * - DRM_MODE_TYPE_BUILTIN: Meant for hard-coded modes, unused. |
---|
264 | | - * Use DRM_MODE_TYPE_DRIVER instead. |
---|
265 | | - * - DRM_MODE_TYPE_DEFAULT: Again a leftover, use |
---|
266 | | - * DRM_MODE_TYPE_PREFERRED instead. |
---|
267 | | - * - DRM_MODE_TYPE_CLOCK_C and DRM_MODE_TYPE_CRTC_C: Define leftovers |
---|
268 | | - * which are stuck around for hysterical raisins only. No one has an |
---|
269 | | - * idea what they were meant for. Don't use. |
---|
270 | | - */ |
---|
271 | | - unsigned int type; |
---|
272 | | - |
---|
273 | | - /** |
---|
274 | 226 | * @clock: |
---|
275 | 227 | * |
---|
276 | 228 | * Pixel clock in kHz. |
---|
277 | 229 | */ |
---|
278 | 230 | int clock; /* in kHz */ |
---|
279 | | - int hdisplay; |
---|
280 | | - int hsync_start; |
---|
281 | | - int hsync_end; |
---|
282 | | - int htotal; |
---|
283 | | - int hskew; |
---|
284 | | - int vdisplay; |
---|
285 | | - int vsync_start; |
---|
286 | | - int vsync_end; |
---|
287 | | - int vtotal; |
---|
288 | | - int vscan; |
---|
| 231 | + u16 hdisplay; |
---|
| 232 | + u16 hsync_start; |
---|
| 233 | + u16 hsync_end; |
---|
| 234 | + u16 htotal; |
---|
| 235 | + u16 hskew; |
---|
| 236 | + u16 vdisplay; |
---|
| 237 | + u16 vsync_start; |
---|
| 238 | + u16 vsync_end; |
---|
| 239 | + u16 vtotal; |
---|
| 240 | + u16 vscan; |
---|
289 | 241 | /** |
---|
290 | 242 | * @flags: |
---|
291 | 243 | * |
---|
.. | .. |
---|
320 | 272 | * - DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF: frame split into left and |
---|
321 | 273 | * right parts. |
---|
322 | 274 | */ |
---|
323 | | - unsigned int flags; |
---|
324 | | - |
---|
325 | | - /** |
---|
326 | | - * @width_mm: |
---|
327 | | - * |
---|
328 | | - * Addressable size of the output in mm, projectors should set this to |
---|
329 | | - * 0. |
---|
330 | | - */ |
---|
331 | | - int width_mm; |
---|
332 | | - |
---|
333 | | - /** |
---|
334 | | - * @height_mm: |
---|
335 | | - * |
---|
336 | | - * Addressable size of the output in mm, projectors should set this to |
---|
337 | | - * 0. |
---|
338 | | - */ |
---|
339 | | - int height_mm; |
---|
| 275 | + u32 flags; |
---|
340 | 276 | |
---|
341 | 277 | /** |
---|
342 | 278 | * @crtc_clock: |
---|
.. | .. |
---|
354 | 290 | * difference is exactly a factor of 10. |
---|
355 | 291 | */ |
---|
356 | 292 | int crtc_clock; |
---|
357 | | - int crtc_hdisplay; |
---|
358 | | - int crtc_hblank_start; |
---|
359 | | - int crtc_hblank_end; |
---|
360 | | - int crtc_hsync_start; |
---|
361 | | - int crtc_hsync_end; |
---|
362 | | - int crtc_htotal; |
---|
363 | | - int crtc_hskew; |
---|
364 | | - int crtc_vdisplay; |
---|
365 | | - int crtc_vblank_start; |
---|
366 | | - int crtc_vblank_end; |
---|
367 | | - int crtc_vsync_start; |
---|
368 | | - int crtc_vsync_end; |
---|
369 | | - int crtc_vtotal; |
---|
| 293 | + u16 crtc_hdisplay; |
---|
| 294 | + u16 crtc_hblank_start; |
---|
| 295 | + u16 crtc_hblank_end; |
---|
| 296 | + u16 crtc_hsync_start; |
---|
| 297 | + u16 crtc_hsync_end; |
---|
| 298 | + u16 crtc_htotal; |
---|
| 299 | + u16 crtc_hskew; |
---|
| 300 | + u16 crtc_vdisplay; |
---|
| 301 | + u16 crtc_vblank_start; |
---|
| 302 | + u16 crtc_vblank_end; |
---|
| 303 | + u16 crtc_vsync_start; |
---|
| 304 | + u16 crtc_vsync_end; |
---|
| 305 | + u16 crtc_vtotal; |
---|
370 | 306 | |
---|
371 | 307 | /** |
---|
372 | | - * @private: |
---|
| 308 | + * @width_mm: |
---|
373 | 309 | * |
---|
374 | | - * Pointer for driver private data. This can only be used for mode |
---|
375 | | - * objects passed to drivers in modeset operations. It shouldn't be used |
---|
376 | | - * by atomic drivers since they can store any additional data by |
---|
377 | | - * subclassing state structures. |
---|
| 310 | + * Addressable size of the output in mm, projectors should set this to |
---|
| 311 | + * 0. |
---|
378 | 312 | */ |
---|
379 | | - int *private; |
---|
| 313 | + u16 width_mm; |
---|
380 | 314 | |
---|
381 | 315 | /** |
---|
382 | | - * @private_flags: |
---|
| 316 | + * @height_mm: |
---|
383 | 317 | * |
---|
384 | | - * Similar to @private, but just an integer. |
---|
| 318 | + * Addressable size of the output in mm, projectors should set this to |
---|
| 319 | + * 0. |
---|
385 | 320 | */ |
---|
386 | | - int private_flags; |
---|
| 321 | + u16 height_mm; |
---|
387 | 322 | |
---|
388 | 323 | /** |
---|
389 | | - * @vrefresh: |
---|
| 324 | + * @type: |
---|
390 | 325 | * |
---|
391 | | - * Vertical refresh rate, for debug output in human readable form. Not |
---|
392 | | - * used in a functional way. |
---|
| 326 | + * A bitmask of flags, mostly about the source of a mode. Possible flags |
---|
| 327 | + * are: |
---|
393 | 328 | * |
---|
394 | | - * This value is in Hz. |
---|
| 329 | + * - DRM_MODE_TYPE_PREFERRED: Preferred mode, usually the native |
---|
| 330 | + * resolution of an LCD panel. There should only be one preferred |
---|
| 331 | + * mode per connector at any given time. |
---|
| 332 | + * - DRM_MODE_TYPE_DRIVER: Mode created by the driver, which is all of |
---|
| 333 | + * them really. Drivers must set this bit for all modes they create |
---|
| 334 | + * and expose to userspace. |
---|
| 335 | + * - DRM_MODE_TYPE_USERDEF: Mode defined or selected via the kernel |
---|
| 336 | + * command line. |
---|
| 337 | + * |
---|
| 338 | + * Plus a big list of flags which shouldn't be used at all, but are |
---|
| 339 | + * still around since these flags are also used in the userspace ABI. |
---|
| 340 | + * We no longer accept modes with these types though: |
---|
| 341 | + * |
---|
| 342 | + * - DRM_MODE_TYPE_BUILTIN: Meant for hard-coded modes, unused. |
---|
| 343 | + * Use DRM_MODE_TYPE_DRIVER instead. |
---|
| 344 | + * - DRM_MODE_TYPE_DEFAULT: Again a leftover, use |
---|
| 345 | + * DRM_MODE_TYPE_PREFERRED instead. |
---|
| 346 | + * - DRM_MODE_TYPE_CLOCK_C and DRM_MODE_TYPE_CRTC_C: Define leftovers |
---|
| 347 | + * which are stuck around for hysterical raisins only. No one has an |
---|
| 348 | + * idea what they were meant for. Don't use. |
---|
395 | 349 | */ |
---|
396 | | - int vrefresh; |
---|
| 350 | + u8 type; |
---|
397 | 351 | |
---|
398 | 352 | /** |
---|
399 | | - * @hsync: |
---|
| 353 | + * @expose_to_userspace: |
---|
400 | 354 | * |
---|
401 | | - * Horizontal refresh rate, for debug output in human readable form. Not |
---|
402 | | - * used in a functional way. |
---|
403 | | - * |
---|
404 | | - * This value is in kHz. |
---|
| 355 | + * Indicates whether the mode is to be exposed to the userspace. |
---|
| 356 | + * This is to maintain a set of exposed modes while preparing |
---|
| 357 | + * user-mode's list in drm_mode_getconnector ioctl. The purpose of |
---|
| 358 | + * this only lies in the ioctl function, and is not to be used |
---|
| 359 | + * outside the function. |
---|
405 | 360 | */ |
---|
406 | | - int hsync; |
---|
| 361 | + bool expose_to_userspace; |
---|
| 362 | + |
---|
| 363 | + /** |
---|
| 364 | + * @head: |
---|
| 365 | + * |
---|
| 366 | + * struct list_head for mode lists. |
---|
| 367 | + */ |
---|
| 368 | + struct list_head head; |
---|
| 369 | + |
---|
| 370 | + /** |
---|
| 371 | + * @name: |
---|
| 372 | + * |
---|
| 373 | + * Human-readable name of the mode, filled out with drm_mode_set_name(). |
---|
| 374 | + */ |
---|
| 375 | + char name[DRM_DISPLAY_MODE_LEN]; |
---|
| 376 | + |
---|
| 377 | + /** |
---|
| 378 | + * @status: |
---|
| 379 | + * |
---|
| 380 | + * Status of the mode, used to filter out modes not supported by the |
---|
| 381 | + * hardware. See enum &drm_mode_status. |
---|
| 382 | + */ |
---|
| 383 | + enum drm_mode_status status; |
---|
407 | 384 | |
---|
408 | 385 | /** |
---|
409 | 386 | * @picture_aspect_ratio: |
---|
.. | .. |
---|
412 | 389 | */ |
---|
413 | 390 | enum hdmi_picture_aspect picture_aspect_ratio; |
---|
414 | 391 | |
---|
415 | | - /** |
---|
416 | | - * @export_head: |
---|
417 | | - * |
---|
418 | | - * struct list_head for modes to be exposed to the userspace. |
---|
419 | | - * This is to maintain a list of exposed modes while preparing |
---|
420 | | - * user-mode's list in drm_mode_getconnector ioctl. The purpose of this |
---|
421 | | - * list_head only lies in the ioctl function, and is not expected to be |
---|
422 | | - * used outside the function. |
---|
423 | | - * Once used, the stale pointers are not reset, but left as it is, to |
---|
424 | | - * avoid overhead of protecting it by mode_config.mutex. |
---|
425 | | - */ |
---|
426 | | - struct list_head export_head; |
---|
427 | 392 | }; |
---|
428 | 393 | |
---|
429 | 394 | /** |
---|
430 | 395 | * DRM_MODE_FMT - printf string for &struct drm_display_mode |
---|
431 | 396 | */ |
---|
432 | | -#define DRM_MODE_FMT "%d:\"%s\" %d %d %d %d %d %d %d %d %d %d 0x%x 0x%x" |
---|
| 397 | +#define DRM_MODE_FMT "\"%s\": %d %d %d %d %d %d %d %d %d %d 0x%x 0x%x" |
---|
433 | 398 | |
---|
434 | 399 | /** |
---|
435 | 400 | * DRM_MODE_ARG - printf arguments for &struct drm_display_mode |
---|
436 | 401 | * @m: display mode |
---|
437 | 402 | */ |
---|
438 | 403 | #define DRM_MODE_ARG(m) \ |
---|
439 | | - (m)->base.id, (m)->name, (m)->vrefresh, (m)->clock, \ |
---|
| 404 | + (m)->name, drm_mode_vrefresh(m), (m)->clock, \ |
---|
440 | 405 | (m)->hdisplay, (m)->hsync_start, (m)->hsync_end, (m)->htotal, \ |
---|
441 | 406 | (m)->vdisplay, (m)->vsync_start, (m)->vsync_end, (m)->vtotal, \ |
---|
442 | 407 | (m)->type, (m)->flags |
---|
.. | .. |
---|
498 | 463 | int index); |
---|
499 | 464 | |
---|
500 | 465 | void drm_mode_set_name(struct drm_display_mode *mode); |
---|
501 | | -int drm_mode_hsync(const struct drm_display_mode *mode); |
---|
502 | 466 | int drm_mode_vrefresh(const struct drm_display_mode *mode); |
---|
503 | 467 | void drm_mode_get_hv_timing(const struct drm_display_mode *mode, |
---|
504 | 468 | int *hdisplay, int *vdisplay); |
---|
.. | .. |
---|
535 | 499 | /* parsing cmdline modes */ |
---|
536 | 500 | bool |
---|
537 | 501 | drm_mode_parse_command_line_for_connector(const char *mode_option, |
---|
538 | | - struct drm_connector *connector, |
---|
| 502 | + const struct drm_connector *connector, |
---|
539 | 503 | struct drm_cmdline_mode *mode); |
---|
540 | 504 | struct drm_display_mode * |
---|
541 | 505 | drm_mode_create_from_cmdline_mode(struct drm_device *dev, |
---|