drm_crtc.h 39 KB

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