blob: 823a8722449809ed57e84db07b8cda5f1d2af7c1 [file] [log] [blame]
Harry Wentland45622362017-09-12 15:58:20 -04001/*
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
26#ifndef DC_INTERFACE_H_
27#define DC_INTERFACE_H_
28
29#include "dc_types.h"
Harry Wentland45622362017-09-12 15:58:20 -040030#include "grph_object_defs.h"
31#include "logger_types.h"
32#include "gpio_types.h"
33#include "link_service_types.h"
34
35#define MAX_TARGETS 6
Harry Wentland091a97e2016-12-06 12:25:52 -050036#define MAX_SURFACES 3
Harry Wentland45622362017-09-12 15:58:20 -040037#define MAX_SINKS_PER_LINK 4
38
39/*******************************************************************************
40 * Display Core Interfaces
41 ******************************************************************************/
42
43struct dc_caps {
44 uint32_t max_targets;
45 uint32_t max_links;
46 uint32_t max_audios;
47 uint32_t max_slave_planes;
48 uint32_t max_downscale_ratio;
49 uint32_t i2c_speed_in_khz;
50};
51
52
53struct dc_dcc_surface_param {
54 enum surface_pixel_format format;
55 struct dc_size surface_size;
56 enum dc_scan_direction scan;
57};
58
59struct dc_dcc_setting {
60 unsigned int max_compressed_blk_size;
61 unsigned int max_uncompressed_blk_size;
62 bool independent_64b_blks;
63};
64
65struct dc_surface_dcc_cap {
66 bool capable;
67 bool const_color_support;
68
69 union {
70 struct {
71 struct dc_dcc_setting rgb;
72 } grph;
73
74 struct {
75 struct dc_dcc_setting luma;
76 struct dc_dcc_setting chroma;
77 } video;
78 };
79};
80
81/* Forward declaration*/
82struct dc;
83struct dc_surface;
84struct validate_context;
85
86struct dc_cap_funcs {
87 int i;
88};
89
90struct dc_stream_funcs {
91 bool (*adjust_vmin_vmax)(struct dc *dc,
92 const struct dc_stream **stream,
93 int num_streams,
94 int vmin,
95 int vmax);
96
97 void (*stream_update_scaling)(const struct dc *dc,
98 const struct dc_stream *dc_stream,
99 const struct rect *src,
100 const struct rect *dst);
101 bool (*set_gamut_remap)(struct dc *dc,
102 const struct dc_stream **stream, int num_streams);
103 bool (*set_backlight)(struct dc *dc, unsigned int backlight_level,
104 unsigned int frame_ramp, const struct dc_stream *stream);
105 bool (*init_dmcu_backlight_settings)(struct dc *dc);
106 bool (*set_abm_level)(struct dc *dc, unsigned int abm_level);
107 bool (*set_psr_enable)(struct dc *dc, bool enable);
108 bool (*setup_psr)(struct dc *dc, const struct dc_stream *stream);
109};
110
111struct link_training_settings;
112
113struct dc_link_funcs {
114 void (*set_drive_settings)(struct dc *dc,
115 struct link_training_settings *lt_settings);
116 void (*perform_link_training)(struct dc *dc,
117 struct dc_link_settings *link_setting,
118 bool skip_video_pattern);
119 void (*set_preferred_link_settings)(struct dc *dc,
120 struct dc_link_settings *link_setting);
121 void (*enable_hpd)(const struct dc_link *link);
122 void (*disable_hpd)(const struct dc_link *link);
123 void (*set_test_pattern)(
124 const struct dc_link *link,
125 enum dp_test_pattern test_pattern,
126 const struct link_training_settings *p_link_settings,
127 const unsigned char *p_custom_pattern,
128 unsigned int cust_pattern_size);
129};
130
131/* Structure to hold configuration flags set by dm at dc creation. */
132struct dc_config {
133 bool gpu_vm_support;
134 bool disable_disp_pll_sharing;
135};
136
137struct dc_debug {
138 bool surface_visual_confirm;
139 bool max_disp_clk;
140 bool target_trace;
141 bool surface_trace;
Yongqiang Sun94749802016-12-08 09:47:11 -0500142 bool timing_trace;
Harry Wentland45622362017-09-12 15:58:20 -0400143 bool validation_trace;
144 bool disable_stutter;
145 bool disable_dcc;
146 bool disable_dfs_bypass;
147 bool disable_power_gate;
148 bool disable_clock_gate;
Yongqiang Sunaa66df52016-12-15 10:50:48 -0500149 bool disable_dmcu;
Tony Chengdc0bcaf2016-12-23 07:12:19 -0500150 bool disable_hdmi_deep_color;
Harry Wentland45622362017-09-12 15:58:20 -0400151};
152
153struct dc {
154 struct dc_caps caps;
155 struct dc_cap_funcs cap_funcs;
156 struct dc_stream_funcs stream_funcs;
157 struct dc_link_funcs link_funcs;
158 struct dc_config config;
159 struct dc_debug debug;
160};
161
Harry Wentland45622362017-09-12 15:58:20 -0400162struct dc_init_data {
163 struct hw_asic_id asic_id;
164 void *driver; /* ctx */
165 struct cgs_device *cgs_device;
166
167 int num_virtual_links;
168 /*
169 * If 'vbios_override' not NULL, it will be called instead
170 * of the real VBIOS. Intended use is Diagnostics on FPGA.
171 */
172 struct dc_bios *vbios_override;
173 enum dce_environment dce_environment;
174
175 struct dc_config flags;
176};
177
178struct dc *dc_create(const struct dc_init_data *init_params);
179
180void dc_destroy(struct dc **dc);
181
Harry Wentland45622362017-09-12 15:58:20 -0400182/*******************************************************************************
183 * Surface Interfaces
184 ******************************************************************************/
185
186enum {
Anthony Koofb735a92016-12-13 13:59:41 -0500187 TRANSFER_FUNC_POINTS = 1025
Harry Wentland45622362017-09-12 15:58:20 -0400188};
189
Andrew Wong1646a6fe2016-12-22 15:41:30 -0500190struct dc_hdr_static_metadata {
191 bool is_hdr;
192
193 /* display chromaticities and white point in units of 0.00001 */
194 unsigned int chromaticity_green_x;
195 unsigned int chromaticity_green_y;
196 unsigned int chromaticity_blue_x;
197 unsigned int chromaticity_blue_y;
198 unsigned int chromaticity_red_x;
199 unsigned int chromaticity_red_y;
200 unsigned int chromaticity_white_point_x;
201 unsigned int chromaticity_white_point_y;
202
203 uint32_t min_luminance;
204 uint32_t max_luminance;
205 uint32_t maximum_content_light_level;
206 uint32_t maximum_frame_average_light_level;
207};
208
Anthony Koofb735a92016-12-13 13:59:41 -0500209enum dc_transfer_func_type {
210 TF_TYPE_PREDEFINED,
211 TF_TYPE_DISTRIBUTED_POINTS,
212};
213
214struct dc_transfer_func_distributed_points {
215 uint16_t red[TRANSFER_FUNC_POINTS];
216 uint16_t green[TRANSFER_FUNC_POINTS];
217 uint16_t blue[TRANSFER_FUNC_POINTS];
218 uint16_t end_exponent;
219 uint16_t x_point_at_y1;
220};
221
222enum dc_transfer_func_predefined {
223 TRANSFER_FUNCTION_SRGB,
224 TRANSFER_FUNCTION_BT709,
Anthony Koo90e508b2016-12-15 12:09:46 -0500225 TRANSFER_FUNCTION_PQ,
Anthony Koofb735a92016-12-13 13:59:41 -0500226 TRANSFER_FUNCTION_LINEAR,
227};
228
229struct dc_transfer_func {
230 enum dc_transfer_func_type type;
231 enum dc_transfer_func_predefined tf;
232 struct dc_transfer_func_distributed_points tf_pts;
233};
234
Harry Wentland45622362017-09-12 15:58:20 -0400235struct dc_surface {
236 bool visible;
237 bool flip_immediate;
238 struct dc_plane_address address;
239
240 struct scaling_taps scaling_quality;
241 struct rect src_rect;
242 struct rect dst_rect;
243 struct rect clip_rect;
244
245 union plane_size plane_size;
246 union dc_tiling_info tiling_info;
247 struct dc_plane_dcc_param dcc;
248 enum dc_color_space color_space;
249
250 enum surface_pixel_format format;
251 enum dc_rotation_angle rotation;
252 bool horizontal_mirror;
253 enum plane_stereo_format stereo_format;
254
Andrew Wong1646a6fe2016-12-22 15:41:30 -0500255 struct dc_hdr_static_metadata hdr_static_ctx;
256
Harry Wentland45622362017-09-12 15:58:20 -0400257 const struct dc_gamma *gamma_correction;
Anthony Koofb735a92016-12-13 13:59:41 -0500258 const struct dc_transfer_func *in_transfer_func;
Harry Wentland45622362017-09-12 15:58:20 -0400259};
260
261struct dc_plane_info {
262 union plane_size plane_size;
263 union dc_tiling_info tiling_info;
Leon Elazar9cd09bf2016-12-19 12:00:05 -0500264 struct dc_plane_dcc_param dcc;
Harry Wentland45622362017-09-12 15:58:20 -0400265 enum surface_pixel_format format;
266 enum dc_rotation_angle rotation;
267 bool horizontal_mirror;
268 enum plane_stereo_format stereo_format;
269 enum dc_color_space color_space; /*todo: wrong place, fits in scaling info*/
270 bool visible;
271};
272
273struct dc_scaling_info {
274 struct rect src_rect;
275 struct rect dst_rect;
276 struct rect clip_rect;
277 struct scaling_taps scaling_quality;
278};
279
280struct dc_surface_update {
281 const struct dc_surface *surface;
282
283 /* isr safe update parameters. null means no updates */
284 struct dc_flip_addrs *flip_addr;
285 struct dc_plane_info *plane_info;
286 struct dc_scaling_info *scaling_info;
287 /* following updates require alloc/sleep/spin that is not isr safe,
288 * null means no updates
289 */
Anthony Koofb735a92016-12-13 13:59:41 -0500290 /* gamma TO BE REMOVED */
Harry Wentland45622362017-09-12 15:58:20 -0400291 struct dc_gamma *gamma;
Andrew Wong1646a6fe2016-12-22 15:41:30 -0500292 struct dc_hdr_static_metadata *hdr_static_metadata;
Anthony Koofb735a92016-12-13 13:59:41 -0500293 struct dc_transfer_func *in_transfer_func;
294 struct dc_transfer_func *out_transfer_func;
295
Harry Wentland45622362017-09-12 15:58:20 -0400296
297};
298/*
299 * This structure is filled in by dc_surface_get_status and contains
300 * the last requested address and the currently active address so the called
301 * can determine if there are any outstanding flips
302 */
303struct dc_surface_status {
304 struct dc_plane_address requested_address;
305 struct dc_plane_address current_address;
306 bool is_flip_pending;
307};
308
309/*
310 * Create a new surface with default parameters;
311 */
312struct dc_surface *dc_create_surface(const struct dc *dc);
313const struct dc_surface_status *dc_surface_get_status(
314 const struct dc_surface *dc_surface);
315
316void dc_surface_retain(const struct dc_surface *dc_surface);
317void dc_surface_release(const struct dc_surface *dc_surface);
318
Amy Zhang89e89632016-12-12 10:32:24 -0500319void dc_gamma_retain(const struct dc_gamma *dc_gamma);
Harry Wentland45622362017-09-12 15:58:20 -0400320void dc_gamma_release(const struct dc_gamma *dc_gamma);
321struct dc_gamma *dc_create_gamma(void);
322
Anthony Koofb735a92016-12-13 13:59:41 -0500323void dc_transfer_func_retain(const struct dc_transfer_func *dc_tf);
324void dc_transfer_func_release(const struct dc_transfer_func *dc_tf);
Anthony Koo90e508b2016-12-15 12:09:46 -0500325struct dc_transfer_func *dc_create_transfer_func(void);
Anthony Koofb735a92016-12-13 13:59:41 -0500326
Harry Wentland45622362017-09-12 15:58:20 -0400327/*
328 * This structure holds a surface address. There could be multiple addresses
329 * in cases such as Stereo 3D, Planar YUV, etc. Other per-flip attributes such
330 * as frame durations and DCC format can also be set.
331 */
332struct dc_flip_addrs {
333 struct dc_plane_address address;
334 bool flip_immediate;
335 /* TODO: DCC format info */
336 /* TODO: add flip duration for FreeSync */
337};
338
339/*
340 * Optimized flip address update function.
341 *
342 * After this call:
343 * Surface addresses and flip attributes are programmed.
344 * Surface flip occur at next configured time (h_sync or v_sync flip)
345 */
346void dc_flip_surface_addrs(struct dc *dc,
347 const struct dc_surface *const surfaces[],
348 struct dc_flip_addrs flip_addrs[],
349 uint32_t count);
350
351/*
352 * Set up surface attributes and associate to a target
353 * The surfaces parameter is an absolute set of all surface active for the target.
354 * If no surfaces are provided, the target will be blanked; no memory read.
355 * Any flip related attribute changes must be done through this interface.
356 *
357 * After this call:
358 * Surfaces attributes are programmed and configured to be composed into target.
359 * This does not trigger a flip. No surface address is programmed.
360 */
361
362bool dc_commit_surfaces_to_target(
363 struct dc *dc,
364 const struct dc_surface **dc_surfaces,
365 uint8_t surface_count,
366 struct dc_target *dc_target);
367
368bool dc_pre_update_surfaces_to_target(
369 struct dc *dc,
370 const struct dc_surface *const *new_surfaces,
371 uint8_t new_surface_count,
372 struct dc_target *dc_target);
373
374bool dc_post_update_surfaces_to_target(
375 struct dc *dc);
376
377void dc_update_surfaces_for_target(struct dc *dc, struct dc_surface_update *updates,
378 int surface_count, struct dc_target *dc_target);
379
380/*******************************************************************************
381 * Target Interfaces
382 ******************************************************************************/
383#define MAX_STREAM_NUM 1
384
385struct dc_target {
386 uint8_t stream_count;
387 const struct dc_stream *streams[MAX_STREAM_NUM];
388};
389
390/*
391 * Target status is returned from dc_target_get_status in order to get the
392 * the IRQ source, current frame counter and currently attached surfaces.
393 */
394struct dc_target_status {
395 int primary_otg_inst;
396 int cur_frame_count;
397 int surface_count;
398 const struct dc_surface *surfaces[MAX_SURFACE_NUM];
399};
400
401struct dc_target *dc_create_target_for_streams(
402 struct dc_stream *dc_streams[],
403 uint8_t stream_count);
404
405/*
406 * Get the current target status.
407 */
408const struct dc_target_status *dc_target_get_status(
409 const struct dc_target* dc_target);
410
411void dc_target_retain(const struct dc_target *dc_target);
412void dc_target_release(const struct dc_target *dc_target);
413void dc_target_log(
414 const struct dc_target *dc_target,
415 struct dal_logger *dc_logger,
416 enum dc_log_type log_type);
417
418uint8_t dc_get_current_target_count(const struct dc *dc);
419struct dc_target *dc_get_target_at_index(const struct dc *dc, uint8_t i);
420
421bool dc_target_is_connected_to_sink(
422 const struct dc_target *dc_target,
423 const struct dc_sink *dc_sink);
424
425uint32_t dc_target_get_vblank_counter(const struct dc_target *dc_target);
426
427/* TODO: Return parsed values rather than direct register read
428 * This has a dependency on the caller (amdgpu_get_crtc_scanoutpos)
429 * being refactored properly to be dce-specific
430 */
431uint32_t dc_target_get_scanoutpos(
432 const struct dc_target *dc_target,
433 uint32_t *vbl,
434 uint32_t *position);
435
436/*
437 * Structure to store surface/target associations for validation
438 */
439struct dc_validation_set {
440 const struct dc_target *target;
441 const struct dc_surface *surfaces[MAX_SURFACES];
442 uint8_t surface_count;
443};
444
445/*
446 * This function takes a set of resources and checks that they are cofunctional.
447 *
448 * After this call:
449 * No hardware is programmed for call. Only validation is done.
450 */
451bool dc_validate_resources(
452 const struct dc *dc,
453 const struct dc_validation_set set[],
454 uint8_t set_count);
455
456/*
457 * This function takes a target and checks if it is guaranteed to be supported.
458 * Guaranteed means that MAX_COFUNC*target is supported.
459 *
460 * After this call:
461 * No hardware is programmed for call. Only validation is done.
462 */
463
464bool dc_validate_guaranteed(
465 const struct dc *dc,
466 const struct dc_target *dc_target);
467
468/*
469 * Set up streams and links associated to targets to drive sinks
470 * The targets parameter is an absolute set of all active targets.
471 *
472 * After this call:
473 * Phy, Encoder, Timing Generator are programmed and enabled.
474 * New targets are enabled with blank stream; no memory read.
475 */
476bool dc_commit_targets(
477 struct dc *dc,
478 struct dc_target *targets[],
479 uint8_t target_count);
480
481/*******************************************************************************
482 * Stream Interfaces
483 ******************************************************************************/
484struct dc_stream {
485 const struct dc_sink *sink;
486 struct dc_crtc_timing timing;
487
488 enum dc_color_space output_color_space;
489
490 struct rect src; /* viewport in target space*/
491 struct rect dst; /* stream addressable area */
492
493 struct audio_info audio_info;
494
495 bool ignore_msa_timing_param;
496
497 struct freesync_context freesync_ctx;
498
Anthony Koo90e508b2016-12-15 12:09:46 -0500499 const struct dc_transfer_func *out_transfer_func;
Harry Wentland45622362017-09-12 15:58:20 -0400500 struct colorspace_transform gamut_remap_matrix;
501 struct csc_transform csc_color_matrix;
Anthony Koo90e508b2016-12-15 12:09:46 -0500502
503 /* TODO: dithering */
Harry Wentland45622362017-09-12 15:58:20 -0400504 /* TODO: custom INFO packets */
505 /* TODO: ABM info (DMCU) */
506 /* TODO: PSR info */
507 /* TODO: CEA VIC */
508};
509
510/**
511 * Create a new default stream for the requested sink
512 */
513struct dc_stream *dc_create_stream_for_sink(const struct dc_sink *dc_sink);
514
515void dc_stream_retain(const struct dc_stream *dc_stream);
516void dc_stream_release(const struct dc_stream *dc_stream);
517
518struct dc_stream_status {
519 /*
520 * link this stream passes through
521 */
522 const struct dc_link *link;
523};
524
525const struct dc_stream_status *dc_stream_get_status(
526 const struct dc_stream *dc_stream);
527
528/*******************************************************************************
529 * Link Interfaces
530 ******************************************************************************/
531
532/*
533 * A link contains one or more sinks and their connected status.
534 * The currently active signal type (HDMI, DP-SST, DP-MST) is also reported.
535 */
536struct dc_link {
537 const struct dc_sink *remote_sinks[MAX_SINKS_PER_LINK];
538 unsigned int sink_count;
539 const struct dc_sink *local_sink;
540 unsigned int link_index;
541 enum dc_connection_type type;
542 enum signal_type connector_signal;
543 enum dc_irq_source irq_source_hpd;
544 enum dc_irq_source irq_source_hpd_rx;/* aka DP Short Pulse */
545 /* caps is the same as reported_link_cap. link_traing use
546 * reported_link_cap. Will clean up. TODO
547 */
548 struct dc_link_settings reported_link_cap;
549 struct dc_link_settings verified_link_cap;
550 struct dc_link_settings max_link_setting;
551 struct dc_link_settings cur_link_settings;
552 struct dc_lane_settings cur_lane_setting;
553
554 uint8_t ddc_hw_inst;
555 uint8_t link_enc_hw_inst;
556
557 struct psr_caps psr_caps;
558 bool test_pattern_enabled;
559 union compliance_test_state compliance_test_state;
560};
561
562struct dpcd_caps {
563 union dpcd_rev dpcd_rev;
564 union max_lane_count max_ln_count;
565 union max_down_spread max_down_spread;
566
567 /* dongle type (DP converter, CV smart dongle) */
568 enum display_dongle_type dongle_type;
569 /* Dongle's downstream count. */
570 union sink_count sink_count;
571 /* If dongle_type == DISPLAY_DONGLE_DP_HDMI_CONVERTER,
572 indicates 'Frame Sequential-to-lllFrame Pack' conversion capability.*/
573 bool is_dp_hdmi_s3d_converter;
574
575 bool allow_invalid_MSA_timing_param;
576 bool panel_mode_edp;
577 uint32_t sink_dev_id;
578 uint32_t branch_dev_id;
579 int8_t branch_dev_name[6];
580 int8_t branch_hw_revision;
581};
582
583struct dc_link_status {
584 struct dpcd_caps *dpcd_caps;
585};
586
587const struct dc_link_status *dc_link_get_status(const struct dc_link *dc_link);
588
589/*
590 * Return an enumerated dc_link. dc_link order is constant and determined at
591 * boot time. They cannot be created or destroyed.
592 * Use dc_get_caps() to get number of links.
593 */
594const struct dc_link *dc_get_link_at_index(const struct dc *dc, uint32_t link_index);
595
596/* Return id of physical connector represented by a dc_link at link_index.*/
597const struct graphics_object_id dc_get_link_id_at_index(
598 struct dc *dc, uint32_t link_index);
599
600/* Set backlight level of an embedded panel (eDP, LVDS). */
601bool dc_link_set_backlight_level(const struct dc_link *dc_link, uint32_t level,
602 uint32_t frame_ramp, const struct dc_stream *stream);
603
604bool dc_link_init_dmcu_backlight_settings(const struct dc_link *dc_link);
605
606bool dc_link_set_abm_level(const struct dc_link *dc_link, uint32_t level);
607
608bool dc_link_set_psr_enable(const struct dc_link *dc_link, bool enable);
609
610bool dc_link_setup_psr(const struct dc_link *dc_link,
611 const struct dc_stream *stream);
612
613/* Request DC to detect if there is a Panel connected.
614 * boot - If this call is during initial boot.
615 * Return false for any type of detection failure or MST detection
616 * true otherwise. True meaning further action is required (status update
617 * and OS notification).
618 */
619bool dc_link_detect(const struct dc_link *dc_link, bool boot);
620
621/* Notify DC about DP RX Interrupt (aka Short Pulse Interrupt).
622 * Return:
623 * true - Downstream port status changed. DM should call DC to do the
624 * detection.
625 * false - no change in Downstream port status. No further action required
626 * from DM. */
627bool dc_link_handle_hpd_rx_irq(const struct dc_link *dc_link);
628
629struct dc_sink_init_data;
630
631struct dc_sink *dc_link_add_remote_sink(
632 const struct dc_link *dc_link,
633 const uint8_t *edid,
634 int len,
635 struct dc_sink_init_data *init_data);
636
637void dc_link_remove_remote_sink(
638 const struct dc_link *link,
639 const struct dc_sink *sink);
640
641/* Used by diagnostics for virtual link at the moment */
642void dc_link_set_sink(const struct dc_link *link, struct dc_sink *sink);
643
644void dc_link_dp_set_drive_settings(
645 struct dc_link *link,
646 struct link_training_settings *lt_settings);
647
648bool dc_link_dp_perform_link_training(
649 struct dc_link *link,
650 const struct dc_link_settings *link_setting,
651 bool skip_video_pattern);
652
653void dc_link_dp_enable_hpd(const struct dc_link *link);
654
655void dc_link_dp_disable_hpd(const struct dc_link *link);
656
657bool dc_link_dp_set_test_pattern(
658 const struct dc_link *link,
659 enum dp_test_pattern test_pattern,
660 const struct link_training_settings *p_link_settings,
661 const unsigned char *p_custom_pattern,
662 unsigned int cust_pattern_size);
663
664/*******************************************************************************
665 * Sink Interfaces - A sink corresponds to a display output device
666 ******************************************************************************/
667
668/*
669 * The sink structure contains EDID and other display device properties
670 */
671struct dc_sink {
672 enum signal_type sink_signal;
673 struct dc_edid dc_edid; /* raw edid */
674 struct dc_edid_caps edid_caps; /* parse display caps */
675};
676
677void dc_sink_retain(const struct dc_sink *sink);
678void dc_sink_release(const struct dc_sink *sink);
679
680const struct audio **dc_get_audios(struct dc *dc);
681
682struct dc_sink_init_data {
683 enum signal_type sink_signal;
684 const struct dc_link *link;
685 uint32_t dongle_max_pix_clk;
686 bool converter_disable_audio;
687};
688
689struct dc_sink *dc_sink_create(const struct dc_sink_init_data *init_params);
690
691/*******************************************************************************
692 * Cursor interfaces - To manages the cursor within a target
693 ******************************************************************************/
694/* TODO: Deprecated once we switch to dc_set_cursor_position */
695bool dc_target_set_cursor_attributes(
696 struct dc_target *dc_target,
697 const struct dc_cursor_attributes *attributes);
698
699bool dc_target_set_cursor_position(
700 struct dc_target *dc_target,
701 const struct dc_cursor_position *position);
702
703/* Newer interfaces */
704struct dc_cursor {
705 struct dc_plane_address address;
706 struct dc_cursor_attributes attributes;
707};
708
709/*
710 * Create a new cursor with default values for a given target.
711 */
712struct dc_cursor *dc_create_cursor_for_target(
713 const struct dc *dc,
714 struct dc_target *dc_target);
715
716/**
717 * Commit cursor attribute changes such as pixel format and dimensions and
718 * surface address.
719 *
720 * After this call:
721 * Cursor address and format is programmed to the new values.
722 * Cursor position is unmodified.
723 */
724bool dc_commit_cursor(
725 const struct dc *dc,
726 struct dc_cursor *cursor);
727
728/*
729 * Optimized cursor position update
730 *
731 * After this call:
732 * Cursor position will be programmed as well as enable/disable bit.
733 */
734bool dc_set_cursor_position(
735 const struct dc *dc,
736 struct dc_cursor *cursor,
737 struct dc_cursor_position *pos);
738
739/*******************************************************************************
740 * Interrupt interfaces
741 ******************************************************************************/
742enum dc_irq_source dc_interrupt_to_irq_source(
743 struct dc *dc,
744 uint32_t src_id,
745 uint32_t ext_id);
746void dc_interrupt_set(const struct dc *dc, enum dc_irq_source src, bool enable);
747void dc_interrupt_ack(struct dc *dc, enum dc_irq_source src);
748enum dc_irq_source dc_get_hpd_irq_source_at_index(
749 struct dc *dc, uint32_t link_index);
750
751/*******************************************************************************
752 * Power Interfaces
753 ******************************************************************************/
754
755void dc_set_power_state(
756 struct dc *dc,
757 enum dc_acpi_cm_power_state power_state,
758 enum dc_video_power_state video_power_state);
759void dc_resume(const struct dc *dc);
760
761/*******************************************************************************
762 * DDC Interfaces
763 ******************************************************************************/
764
765const struct ddc_service *dc_get_ddc_at_index(
766 struct dc *dc, uint32_t link_index);
767
768/*
769 * DPCD access interfaces
770 */
771
772bool dc_read_dpcd(
773 struct dc *dc,
774 uint32_t link_index,
775 uint32_t address,
776 uint8_t *data,
777 uint32_t size);
778
779bool dc_write_dpcd(
780 struct dc *dc,
781 uint32_t link_index,
782 uint32_t address,
783 const uint8_t *data,
784 uint32_t size);
785
786bool dc_submit_i2c(
787 struct dc *dc,
788 uint32_t link_index,
789 struct i2c_command *cmd);
790
791#endif /* DC_INTERFACE_H_ */