dc.h 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805
  1. /*
  2. * Copyright 2012-14 Advanced Micro Devices, Inc.
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a
  5. * copy of this software and associated documentation files (the "Software"),
  6. * to deal in the Software without restriction, including without limitation
  7. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  8. * and/or sell copies of the Software, and to permit persons to whom the
  9. * Software is furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included in
  12. * all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  17. * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
  18. * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  19. * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  20. * OTHER DEALINGS IN THE SOFTWARE.
  21. *
  22. * Authors: AMD
  23. *
  24. */
  25. #ifndef DC_INTERFACE_H_
  26. #define DC_INTERFACE_H_
  27. #include "dc_types.h"
  28. #include "grph_object_defs.h"
  29. #include "logger_types.h"
  30. #include "gpio_types.h"
  31. #include "link_service_types.h"
  32. #define MAX_TARGETS 6
  33. #define MAX_SURFACES 3
  34. #define MAX_SINKS_PER_LINK 4
  35. /*******************************************************************************
  36. * Display Core Interfaces
  37. ******************************************************************************/
  38. struct dc_caps {
  39. uint32_t max_targets;
  40. uint32_t max_links;
  41. uint32_t max_audios;
  42. uint32_t max_slave_planes;
  43. uint32_t max_downscale_ratio;
  44. uint32_t i2c_speed_in_khz;
  45. };
  46. struct dc_dcc_surface_param {
  47. enum surface_pixel_format format;
  48. struct dc_size surface_size;
  49. enum dc_scan_direction scan;
  50. };
  51. struct dc_dcc_setting {
  52. unsigned int max_compressed_blk_size;
  53. unsigned int max_uncompressed_blk_size;
  54. bool independent_64b_blks;
  55. };
  56. struct dc_surface_dcc_cap {
  57. bool capable;
  58. bool const_color_support;
  59. union {
  60. struct {
  61. struct dc_dcc_setting rgb;
  62. } grph;
  63. struct {
  64. struct dc_dcc_setting luma;
  65. struct dc_dcc_setting chroma;
  66. } video;
  67. };
  68. };
  69. /* Forward declaration*/
  70. struct dc;
  71. struct dc_surface;
  72. struct validate_context;
  73. struct dc_cap_funcs {
  74. int i;
  75. };
  76. struct dc_stream_funcs {
  77. bool (*adjust_vmin_vmax)(struct dc *dc,
  78. const struct dc_stream **stream,
  79. int num_streams,
  80. int vmin,
  81. int vmax);
  82. void (*stream_update_scaling)(const struct dc *dc,
  83. const struct dc_stream *dc_stream,
  84. const struct rect *src,
  85. const struct rect *dst);
  86. bool (*set_gamut_remap)(struct dc *dc,
  87. const struct dc_stream **stream, int num_streams);
  88. bool (*set_backlight)(struct dc *dc, unsigned int backlight_level,
  89. unsigned int frame_ramp, const struct dc_stream *stream);
  90. bool (*init_dmcu_backlight_settings)(struct dc *dc);
  91. bool (*set_abm_level)(struct dc *dc, unsigned int abm_level);
  92. bool (*set_psr_enable)(struct dc *dc, bool enable);
  93. bool (*setup_psr)(struct dc *dc, const struct dc_stream *stream);
  94. };
  95. struct link_training_settings;
  96. struct dc_link_funcs {
  97. void (*set_drive_settings)(struct dc *dc,
  98. struct link_training_settings *lt_settings);
  99. void (*perform_link_training)(struct dc *dc,
  100. struct dc_link_settings *link_setting,
  101. bool skip_video_pattern);
  102. void (*set_preferred_link_settings)(struct dc *dc,
  103. struct dc_link_settings *link_setting);
  104. void (*enable_hpd)(const struct dc_link *link);
  105. void (*disable_hpd)(const struct dc_link *link);
  106. void (*set_test_pattern)(
  107. const struct dc_link *link,
  108. enum dp_test_pattern test_pattern,
  109. const struct link_training_settings *p_link_settings,
  110. const unsigned char *p_custom_pattern,
  111. unsigned int cust_pattern_size);
  112. };
  113. /* Structure to hold configuration flags set by dm at dc creation. */
  114. struct dc_config {
  115. bool gpu_vm_support;
  116. bool disable_disp_pll_sharing;
  117. };
  118. struct dc_debug {
  119. bool surface_visual_confirm;
  120. bool max_disp_clk;
  121. bool target_trace;
  122. bool surface_trace;
  123. bool timing_trace;
  124. bool validation_trace;
  125. bool disable_stutter;
  126. bool disable_dcc;
  127. bool disable_dfs_bypass;
  128. bool disable_power_gate;
  129. bool disable_clock_gate;
  130. bool disable_dmcu;
  131. };
  132. struct dc {
  133. struct dc_caps caps;
  134. struct dc_cap_funcs cap_funcs;
  135. struct dc_stream_funcs stream_funcs;
  136. struct dc_link_funcs link_funcs;
  137. struct dc_config config;
  138. struct dc_debug debug;
  139. };
  140. struct dc_init_data {
  141. struct hw_asic_id asic_id;
  142. void *driver; /* ctx */
  143. struct cgs_device *cgs_device;
  144. int num_virtual_links;
  145. /*
  146. * If 'vbios_override' not NULL, it will be called instead
  147. * of the real VBIOS. Intended use is Diagnostics on FPGA.
  148. */
  149. struct dc_bios *vbios_override;
  150. enum dce_environment dce_environment;
  151. struct dc_config flags;
  152. };
  153. struct dc *dc_create(const struct dc_init_data *init_params);
  154. void dc_destroy(struct dc **dc);
  155. /*******************************************************************************
  156. * Surface Interfaces
  157. ******************************************************************************/
  158. enum {
  159. RGB_256X3X16 = 256,
  160. FLOAT_GAMMA_RAMP_MAX = 1025,
  161. TRANSFER_FUNC_POINTS = 1025
  162. };
  163. enum dc_gamma_ramp_type {
  164. GAMMA_RAMP_RBG256X3X16,
  165. GAMMA_RAMP_FLOAT,
  166. };
  167. struct float_rgb {
  168. struct fixed32_32 red;
  169. struct fixed32_32 green;
  170. struct fixed32_32 blue;
  171. };
  172. struct dc_gamma_ramp_float {
  173. struct float_rgb scale;
  174. struct float_rgb offset;
  175. struct float_rgb gamma_curve[FLOAT_GAMMA_RAMP_MAX];
  176. };
  177. struct dc_gamma_ramp_rgb256x3x16 {
  178. uint16_t red[RGB_256X3X16];
  179. uint16_t green[RGB_256X3X16];
  180. uint16_t blue[RGB_256X3X16];
  181. };
  182. struct dc_gamma {
  183. enum dc_gamma_ramp_type type;
  184. union {
  185. struct dc_gamma_ramp_rgb256x3x16 gamma_ramp_rgb256x3x16;
  186. struct dc_gamma_ramp_float gamma_ramp_float;
  187. };
  188. uint32_t size;
  189. };
  190. enum dc_transfer_func_type {
  191. TF_TYPE_PREDEFINED,
  192. TF_TYPE_DISTRIBUTED_POINTS,
  193. };
  194. struct dc_transfer_func_distributed_points {
  195. uint16_t red[TRANSFER_FUNC_POINTS];
  196. uint16_t green[TRANSFER_FUNC_POINTS];
  197. uint16_t blue[TRANSFER_FUNC_POINTS];
  198. uint16_t end_exponent;
  199. uint16_t x_point_at_y1;
  200. };
  201. enum dc_transfer_func_predefined {
  202. TRANSFER_FUNCTION_SRGB,
  203. TRANSFER_FUNCTION_BT709,
  204. TRANSFER_FUNCTION_PQ,
  205. TRANSFER_FUNCTION_LINEAR,
  206. };
  207. struct dc_transfer_func {
  208. enum dc_transfer_func_type type;
  209. enum dc_transfer_func_predefined tf;
  210. struct dc_transfer_func_distributed_points tf_pts;
  211. };
  212. struct dc_surface {
  213. bool visible;
  214. bool flip_immediate;
  215. struct dc_plane_address address;
  216. struct scaling_taps scaling_quality;
  217. struct rect src_rect;
  218. struct rect dst_rect;
  219. struct rect clip_rect;
  220. union plane_size plane_size;
  221. union dc_tiling_info tiling_info;
  222. struct dc_plane_dcc_param dcc;
  223. enum dc_color_space color_space;
  224. enum surface_pixel_format format;
  225. enum dc_rotation_angle rotation;
  226. bool horizontal_mirror;
  227. enum plane_stereo_format stereo_format;
  228. /* TO BE REMOVED AFTER BELOW TRANSFER FUNCTIONS IMPLEMENTED */
  229. const struct dc_gamma *gamma_correction;
  230. const struct dc_transfer_func *in_transfer_func;
  231. };
  232. struct dc_plane_info {
  233. union plane_size plane_size;
  234. union dc_tiling_info tiling_info;
  235. struct dc_plane_dcc_param dcc;
  236. enum surface_pixel_format format;
  237. enum dc_rotation_angle rotation;
  238. bool horizontal_mirror;
  239. enum plane_stereo_format stereo_format;
  240. enum dc_color_space color_space; /*todo: wrong place, fits in scaling info*/
  241. bool visible;
  242. };
  243. struct dc_scaling_info {
  244. struct rect src_rect;
  245. struct rect dst_rect;
  246. struct rect clip_rect;
  247. struct scaling_taps scaling_quality;
  248. };
  249. struct dc_surface_update {
  250. const struct dc_surface *surface;
  251. /* isr safe update parameters. null means no updates */
  252. struct dc_flip_addrs *flip_addr;
  253. struct dc_plane_info *plane_info;
  254. struct dc_scaling_info *scaling_info;
  255. /* following updates require alloc/sleep/spin that is not isr safe,
  256. * null means no updates
  257. */
  258. /* gamma TO BE REMOVED */
  259. struct dc_gamma *gamma;
  260. struct dc_transfer_func *in_transfer_func;
  261. struct dc_transfer_func *out_transfer_func;
  262. };
  263. /*
  264. * This structure is filled in by dc_surface_get_status and contains
  265. * the last requested address and the currently active address so the called
  266. * can determine if there are any outstanding flips
  267. */
  268. struct dc_surface_status {
  269. struct dc_plane_address requested_address;
  270. struct dc_plane_address current_address;
  271. bool is_flip_pending;
  272. };
  273. /*
  274. * Create a new surface with default parameters;
  275. */
  276. struct dc_surface *dc_create_surface(const struct dc *dc);
  277. const struct dc_surface_status *dc_surface_get_status(
  278. const struct dc_surface *dc_surface);
  279. void dc_surface_retain(const struct dc_surface *dc_surface);
  280. void dc_surface_release(const struct dc_surface *dc_surface);
  281. void dc_gamma_retain(const struct dc_gamma *dc_gamma);
  282. void dc_gamma_release(const struct dc_gamma *dc_gamma);
  283. struct dc_gamma *dc_create_gamma(void);
  284. void dc_transfer_func_retain(const struct dc_transfer_func *dc_tf);
  285. void dc_transfer_func_release(const struct dc_transfer_func *dc_tf);
  286. struct dc_transfer_func *dc_create_transfer_func(void);
  287. /*
  288. * This structure holds a surface address. There could be multiple addresses
  289. * in cases such as Stereo 3D, Planar YUV, etc. Other per-flip attributes such
  290. * as frame durations and DCC format can also be set.
  291. */
  292. struct dc_flip_addrs {
  293. struct dc_plane_address address;
  294. bool flip_immediate;
  295. /* TODO: DCC format info */
  296. /* TODO: add flip duration for FreeSync */
  297. };
  298. /*
  299. * Optimized flip address update function.
  300. *
  301. * After this call:
  302. * Surface addresses and flip attributes are programmed.
  303. * Surface flip occur at next configured time (h_sync or v_sync flip)
  304. */
  305. void dc_flip_surface_addrs(struct dc *dc,
  306. const struct dc_surface *const surfaces[],
  307. struct dc_flip_addrs flip_addrs[],
  308. uint32_t count);
  309. /*
  310. * Set up surface attributes and associate to a target
  311. * The surfaces parameter is an absolute set of all surface active for the target.
  312. * If no surfaces are provided, the target will be blanked; no memory read.
  313. * Any flip related attribute changes must be done through this interface.
  314. *
  315. * After this call:
  316. * Surfaces attributes are programmed and configured to be composed into target.
  317. * This does not trigger a flip. No surface address is programmed.
  318. */
  319. bool dc_commit_surfaces_to_target(
  320. struct dc *dc,
  321. const struct dc_surface **dc_surfaces,
  322. uint8_t surface_count,
  323. struct dc_target *dc_target);
  324. bool dc_pre_update_surfaces_to_target(
  325. struct dc *dc,
  326. const struct dc_surface *const *new_surfaces,
  327. uint8_t new_surface_count,
  328. struct dc_target *dc_target);
  329. bool dc_post_update_surfaces_to_target(
  330. struct dc *dc);
  331. void dc_update_surfaces_for_target(struct dc *dc, struct dc_surface_update *updates,
  332. int surface_count, struct dc_target *dc_target);
  333. /*******************************************************************************
  334. * Target Interfaces
  335. ******************************************************************************/
  336. #define MAX_STREAM_NUM 1
  337. struct dc_target {
  338. uint8_t stream_count;
  339. const struct dc_stream *streams[MAX_STREAM_NUM];
  340. };
  341. /*
  342. * Target status is returned from dc_target_get_status in order to get the
  343. * the IRQ source, current frame counter and currently attached surfaces.
  344. */
  345. struct dc_target_status {
  346. int primary_otg_inst;
  347. int cur_frame_count;
  348. int surface_count;
  349. const struct dc_surface *surfaces[MAX_SURFACE_NUM];
  350. };
  351. struct dc_target *dc_create_target_for_streams(
  352. struct dc_stream *dc_streams[],
  353. uint8_t stream_count);
  354. /*
  355. * Get the current target status.
  356. */
  357. const struct dc_target_status *dc_target_get_status(
  358. const struct dc_target* dc_target);
  359. void dc_target_retain(const struct dc_target *dc_target);
  360. void dc_target_release(const struct dc_target *dc_target);
  361. void dc_target_log(
  362. const struct dc_target *dc_target,
  363. struct dal_logger *dc_logger,
  364. enum dc_log_type log_type);
  365. uint8_t dc_get_current_target_count(const struct dc *dc);
  366. struct dc_target *dc_get_target_at_index(const struct dc *dc, uint8_t i);
  367. bool dc_target_is_connected_to_sink(
  368. const struct dc_target *dc_target,
  369. const struct dc_sink *dc_sink);
  370. uint32_t dc_target_get_vblank_counter(const struct dc_target *dc_target);
  371. /* TODO: Return parsed values rather than direct register read
  372. * This has a dependency on the caller (amdgpu_get_crtc_scanoutpos)
  373. * being refactored properly to be dce-specific
  374. */
  375. uint32_t dc_target_get_scanoutpos(
  376. const struct dc_target *dc_target,
  377. uint32_t *vbl,
  378. uint32_t *position);
  379. /*
  380. * Structure to store surface/target associations for validation
  381. */
  382. struct dc_validation_set {
  383. const struct dc_target *target;
  384. const struct dc_surface *surfaces[MAX_SURFACES];
  385. uint8_t surface_count;
  386. };
  387. /*
  388. * This function takes a set of resources and checks that they are cofunctional.
  389. *
  390. * After this call:
  391. * No hardware is programmed for call. Only validation is done.
  392. */
  393. bool dc_validate_resources(
  394. const struct dc *dc,
  395. const struct dc_validation_set set[],
  396. uint8_t set_count);
  397. /*
  398. * This function takes a target and checks if it is guaranteed to be supported.
  399. * Guaranteed means that MAX_COFUNC*target is supported.
  400. *
  401. * After this call:
  402. * No hardware is programmed for call. Only validation is done.
  403. */
  404. bool dc_validate_guaranteed(
  405. const struct dc *dc,
  406. const struct dc_target *dc_target);
  407. /*
  408. * Set up streams and links associated to targets to drive sinks
  409. * The targets parameter is an absolute set of all active targets.
  410. *
  411. * After this call:
  412. * Phy, Encoder, Timing Generator are programmed and enabled.
  413. * New targets are enabled with blank stream; no memory read.
  414. */
  415. bool dc_commit_targets(
  416. struct dc *dc,
  417. struct dc_target *targets[],
  418. uint8_t target_count);
  419. /*******************************************************************************
  420. * Stream Interfaces
  421. ******************************************************************************/
  422. struct dc_stream {
  423. const struct dc_sink *sink;
  424. struct dc_crtc_timing timing;
  425. enum dc_color_space output_color_space;
  426. struct rect src; /* viewport in target space*/
  427. struct rect dst; /* stream addressable area */
  428. struct audio_info audio_info;
  429. bool ignore_msa_timing_param;
  430. struct freesync_context freesync_ctx;
  431. const struct dc_transfer_func *out_transfer_func;
  432. struct colorspace_transform gamut_remap_matrix;
  433. struct csc_transform csc_color_matrix;
  434. /* TODO: dithering */
  435. /* TODO: custom INFO packets */
  436. /* TODO: ABM info (DMCU) */
  437. /* TODO: PSR info */
  438. /* TODO: CEA VIC */
  439. };
  440. /**
  441. * Create a new default stream for the requested sink
  442. */
  443. struct dc_stream *dc_create_stream_for_sink(const struct dc_sink *dc_sink);
  444. void dc_stream_retain(const struct dc_stream *dc_stream);
  445. void dc_stream_release(const struct dc_stream *dc_stream);
  446. struct dc_stream_status {
  447. /*
  448. * link this stream passes through
  449. */
  450. const struct dc_link *link;
  451. };
  452. const struct dc_stream_status *dc_stream_get_status(
  453. const struct dc_stream *dc_stream);
  454. /*******************************************************************************
  455. * Link Interfaces
  456. ******************************************************************************/
  457. /*
  458. * A link contains one or more sinks and their connected status.
  459. * The currently active signal type (HDMI, DP-SST, DP-MST) is also reported.
  460. */
  461. struct dc_link {
  462. const struct dc_sink *remote_sinks[MAX_SINKS_PER_LINK];
  463. unsigned int sink_count;
  464. const struct dc_sink *local_sink;
  465. unsigned int link_index;
  466. enum dc_connection_type type;
  467. enum signal_type connector_signal;
  468. enum dc_irq_source irq_source_hpd;
  469. enum dc_irq_source irq_source_hpd_rx;/* aka DP Short Pulse */
  470. /* caps is the same as reported_link_cap. link_traing use
  471. * reported_link_cap. Will clean up. TODO
  472. */
  473. struct dc_link_settings reported_link_cap;
  474. struct dc_link_settings verified_link_cap;
  475. struct dc_link_settings max_link_setting;
  476. struct dc_link_settings cur_link_settings;
  477. struct dc_lane_settings cur_lane_setting;
  478. uint8_t ddc_hw_inst;
  479. uint8_t link_enc_hw_inst;
  480. struct psr_caps psr_caps;
  481. bool test_pattern_enabled;
  482. union compliance_test_state compliance_test_state;
  483. };
  484. struct dpcd_caps {
  485. union dpcd_rev dpcd_rev;
  486. union max_lane_count max_ln_count;
  487. union max_down_spread max_down_spread;
  488. /* dongle type (DP converter, CV smart dongle) */
  489. enum display_dongle_type dongle_type;
  490. /* Dongle's downstream count. */
  491. union sink_count sink_count;
  492. /* If dongle_type == DISPLAY_DONGLE_DP_HDMI_CONVERTER,
  493. indicates 'Frame Sequential-to-lllFrame Pack' conversion capability.*/
  494. bool is_dp_hdmi_s3d_converter;
  495. bool allow_invalid_MSA_timing_param;
  496. bool panel_mode_edp;
  497. uint32_t sink_dev_id;
  498. uint32_t branch_dev_id;
  499. int8_t branch_dev_name[6];
  500. int8_t branch_hw_revision;
  501. };
  502. struct dc_link_status {
  503. struct dpcd_caps *dpcd_caps;
  504. };
  505. const struct dc_link_status *dc_link_get_status(const struct dc_link *dc_link);
  506. /*
  507. * Return an enumerated dc_link. dc_link order is constant and determined at
  508. * boot time. They cannot be created or destroyed.
  509. * Use dc_get_caps() to get number of links.
  510. */
  511. const struct dc_link *dc_get_link_at_index(const struct dc *dc, uint32_t link_index);
  512. /* Return id of physical connector represented by a dc_link at link_index.*/
  513. const struct graphics_object_id dc_get_link_id_at_index(
  514. struct dc *dc, uint32_t link_index);
  515. /* Set backlight level of an embedded panel (eDP, LVDS). */
  516. bool dc_link_set_backlight_level(const struct dc_link *dc_link, uint32_t level,
  517. uint32_t frame_ramp, const struct dc_stream *stream);
  518. bool dc_link_init_dmcu_backlight_settings(const struct dc_link *dc_link);
  519. bool dc_link_set_abm_level(const struct dc_link *dc_link, uint32_t level);
  520. bool dc_link_set_psr_enable(const struct dc_link *dc_link, bool enable);
  521. bool dc_link_setup_psr(const struct dc_link *dc_link,
  522. const struct dc_stream *stream);
  523. /* Request DC to detect if there is a Panel connected.
  524. * boot - If this call is during initial boot.
  525. * Return false for any type of detection failure or MST detection
  526. * true otherwise. True meaning further action is required (status update
  527. * and OS notification).
  528. */
  529. bool dc_link_detect(const struct dc_link *dc_link, bool boot);
  530. /* Notify DC about DP RX Interrupt (aka Short Pulse Interrupt).
  531. * Return:
  532. * true - Downstream port status changed. DM should call DC to do the
  533. * detection.
  534. * false - no change in Downstream port status. No further action required
  535. * from DM. */
  536. bool dc_link_handle_hpd_rx_irq(const struct dc_link *dc_link);
  537. struct dc_sink_init_data;
  538. struct dc_sink *dc_link_add_remote_sink(
  539. const struct dc_link *dc_link,
  540. const uint8_t *edid,
  541. int len,
  542. struct dc_sink_init_data *init_data);
  543. void dc_link_remove_remote_sink(
  544. const struct dc_link *link,
  545. const struct dc_sink *sink);
  546. /* Used by diagnostics for virtual link at the moment */
  547. void dc_link_set_sink(const struct dc_link *link, struct dc_sink *sink);
  548. void dc_link_dp_set_drive_settings(
  549. struct dc_link *link,
  550. struct link_training_settings *lt_settings);
  551. bool dc_link_dp_perform_link_training(
  552. struct dc_link *link,
  553. const struct dc_link_settings *link_setting,
  554. bool skip_video_pattern);
  555. void dc_link_dp_enable_hpd(const struct dc_link *link);
  556. void dc_link_dp_disable_hpd(const struct dc_link *link);
  557. bool dc_link_dp_set_test_pattern(
  558. const struct dc_link *link,
  559. enum dp_test_pattern test_pattern,
  560. const struct link_training_settings *p_link_settings,
  561. const unsigned char *p_custom_pattern,
  562. unsigned int cust_pattern_size);
  563. /*******************************************************************************
  564. * Sink Interfaces - A sink corresponds to a display output device
  565. ******************************************************************************/
  566. /*
  567. * The sink structure contains EDID and other display device properties
  568. */
  569. struct dc_sink {
  570. enum signal_type sink_signal;
  571. struct dc_edid dc_edid; /* raw edid */
  572. struct dc_edid_caps edid_caps; /* parse display caps */
  573. };
  574. void dc_sink_retain(const struct dc_sink *sink);
  575. void dc_sink_release(const struct dc_sink *sink);
  576. const struct audio **dc_get_audios(struct dc *dc);
  577. struct dc_sink_init_data {
  578. enum signal_type sink_signal;
  579. const struct dc_link *link;
  580. uint32_t dongle_max_pix_clk;
  581. bool converter_disable_audio;
  582. };
  583. struct dc_sink *dc_sink_create(const struct dc_sink_init_data *init_params);
  584. /*******************************************************************************
  585. * Cursor interfaces - To manages the cursor within a target
  586. ******************************************************************************/
  587. /* TODO: Deprecated once we switch to dc_set_cursor_position */
  588. bool dc_target_set_cursor_attributes(
  589. struct dc_target *dc_target,
  590. const struct dc_cursor_attributes *attributes);
  591. bool dc_target_set_cursor_position(
  592. struct dc_target *dc_target,
  593. const struct dc_cursor_position *position);
  594. /* Newer interfaces */
  595. struct dc_cursor {
  596. struct dc_plane_address address;
  597. struct dc_cursor_attributes attributes;
  598. };
  599. /*
  600. * Create a new cursor with default values for a given target.
  601. */
  602. struct dc_cursor *dc_create_cursor_for_target(
  603. const struct dc *dc,
  604. struct dc_target *dc_target);
  605. /**
  606. * Commit cursor attribute changes such as pixel format and dimensions and
  607. * surface address.
  608. *
  609. * After this call:
  610. * Cursor address and format is programmed to the new values.
  611. * Cursor position is unmodified.
  612. */
  613. bool dc_commit_cursor(
  614. const struct dc *dc,
  615. struct dc_cursor *cursor);
  616. /*
  617. * Optimized cursor position update
  618. *
  619. * After this call:
  620. * Cursor position will be programmed as well as enable/disable bit.
  621. */
  622. bool dc_set_cursor_position(
  623. const struct dc *dc,
  624. struct dc_cursor *cursor,
  625. struct dc_cursor_position *pos);
  626. /*******************************************************************************
  627. * Interrupt interfaces
  628. ******************************************************************************/
  629. enum dc_irq_source dc_interrupt_to_irq_source(
  630. struct dc *dc,
  631. uint32_t src_id,
  632. uint32_t ext_id);
  633. void dc_interrupt_set(const struct dc *dc, enum dc_irq_source src, bool enable);
  634. void dc_interrupt_ack(struct dc *dc, enum dc_irq_source src);
  635. enum dc_irq_source dc_get_hpd_irq_source_at_index(
  636. struct dc *dc, uint32_t link_index);
  637. /*******************************************************************************
  638. * Power Interfaces
  639. ******************************************************************************/
  640. void dc_set_power_state(
  641. struct dc *dc,
  642. enum dc_acpi_cm_power_state power_state,
  643. enum dc_video_power_state video_power_state);
  644. void dc_resume(const struct dc *dc);
  645. /*******************************************************************************
  646. * DDC Interfaces
  647. ******************************************************************************/
  648. const struct ddc_service *dc_get_ddc_at_index(
  649. struct dc *dc, uint32_t link_index);
  650. /*
  651. * DPCD access interfaces
  652. */
  653. bool dc_read_dpcd(
  654. struct dc *dc,
  655. uint32_t link_index,
  656. uint32_t address,
  657. uint8_t *data,
  658. uint32_t size);
  659. bool dc_write_dpcd(
  660. struct dc *dc,
  661. uint32_t link_index,
  662. uint32_t address,
  663. const uint8_t *data,
  664. uint32_t size);
  665. bool dc_submit_i2c(
  666. struct dc *dc,
  667. uint32_t link_index,
  668. struct i2c_command *cmd);
  669. #endif /* DC_INTERFACE_H_ */