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