drm_crtc.h 39 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075
  1. /*
  2. * Copyright © 2006 Keith Packard
  3. * Copyright © 2007-2008 Dave Airlie
  4. * Copyright © 2007-2008 Intel Corporation
  5. * Jesse Barnes <jesse.barnes@intel.com>
  6. *
  7. * Permission is hereby granted, free of charge, to any person obtaining a
  8. * copy of this software and associated documentation files (the "Software"),
  9. * to deal in the Software without restriction, including without limitation
  10. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  11. * and/or sell copies of the Software, and to permit persons to whom the
  12. * Software is furnished to do so, subject to the following conditions:
  13. *
  14. * The above copyright notice and this permission notice shall be included in
  15. * all copies or substantial portions of the Software.
  16. *
  17. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  19. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  20. * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
  21. * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  22. * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  23. * OTHER DEALINGS IN THE SOFTWARE.
  24. */
  25. #ifndef __DRM_CRTC_H__
  26. #define __DRM_CRTC_H__
  27. #include <linux/i2c.h>
  28. #include <linux/spinlock.h>
  29. #include <linux/types.h>
  30. #include <linux/idr.h>
  31. #include <linux/fb.h>
  32. #include <drm/drm_fourcc.h>
  33. struct drm_device;
  34. struct drm_mode_set;
  35. struct drm_framebuffer;
  36. struct drm_object_properties;
  37. #define DRM_MODE_OBJECT_CRTC 0xcccccccc
  38. #define DRM_MODE_OBJECT_CONNECTOR 0xc0c0c0c0
  39. #define DRM_MODE_OBJECT_ENCODER 0xe0e0e0e0
  40. #define DRM_MODE_OBJECT_MODE 0xdededede
  41. #define DRM_MODE_OBJECT_PROPERTY 0xb0b0b0b0
  42. #define DRM_MODE_OBJECT_FB 0xfbfbfbfb
  43. #define DRM_MODE_OBJECT_BLOB 0xbbbbbbbb
  44. #define DRM_MODE_OBJECT_PLANE 0xeeeeeeee
  45. struct drm_mode_object {
  46. uint32_t id;
  47. uint32_t type;
  48. struct drm_object_properties *properties;
  49. };
  50. #define DRM_OBJECT_MAX_PROPERTY 24
  51. struct drm_object_properties {
  52. int count;
  53. uint32_t ids[DRM_OBJECT_MAX_PROPERTY];
  54. uint64_t values[DRM_OBJECT_MAX_PROPERTY];
  55. };
  56. /*
  57. * Note on terminology: here, for brevity and convenience, we refer to connector
  58. * control chips as 'CRTCs'. They can control any type of connector, VGA, LVDS,
  59. * DVI, etc. And 'screen' refers to the whole of the visible display, which
  60. * may span multiple monitors (and therefore multiple CRTC and connector
  61. * structures).
  62. */
  63. enum drm_mode_status {
  64. MODE_OK = 0, /* Mode OK */
  65. MODE_HSYNC, /* hsync out of range */
  66. MODE_VSYNC, /* vsync out of range */
  67. MODE_H_ILLEGAL, /* mode has illegal horizontal timings */
  68. MODE_V_ILLEGAL, /* mode has illegal horizontal timings */
  69. MODE_BAD_WIDTH, /* requires an unsupported linepitch */
  70. MODE_NOMODE, /* no mode with a matching name */
  71. MODE_NO_INTERLACE, /* interlaced mode not supported */
  72. MODE_NO_DBLESCAN, /* doublescan mode not supported */
  73. MODE_NO_VSCAN, /* multiscan mode not supported */
  74. MODE_MEM, /* insufficient video memory */
  75. MODE_VIRTUAL_X, /* mode width too large for specified virtual size */
  76. MODE_VIRTUAL_Y, /* mode height too large for specified virtual size */
  77. MODE_MEM_VIRT, /* insufficient video memory given virtual size */
  78. MODE_NOCLOCK, /* no fixed clock available */
  79. MODE_CLOCK_HIGH, /* clock required is too high */
  80. MODE_CLOCK_LOW, /* clock required is too low */
  81. MODE_CLOCK_RANGE, /* clock/mode isn't in a ClockRange */
  82. MODE_BAD_HVALUE, /* horizontal timing was out of range */
  83. MODE_BAD_VVALUE, /* vertical timing was out of range */
  84. MODE_BAD_VSCAN, /* VScan value out of range */
  85. MODE_HSYNC_NARROW, /* horizontal sync too narrow */
  86. MODE_HSYNC_WIDE, /* horizontal sync too wide */
  87. MODE_HBLANK_NARROW, /* horizontal blanking too narrow */
  88. MODE_HBLANK_WIDE, /* horizontal blanking too wide */
  89. MODE_VSYNC_NARROW, /* vertical sync too narrow */
  90. MODE_VSYNC_WIDE, /* vertical sync too wide */
  91. MODE_VBLANK_NARROW, /* vertical blanking too narrow */
  92. MODE_VBLANK_WIDE, /* vertical blanking too wide */
  93. MODE_PANEL, /* exceeds panel dimensions */
  94. MODE_INTERLACE_WIDTH, /* width too large for interlaced mode */
  95. MODE_ONE_WIDTH, /* only one width is supported */
  96. MODE_ONE_HEIGHT, /* only one height is supported */
  97. MODE_ONE_SIZE, /* only one resolution is supported */
  98. MODE_NO_REDUCED, /* monitor doesn't accept reduced blanking */
  99. MODE_UNVERIFIED = -3, /* mode needs to reverified */
  100. MODE_BAD = -2, /* unspecified reason */
  101. MODE_ERROR = -1 /* error condition */
  102. };
  103. #define DRM_MODE_TYPE_CLOCK_CRTC_C (DRM_MODE_TYPE_CLOCK_C | \
  104. DRM_MODE_TYPE_CRTC_C)
  105. #define DRM_MODE(nm, t, c, hd, hss, hse, ht, hsk, vd, vss, vse, vt, vs, f) \
  106. .name = nm, .status = 0, .type = (t), .clock = (c), \
  107. .hdisplay = (hd), .hsync_start = (hss), .hsync_end = (hse), \
  108. .htotal = (ht), .hskew = (hsk), .vdisplay = (vd), \
  109. .vsync_start = (vss), .vsync_end = (vse), .vtotal = (vt), \
  110. .vscan = (vs), .flags = (f), .vrefresh = 0, \
  111. .base.type = DRM_MODE_OBJECT_MODE
  112. #define CRTC_INTERLACE_HALVE_V 0x1 /* halve V values for interlacing */
  113. struct drm_display_mode {
  114. /* Header */
  115. struct list_head head;
  116. struct drm_mode_object base;
  117. char name[DRM_DISPLAY_MODE_LEN];
  118. enum drm_mode_status status;
  119. unsigned int type;
  120. /* Proposed mode values */
  121. int clock; /* in kHz */
  122. int hdisplay;
  123. int hsync_start;
  124. int hsync_end;
  125. int htotal;
  126. int hskew;
  127. int vdisplay;
  128. int vsync_start;
  129. int vsync_end;
  130. int vtotal;
  131. int vscan;
  132. unsigned int flags;
  133. /* Addressable image size (may be 0 for projectors, etc.) */
  134. int width_mm;
  135. int height_mm;
  136. /* Actual mode we give to hw */
  137. int clock_index;
  138. int synth_clock;
  139. int crtc_hdisplay;
  140. int crtc_hblank_start;
  141. int crtc_hblank_end;
  142. int crtc_hsync_start;
  143. int crtc_hsync_end;
  144. int crtc_htotal;
  145. int crtc_hskew;
  146. int crtc_vdisplay;
  147. int crtc_vblank_start;
  148. int crtc_vblank_end;
  149. int crtc_vsync_start;
  150. int crtc_vsync_end;
  151. int crtc_vtotal;
  152. /* Driver private mode info */
  153. int private_size;
  154. int *private;
  155. int private_flags;
  156. int vrefresh; /* in Hz */
  157. int hsync; /* in kHz */
  158. };
  159. enum drm_connector_status {
  160. connector_status_connected = 1,
  161. connector_status_disconnected = 2,
  162. connector_status_unknown = 3,
  163. };
  164. enum subpixel_order {
  165. SubPixelUnknown = 0,
  166. SubPixelHorizontalRGB,
  167. SubPixelHorizontalBGR,
  168. SubPixelVerticalRGB,
  169. SubPixelVerticalBGR,
  170. SubPixelNone,
  171. };
  172. #define DRM_COLOR_FORMAT_RGB444 (1<<0)
  173. #define DRM_COLOR_FORMAT_YCRCB444 (1<<1)
  174. #define DRM_COLOR_FORMAT_YCRCB422 (1<<2)
  175. /*
  176. * Describes a given display (e.g. CRT or flat panel) and its limitations.
  177. */
  178. struct drm_display_info {
  179. char name[DRM_DISPLAY_INFO_LEN];
  180. /* Physical size */
  181. unsigned int width_mm;
  182. unsigned int height_mm;
  183. /* Clock limits FIXME: storage format */
  184. unsigned int min_vfreq, max_vfreq;
  185. unsigned int min_hfreq, max_hfreq;
  186. unsigned int pixel_clock;
  187. unsigned int bpc;
  188. enum subpixel_order subpixel_order;
  189. u32 color_formats;
  190. u8 cea_rev;
  191. };
  192. struct drm_framebuffer_funcs {
  193. /* note: use drm_framebuffer_remove() */
  194. void (*destroy)(struct drm_framebuffer *framebuffer);
  195. int (*create_handle)(struct drm_framebuffer *fb,
  196. struct drm_file *file_priv,
  197. unsigned int *handle);
  198. /**
  199. * Optinal callback for the dirty fb ioctl.
  200. *
  201. * Userspace can notify the driver via this callback
  202. * that a area of the framebuffer has changed and should
  203. * be flushed to the display hardware.
  204. *
  205. * See documentation in drm_mode.h for the struct
  206. * drm_mode_fb_dirty_cmd for more information as all
  207. * the semantics and arguments have a one to one mapping
  208. * on this function.
  209. */
  210. int (*dirty)(struct drm_framebuffer *framebuffer,
  211. struct drm_file *file_priv, unsigned flags,
  212. unsigned color, struct drm_clip_rect *clips,
  213. unsigned num_clips);
  214. };
  215. struct drm_framebuffer {
  216. struct drm_device *dev;
  217. /*
  218. * Note that the fb is refcounted for the benefit of driver internals,
  219. * for example some hw, disabling a CRTC/plane is asynchronous, and
  220. * scanout does not actually complete until the next vblank. So some
  221. * cleanup (like releasing the reference(s) on the backing GEM bo(s))
  222. * should be deferred. In cases like this, the driver would like to
  223. * hold a ref to the fb even though it has already been removed from
  224. * userspace perspective.
  225. */
  226. struct kref refcount;
  227. struct list_head head;
  228. struct drm_mode_object base;
  229. const struct drm_framebuffer_funcs *funcs;
  230. unsigned int pitches[4];
  231. unsigned int offsets[4];
  232. unsigned int width;
  233. unsigned int height;
  234. /* depth can be 15 or 16 */
  235. unsigned int depth;
  236. int bits_per_pixel;
  237. int flags;
  238. uint32_t pixel_format; /* fourcc format */
  239. struct list_head filp_head;
  240. /* if you are using the helper */
  241. void *helper_private;
  242. };
  243. struct drm_property_blob {
  244. struct drm_mode_object base;
  245. struct list_head head;
  246. unsigned int length;
  247. unsigned char data[];
  248. };
  249. struct drm_property_enum {
  250. uint64_t value;
  251. struct list_head head;
  252. char name[DRM_PROP_NAME_LEN];
  253. };
  254. struct drm_property {
  255. struct list_head head;
  256. struct drm_mode_object base;
  257. uint32_t flags;
  258. char name[DRM_PROP_NAME_LEN];
  259. uint32_t num_values;
  260. uint64_t *values;
  261. struct list_head enum_blob_list;
  262. };
  263. struct drm_crtc;
  264. struct drm_connector;
  265. struct drm_encoder;
  266. struct drm_pending_vblank_event;
  267. struct drm_plane;
  268. /**
  269. * drm_crtc_funcs - control CRTCs for a given device
  270. * @save: save CRTC state
  271. * @restore: restore CRTC state
  272. * @reset: reset CRTC after state has been invalidate (e.g. resume)
  273. * @cursor_set: setup the cursor
  274. * @cursor_move: move the cursor
  275. * @gamma_set: specify color ramp for CRTC
  276. * @destroy: deinit and free object
  277. * @set_property: called when a property is changed
  278. * @set_config: apply a new CRTC configuration
  279. * @page_flip: initiate a page flip
  280. *
  281. * The drm_crtc_funcs structure is the central CRTC management structure
  282. * in the DRM. Each CRTC controls one or more connectors (note that the name
  283. * CRTC is simply historical, a CRTC may control LVDS, VGA, DVI, TV out, etc.
  284. * connectors, not just CRTs).
  285. *
  286. * Each driver is responsible for filling out this structure at startup time,
  287. * in addition to providing other modesetting features, like i2c and DDC
  288. * bus accessors.
  289. */
  290. struct drm_crtc_funcs {
  291. /* Save CRTC state */
  292. void (*save)(struct drm_crtc *crtc); /* suspend? */
  293. /* Restore CRTC state */
  294. void (*restore)(struct drm_crtc *crtc); /* resume? */
  295. /* Reset CRTC state */
  296. void (*reset)(struct drm_crtc *crtc);
  297. /* cursor controls */
  298. int (*cursor_set)(struct drm_crtc *crtc, struct drm_file *file_priv,
  299. uint32_t handle, uint32_t width, uint32_t height);
  300. int (*cursor_move)(struct drm_crtc *crtc, int x, int y);
  301. /* Set gamma on the CRTC */
  302. void (*gamma_set)(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b,
  303. uint32_t start, uint32_t size);
  304. /* Object destroy routine */
  305. void (*destroy)(struct drm_crtc *crtc);
  306. int (*set_config)(struct drm_mode_set *set);
  307. /*
  308. * Flip to the given framebuffer. This implements the page
  309. * flip ioctl described in drm_mode.h, specifically, the
  310. * implementation must return immediately and block all
  311. * rendering to the current fb until the flip has completed.
  312. * If userspace set the event flag in the ioctl, the event
  313. * argument will point to an event to send back when the flip
  314. * completes, otherwise it will be NULL.
  315. */
  316. int (*page_flip)(struct drm_crtc *crtc,
  317. struct drm_framebuffer *fb,
  318. struct drm_pending_vblank_event *event);
  319. int (*set_property)(struct drm_crtc *crtc,
  320. struct drm_property *property, uint64_t val);
  321. };
  322. /**
  323. * drm_crtc - central CRTC control structure
  324. * @dev: parent DRM device
  325. * @head: list management
  326. * @base: base KMS object for ID tracking etc.
  327. * @enabled: is this CRTC enabled?
  328. * @mode: current mode timings
  329. * @hwmode: mode timings as programmed to hw regs
  330. * @x: x position on screen
  331. * @y: y position on screen
  332. * @funcs: CRTC control functions
  333. * @gamma_size: size of gamma ramp
  334. * @gamma_store: gamma ramp values
  335. * @framedur_ns: precise frame timing
  336. * @framedur_ns: precise line timing
  337. * @pixeldur_ns: precise pixel timing
  338. * @helper_private: mid-layer private data
  339. * @properties: property tracking for this CRTC
  340. *
  341. * Each CRTC may have one or more connectors associated with it. This structure
  342. * allows the CRTC to be controlled.
  343. */
  344. struct drm_crtc {
  345. struct drm_device *dev;
  346. struct list_head head;
  347. struct drm_mode_object base;
  348. /* framebuffer the connector is currently bound to */
  349. struct drm_framebuffer *fb;
  350. bool enabled;
  351. /* Requested mode from modesetting. */
  352. struct drm_display_mode mode;
  353. /* Programmed mode in hw, after adjustments for encoders,
  354. * crtc, panel scaling etc. Needed for timestamping etc.
  355. */
  356. struct drm_display_mode hwmode;
  357. int x, y;
  358. const struct drm_crtc_funcs *funcs;
  359. /* CRTC gamma size for reporting to userspace */
  360. uint32_t gamma_size;
  361. uint16_t *gamma_store;
  362. /* Constants needed for precise vblank and swap timestamping. */
  363. s64 framedur_ns, linedur_ns, pixeldur_ns;
  364. /* if you are using the helper */
  365. void *helper_private;
  366. struct drm_object_properties properties;
  367. };
  368. /**
  369. * drm_connector_funcs - control connectors on a given device
  370. * @dpms: set power state (see drm_crtc_funcs above)
  371. * @save: save connector state
  372. * @restore: restore connector state
  373. * @reset: reset connector after state has been invalidate (e.g. resume)
  374. * @detect: is this connector active?
  375. * @fill_modes: fill mode list for this connector
  376. * @set_property: property for this connector may need update
  377. * @destroy: make object go away
  378. * @force: notify the driver the connector is forced on
  379. *
  380. * Each CRTC may have one or more connectors attached to it. The functions
  381. * below allow the core DRM code to control connectors, enumerate available modes,
  382. * etc.
  383. */
  384. struct drm_connector_funcs {
  385. void (*dpms)(struct drm_connector *connector, int mode);
  386. void (*save)(struct drm_connector *connector);
  387. void (*restore)(struct drm_connector *connector);
  388. void (*reset)(struct drm_connector *connector);
  389. /* Check to see if anything is attached to the connector.
  390. * @force is set to false whilst polling, true when checking the
  391. * connector due to user request. @force can be used by the driver
  392. * to avoid expensive, destructive operations during automated
  393. * probing.
  394. */
  395. enum drm_connector_status (*detect)(struct drm_connector *connector,
  396. bool force);
  397. int (*fill_modes)(struct drm_connector *connector, uint32_t max_width, uint32_t max_height);
  398. int (*set_property)(struct drm_connector *connector, struct drm_property *property,
  399. uint64_t val);
  400. void (*destroy)(struct drm_connector *connector);
  401. void (*force)(struct drm_connector *connector);
  402. };
  403. /**
  404. * drm_encoder_funcs - encoder controls
  405. * @reset: reset state (e.g. at init or resume time)
  406. * @destroy: cleanup and free associated data
  407. *
  408. * Encoders sit between CRTCs and connectors.
  409. */
  410. struct drm_encoder_funcs {
  411. void (*reset)(struct drm_encoder *encoder);
  412. void (*destroy)(struct drm_encoder *encoder);
  413. };
  414. #define DRM_CONNECTOR_MAX_UMODES 16
  415. #define DRM_CONNECTOR_LEN 32
  416. #define DRM_CONNECTOR_MAX_ENCODER 3
  417. /**
  418. * drm_encoder - central DRM encoder structure
  419. * @dev: parent DRM device
  420. * @head: list management
  421. * @base: base KMS object
  422. * @encoder_type: one of the %DRM_MODE_ENCODER_<foo> types in drm_mode.h
  423. * @possible_crtcs: bitmask of potential CRTC bindings
  424. * @possible_clones: bitmask of potential sibling encoders for cloning
  425. * @crtc: currently bound CRTC
  426. * @funcs: control functions
  427. * @helper_private: mid-layer private data
  428. *
  429. * CRTCs drive pixels to encoders, which convert them into signals
  430. * appropriate for a given connector or set of connectors.
  431. */
  432. struct drm_encoder {
  433. struct drm_device *dev;
  434. struct list_head head;
  435. struct drm_mode_object base;
  436. int encoder_type;
  437. uint32_t possible_crtcs;
  438. uint32_t possible_clones;
  439. struct drm_crtc *crtc;
  440. const struct drm_encoder_funcs *funcs;
  441. void *helper_private;
  442. };
  443. enum drm_connector_force {
  444. DRM_FORCE_UNSPECIFIED,
  445. DRM_FORCE_OFF,
  446. DRM_FORCE_ON, /* force on analog part normally */
  447. DRM_FORCE_ON_DIGITAL, /* for DVI-I use digital connector */
  448. };
  449. /* should we poll this connector for connects and disconnects */
  450. /* hot plug detectable */
  451. #define DRM_CONNECTOR_POLL_HPD (1 << 0)
  452. /* poll for connections */
  453. #define DRM_CONNECTOR_POLL_CONNECT (1 << 1)
  454. /* can cleanly poll for disconnections without flickering the screen */
  455. /* DACs should rarely do this without a lot of testing */
  456. #define DRM_CONNECTOR_POLL_DISCONNECT (1 << 2)
  457. #define MAX_ELD_BYTES 128
  458. /**
  459. * drm_connector - central DRM connector control structure
  460. * @dev: parent DRM device
  461. * @kdev: kernel device for sysfs attributes
  462. * @attr: sysfs attributes
  463. * @head: list management
  464. * @base: base KMS object
  465. * @connector_type: one of the %DRM_MODE_CONNECTOR_<foo> types from drm_mode.h
  466. * @connector_type_id: index into connector type enum
  467. * @interlace_allowed: can this connector handle interlaced modes?
  468. * @doublescan_allowed: can this connector handle doublescan?
  469. * @modes: modes available on this connector (from fill_modes() + user)
  470. * @status: one of the drm_connector_status enums (connected, not, or unknown)
  471. * @probed_modes: list of modes derived directly from the display
  472. * @display_info: information about attached display (e.g. from EDID)
  473. * @funcs: connector control functions
  474. * @user_modes: user added mode list
  475. * @edid_blob_ptr: DRM property containing EDID if present
  476. * @properties: property tracking for this connector
  477. * @polled: a %DRM_CONNECTOR_POLL_<foo> value for core driven polling
  478. * @dpms: current dpms state
  479. * @helper_private: mid-layer private data
  480. * @force: a %DRM_FORCE_<foo> state for forced mode sets
  481. * @encoder_ids: valid encoders for this connector
  482. * @encoder: encoder driving this connector, if any
  483. * @eld: EDID-like data, if present
  484. * @dvi_dual: dual link DVI, if found
  485. * @max_tmds_clock: max clock rate, if found
  486. * @latency_present: AV delay info from ELD, if found
  487. * @video_latency: video latency info from ELD, if found
  488. * @audio_latency: audio latency info from ELD, if found
  489. * @null_edid_counter: track sinks that give us all zeros for the EDID
  490. *
  491. * Each connector may be connected to one or more CRTCs, or may be clonable by
  492. * another connector if they can share a CRTC. Each connector also has a specific
  493. * position in the broader display (referred to as a 'screen' though it could
  494. * span multiple monitors).
  495. */
  496. struct drm_connector {
  497. struct drm_device *dev;
  498. struct device kdev;
  499. struct device_attribute *attr;
  500. struct list_head head;
  501. struct drm_mode_object base;
  502. int connector_type;
  503. int connector_type_id;
  504. bool interlace_allowed;
  505. bool doublescan_allowed;
  506. struct list_head modes; /* list of modes on this connector */
  507. enum drm_connector_status status;
  508. /* these are modes added by probing with DDC or the BIOS */
  509. struct list_head probed_modes;
  510. struct drm_display_info display_info;
  511. const struct drm_connector_funcs *funcs;
  512. struct list_head user_modes;
  513. struct drm_property_blob *edid_blob_ptr;
  514. struct drm_object_properties properties;
  515. uint8_t polled; /* DRM_CONNECTOR_POLL_* */
  516. /* requested DPMS state */
  517. int dpms;
  518. void *helper_private;
  519. /* forced on connector */
  520. enum drm_connector_force force;
  521. uint32_t encoder_ids[DRM_CONNECTOR_MAX_ENCODER];
  522. struct drm_encoder *encoder; /* currently active encoder */
  523. /* EDID bits */
  524. uint8_t eld[MAX_ELD_BYTES];
  525. bool dvi_dual;
  526. int max_tmds_clock; /* in MHz */
  527. bool latency_present[2];
  528. int video_latency[2]; /* [0]: progressive, [1]: interlaced */
  529. int audio_latency[2];
  530. int null_edid_counter; /* needed to workaround some HW bugs where we get all 0s */
  531. unsigned bad_edid_counter;
  532. };
  533. /**
  534. * drm_plane_funcs - driver plane control functions
  535. * @update_plane: update the plane configuration
  536. * @disable_plane: shut down the plane
  537. * @destroy: clean up plane resources
  538. * @set_property: called when a property is changed
  539. */
  540. struct drm_plane_funcs {
  541. int (*update_plane)(struct drm_plane *plane,
  542. struct drm_crtc *crtc, struct drm_framebuffer *fb,
  543. int crtc_x, int crtc_y,
  544. unsigned int crtc_w, unsigned int crtc_h,
  545. uint32_t src_x, uint32_t src_y,
  546. uint32_t src_w, uint32_t src_h);
  547. int (*disable_plane)(struct drm_plane *plane);
  548. void (*destroy)(struct drm_plane *plane);
  549. int (*set_property)(struct drm_plane *plane,
  550. struct drm_property *property, uint64_t val);
  551. };
  552. /**
  553. * drm_plane - central DRM plane control structure
  554. * @dev: DRM device this plane belongs to
  555. * @head: for list management
  556. * @base: base mode object
  557. * @possible_crtcs: pipes this plane can be bound to
  558. * @format_types: array of formats supported by this plane
  559. * @format_count: number of formats supported
  560. * @crtc: currently bound CRTC
  561. * @fb: currently bound fb
  562. * @gamma_size: size of gamma table
  563. * @gamma_store: gamma correction table
  564. * @enabled: enabled flag
  565. * @funcs: helper functions
  566. * @helper_private: storage for drver layer
  567. * @properties: property tracking for this plane
  568. */
  569. struct drm_plane {
  570. struct drm_device *dev;
  571. struct list_head head;
  572. struct drm_mode_object base;
  573. uint32_t possible_crtcs;
  574. uint32_t *format_types;
  575. uint32_t format_count;
  576. struct drm_crtc *crtc;
  577. struct drm_framebuffer *fb;
  578. /* CRTC gamma size for reporting to userspace */
  579. uint32_t gamma_size;
  580. uint16_t *gamma_store;
  581. bool enabled;
  582. const struct drm_plane_funcs *funcs;
  583. void *helper_private;
  584. struct drm_object_properties properties;
  585. };
  586. /**
  587. * drm_mode_set - new values for a CRTC config change
  588. * @head: list management
  589. * @fb: framebuffer to use for new config
  590. * @crtc: CRTC whose configuration we're about to change
  591. * @mode: mode timings to use
  592. * @x: position of this CRTC relative to @fb
  593. * @y: position of this CRTC relative to @fb
  594. * @connectors: array of connectors to drive with this CRTC if possible
  595. * @num_connectors: size of @connectors array
  596. *
  597. * Represents a single crtc the connectors that it drives with what mode
  598. * and from which framebuffer it scans out from.
  599. *
  600. * This is used to set modes.
  601. */
  602. struct drm_mode_set {
  603. struct drm_framebuffer *fb;
  604. struct drm_crtc *crtc;
  605. struct drm_display_mode *mode;
  606. uint32_t x;
  607. uint32_t y;
  608. struct drm_connector **connectors;
  609. size_t num_connectors;
  610. };
  611. /**
  612. * struct drm_mode_config_funcs - basic driver provided mode setting functions
  613. * @fb_create: create a new framebuffer object
  614. * @output_poll_changed: function to handle output configuration changes
  615. *
  616. * Some global (i.e. not per-CRTC, connector, etc) mode setting functions that
  617. * involve drivers.
  618. */
  619. struct drm_mode_config_funcs {
  620. struct drm_framebuffer *(*fb_create)(struct drm_device *dev,
  621. struct drm_file *file_priv,
  622. struct drm_mode_fb_cmd2 *mode_cmd);
  623. void (*output_poll_changed)(struct drm_device *dev);
  624. };
  625. /**
  626. * drm_mode_group - group of mode setting resources for potential sub-grouping
  627. * @num_crtcs: CRTC count
  628. * @num_encoders: encoder count
  629. * @num_connectors: connector count
  630. * @id_list: list of KMS object IDs in this group
  631. *
  632. * Currently this simply tracks the global mode setting state. But in the
  633. * future it could allow groups of objects to be set aside into independent
  634. * control groups for use by different user level processes (e.g. two X servers
  635. * running simultaneously on different heads, each with their own mode
  636. * configuration and freedom of mode setting).
  637. */
  638. struct drm_mode_group {
  639. uint32_t num_crtcs;
  640. uint32_t num_encoders;
  641. uint32_t num_connectors;
  642. /* list of object IDs for this group */
  643. uint32_t *id_list;
  644. };
  645. /**
  646. * drm_mode_config - Mode configuration control structure
  647. * @mutex: mutex protecting KMS related lists and structures
  648. * @idr_mutex: mutex for KMS ID allocation and management
  649. * @crtc_idr: main KMS ID tracking object
  650. * @num_fb: number of fbs available
  651. * @fb_list: list of framebuffers available
  652. * @num_connector: number of connectors on this device
  653. * @connector_list: list of connector objects
  654. * @num_encoder: number of encoders on this device
  655. * @encoder_list: list of encoder objects
  656. * @num_crtc: number of CRTCs on this device
  657. * @crtc_list: list of CRTC objects
  658. * @min_width: minimum pixel width on this device
  659. * @min_height: minimum pixel height on this device
  660. * @max_width: maximum pixel width on this device
  661. * @max_height: maximum pixel height on this device
  662. * @funcs: core driver provided mode setting functions
  663. * @fb_base: base address of the framebuffer
  664. * @poll_enabled: track polling status for this device
  665. * @output_poll_work: delayed work for polling in process context
  666. * @*_property: core property tracking
  667. *
  668. * Core mode resource tracking structure. All CRTC, encoders, and connectors
  669. * enumerated by the driver are added here, as are global properties. Some
  670. * global restrictions are also here, e.g. dimension restrictions.
  671. */
  672. struct drm_mode_config {
  673. struct mutex mutex; /* protects configuration (mode lists etc.) */
  674. struct mutex idr_mutex; /* for IDR management */
  675. struct idr crtc_idr; /* use this idr for all IDs, fb, crtc, connector, modes - just makes life easier */
  676. /* this is limited to one for now */
  677. int num_fb;
  678. struct list_head fb_list;
  679. int num_connector;
  680. struct list_head connector_list;
  681. int num_encoder;
  682. struct list_head encoder_list;
  683. int num_plane;
  684. struct list_head plane_list;
  685. int num_crtc;
  686. struct list_head crtc_list;
  687. struct list_head property_list;
  688. int min_width, min_height;
  689. int max_width, max_height;
  690. const struct drm_mode_config_funcs *funcs;
  691. resource_size_t fb_base;
  692. /* output poll support */
  693. bool poll_enabled;
  694. struct delayed_work output_poll_work;
  695. /* pointers to standard properties */
  696. struct list_head property_blob_list;
  697. struct drm_property *edid_property;
  698. struct drm_property *dpms_property;
  699. /* DVI-I properties */
  700. struct drm_property *dvi_i_subconnector_property;
  701. struct drm_property *dvi_i_select_subconnector_property;
  702. /* TV properties */
  703. struct drm_property *tv_subconnector_property;
  704. struct drm_property *tv_select_subconnector_property;
  705. struct drm_property *tv_mode_property;
  706. struct drm_property *tv_left_margin_property;
  707. struct drm_property *tv_right_margin_property;
  708. struct drm_property *tv_top_margin_property;
  709. struct drm_property *tv_bottom_margin_property;
  710. struct drm_property *tv_brightness_property;
  711. struct drm_property *tv_contrast_property;
  712. struct drm_property *tv_flicker_reduction_property;
  713. struct drm_property *tv_overscan_property;
  714. struct drm_property *tv_saturation_property;
  715. struct drm_property *tv_hue_property;
  716. /* Optional properties */
  717. struct drm_property *scaling_mode_property;
  718. struct drm_property *dithering_mode_property;
  719. struct drm_property *dirty_info_property;
  720. /* dumb ioctl parameters */
  721. uint32_t preferred_depth, prefer_shadow;
  722. };
  723. #define obj_to_crtc(x) container_of(x, struct drm_crtc, base)
  724. #define obj_to_connector(x) container_of(x, struct drm_connector, base)
  725. #define obj_to_encoder(x) container_of(x, struct drm_encoder, base)
  726. #define obj_to_mode(x) container_of(x, struct drm_display_mode, base)
  727. #define obj_to_fb(x) container_of(x, struct drm_framebuffer, base)
  728. #define obj_to_property(x) container_of(x, struct drm_property, base)
  729. #define obj_to_blob(x) container_of(x, struct drm_property_blob, base)
  730. #define obj_to_plane(x) container_of(x, struct drm_plane, base)
  731. struct drm_prop_enum_list {
  732. int type;
  733. char *name;
  734. };
  735. extern int drm_crtc_init(struct drm_device *dev,
  736. struct drm_crtc *crtc,
  737. const struct drm_crtc_funcs *funcs);
  738. extern void drm_crtc_cleanup(struct drm_crtc *crtc);
  739. extern int drm_connector_init(struct drm_device *dev,
  740. struct drm_connector *connector,
  741. const struct drm_connector_funcs *funcs,
  742. int connector_type);
  743. extern void drm_connector_cleanup(struct drm_connector *connector);
  744. /* helper to unplug all connectors from sysfs for device */
  745. extern void drm_connector_unplug_all(struct drm_device *dev);
  746. extern int drm_encoder_init(struct drm_device *dev,
  747. struct drm_encoder *encoder,
  748. const struct drm_encoder_funcs *funcs,
  749. int encoder_type);
  750. extern int drm_plane_init(struct drm_device *dev,
  751. struct drm_plane *plane,
  752. unsigned long possible_crtcs,
  753. const struct drm_plane_funcs *funcs,
  754. const uint32_t *formats, uint32_t format_count,
  755. bool priv);
  756. extern void drm_plane_cleanup(struct drm_plane *plane);
  757. extern void drm_encoder_cleanup(struct drm_encoder *encoder);
  758. extern char *drm_get_connector_name(struct drm_connector *connector);
  759. extern char *drm_get_dpms_name(int val);
  760. extern char *drm_get_dvi_i_subconnector_name(int val);
  761. extern char *drm_get_dvi_i_select_name(int val);
  762. extern char *drm_get_tv_subconnector_name(int val);
  763. extern char *drm_get_tv_select_name(int val);
  764. extern void drm_fb_release(struct drm_file *file_priv);
  765. extern int drm_mode_group_init_legacy_group(struct drm_device *dev, struct drm_mode_group *group);
  766. extern struct edid *drm_get_edid(struct drm_connector *connector,
  767. struct i2c_adapter *adapter);
  768. extern int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid);
  769. extern void drm_mode_probed_add(struct drm_connector *connector, struct drm_display_mode *mode);
  770. extern void drm_mode_remove(struct drm_connector *connector, struct drm_display_mode *mode);
  771. extern void drm_mode_copy(struct drm_display_mode *dst, const struct drm_display_mode *src);
  772. extern struct drm_display_mode *drm_mode_duplicate(struct drm_device *dev,
  773. const struct drm_display_mode *mode);
  774. extern void drm_mode_debug_printmodeline(struct drm_display_mode *mode);
  775. extern void drm_mode_config_init(struct drm_device *dev);
  776. extern void drm_mode_config_reset(struct drm_device *dev);
  777. extern void drm_mode_config_cleanup(struct drm_device *dev);
  778. extern void drm_mode_set_name(struct drm_display_mode *mode);
  779. extern bool drm_mode_equal(struct drm_display_mode *mode1, struct drm_display_mode *mode2);
  780. extern int drm_mode_width(struct drm_display_mode *mode);
  781. extern int drm_mode_height(struct drm_display_mode *mode);
  782. /* for us by fb module */
  783. extern int drm_mode_attachmode_crtc(struct drm_device *dev,
  784. struct drm_crtc *crtc,
  785. const struct drm_display_mode *mode);
  786. extern int drm_mode_detachmode_crtc(struct drm_device *dev, struct drm_display_mode *mode);
  787. extern struct drm_display_mode *drm_mode_create(struct drm_device *dev);
  788. extern void drm_mode_destroy(struct drm_device *dev, struct drm_display_mode *mode);
  789. extern void drm_mode_list_concat(struct list_head *head,
  790. struct list_head *new);
  791. extern void drm_mode_validate_size(struct drm_device *dev,
  792. struct list_head *mode_list,
  793. int maxX, int maxY, int maxPitch);
  794. extern void drm_mode_prune_invalid(struct drm_device *dev,
  795. struct list_head *mode_list, bool verbose);
  796. extern void drm_mode_sort(struct list_head *mode_list);
  797. extern int drm_mode_hsync(const struct drm_display_mode *mode);
  798. extern int drm_mode_vrefresh(const struct drm_display_mode *mode);
  799. extern void drm_mode_set_crtcinfo(struct drm_display_mode *p,
  800. int adjust_flags);
  801. extern void drm_mode_connector_list_update(struct drm_connector *connector);
  802. extern int drm_mode_connector_update_edid_property(struct drm_connector *connector,
  803. struct edid *edid);
  804. extern int drm_connector_property_set_value(struct drm_connector *connector,
  805. struct drm_property *property,
  806. uint64_t value);
  807. extern int drm_connector_property_get_value(struct drm_connector *connector,
  808. struct drm_property *property,
  809. uint64_t *value);
  810. extern int drm_object_property_set_value(struct drm_mode_object *obj,
  811. struct drm_property *property,
  812. uint64_t val);
  813. extern int drm_object_property_get_value(struct drm_mode_object *obj,
  814. struct drm_property *property,
  815. uint64_t *value);
  816. extern struct drm_display_mode *drm_crtc_mode_create(struct drm_device *dev);
  817. extern void drm_framebuffer_set_object(struct drm_device *dev,
  818. unsigned long handle);
  819. extern int drm_framebuffer_init(struct drm_device *dev,
  820. struct drm_framebuffer *fb,
  821. const struct drm_framebuffer_funcs *funcs);
  822. extern void drm_framebuffer_unreference(struct drm_framebuffer *fb);
  823. extern void drm_framebuffer_reference(struct drm_framebuffer *fb);
  824. extern void drm_framebuffer_remove(struct drm_framebuffer *fb);
  825. extern void drm_framebuffer_cleanup(struct drm_framebuffer *fb);
  826. extern int drmfb_probe(struct drm_device *dev, struct drm_crtc *crtc);
  827. extern int drmfb_remove(struct drm_device *dev, struct drm_framebuffer *fb);
  828. extern void drm_crtc_probe_connector_modes(struct drm_device *dev, int maxX, int maxY);
  829. extern bool drm_crtc_in_use(struct drm_crtc *crtc);
  830. extern void drm_connector_attach_property(struct drm_connector *connector,
  831. struct drm_property *property, uint64_t init_val);
  832. extern void drm_object_attach_property(struct drm_mode_object *obj,
  833. struct drm_property *property,
  834. uint64_t init_val);
  835. extern struct drm_property *drm_property_create(struct drm_device *dev, int flags,
  836. const char *name, int num_values);
  837. extern struct drm_property *drm_property_create_enum(struct drm_device *dev, int flags,
  838. const char *name,
  839. const struct drm_prop_enum_list *props,
  840. int num_values);
  841. struct drm_property *drm_property_create_bitmask(struct drm_device *dev,
  842. int flags, const char *name,
  843. const struct drm_prop_enum_list *props,
  844. int num_values);
  845. struct drm_property *drm_property_create_range(struct drm_device *dev, int flags,
  846. const char *name,
  847. uint64_t min, uint64_t max);
  848. extern void drm_property_destroy(struct drm_device *dev, struct drm_property *property);
  849. extern int drm_property_add_enum(struct drm_property *property, int index,
  850. uint64_t value, const char *name);
  851. extern int drm_mode_create_dvi_i_properties(struct drm_device *dev);
  852. extern int drm_mode_create_tv_properties(struct drm_device *dev, int num_formats,
  853. char *formats[]);
  854. extern int drm_mode_create_scaling_mode_property(struct drm_device *dev);
  855. extern int drm_mode_create_dithering_property(struct drm_device *dev);
  856. extern int drm_mode_create_dirty_info_property(struct drm_device *dev);
  857. extern char *drm_get_encoder_name(struct drm_encoder *encoder);
  858. extern int drm_mode_connector_attach_encoder(struct drm_connector *connector,
  859. struct drm_encoder *encoder);
  860. extern void drm_mode_connector_detach_encoder(struct drm_connector *connector,
  861. struct drm_encoder *encoder);
  862. extern int drm_mode_crtc_set_gamma_size(struct drm_crtc *crtc,
  863. int gamma_size);
  864. extern struct drm_mode_object *drm_mode_object_find(struct drm_device *dev,
  865. uint32_t id, uint32_t type);
  866. /* IOCTLs */
  867. extern int drm_mode_getresources(struct drm_device *dev,
  868. void *data, struct drm_file *file_priv);
  869. extern int drm_mode_getplane_res(struct drm_device *dev, void *data,
  870. struct drm_file *file_priv);
  871. extern int drm_mode_getcrtc(struct drm_device *dev,
  872. void *data, struct drm_file *file_priv);
  873. extern int drm_mode_getconnector(struct drm_device *dev,
  874. void *data, struct drm_file *file_priv);
  875. extern int drm_mode_setcrtc(struct drm_device *dev,
  876. void *data, struct drm_file *file_priv);
  877. extern int drm_mode_getplane(struct drm_device *dev,
  878. void *data, struct drm_file *file_priv);
  879. extern int drm_mode_setplane(struct drm_device *dev,
  880. void *data, struct drm_file *file_priv);
  881. extern int drm_mode_cursor_ioctl(struct drm_device *dev,
  882. void *data, struct drm_file *file_priv);
  883. extern int drm_mode_addfb(struct drm_device *dev,
  884. void *data, struct drm_file *file_priv);
  885. extern int drm_mode_addfb2(struct drm_device *dev,
  886. void *data, struct drm_file *file_priv);
  887. extern uint32_t drm_mode_legacy_fb_format(uint32_t bpp, uint32_t depth);
  888. extern int drm_mode_rmfb(struct drm_device *dev,
  889. void *data, struct drm_file *file_priv);
  890. extern int drm_mode_getfb(struct drm_device *dev,
  891. void *data, struct drm_file *file_priv);
  892. extern int drm_mode_dirtyfb_ioctl(struct drm_device *dev,
  893. void *data, struct drm_file *file_priv);
  894. extern int drm_mode_addmode_ioctl(struct drm_device *dev,
  895. void *data, struct drm_file *file_priv);
  896. extern int drm_mode_rmmode_ioctl(struct drm_device *dev,
  897. void *data, struct drm_file *file_priv);
  898. extern int drm_mode_attachmode_ioctl(struct drm_device *dev,
  899. void *data, struct drm_file *file_priv);
  900. extern int drm_mode_detachmode_ioctl(struct drm_device *dev,
  901. void *data, struct drm_file *file_priv);
  902. extern int drm_mode_getproperty_ioctl(struct drm_device *dev,
  903. void *data, struct drm_file *file_priv);
  904. extern int drm_mode_getblob_ioctl(struct drm_device *dev,
  905. void *data, struct drm_file *file_priv);
  906. extern int drm_mode_connector_property_set_ioctl(struct drm_device *dev,
  907. void *data, struct drm_file *file_priv);
  908. extern int drm_mode_hotplug_ioctl(struct drm_device *dev,
  909. void *data, struct drm_file *file_priv);
  910. extern int drm_mode_replacefb(struct drm_device *dev,
  911. void *data, struct drm_file *file_priv);
  912. extern int drm_mode_getencoder(struct drm_device *dev,
  913. void *data, struct drm_file *file_priv);
  914. extern int drm_mode_gamma_get_ioctl(struct drm_device *dev,
  915. void *data, struct drm_file *file_priv);
  916. extern int drm_mode_gamma_set_ioctl(struct drm_device *dev,
  917. void *data, struct drm_file *file_priv);
  918. extern u8 *drm_find_cea_extension(struct edid *edid);
  919. extern bool drm_detect_hdmi_monitor(struct edid *edid);
  920. extern bool drm_detect_monitor_audio(struct edid *edid);
  921. extern int drm_mode_page_flip_ioctl(struct drm_device *dev,
  922. void *data, struct drm_file *file_priv);
  923. extern struct drm_display_mode *drm_cvt_mode(struct drm_device *dev,
  924. int hdisplay, int vdisplay, int vrefresh,
  925. bool reduced, bool interlaced, bool margins);
  926. extern struct drm_display_mode *drm_gtf_mode(struct drm_device *dev,
  927. int hdisplay, int vdisplay, int vrefresh,
  928. bool interlaced, int margins);
  929. extern struct drm_display_mode *drm_gtf_mode_complex(struct drm_device *dev,
  930. int hdisplay, int vdisplay, int vrefresh,
  931. bool interlaced, int margins, int GTF_M,
  932. int GTF_2C, int GTF_K, int GTF_2J);
  933. extern int drm_add_modes_noedid(struct drm_connector *connector,
  934. int hdisplay, int vdisplay);
  935. extern int drm_edid_header_is_valid(const u8 *raw_edid);
  936. extern bool drm_edid_block_valid(u8 *raw_edid, int block, bool print_bad_edid);
  937. extern bool drm_edid_is_valid(struct edid *edid);
  938. struct drm_display_mode *drm_mode_find_dmt(struct drm_device *dev,
  939. int hsize, int vsize, int fresh,
  940. bool rb);
  941. extern int drm_mode_create_dumb_ioctl(struct drm_device *dev,
  942. void *data, struct drm_file *file_priv);
  943. extern int drm_mode_mmap_dumb_ioctl(struct drm_device *dev,
  944. void *data, struct drm_file *file_priv);
  945. extern int drm_mode_destroy_dumb_ioctl(struct drm_device *dev,
  946. void *data, struct drm_file *file_priv);
  947. extern int drm_mode_obj_get_properties_ioctl(struct drm_device *dev, void *data,
  948. struct drm_file *file_priv);
  949. extern int drm_mode_obj_set_property_ioctl(struct drm_device *dev, void *data,
  950. struct drm_file *file_priv);
  951. extern void drm_fb_get_bpp_depth(uint32_t format, unsigned int *depth,
  952. int *bpp);
  953. extern int drm_format_num_planes(uint32_t format);
  954. extern int drm_format_plane_cpp(uint32_t format, int plane);
  955. extern int drm_format_horz_chroma_subsampling(uint32_t format);
  956. extern int drm_format_vert_chroma_subsampling(uint32_t format);
  957. #endif /* __DRM_CRTC_H__ */