dc.h 22 KB

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