amdgpu_mode.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649
  1. /*
  2. * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and
  3. * VA Linux Systems Inc., Fremont, California.
  4. * Copyright 2008 Red Hat Inc.
  5. *
  6. * Permission is hereby granted, free of charge, to any person obtaining a
  7. * copy of this software and associated documentation files (the "Software"),
  8. * to deal in the Software without restriction, including without limitation
  9. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  10. * and/or sell copies of the Software, and to permit persons to whom the
  11. * Software is furnished to do so, subject to the following conditions:
  12. *
  13. * The above copyright notice and this permission notice shall be included in
  14. * all copies or substantial portions of the Software.
  15. *
  16. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  19. * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
  20. * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  21. * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  22. * OTHER DEALINGS IN THE SOFTWARE.
  23. *
  24. * Original Authors:
  25. * Kevin E. Martin, Rickard E. Faith, Alan Hourihane
  26. *
  27. * Kernel port Author: Dave Airlie
  28. */
  29. #ifndef AMDGPU_MODE_H
  30. #define AMDGPU_MODE_H
  31. #include <drm/drm_crtc.h>
  32. #include <drm/drm_edid.h>
  33. #include <drm/drm_encoder.h>
  34. #include <drm/drm_dp_helper.h>
  35. #include <drm/drm_fixed.h>
  36. #include <drm/drm_crtc_helper.h>
  37. #include <drm/drm_fb_helper.h>
  38. #include <drm/drm_plane_helper.h>
  39. #include <drm/drm_fb_helper.h>
  40. #include <linux/i2c.h>
  41. #include <linux/i2c-algo-bit.h>
  42. #include <linux/hrtimer.h>
  43. #include "amdgpu_irq.h"
  44. #include <drm/drm_dp_mst_helper.h>
  45. #include "modules/inc/mod_freesync.h"
  46. struct amdgpu_bo;
  47. struct amdgpu_device;
  48. struct amdgpu_encoder;
  49. struct amdgpu_router;
  50. struct amdgpu_hpd;
  51. #define to_amdgpu_crtc(x) container_of(x, struct amdgpu_crtc, base)
  52. #define to_amdgpu_connector(x) container_of(x, struct amdgpu_connector, base)
  53. #define to_amdgpu_encoder(x) container_of(x, struct amdgpu_encoder, base)
  54. #define to_amdgpu_framebuffer(x) container_of(x, struct amdgpu_framebuffer, base)
  55. #define to_amdgpu_plane(x) container_of(x, struct amdgpu_plane, base)
  56. #define to_dm_plane_state(x) container_of(x, struct dm_plane_state, base);
  57. #define AMDGPU_MAX_HPD_PINS 6
  58. #define AMDGPU_MAX_CRTCS 6
  59. #define AMDGPU_MAX_PLANES 6
  60. #define AMDGPU_MAX_AFMT_BLOCKS 9
  61. enum amdgpu_rmx_type {
  62. RMX_OFF,
  63. RMX_FULL,
  64. RMX_CENTER,
  65. RMX_ASPECT
  66. };
  67. enum amdgpu_underscan_type {
  68. UNDERSCAN_OFF,
  69. UNDERSCAN_ON,
  70. UNDERSCAN_AUTO,
  71. };
  72. #define AMDGPU_HPD_CONNECT_INT_DELAY_IN_MS 50
  73. #define AMDGPU_HPD_DISCONNECT_INT_DELAY_IN_MS 10
  74. enum amdgpu_hpd_id {
  75. AMDGPU_HPD_1 = 0,
  76. AMDGPU_HPD_2,
  77. AMDGPU_HPD_3,
  78. AMDGPU_HPD_4,
  79. AMDGPU_HPD_5,
  80. AMDGPU_HPD_6,
  81. AMDGPU_HPD_NONE = 0xff,
  82. };
  83. enum amdgpu_crtc_irq {
  84. AMDGPU_CRTC_IRQ_VBLANK1 = 0,
  85. AMDGPU_CRTC_IRQ_VBLANK2,
  86. AMDGPU_CRTC_IRQ_VBLANK3,
  87. AMDGPU_CRTC_IRQ_VBLANK4,
  88. AMDGPU_CRTC_IRQ_VBLANK5,
  89. AMDGPU_CRTC_IRQ_VBLANK6,
  90. AMDGPU_CRTC_IRQ_VLINE1,
  91. AMDGPU_CRTC_IRQ_VLINE2,
  92. AMDGPU_CRTC_IRQ_VLINE3,
  93. AMDGPU_CRTC_IRQ_VLINE4,
  94. AMDGPU_CRTC_IRQ_VLINE5,
  95. AMDGPU_CRTC_IRQ_VLINE6,
  96. AMDGPU_CRTC_IRQ_NONE = 0xff
  97. };
  98. enum amdgpu_pageflip_irq {
  99. AMDGPU_PAGEFLIP_IRQ_D1 = 0,
  100. AMDGPU_PAGEFLIP_IRQ_D2,
  101. AMDGPU_PAGEFLIP_IRQ_D3,
  102. AMDGPU_PAGEFLIP_IRQ_D4,
  103. AMDGPU_PAGEFLIP_IRQ_D5,
  104. AMDGPU_PAGEFLIP_IRQ_D6,
  105. AMDGPU_PAGEFLIP_IRQ_NONE = 0xff
  106. };
  107. enum amdgpu_flip_status {
  108. AMDGPU_FLIP_NONE,
  109. AMDGPU_FLIP_PENDING,
  110. AMDGPU_FLIP_SUBMITTED
  111. };
  112. #define AMDGPU_MAX_I2C_BUS 16
  113. /* amdgpu gpio-based i2c
  114. * 1. "mask" reg and bits
  115. * grabs the gpio pins for software use
  116. * 0=not held 1=held
  117. * 2. "a" reg and bits
  118. * output pin value
  119. * 0=low 1=high
  120. * 3. "en" reg and bits
  121. * sets the pin direction
  122. * 0=input 1=output
  123. * 4. "y" reg and bits
  124. * input pin value
  125. * 0=low 1=high
  126. */
  127. struct amdgpu_i2c_bus_rec {
  128. bool valid;
  129. /* id used by atom */
  130. uint8_t i2c_id;
  131. /* id used by atom */
  132. enum amdgpu_hpd_id hpd;
  133. /* can be used with hw i2c engine */
  134. bool hw_capable;
  135. /* uses multi-media i2c engine */
  136. bool mm_i2c;
  137. /* regs and bits */
  138. uint32_t mask_clk_reg;
  139. uint32_t mask_data_reg;
  140. uint32_t a_clk_reg;
  141. uint32_t a_data_reg;
  142. uint32_t en_clk_reg;
  143. uint32_t en_data_reg;
  144. uint32_t y_clk_reg;
  145. uint32_t y_data_reg;
  146. uint32_t mask_clk_mask;
  147. uint32_t mask_data_mask;
  148. uint32_t a_clk_mask;
  149. uint32_t a_data_mask;
  150. uint32_t en_clk_mask;
  151. uint32_t en_data_mask;
  152. uint32_t y_clk_mask;
  153. uint32_t y_data_mask;
  154. };
  155. #define AMDGPU_MAX_BIOS_CONNECTOR 16
  156. /* pll flags */
  157. #define AMDGPU_PLL_USE_BIOS_DIVS (1 << 0)
  158. #define AMDGPU_PLL_NO_ODD_POST_DIV (1 << 1)
  159. #define AMDGPU_PLL_USE_REF_DIV (1 << 2)
  160. #define AMDGPU_PLL_LEGACY (1 << 3)
  161. #define AMDGPU_PLL_PREFER_LOW_REF_DIV (1 << 4)
  162. #define AMDGPU_PLL_PREFER_HIGH_REF_DIV (1 << 5)
  163. #define AMDGPU_PLL_PREFER_LOW_FB_DIV (1 << 6)
  164. #define AMDGPU_PLL_PREFER_HIGH_FB_DIV (1 << 7)
  165. #define AMDGPU_PLL_PREFER_LOW_POST_DIV (1 << 8)
  166. #define AMDGPU_PLL_PREFER_HIGH_POST_DIV (1 << 9)
  167. #define AMDGPU_PLL_USE_FRAC_FB_DIV (1 << 10)
  168. #define AMDGPU_PLL_PREFER_CLOSEST_LOWER (1 << 11)
  169. #define AMDGPU_PLL_USE_POST_DIV (1 << 12)
  170. #define AMDGPU_PLL_IS_LCD (1 << 13)
  171. #define AMDGPU_PLL_PREFER_MINM_OVER_MAXP (1 << 14)
  172. struct amdgpu_pll {
  173. /* reference frequency */
  174. uint32_t reference_freq;
  175. /* fixed dividers */
  176. uint32_t reference_div;
  177. uint32_t post_div;
  178. /* pll in/out limits */
  179. uint32_t pll_in_min;
  180. uint32_t pll_in_max;
  181. uint32_t pll_out_min;
  182. uint32_t pll_out_max;
  183. uint32_t lcd_pll_out_min;
  184. uint32_t lcd_pll_out_max;
  185. uint32_t best_vco;
  186. /* divider limits */
  187. uint32_t min_ref_div;
  188. uint32_t max_ref_div;
  189. uint32_t min_post_div;
  190. uint32_t max_post_div;
  191. uint32_t min_feedback_div;
  192. uint32_t max_feedback_div;
  193. uint32_t min_frac_feedback_div;
  194. uint32_t max_frac_feedback_div;
  195. /* flags for the current clock */
  196. uint32_t flags;
  197. /* pll id */
  198. uint32_t id;
  199. };
  200. struct amdgpu_i2c_chan {
  201. struct i2c_adapter adapter;
  202. struct drm_device *dev;
  203. struct i2c_algo_bit_data bit;
  204. struct amdgpu_i2c_bus_rec rec;
  205. struct drm_dp_aux aux;
  206. bool has_aux;
  207. struct mutex mutex;
  208. };
  209. struct amdgpu_fbdev;
  210. struct amdgpu_afmt {
  211. bool enabled;
  212. int offset;
  213. bool last_buffer_filled_status;
  214. int id;
  215. struct amdgpu_audio_pin *pin;
  216. };
  217. /*
  218. * Audio
  219. */
  220. struct amdgpu_audio_pin {
  221. int channels;
  222. int rate;
  223. int bits_per_sample;
  224. u8 status_bits;
  225. u8 category_code;
  226. u32 offset;
  227. bool connected;
  228. u32 id;
  229. };
  230. struct amdgpu_audio {
  231. bool enabled;
  232. struct amdgpu_audio_pin pin[AMDGPU_MAX_AFMT_BLOCKS];
  233. int num_pins;
  234. };
  235. struct amdgpu_display_funcs {
  236. /* display watermarks */
  237. void (*bandwidth_update)(struct amdgpu_device *adev);
  238. /* get frame count */
  239. u32 (*vblank_get_counter)(struct amdgpu_device *adev, int crtc);
  240. /* set backlight level */
  241. void (*backlight_set_level)(struct amdgpu_encoder *amdgpu_encoder,
  242. u8 level);
  243. /* get backlight level */
  244. u8 (*backlight_get_level)(struct amdgpu_encoder *amdgpu_encoder);
  245. /* hotplug detect */
  246. bool (*hpd_sense)(struct amdgpu_device *adev, enum amdgpu_hpd_id hpd);
  247. void (*hpd_set_polarity)(struct amdgpu_device *adev,
  248. enum amdgpu_hpd_id hpd);
  249. u32 (*hpd_get_gpio_reg)(struct amdgpu_device *adev);
  250. /* pageflipping */
  251. void (*page_flip)(struct amdgpu_device *adev,
  252. int crtc_id, u64 crtc_base, bool async);
  253. int (*page_flip_get_scanoutpos)(struct amdgpu_device *adev, int crtc,
  254. u32 *vbl, u32 *position);
  255. /* display topology setup */
  256. void (*add_encoder)(struct amdgpu_device *adev,
  257. uint32_t encoder_enum,
  258. uint32_t supported_device,
  259. u16 caps);
  260. void (*add_connector)(struct amdgpu_device *adev,
  261. uint32_t connector_id,
  262. uint32_t supported_device,
  263. int connector_type,
  264. struct amdgpu_i2c_bus_rec *i2c_bus,
  265. uint16_t connector_object_id,
  266. struct amdgpu_hpd *hpd,
  267. struct amdgpu_router *router);
  268. /* it is used to enter or exit into free sync mode */
  269. int (*notify_freesync)(struct drm_device *dev, void *data,
  270. struct drm_file *filp);
  271. /* it is used to allow enablement of freesync mode */
  272. int (*set_freesync_property)(struct drm_connector *connector,
  273. struct drm_property *property,
  274. uint64_t val);
  275. };
  276. struct amdgpu_framebuffer {
  277. struct drm_framebuffer base;
  278. /* caching for later use */
  279. uint64_t address;
  280. };
  281. struct amdgpu_fbdev {
  282. struct drm_fb_helper helper;
  283. struct amdgpu_framebuffer rfb;
  284. struct list_head fbdev_list;
  285. struct amdgpu_device *adev;
  286. };
  287. struct amdgpu_mode_info {
  288. struct atom_context *atom_context;
  289. struct card_info *atom_card_info;
  290. bool mode_config_initialized;
  291. struct amdgpu_crtc *crtcs[AMDGPU_MAX_CRTCS];
  292. struct amdgpu_plane *planes[AMDGPU_MAX_PLANES];
  293. struct amdgpu_afmt *afmt[AMDGPU_MAX_AFMT_BLOCKS];
  294. /* DVI-I properties */
  295. struct drm_property *coherent_mode_property;
  296. /* DAC enable load detect */
  297. struct drm_property *load_detect_property;
  298. /* underscan */
  299. struct drm_property *underscan_property;
  300. struct drm_property *underscan_hborder_property;
  301. struct drm_property *underscan_vborder_property;
  302. /* audio */
  303. struct drm_property *audio_property;
  304. /* FMT dithering */
  305. struct drm_property *dither_property;
  306. /* maximum number of bits per channel for monitor color */
  307. struct drm_property *max_bpc_property;
  308. /* hardcoded DFP edid from BIOS */
  309. struct edid *bios_hardcoded_edid;
  310. int bios_hardcoded_edid_size;
  311. /* pointer to fbdev info structure */
  312. struct amdgpu_fbdev *rfbdev;
  313. /* firmware flags */
  314. u16 firmware_flags;
  315. /* pointer to backlight encoder */
  316. struct amdgpu_encoder *bl_encoder;
  317. u8 bl_level; /* saved backlight level */
  318. struct amdgpu_audio audio; /* audio stuff */
  319. int num_crtc; /* number of crtcs */
  320. int num_hpd; /* number of hpd pins */
  321. int num_dig; /* number of dig blocks */
  322. int disp_priority;
  323. const struct amdgpu_display_funcs *funcs;
  324. const enum drm_plane_type *plane_type;
  325. };
  326. #define AMDGPU_MAX_BL_LEVEL 0xFF
  327. #if defined(CONFIG_BACKLIGHT_CLASS_DEVICE) || defined(CONFIG_BACKLIGHT_CLASS_DEVICE_MODULE)
  328. struct amdgpu_backlight_privdata {
  329. struct amdgpu_encoder *encoder;
  330. uint8_t negative;
  331. };
  332. #endif
  333. struct amdgpu_atom_ss {
  334. uint16_t percentage;
  335. uint16_t percentage_divider;
  336. uint8_t type;
  337. uint16_t step;
  338. uint8_t delay;
  339. uint8_t range;
  340. uint8_t refdiv;
  341. /* asic_ss */
  342. uint16_t rate;
  343. uint16_t amount;
  344. };
  345. struct amdgpu_crtc {
  346. struct drm_crtc base;
  347. int crtc_id;
  348. bool enabled;
  349. bool can_tile;
  350. uint32_t crtc_offset;
  351. struct drm_gem_object *cursor_bo;
  352. uint64_t cursor_addr;
  353. int cursor_x;
  354. int cursor_y;
  355. int cursor_hot_x;
  356. int cursor_hot_y;
  357. int cursor_width;
  358. int cursor_height;
  359. int max_cursor_width;
  360. int max_cursor_height;
  361. enum amdgpu_rmx_type rmx_type;
  362. u8 h_border;
  363. u8 v_border;
  364. fixed20_12 vsc;
  365. fixed20_12 hsc;
  366. struct drm_display_mode native_mode;
  367. u32 pll_id;
  368. /* page flipping */
  369. struct amdgpu_flip_work *pflip_works;
  370. enum amdgpu_flip_status pflip_status;
  371. int deferred_flip_completion;
  372. /* pll sharing */
  373. struct amdgpu_atom_ss ss;
  374. bool ss_enabled;
  375. u32 adjusted_clock;
  376. int bpc;
  377. u32 pll_reference_div;
  378. u32 pll_post_div;
  379. u32 pll_flags;
  380. struct drm_encoder *encoder;
  381. struct drm_connector *connector;
  382. /* for dpm */
  383. u32 line_time;
  384. u32 wm_low;
  385. u32 wm_high;
  386. u32 lb_vblank_lead_lines;
  387. struct drm_display_mode hw_mode;
  388. /* for virtual dce */
  389. struct hrtimer vblank_timer;
  390. enum amdgpu_interrupt_state vsync_timer_enabled;
  391. int otg_inst;
  392. struct drm_pending_vblank_event *event;
  393. };
  394. struct amdgpu_plane {
  395. struct drm_plane base;
  396. enum drm_plane_type plane_type;
  397. };
  398. struct amdgpu_encoder_atom_dig {
  399. bool linkb;
  400. /* atom dig */
  401. bool coherent_mode;
  402. int dig_encoder; /* -1 disabled, 0 DIGA, 1 DIGB, etc. */
  403. /* atom lvds/edp */
  404. uint32_t lcd_misc;
  405. uint16_t panel_pwr_delay;
  406. uint32_t lcd_ss_id;
  407. /* panel mode */
  408. struct drm_display_mode native_mode;
  409. struct backlight_device *bl_dev;
  410. int dpms_mode;
  411. uint8_t backlight_level;
  412. int panel_mode;
  413. struct amdgpu_afmt *afmt;
  414. };
  415. struct amdgpu_encoder {
  416. struct drm_encoder base;
  417. uint32_t encoder_enum;
  418. uint32_t encoder_id;
  419. uint32_t devices;
  420. uint32_t active_device;
  421. uint32_t flags;
  422. uint32_t pixel_clock;
  423. enum amdgpu_rmx_type rmx_type;
  424. enum amdgpu_underscan_type underscan_type;
  425. uint32_t underscan_hborder;
  426. uint32_t underscan_vborder;
  427. struct drm_display_mode native_mode;
  428. void *enc_priv;
  429. int audio_polling_active;
  430. bool is_ext_encoder;
  431. u16 caps;
  432. };
  433. struct amdgpu_connector_atom_dig {
  434. /* displayport */
  435. u8 dpcd[DP_RECEIVER_CAP_SIZE];
  436. u8 dp_sink_type;
  437. int dp_clock;
  438. int dp_lane_count;
  439. bool edp_on;
  440. };
  441. struct amdgpu_gpio_rec {
  442. bool valid;
  443. u8 id;
  444. u32 reg;
  445. u32 mask;
  446. u32 shift;
  447. };
  448. struct amdgpu_hpd {
  449. enum amdgpu_hpd_id hpd;
  450. u8 plugged_state;
  451. struct amdgpu_gpio_rec gpio;
  452. };
  453. struct amdgpu_router {
  454. u32 router_id;
  455. struct amdgpu_i2c_bus_rec i2c_info;
  456. u8 i2c_addr;
  457. /* i2c mux */
  458. bool ddc_valid;
  459. u8 ddc_mux_type;
  460. u8 ddc_mux_control_pin;
  461. u8 ddc_mux_state;
  462. /* clock/data mux */
  463. bool cd_valid;
  464. u8 cd_mux_type;
  465. u8 cd_mux_control_pin;
  466. u8 cd_mux_state;
  467. };
  468. enum amdgpu_connector_audio {
  469. AMDGPU_AUDIO_DISABLE = 0,
  470. AMDGPU_AUDIO_ENABLE = 1,
  471. AMDGPU_AUDIO_AUTO = 2
  472. };
  473. enum amdgpu_connector_dither {
  474. AMDGPU_FMT_DITHER_DISABLE = 0,
  475. AMDGPU_FMT_DITHER_ENABLE = 1,
  476. };
  477. struct amdgpu_dm_dp_aux {
  478. struct drm_dp_aux aux;
  479. struct ddc_service *ddc_service;
  480. };
  481. struct amdgpu_i2c_adapter {
  482. struct i2c_adapter base;
  483. struct ddc_service *ddc_service;
  484. };
  485. #define TO_DM_AUX(x) container_of((x), struct amdgpu_dm_dp_aux, aux)
  486. struct amdgpu_connector {
  487. struct drm_connector base;
  488. uint32_t connector_id;
  489. uint32_t devices;
  490. struct amdgpu_i2c_chan *ddc_bus;
  491. /* some systems have an hdmi and vga port with a shared ddc line */
  492. bool shared_ddc;
  493. bool use_digital;
  494. /* we need to mind the EDID between detect
  495. and get modes due to analog/digital/tvencoder */
  496. struct edid *edid;
  497. void *con_priv;
  498. bool dac_load_detect;
  499. bool detected_by_load; /* if the connection status was determined by load */
  500. uint16_t connector_object_id;
  501. struct amdgpu_hpd hpd;
  502. struct amdgpu_router router;
  503. struct amdgpu_i2c_chan *router_bus;
  504. enum amdgpu_connector_audio audio;
  505. enum amdgpu_connector_dither dither;
  506. unsigned pixelclock_for_modeset;
  507. };
  508. /* TODO: start to use this struct and remove same field from base one */
  509. struct amdgpu_mst_connector {
  510. struct amdgpu_connector base;
  511. struct drm_dp_mst_topology_mgr mst_mgr;
  512. struct amdgpu_dm_dp_aux dm_dp_aux;
  513. struct drm_dp_mst_port *port;
  514. struct amdgpu_connector *mst_port;
  515. bool is_mst_connector;
  516. struct amdgpu_encoder *mst_encoder;
  517. };
  518. #define ENCODER_MODE_IS_DP(em) (((em) == ATOM_ENCODER_MODE_DP) || \
  519. ((em) == ATOM_ENCODER_MODE_DP_MST))
  520. /* Driver internal use only flags of amdgpu_display_get_crtc_scanoutpos() */
  521. #define DRM_SCANOUTPOS_VALID (1 << 0)
  522. #define DRM_SCANOUTPOS_IN_VBLANK (1 << 1)
  523. #define DRM_SCANOUTPOS_ACCURATE (1 << 2)
  524. #define USE_REAL_VBLANKSTART (1 << 30)
  525. #define GET_DISTANCE_TO_VBLANKSTART (1 << 31)
  526. void amdgpu_link_encoder_connector(struct drm_device *dev);
  527. struct drm_connector *
  528. amdgpu_get_connector_for_encoder(struct drm_encoder *encoder);
  529. struct drm_connector *
  530. amdgpu_get_connector_for_encoder_init(struct drm_encoder *encoder);
  531. bool amdgpu_dig_monitor_is_duallink(struct drm_encoder *encoder,
  532. u32 pixel_clock);
  533. u16 amdgpu_encoder_get_dp_bridge_encoder_id(struct drm_encoder *encoder);
  534. struct drm_encoder *amdgpu_get_external_encoder(struct drm_encoder *encoder);
  535. bool amdgpu_display_ddc_probe(struct amdgpu_connector *amdgpu_connector,
  536. bool use_aux);
  537. void amdgpu_encoder_set_active_device(struct drm_encoder *encoder);
  538. int amdgpu_display_get_crtc_scanoutpos(struct drm_device *dev,
  539. unsigned int pipe, unsigned int flags, int *vpos,
  540. int *hpos, ktime_t *stime, ktime_t *etime,
  541. const struct drm_display_mode *mode);
  542. int amdgpu_display_framebuffer_init(struct drm_device *dev,
  543. struct amdgpu_framebuffer *rfb,
  544. const struct drm_mode_fb_cmd2 *mode_cmd,
  545. struct drm_gem_object *obj);
  546. int amdgpufb_remove(struct drm_device *dev, struct drm_framebuffer *fb);
  547. void amdgpu_enc_destroy(struct drm_encoder *encoder);
  548. void amdgpu_copy_fb(struct drm_device *dev, struct drm_gem_object *dst_obj);
  549. bool amdgpu_display_crtc_scaling_mode_fixup(struct drm_crtc *crtc,
  550. const struct drm_display_mode *mode,
  551. struct drm_display_mode *adjusted_mode);
  552. void amdgpu_panel_mode_fixup(struct drm_encoder *encoder,
  553. struct drm_display_mode *adjusted_mode);
  554. int amdgpu_display_crtc_idx_to_irq_type(struct amdgpu_device *adev, int crtc);
  555. /* fbdev layer */
  556. int amdgpu_fbdev_init(struct amdgpu_device *adev);
  557. void amdgpu_fbdev_fini(struct amdgpu_device *adev);
  558. void amdgpu_fbdev_set_suspend(struct amdgpu_device *adev, int state);
  559. int amdgpu_fbdev_total_size(struct amdgpu_device *adev);
  560. bool amdgpu_fbdev_robj_is_fb(struct amdgpu_device *adev, struct amdgpu_bo *robj);
  561. int amdgpu_align_pitch(struct amdgpu_device *adev, int width, int bpp, bool tiled);
  562. /* amdgpu_display.c */
  563. void amdgpu_display_print_display_setup(struct drm_device *dev);
  564. int amdgpu_display_modeset_create_props(struct amdgpu_device *adev);
  565. int amdgpu_display_crtc_set_config(struct drm_mode_set *set,
  566. struct drm_modeset_acquire_ctx *ctx);
  567. int amdgpu_display_crtc_page_flip_target(struct drm_crtc *crtc,
  568. struct drm_framebuffer *fb,
  569. struct drm_pending_vblank_event *event,
  570. uint32_t page_flip_flags, uint32_t target,
  571. struct drm_modeset_acquire_ctx *ctx);
  572. extern const struct drm_mode_config_funcs amdgpu_mode_funcs;
  573. #endif