dc.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759
  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. #include "grph_object_ctrl_defs.h"
  33. #include <inc/hw/opp.h>
  34. #include "inc/hw_sequencer.h"
  35. #include "inc/compressor.h"
  36. #include "dml/display_mode_lib.h"
  37. #define DC_VER "3.1.68"
  38. #define MAX_SURFACES 3
  39. #define MAX_STREAMS 6
  40. #define MAX_SINKS_PER_LINK 4
  41. /*******************************************************************************
  42. * Display Core Interfaces
  43. ******************************************************************************/
  44. struct dmcu_version {
  45. unsigned int date;
  46. unsigned int month;
  47. unsigned int year;
  48. unsigned int interface_version;
  49. };
  50. struct dc_versions {
  51. const char *dc_ver;
  52. struct dmcu_version dmcu_version;
  53. };
  54. struct dc_caps {
  55. uint32_t max_streams;
  56. uint32_t max_links;
  57. uint32_t max_audios;
  58. uint32_t max_slave_planes;
  59. uint32_t max_planes;
  60. uint32_t max_downscale_ratio;
  61. uint32_t i2c_speed_in_khz;
  62. uint32_t dmdata_alloc_size;
  63. unsigned int max_cursor_size;
  64. unsigned int max_video_width;
  65. int linear_pitch_alignment;
  66. bool dcc_const_color;
  67. bool dynamic_audio;
  68. bool is_apu;
  69. bool dual_link_dvi;
  70. bool post_blend_color_processing;
  71. bool force_dp_tps4_for_cp2520;
  72. bool disable_dp_clk_share;
  73. bool psp_setup_panel_mode;
  74. };
  75. struct dc_dcc_surface_param {
  76. struct dc_size surface_size;
  77. enum surface_pixel_format format;
  78. enum swizzle_mode_values swizzle_mode;
  79. enum dc_scan_direction scan;
  80. };
  81. struct dc_dcc_setting {
  82. unsigned int max_compressed_blk_size;
  83. unsigned int max_uncompressed_blk_size;
  84. bool independent_64b_blks;
  85. };
  86. struct dc_surface_dcc_cap {
  87. union {
  88. struct {
  89. struct dc_dcc_setting rgb;
  90. } grph;
  91. struct {
  92. struct dc_dcc_setting luma;
  93. struct dc_dcc_setting chroma;
  94. } video;
  95. };
  96. bool capable;
  97. bool const_color_support;
  98. };
  99. struct dc_static_screen_events {
  100. bool force_trigger;
  101. bool cursor_update;
  102. bool surface_update;
  103. bool overlay_update;
  104. };
  105. /* Surface update type is used by dc_update_surfaces_and_stream
  106. * The update type is determined at the very beginning of the function based
  107. * on parameters passed in and decides how much programming (or updating) is
  108. * going to be done during the call.
  109. *
  110. * UPDATE_TYPE_FAST is used for really fast updates that do not require much
  111. * logical calculations or hardware register programming. This update MUST be
  112. * ISR safe on windows. Currently fast update will only be used to flip surface
  113. * address.
  114. *
  115. * UPDATE_TYPE_MED is used for slower updates which require significant hw
  116. * re-programming however do not affect bandwidth consumption or clock
  117. * requirements. At present, this is the level at which front end updates
  118. * that do not require us to run bw_calcs happen. These are in/out transfer func
  119. * updates, viewport offset changes, recout size changes and pixel depth changes.
  120. * This update can be done at ISR, but we want to minimize how often this happens.
  121. *
  122. * UPDATE_TYPE_FULL is slow. Really slow. This requires us to recalculate our
  123. * bandwidth and clocks, possibly rearrange some pipes and reprogram anything front
  124. * end related. Any time viewport dimensions, recout dimensions, scaling ratios or
  125. * gamma need to be adjusted or pipe needs to be turned on (or disconnected) we do
  126. * a full update. This cannot be done at ISR level and should be a rare event.
  127. * Unless someone is stress testing mpo enter/exit, playing with colour or adjusting
  128. * underscan we don't expect to see this call at all.
  129. */
  130. enum surface_update_type {
  131. UPDATE_TYPE_FAST, /* super fast, safe to execute in isr */
  132. UPDATE_TYPE_MED, /* ISR safe, most of programming needed, no bw/clk change*/
  133. UPDATE_TYPE_FULL, /* may need to shuffle resources */
  134. };
  135. /* Forward declaration*/
  136. struct dc;
  137. struct dc_plane_state;
  138. struct dc_state;
  139. struct dc_cap_funcs {
  140. bool (*get_dcc_compression_cap)(const struct dc *dc,
  141. const struct dc_dcc_surface_param *input,
  142. struct dc_surface_dcc_cap *output);
  143. };
  144. struct link_training_settings;
  145. /* Structure to hold configuration flags set by dm at dc creation. */
  146. struct dc_config {
  147. bool gpu_vm_support;
  148. bool disable_disp_pll_sharing;
  149. bool fbc_support;
  150. };
  151. enum visual_confirm {
  152. VISUAL_CONFIRM_DISABLE = 0,
  153. VISUAL_CONFIRM_SURFACE = 1,
  154. VISUAL_CONFIRM_HDR = 2,
  155. };
  156. enum dcc_option {
  157. DCC_ENABLE = 0,
  158. DCC_DISABLE = 1,
  159. DCC_HALF_REQ_DISALBE = 2,
  160. };
  161. enum pipe_split_policy {
  162. MPC_SPLIT_DYNAMIC = 0,
  163. MPC_SPLIT_AVOID = 1,
  164. MPC_SPLIT_AVOID_MULT_DISP = 2,
  165. };
  166. enum wm_report_mode {
  167. WM_REPORT_DEFAULT = 0,
  168. WM_REPORT_OVERRIDE = 1,
  169. };
  170. /*
  171. * For any clocks that may differ per pipe
  172. * only the max is stored in this structure
  173. */
  174. struct dc_clocks {
  175. int dispclk_khz;
  176. int max_supported_dppclk_khz;
  177. int dppclk_khz;
  178. int dcfclk_khz;
  179. int socclk_khz;
  180. int dcfclk_deep_sleep_khz;
  181. int fclk_khz;
  182. int phyclk_khz;
  183. int dramclk_khz;
  184. };
  185. struct dc_debug_options {
  186. enum visual_confirm visual_confirm;
  187. bool sanity_checks;
  188. bool max_disp_clk;
  189. bool surface_trace;
  190. bool timing_trace;
  191. bool clock_trace;
  192. bool validation_trace;
  193. bool bandwidth_calcs_trace;
  194. int max_downscale_src_width;
  195. /* stutter efficiency related */
  196. bool disable_stutter;
  197. bool use_max_lb;
  198. enum dcc_option disable_dcc;
  199. enum pipe_split_policy pipe_split_policy;
  200. bool force_single_disp_pipe_split;
  201. bool voltage_align_fclk;
  202. bool disable_dfs_bypass;
  203. bool disable_dpp_power_gate;
  204. bool disable_hubp_power_gate;
  205. bool disable_pplib_wm_range;
  206. enum wm_report_mode pplib_wm_report_mode;
  207. unsigned int min_disp_clk_khz;
  208. int sr_exit_time_dpm0_ns;
  209. int sr_enter_plus_exit_time_dpm0_ns;
  210. int sr_exit_time_ns;
  211. int sr_enter_plus_exit_time_ns;
  212. int urgent_latency_ns;
  213. int percent_of_ideal_drambw;
  214. int dram_clock_change_latency_ns;
  215. bool optimized_watermark;
  216. int always_scale;
  217. bool disable_pplib_clock_request;
  218. bool disable_clock_gate;
  219. bool disable_dmcu;
  220. bool disable_psr;
  221. bool force_abm_enable;
  222. bool disable_hbup_pg;
  223. bool disable_dpp_pg;
  224. bool disable_stereo_support;
  225. bool vsr_support;
  226. bool performance_trace;
  227. bool az_endpoint_mute_only;
  228. bool always_use_regamma;
  229. bool p010_mpo_support;
  230. bool recovery_enabled;
  231. bool avoid_vbios_exec_table;
  232. bool scl_reset_length10;
  233. bool hdmi20_disable;
  234. bool skip_detection_link_training;
  235. };
  236. struct dc_debug_data {
  237. uint32_t ltFailCount;
  238. uint32_t i2cErrorCount;
  239. uint32_t auxErrorCount;
  240. };
  241. struct dc_state;
  242. struct resource_pool;
  243. struct dce_hwseq;
  244. struct dc {
  245. struct dc_versions versions;
  246. struct dc_caps caps;
  247. struct dc_cap_funcs cap_funcs;
  248. struct dc_config config;
  249. struct dc_debug_options debug;
  250. struct dc_context *ctx;
  251. uint8_t link_count;
  252. struct dc_link *links[MAX_PIPES * 2];
  253. struct dc_state *current_state;
  254. struct resource_pool *res_pool;
  255. /* Display Engine Clock levels */
  256. struct dm_pp_clock_levels sclk_lvls;
  257. /* Inputs into BW and WM calculations. */
  258. struct bw_calcs_dceip *bw_dceip;
  259. struct bw_calcs_vbios *bw_vbios;
  260. #ifdef CONFIG_DRM_AMD_DC_DCN1_0
  261. struct dcn_soc_bounding_box *dcn_soc;
  262. struct dcn_ip_params *dcn_ip;
  263. struct display_mode_lib dml;
  264. #endif
  265. /* HW functions */
  266. struct hw_sequencer_funcs hwss;
  267. struct dce_hwseq *hwseq;
  268. /* temp store of dm_pp_display_configuration
  269. * to compare to see if display config changed
  270. */
  271. struct dm_pp_display_configuration prev_display_config;
  272. bool optimized_required;
  273. /* FBC compressor */
  274. struct compressor *fbc_compressor;
  275. struct dc_debug_data debug_data;
  276. const char *build_id;
  277. };
  278. enum frame_buffer_mode {
  279. FRAME_BUFFER_MODE_LOCAL_ONLY = 0,
  280. FRAME_BUFFER_MODE_ZFB_ONLY,
  281. FRAME_BUFFER_MODE_MIXED_ZFB_AND_LOCAL,
  282. } ;
  283. struct dchub_init_data {
  284. int64_t zfb_phys_addr_base;
  285. int64_t zfb_mc_base_addr;
  286. uint64_t zfb_size_in_byte;
  287. enum frame_buffer_mode fb_mode;
  288. bool dchub_initialzied;
  289. bool dchub_info_valid;
  290. };
  291. struct dc_init_data {
  292. struct hw_asic_id asic_id;
  293. void *driver; /* ctx */
  294. struct cgs_device *cgs_device;
  295. int num_virtual_links;
  296. /*
  297. * If 'vbios_override' not NULL, it will be called instead
  298. * of the real VBIOS. Intended use is Diagnostics on FPGA.
  299. */
  300. struct dc_bios *vbios_override;
  301. enum dce_environment dce_environment;
  302. struct dc_config flags;
  303. uint32_t log_mask;
  304. };
  305. struct dc *dc_create(const struct dc_init_data *init_params);
  306. void dc_destroy(struct dc **dc);
  307. /*******************************************************************************
  308. * Surface Interfaces
  309. ******************************************************************************/
  310. enum {
  311. TRANSFER_FUNC_POINTS = 1025
  312. };
  313. struct dc_hdr_static_metadata {
  314. /* display chromaticities and white point in units of 0.00001 */
  315. unsigned int chromaticity_green_x;
  316. unsigned int chromaticity_green_y;
  317. unsigned int chromaticity_blue_x;
  318. unsigned int chromaticity_blue_y;
  319. unsigned int chromaticity_red_x;
  320. unsigned int chromaticity_red_y;
  321. unsigned int chromaticity_white_point_x;
  322. unsigned int chromaticity_white_point_y;
  323. uint32_t min_luminance;
  324. uint32_t max_luminance;
  325. uint32_t maximum_content_light_level;
  326. uint32_t maximum_frame_average_light_level;
  327. };
  328. enum dc_transfer_func_type {
  329. TF_TYPE_PREDEFINED,
  330. TF_TYPE_DISTRIBUTED_POINTS,
  331. TF_TYPE_BYPASS,
  332. TF_TYPE_HWPWL
  333. };
  334. struct dc_transfer_func_distributed_points {
  335. struct fixed31_32 red[TRANSFER_FUNC_POINTS];
  336. struct fixed31_32 green[TRANSFER_FUNC_POINTS];
  337. struct fixed31_32 blue[TRANSFER_FUNC_POINTS];
  338. uint16_t end_exponent;
  339. uint16_t x_point_at_y1_red;
  340. uint16_t x_point_at_y1_green;
  341. uint16_t x_point_at_y1_blue;
  342. };
  343. enum dc_transfer_func_predefined {
  344. TRANSFER_FUNCTION_SRGB,
  345. TRANSFER_FUNCTION_BT709,
  346. TRANSFER_FUNCTION_PQ,
  347. TRANSFER_FUNCTION_LINEAR,
  348. TRANSFER_FUNCTION_UNITY,
  349. TRANSFER_FUNCTION_HLG,
  350. TRANSFER_FUNCTION_HLG12,
  351. TRANSFER_FUNCTION_GAMMA22
  352. };
  353. struct dc_transfer_func {
  354. struct kref refcount;
  355. enum dc_transfer_func_type type;
  356. enum dc_transfer_func_predefined tf;
  357. /* FP16 1.0 reference level in nits, default is 80 nits, only for PQ*/
  358. uint32_t sdr_ref_white_level;
  359. struct dc_context *ctx;
  360. union {
  361. struct pwl_params pwl;
  362. struct dc_transfer_func_distributed_points tf_pts;
  363. };
  364. };
  365. /*
  366. * This structure is filled in by dc_surface_get_status and contains
  367. * the last requested address and the currently active address so the called
  368. * can determine if there are any outstanding flips
  369. */
  370. struct dc_plane_status {
  371. struct dc_plane_address requested_address;
  372. struct dc_plane_address current_address;
  373. bool is_flip_pending;
  374. bool is_right_eye;
  375. };
  376. union surface_update_flags {
  377. struct {
  378. /* Medium updates */
  379. uint32_t dcc_change:1;
  380. uint32_t color_space_change:1;
  381. uint32_t horizontal_mirror_change:1;
  382. uint32_t per_pixel_alpha_change:1;
  383. uint32_t global_alpha_change:1;
  384. uint32_t rotation_change:1;
  385. uint32_t swizzle_change:1;
  386. uint32_t scaling_change:1;
  387. uint32_t position_change:1;
  388. uint32_t in_transfer_func_change:1;
  389. uint32_t input_csc_change:1;
  390. uint32_t coeff_reduction_change:1;
  391. uint32_t output_tf_change:1;
  392. uint32_t pixel_format_change:1;
  393. /* Full updates */
  394. uint32_t new_plane:1;
  395. uint32_t bpp_change:1;
  396. uint32_t gamma_change:1;
  397. uint32_t bandwidth_change:1;
  398. uint32_t clock_change:1;
  399. uint32_t stereo_format_change:1;
  400. uint32_t full_update:1;
  401. } bits;
  402. uint32_t raw;
  403. };
  404. struct dc_plane_state {
  405. struct dc_plane_address address;
  406. struct dc_plane_flip_time time;
  407. struct scaling_taps scaling_quality;
  408. struct rect src_rect;
  409. struct rect dst_rect;
  410. struct rect clip_rect;
  411. union plane_size plane_size;
  412. union dc_tiling_info tiling_info;
  413. struct dc_plane_dcc_param dcc;
  414. struct dc_gamma *gamma_correction;
  415. struct dc_transfer_func *in_transfer_func;
  416. struct dc_bias_and_scale *bias_and_scale;
  417. struct dc_csc_transform input_csc_color_matrix;
  418. struct fixed31_32 coeff_reduction_factor;
  419. uint32_t sdr_white_level;
  420. // TODO: No longer used, remove
  421. struct dc_hdr_static_metadata hdr_static_ctx;
  422. enum dc_color_space color_space;
  423. enum surface_pixel_format format;
  424. enum dc_rotation_angle rotation;
  425. enum plane_stereo_format stereo_format;
  426. bool is_tiling_rotated;
  427. bool per_pixel_alpha;
  428. bool global_alpha;
  429. int global_alpha_value;
  430. bool visible;
  431. bool flip_immediate;
  432. bool horizontal_mirror;
  433. union surface_update_flags update_flags;
  434. /* private to DC core */
  435. struct dc_plane_status status;
  436. struct dc_context *ctx;
  437. /* private to dc_surface.c */
  438. enum dc_irq_source irq_source;
  439. struct kref refcount;
  440. };
  441. struct dc_plane_info {
  442. union plane_size plane_size;
  443. union dc_tiling_info tiling_info;
  444. struct dc_plane_dcc_param dcc;
  445. enum surface_pixel_format format;
  446. enum dc_rotation_angle rotation;
  447. enum plane_stereo_format stereo_format;
  448. enum dc_color_space color_space;
  449. unsigned int sdr_white_level;
  450. bool horizontal_mirror;
  451. bool visible;
  452. bool per_pixel_alpha;
  453. bool global_alpha;
  454. int global_alpha_value;
  455. bool input_csc_enabled;
  456. };
  457. struct dc_scaling_info {
  458. struct rect src_rect;
  459. struct rect dst_rect;
  460. struct rect clip_rect;
  461. struct scaling_taps scaling_quality;
  462. };
  463. struct dc_surface_update {
  464. struct dc_plane_state *surface;
  465. /* isr safe update parameters. null means no updates */
  466. const struct dc_flip_addrs *flip_addr;
  467. const struct dc_plane_info *plane_info;
  468. const struct dc_scaling_info *scaling_info;
  469. /* following updates require alloc/sleep/spin that is not isr safe,
  470. * null means no updates
  471. */
  472. const struct dc_gamma *gamma;
  473. const struct dc_transfer_func *in_transfer_func;
  474. const struct dc_csc_transform *input_csc_color_matrix;
  475. const struct fixed31_32 *coeff_reduction_factor;
  476. };
  477. /*
  478. * Create a new surface with default parameters;
  479. */
  480. struct dc_plane_state *dc_create_plane_state(struct dc *dc);
  481. const struct dc_plane_status *dc_plane_get_status(
  482. const struct dc_plane_state *plane_state);
  483. void dc_plane_state_retain(struct dc_plane_state *plane_state);
  484. void dc_plane_state_release(struct dc_plane_state *plane_state);
  485. void dc_gamma_retain(struct dc_gamma *dc_gamma);
  486. void dc_gamma_release(struct dc_gamma **dc_gamma);
  487. struct dc_gamma *dc_create_gamma(void);
  488. void dc_transfer_func_retain(struct dc_transfer_func *dc_tf);
  489. void dc_transfer_func_release(struct dc_transfer_func *dc_tf);
  490. struct dc_transfer_func *dc_create_transfer_func(void);
  491. /*
  492. * This structure holds a surface address. There could be multiple addresses
  493. * in cases such as Stereo 3D, Planar YUV, etc. Other per-flip attributes such
  494. * as frame durations and DCC format can also be set.
  495. */
  496. struct dc_flip_addrs {
  497. struct dc_plane_address address;
  498. unsigned int flip_timestamp_in_us;
  499. bool flip_immediate;
  500. /* TODO: add flip duration for FreeSync */
  501. };
  502. bool dc_post_update_surfaces_to_stream(
  503. struct dc *dc);
  504. #include "dc_stream.h"
  505. /*
  506. * Structure to store surface/stream associations for validation
  507. */
  508. struct dc_validation_set {
  509. struct dc_stream_state *stream;
  510. struct dc_plane_state *plane_states[MAX_SURFACES];
  511. uint8_t plane_count;
  512. };
  513. enum dc_status dc_validate_plane(struct dc *dc, const struct dc_plane_state *plane_state);
  514. void get_clock_requirements_for_state(struct dc_state *state, struct AsicStateEx *info);
  515. enum dc_status dc_validate_global_state(
  516. struct dc *dc,
  517. struct dc_state *new_ctx);
  518. void dc_resource_state_construct(
  519. const struct dc *dc,
  520. struct dc_state *dst_ctx);
  521. void dc_resource_state_copy_construct(
  522. const struct dc_state *src_ctx,
  523. struct dc_state *dst_ctx);
  524. void dc_resource_state_copy_construct_current(
  525. const struct dc *dc,
  526. struct dc_state *dst_ctx);
  527. void dc_resource_state_destruct(struct dc_state *context);
  528. /*
  529. * TODO update to make it about validation sets
  530. * Set up streams and links associated to drive sinks
  531. * The streams parameter is an absolute set of all active streams.
  532. *
  533. * After this call:
  534. * Phy, Encoder, Timing Generator are programmed and enabled.
  535. * New streams are enabled with blank stream; no memory read.
  536. */
  537. bool dc_commit_state(struct dc *dc, struct dc_state *context);
  538. struct dc_state *dc_create_state(void);
  539. void dc_retain_state(struct dc_state *context);
  540. void dc_release_state(struct dc_state *context);
  541. /*******************************************************************************
  542. * Link Interfaces
  543. ******************************************************************************/
  544. struct dpcd_caps {
  545. union dpcd_rev dpcd_rev;
  546. union max_lane_count max_ln_count;
  547. union max_down_spread max_down_spread;
  548. /* dongle type (DP converter, CV smart dongle) */
  549. enum display_dongle_type dongle_type;
  550. /* Dongle's downstream count. */
  551. union sink_count sink_count;
  552. /* If dongle_type == DISPLAY_DONGLE_DP_HDMI_CONVERTER,
  553. indicates 'Frame Sequential-to-lllFrame Pack' conversion capability.*/
  554. struct dc_dongle_caps dongle_caps;
  555. uint32_t sink_dev_id;
  556. int8_t sink_dev_id_str[6];
  557. int8_t sink_hw_revision;
  558. int8_t sink_fw_revision[2];
  559. uint32_t branch_dev_id;
  560. int8_t branch_dev_name[6];
  561. int8_t branch_hw_revision;
  562. int8_t branch_fw_revision[2];
  563. bool allow_invalid_MSA_timing_param;
  564. bool panel_mode_edp;
  565. bool dpcd_display_control_capable;
  566. };
  567. #include "dc_link.h"
  568. /*******************************************************************************
  569. * Sink Interfaces - A sink corresponds to a display output device
  570. ******************************************************************************/
  571. struct dc_container_id {
  572. // 128bit GUID in binary form
  573. unsigned char guid[16];
  574. // 8 byte port ID -> ELD.PortID
  575. unsigned int portId[2];
  576. // 128bit GUID in binary formufacturer name -> ELD.ManufacturerName
  577. unsigned short manufacturerName;
  578. // 2 byte product code -> ELD.ProductCode
  579. unsigned short productCode;
  580. };
  581. /*
  582. * The sink structure contains EDID and other display device properties
  583. */
  584. struct dc_sink {
  585. enum signal_type sink_signal;
  586. struct dc_edid dc_edid; /* raw edid */
  587. struct dc_edid_caps edid_caps; /* parse display caps */
  588. struct dc_container_id *dc_container_id;
  589. uint32_t dongle_max_pix_clk;
  590. void *priv;
  591. struct stereo_3d_features features_3d[TIMING_3D_FORMAT_MAX];
  592. bool converter_disable_audio;
  593. /* private to DC core */
  594. struct dc_link *link;
  595. struct dc_context *ctx;
  596. uint32_t sink_id;
  597. /* private to dc_sink.c */
  598. // refcount must be the last member in dc_sink, since we want the
  599. // sink structure to be logically cloneable up to (but not including)
  600. // refcount
  601. struct kref refcount;
  602. };
  603. void dc_sink_retain(struct dc_sink *sink);
  604. void dc_sink_release(struct dc_sink *sink);
  605. struct dc_sink_init_data {
  606. enum signal_type sink_signal;
  607. struct dc_link *link;
  608. uint32_t dongle_max_pix_clk;
  609. bool converter_disable_audio;
  610. };
  611. struct dc_sink *dc_sink_create(const struct dc_sink_init_data *init_params);
  612. /* Newer interfaces */
  613. struct dc_cursor {
  614. struct dc_plane_address address;
  615. struct dc_cursor_attributes attributes;
  616. };
  617. /*******************************************************************************
  618. * Interrupt interfaces
  619. ******************************************************************************/
  620. enum dc_irq_source dc_interrupt_to_irq_source(
  621. struct dc *dc,
  622. uint32_t src_id,
  623. uint32_t ext_id);
  624. bool dc_interrupt_set(struct dc *dc, enum dc_irq_source src, bool enable);
  625. void dc_interrupt_ack(struct dc *dc, enum dc_irq_source src);
  626. enum dc_irq_source dc_get_hpd_irq_source_at_index(
  627. struct dc *dc, uint32_t link_index);
  628. /*******************************************************************************
  629. * Power Interfaces
  630. ******************************************************************************/
  631. void dc_set_power_state(
  632. struct dc *dc,
  633. enum dc_acpi_cm_power_state power_state);
  634. void dc_resume(struct dc *dc);
  635. #endif /* DC_INTERFACE_H_ */