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